snow-startstop(snow)
snow-startstop()所属R语言包:snow
Starting and Stopping SNOW Clusters
启动和停止SNOW聚类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Functions to start and stop a SNOW cluster and to set default cluster options.
雪聚类功能来启动和停止,并设置默认的聚类选项。
用法----------Usage----------
makeCluster(spec, type = getClusterOption("type"), ...)
stopCluster(cl)
setDefaultClusterOptions(...)
makeSOCKcluster(names, ..., options = defaultClusterOptions)
makePVMcluster(count, ..., options = defaultClusterOptions)
makeMPIcluster(count, ..., options = defaultClusterOptions)
makeNWScluster(names, ..., options = defaultClusterOptions)
getMPIcluster()
参数----------Arguments----------
参数:spec
cluster specification
聚类规范
参数:count
number of nodes to create
要创建的节点的数量
参数:names
character vector of node names
字符向量的节点名称
参数:options
cluster options object
聚类选项对象
参数:cl
cluster object
聚类对象
参数:...
cluster option specifications
聚类选项规格
参数:type
character; specifies cluster type.
性格;指定聚类类型。
Details
详细信息----------Details----------
makeCluster starts a cluster of the specified or default type and returns a reference to the cluster. Supported cluster types are "SOCK", "PVM", "MPI", and "NWS". For "PVM" and "MPI" clusters the spec argument should be an integer specifying the number of slave nodes to create. For "SOCK" and "NWS" clusters spec should be a character vector naming the hosts on which slave nodes should be started; one node is started for each element in the vector. For "SOCK" and "NWS" clusters spec can also be an integer specifying the number of slaves nodes to create on the local machine.
makeCluster启动一个聚类指定的或默认的类型,并返回一个引用到聚类中。支持的聚类类型是"SOCK","PVM","MPI","NWS"。对于"PVM"和"MPI"聚类spec参数必须是一个整数,指定从节点创建。对于"SOCK"和"NWS"聚类spec应该是一个字符向量命名的主机上,应该开始从节点一个节点开始的向量中的每个元素。对于"SOCK"和"NWS"聚类spec也可以是一个整数指定的奴隶节点在本地计算机上创建数。
For SOCK and NWS clusters the spec can also be a list of machine specifications, each a list of named option values. Such a list must include a character value named host host specifying the name or address of the host to use. Any other option can be specified as well. For SOCK and NWS clusters this may be a more convenient alternative than inhomogeneous cluster startup procedure. The options rscript and snowlib are often useful; see the examples below.
对于SOCK和NWS聚类spec也可以是一个机器规格列表,每一个列表中命名的选项值。这样的列表必须包含一个名为host主机指定的主机的名称或地址使用的字符值。以及可以被指定为任何其他选项。对于SOCK和NWS聚类比不均匀的聚类启动程序,这可能是一个更方便的选择。的选项rscript和snowlib往往是有用的,看下面的例子。
stopCluster should be called to properly shut down the cluster before exiting R. If it is not called it may be necessary to use external means to ensure that all slave processes are shut down.
stopCluster应该被称为正常关闭聚类,然后再退出R.如果它不叫,可能有必要使用外部手段,以确保所有的从属进程被关闭。
setDefaultClusterOptions can be used to specify alternate values for default cluster options. There are many options. The most useful ones are type and homogeneous. The default value of the type option is currently set to "MPI" if Rmpi is on the search path. Otherwise it is set to "PVM" if the rpvm package is available, to "MPI" if Rmpi is available but rpvm is not, and to "SOCK" if neither of these packages is found.
setDefaultClusterOptions可以用来指定默认聚类选项的替代值。有很多的选择。最有用的是type和homogeneous。目前,type选项的默认值设置为“MPI”如果Rmpi是在搜索路径。否则,它被设置成"PVM"如果rpvm包,"MPI"如果Rmpi是有的,但rpvm是不是,和"SOCK"的“如果这些包都没有被发现。”
The homogeneous option should be set to FALSE to specify that the startup procedure for inhomogeneous clusters is to be used; this requires some additional configuration. The default setting is TRUE unless the environment variable R_SNOW_LIB is defined on the master host with a non-empty value.
homogeneous选项应设置为FALSE规定,在启动过程中使用的非齐次簇是,这需要一些额外的配置。默认设置为TRUE除非环境变量R_SNOW_LIB定义主控主机上的一个非空值。
The optionoutfile can be used to specify the file to which slave node output is to be directed. The default is /dev/null; during debugging of an installation it can be useful to set this to a proper file. On some systems setting outfile to "" or to /dev/tty will result in worker output being sent tothe terminal running the master process.
选项“outfile可用于从节点输出被定向到指定的文件。默认值是/dev/null;的安装调试过程中,它可以将其设置为一个适当的文件。在某些系统中设置outfile到""或/dev/tty的会导致工人输出被发送给终端运行的主进程。
The functions makeSOCKcluster, makePVMcluster, makeMPIcluster, and makeNWScluster can be used to start a cluster of the corresponding type.
的功能makeSOCKcluster,makePVMcluster,makeMPIcluster和makeNWScluster可以用于启动聚类相应类型的。
In MPI configurations where process spawning is not available and something like mpirun is used to start a master and a set of slaves the corresponding cluster will have been pre-constructed and can be obtained with getMPIcluster. It is also possible to obtain a reference to the running cluster using makeCluster or makeMPIcluster. In this case the count argument can be omitted; if it is supplied, it must equal the number of nodes in the cluster. This interface is still experimental and subject to change.
在MPI配置生成进程是不可用,并且,像mpirun是用来启动一个主站和一组的奴隶,相应的聚类将被预先建造的,可以得到getMPIcluster。这是一个正在运行的聚类使用makeCluster或makeMPIcluster,也有可能获得。 count参数在此情况下可以省略,如果它被提供时,它必须等于在聚类中的节点的数目。这个接口仍然是实验性,并且改变。
For SOCK and NWS clusters the option manual = TRUE forces a manual startup mode in which the master prints the command to be run manually to start a worker process. Together with setting the outfile option this can be useful for debugging cluster startup.
SOCK及新创建聚类选项“manual = TRUE强制手动启动模式,在这模式下,主输出要运行的命令手动启动工作过程。一起设置outfile选项,这可能是有用的调试聚类启动。
For more details see http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html.
欲了解更多详细信息,请参阅http://www.stat.uiowa.edu/~:微温/ R /聚类/ cluster.html的。
实例----------Examples----------
## Not run: [#不运行:]
## Two workers run on the local machine as a SOCK cluster.[#两名工人在本地机器上运行的为SOCK聚类。]
cl <- makeCluster(c("localhost","localhost"), type = "SOCK")
clusterApply(cl, 1:2, get("+"), 3)
stopCluster(cl)
## Another approach to running on the local machine as a SOCK cluster.[#SOCK聚类作为运行在本地机器上的另一种方法。]
cl <- makeCluster(2, type = "SOCK")
clusterApply(cl, 1:2, get("+"), 3)
stopCluster(cl)
## A SOCK cluster with two workers on Mac OS X, two on Linux, and two[#A SOCK聚类,两名工人在Mac OS X,Linux上,和两个]
## on Windows:[#在Windows上:]
macOptions <-
list(host = "owasso",
rscript = "/Library/Frameworks/R.framework/Resources/bin/Rscript",
snowlib = "/Library/Frameworks/R.framework/Resources/library")
lnxOptions <-
list(host = "itasca",
rscript = "/usr/lib64/R/bin/Rscript",
snowlib = "/home/luke/tmp/lib")
winOptions <-
list(host="192.168.1.168",
rscript="C:/Program Files/R/R-2.7.1/bin/Rscript.exe",
snowlib="C:/Rlibs")
cl <- makeCluster(c(rep(list(macOptions), 2), rep(list(lnxOptions), 2),
rep(list(winOptions), 2), type = "SOCK")
clusterApply(cl, 1:6, get("+"), 3)
stopCluster(cl)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|