parallel STAN issues - many SO files created in /tmp

101 views
Skip to first unread message

andy...@cubist-asia.com

unread,
May 28, 2015, 1:23:22 AM5/28/15
to stan-...@googlegroups.com
Hi all,

I tried to the use the parallel "wrapper" from here:

http://mc-stan.org/rstan/stan.R

First, I have to say - it's awesome!

But, i do realized that each time I call the new stan function with the same stan script, a whole of SO are created in the /tmp directory. And, this quickly fills up my /tmp directory.

Here is my R code that I have run multiple times and each time, it seems to create a new set of SO

EA.stanEngine.files.estAnalystSkills <- "stan_estimate_analyst_skills.stan";
sfit.skills <- stan (EA.stanEngine.files.estAnalystSkills, cores=4, sound = 0, data=dataSTAN); 

I'm running on Linux/Debian 3.13


Many thanks,
Andy



Ben Goodrich

unread,
May 28, 2015, 2:27:15 AM5/28/15
to stan-...@googlegroups.com, andy...@cubist-asia.com
On Thursday, May 28, 2015 at 1:23:22 AM UTC-4, andy...@cubist-asia.com wrote:
But, i do realized that each time I call the new stan function with the same stan script, a whole of SO are created in the /tmp directory. And, this quickly fills up my /tmp directory.

I'm guessing the working directory is unwritable or possibly the clock on the machine is messed up or something because that is not supposed to happen. What does it say if you specify pedantic = TRUE? But you can still pass the old stanfit object to the fit argument the next time you call stan() and it won't recompile the model.

Ben


andy...@cubist-asia.com

unread,
May 28, 2015, 11:21:01 PM5/28/15
to stan-...@googlegroups.com, andy...@cubist-asia.com
Hi Ben,

I have looked through the code and noticed the following:
- The .SO's are generated after the following line in stan.R:
  return(do.call(rstan::stan, args = dots))

so, it seems it's not a recompilation issue.

- the number of SO's generated in /tmp each call to stan is exactly the same as the number of cores specified, i.e. if i call with cores=4, i will get 4 new fileXXXXX.so generated, if i call with cores=2, i will get 2 new fileXXXX.so generated.

- further, the SO's generated by has file mod: 644 (non exec) vs those SO that get generated from call to stan_model which as 755.

Are these SO's being generated to support the multi-core execution but somehow didn't get cleanup?

Many thanks,

Andy

Ben Goodrich

unread,
May 29, 2015, 12:12:08 AM5/29/15
to stan-...@googlegroups.com, andy...@cubist-asia.com
What is supposed to happen is that

if(!file.exists(stanProgram.rda) ...

is supposed to be FALSE in which case it is supposed to load the cached model instead of compiling it.

Is there a .rda file in the directory where the .stan file is? If so, what is its mtime and the mtime of the .stan file?

Ben

andy...@cubist-asia.com

unread,
May 29, 2015, 3:35:29 AM5/29/15
to stan-...@googlegroups.com, andy...@cubist-asia.com
Hi Ben,

I played with the code, it seems that it has gotten through this test and i can see the following printed with pedatic=T

Loading cached model.

If i stop the program right after this if block, no SO's are created.

I can see the rda files in the dir:

-rw-r--r-- 1 andy andy 1122629 May 28 12:40 stan_estimate_analyst_skills.rda
-rw-r--r-- 1 andy andy 2680 May 28 12:34 stan_estimate_analyst_skills_missing.stan
Reply all
Reply to author
Forward
0 new messages