You are here

Using OpenMx with Xgrid

10 posts / 0 new
Last post
pdeboeck's picture
Offline
Joined: 08/04/2009 - 15:55
Using OpenMx with Xgrid

There seems to be a problem with how OpenMx and Xgrid interact. I have three machines on my Xgrid, each of which has no problem running OpenMx. After submitting jobs, the R scripts come back with the following errors:

> require(OpenMx)
Loading required package: OpenMx
Loading required package: snowfall
Loading required package: snow
Error in dirCreateStop(.sfOption$RESTDIR) :
UNABLE to create directory: /var/empty/.sfCluster/restore
In addition: Warning message:
In dir.create(dir, recursive = TRUE) :
cannot create dir '/var/empty/.sfCluster', reason 'Permission denied'

And the script terminates with:

Error: could not find function "mxModel"
Execution halted

I can load snow and snowfall w/out issue.

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Hmm, the snowfall library

Hmm, the snowfall library tries to create a .sfCluster directory where it stores some runtime information. I encourage you to try using the snowfall package to run OpenMx in a cluster environment. Currently any independent submodels (independent = TRUE in mxModel) are executed concurrently using snowfall. However, with regards to solving your original problem, I poked around the snowfall source code. Try adding the following argument to the R command line:
R --restdir /path/to/writable/directory --tmpdir /path/to/another/directory

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
might add onto the ?mxModel

might add onto the ?mxModel help:

independent logical. If TRUE then the model is independent (models must be independent if you wish them to execute concurrently in snowfall)

What does the default value of NA cause?

pdeboeck's picture
Offline
Joined: 08/04/2009 - 15:55
Thanks for the suggestions. I

Thanks for the suggestions. I think it is going to take me a while to figure out how to set up my computers so that I can use snowfall with Xgrid. Right now I'm just using a script to create multiple folders using R (each of which has a .sh file calling R) which I turn over to the Xgrid using a loop.

I didn't have luck with your path suggestion, but I am probably doing it incorrectly. My original R call was "/usr/bin/R CMD BATCH SimJob.R".

Is there an option to get OpenMx to not use snow & snowfall?

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Try instead, R --vanilla

Try instead,

R --vanilla --slave --restdir /path/to/writable/directory --tmpdir /path/to/another/directory < SimJob.R

There is currently not an option to turn off snow & snowfall. But we can add one, if it turns out to be necessary.

pdeboeck's picture
Offline
Joined: 08/04/2009 - 15:55
I got warnings that

I got warnings that '--restdir' and '--tmpdir' are unknown options and that they would be ignored.

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Doh. Argument have to be of

Doh. Argument have to be of the form "--name=value" (so sayith a comment inside the snowfall source code). Try inserting an '=' between the name and value on the command line.

pdeboeck's picture
Offline
Joined: 08/04/2009 - 15:55
I think that did it ---

I think that did it --- thanks! For anyone who runs into the same problem:

My original .sh file:

!/bin/sh

/usr/bin/R CMD BATCH SimJob.R

My new .sh file:

!/bin/sh

/usr/bin/R --vanilla --slave --restdir=var/empty/.sfCluster/restore --tmpdir=tempdir < SimJob.R

Steve's picture
Offline
Joined: 07/30/2009 - 14:03
Cool! Let us know how the

Cool! Let us know how the sim worked.

pdeboeck's picture
Offline
Joined: 08/04/2009 - 15:55
Looks like this is the end of

Looks like this is the end of an era. No longer will I be using system() to farm out jobs to Mx, using grep to check for code reds, and subsequently reading the results using scan().

The Xgrid simulation seems to have gone fine, although I won't get a chance to look at the results until later this week. The simulation consisted of comparing two statistics using 2400 conditions, 1000 repetitions each, on a 24 processor Xgrid.