Skip to content

Problems with package SNOW

5 messages · María del Carmen Romero, Stephen Weston

#
2011/5/7 Mar?a del Carmen Romero <mariadelc.romero at gmail.com>:
It looks like a worker is seeing a corrupted port value.
I can reproduce this type of error with:

    > setDefaultClusterOptions(port="frank")
    > cl <- makeCluster(2, type="SOCK")

In this case, the worker tries to convert "frank" to an integer,
gets an NA instead, and then socketConnection complains that
NA is an invalid port value.

But I don't see how that would happen accidentally.  snow doesn't
use a configuration file that I know of.  You're not executing any
snow functions in a Rprofile file, are you?

You could look at the default value of the port option using:
cl <- makeCluster(2, type="SOCK", manual=TRUE)
    > getClusterOption("port")

By default, it returns 10187.
That's rather common when something goes wrong in
makeSOCKcluster.  The fact that you're using local workers
rules out a number of possible problems, but it still doesn't tell
me much.

In both cases, I suggest using the manual=TRUE option, and then
starting the workers on the local machine using the specified
command lines.  That will tell you how the port value is being set
in the first case.  And you might see some other error message
from the workers in the second case.

In your case, use the command:

    > cl <- makeCluster(2, type="SOCK", manual=TRUE, outfile="")

Setting outfile to an empty string will prevent the worker from
redirecting informational messages.  I think that is useful when
executing workers manually.

- Steve
#
I seem to have garbled my instructions on getting the default
port value.

2011/5/7 Stephen Weston <stephen.b.weston at gmail.com>:
Ignore that extra line.  I meant to say:

You could look at the default value of the port option using:

    > getClusterOption("port")

- Steve
#
It appears to me that in R 2.13.0, the internal function
.path.package has changed.  Instead of returning the old-
style, short file names, it's returning paths that can contain
white space.  snow uses .path.package("snow") to set the
default values of several options, including "snowlib", and
makeSOCKcluster uses "snowlib" to locate RSOCKnode.R,
for example.  Since makeSOCKcluster doesn't quote the
command for starting the workers, it can fail if there are
blanks in the path of RSOCKnode, for example.

I'm not sure why you didn't see an error message from
Rscript when you tried to start the worker, however.
Anyway, I would suggest that you specify a value for
the "snowlib" option to see if it helps.  Here's my guess
of how to set it:

    > snowlib <- file.path(Sys.getenv("R_HOME"), "library")
    > setDefaultClusterOptions(snowlib=snowlib)

I suggest this because it appears from your output that
the R_HOME environment variable still uses the short
file name form.

You can verify that you set it properly with the command:

    > list.files(file.path(getClusterOption("snowlib"), "snow"))

which should list the contents of the snow installation directory.

Now you can create a socket cluster as before.

Good luck,

- Steve


2011/5/7 Mar?a del Carmen Romero <mariadelc.romero at gmail.com>: