snowfall-init(snowfall)
snowfall-init()所属R语言包:snowfall
Initialisation of cluster usage
初始化聚类使用
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Initialisation and organisation code to use snowfall.
初始化和组织机构代码,使用snowfall。
用法----------Usage----------
sfInit( parallel=NULL, cpus=NULL, type=NULL, socketHosts=NULL, restore=NULL, slaveOutfile=NULL, nostart=FALSE, useRscript=FALSE )
sfStop( nostop=FALSE )
sfParallel()
sfIsRunning()
sfCpus()
sfNodes()
sfGetCluster()
sfType()
sfSession()
sfSocketHosts()
sfSetMaxCPUs( number=32 )
参数----------Arguments----------
参数:parallel
Logical determinating parallel or sequential execution. If not set values from commandline are taken.
的逻辑法测定平行或顺序执行。如果没有设置值的命令行。
参数:cpus
Numerical amount of CPUs requested for the cluster. If not set, values from the commandline are taken.
聚类要求的CPU的数字量。如果没有设置,在命令行中的值。
参数:nostart
Logical determinating if the basic cluster setup should be skipped. Needed for nested use of snowfall and usage in packages.
逻辑法测定的基本聚类设置应跳过。所需要的包中嵌套使用snowfall和使用的。
参数:type
Type of cluster. Can be 'SOCK', 'MPI', 'PVM' or 'NWS'. Default is 'SOCK'.
聚类类型。可以“SOCK,MPI”,“PVM”或“新创建”。默认值是“SOCK。
参数:socketHosts
Host list for socket clusters. Only needed for socketmode (SOCK) and if using more than one machines (if using only your local machine (localhost) no list is needed).
插座聚类的主机列表。只需要socketmode(SOCK),和如果使用一个以上的机器(如果只用你的本地计算机(localhost)没有列表)。
参数:restore
Globally set the restore behavior in the call sfClusterApplySR to the given value.
在全球范围内设置恢复sfClusterApplySR给定值,在调用的行为。
参数:slaveOutfile
Write R slave output to this file. Default: no output (Unix: /dev/null, Windows: :nul). If using sfCluster this argument has no function, as slave logs are defined using sfCluster.
写R从输出到该文件。默认值:无输出(UNIX:/dev/null,Windows上::nul)。如果使用sfCluster这种说法有没有功能,,作为从log的使用sfCluster定义的。
参数:useRscript
Change startup behavior (snow>0.3 needed): use shell scripts or R-script for startup (R-scripts beeing the new variant, but not working with sfCluster.
更改启动行为(雪> 0.3):使用shell脚本或R-脚本启动(R-脚本工作状态的新变种,但不与sfCluster工作。
参数:nostop
Same as noStart for ending.
同为结束noStart。
参数:number
Amount of maximum CPUs useable.
金额最大的CPU可用。
Details
详细信息----------Details----------
sfInit initialisise the usage of the snowfall functions and - if running in parallel mode - setup the cluster and snow. If using sfCluster management tool, call this without arguments. If sfInit is called with arguments, these overwrite sfCluster settings. If running parallel, sfInit set up the cluster by calling makeCluster from snow. If using with sfCluster, the initialisation also contains management of lockfiles. If this function is called more than once and current cluster is yet running, sfStop is called automatically.
sfInitinitialisise的snowfall的使用功能 - 如果在并行模式下运行 - 设置聚类和snow。如果使用sfCluster管理工具,调用不带参数。如果sfInit被称为参数,这些覆盖sfCluster设置。如果平行,sfInit设立的聚类通过调用makeClustersnow。如果用sfCluster,初始化也包含的lockfiles管理。如果这个函数被调用超过一次,当前的聚类尚未运行,sfStop被称为自动。
Note that you should call sfInit before using any other function from snowfall, with the only exception sfSetMaxCPUs. If you do not call sfInit first, on calling any snowfall function sfInit is called without any parameters, which is equal to sequential mode in snowfall only mode or the settings from sfCluster if used with sfCluster.
请注意,你应该调用“sfInit使用任何其它功能之前,从snowfall,唯一的例外sfSetMaxCPUs。如果你不调用“sfInit首先,在调用任何snowfall函数sfInit被称为不带任何参数,这是等于连续snowfall唯一的模式或设置模式sfCluster如果使用sfCluster。
This also means, you cannot check if sfInit was called from within your own program, as any call to a function will initialize again. Therefore the function sfIsRunning gives you a logical if a cluster is running. Please note: this will not call sfInit and it also returns true if a previous running cluster was stopped via sfStop in the meantime.
这也意味着,你可以不检查如果sfInit被称为从你自己的程序,任何调用一个函数将初始化。因此,函数sfIsRunning“为您提供了一个逻辑,如果一个聚类正在运行。请注意:这不会调用“sfInit”,它也返回true,如果以前通过sfStop在此期间停止正在运行的聚类。
If you use snowfall in a package argument nostart is very handy if mainprogram uses snowfall as well. If set, cluster setup will be skipped and both parts (package and main program) use the same cluster.
如果你用snowfallnostart包中的参数是非常方便的,如果主程序使用snowfall以及。如果设置,聚类的设置将被跳过两个部分(包和主程序)使用相同的聚类。
If you call sfInit more than one time in a program without explicit calling sfStop, stopping of the cluster will be executed automatically. If your R-environment does not cover required libraries, sfInit automatically switches to sequential mode (with a warning). Required libraries for parallel usage are snow and depending on argument type the libraries for the cluster mode (none for socket clusters, Rmpi for MPI clusters, rpvm for PVM clusters and nws for NetWorkSpaces).
如果你调用sfInit一个以上的时间在一个程序中没有明确的通话sfStop,停止聚类将自动执行。如果你的R-环境中不包括所需的库,sfInit自动切换到顺序模式(警告)。所需的库并行使用的是snow和根据参数type库聚类模式下(没有插座聚类,RmpiMPI的聚类,rpvmPVM聚类nwsNetWorkSpaces)。
If using Socket or NetWorkSpaces, socketHosts can be used to specify the hosts you want to have your workers running. Basically this is a list, where any entry can be a plain character string with IP or hostname (depending on your DNS settings). Also for real heterogenous clusters for any host pathes are setable. Please look to the acccording snow documentation for details. If you are not giving an socketlist, a list with the required amount of CPUs on your local machine (localhost) is used. This would be the easiest way to use parallel computing on a single machine, like a laptop.
如果使用插座或NetWorkSpaces,则socketHosts可以用来指定主机,你想你的工人。基本上这是一个列表,其中的任何条目可以是简单的字符串,IP地址或主机名(取决于您的DNS设置)。此外,任何主机的运动轨迹为真正的异质性聚类是可设置的。请看看的acccording snow文件的详细信息,。如果您不,给人一种socketlist,所需的CPU在本地计算机上的列表(localhost)的使用。这将是最简单的方法,就像一台笔记本电脑使用一台机器上并行计算。
Note there is limit on CPUs used in one program (which can be configured on package installation). The current limit are 32 CPUs. If you need a higher amount of CPUs, call sfSetMaxCPUs before the first call to sfInit. The limit is set to prevent inadvertently request by single users affecting the cluster as a whole.
请注意,是在一个程序(可配置包安装)的CPU使用限制。目前的限制是32个CPU。如果您需要更高的CPU,调用“sfSetMaxCPUs之前,先调用sfInit。限制设置,以防止不小心的要求影响到整个聚类的单个用户。
Use slaveOutfile to define a file where to write the log files. The file location must be available on all nodes. Beware of taking a location on a shared network drive! Under *nix systems, most likely the directories /tmp and /var/tmp are not shared between the different machines. The default is no output file. If you are using sfCluster this argument have no meaning as the slave logs are always created in a location of sfClusters choice (depending on it's configuration).
使用slaveOutfile定义一个文件,其中写的log文件。必须在所有节点上的文件位置。谨防共享网络驱动器上的位置!在* nix系统中,最有可能的目录/tmp和/var/tmp在不同的机器之间不共享。默认情况下不输出文件。如果您使用的是sfCluster这种说法没有任何意义的奴隶logsfClusters选择(取决于它的位置总是被创建的配置)。
sfStop stop cluster. If running in parallel mode, the LAM/MPI cluster is shut down.
sfStop停止聚类。如果在并行模式下运行,LAM / MPI聚类被关闭。
sfParallel, sfCpus and sfSession grant access to the internal state of the currently used cluster. All three can be configured via commandline and especially with sfCluster as well, but given arguments in sfInit always overwrite values on commandline. The commandline options are --parallel (empty option. If missing, sequential mode is forced), --cpus=X (for nodes, where X is a numerical value) and --session=X (with X a string).
sfParallel,sfCpus和sfSession授予访问权限的内部状态,目前使用的聚类。所有这三个可以通过命令行,特别是与sfCluster,但给定的参数在sfInit始终覆盖值命令行配置。命令行选项是--parallel(空的选项,如果丢失,顺序模式被强制),--cpus=X的节点,其中X是一个数值,和--session=X(与X的字符串) 。
sfParallel returns a logical if program is running in parallel/cluster-mode or sequential on a single processor.
sfParallel返回一个逻辑,如果程序正在运行在一个处理器上并行/聚类模式或顺序。
sfCpus returns the size of the cluster in CPUs (equals the CPUs which are useable). In sequential mode sfCpus returns one. sfNodes is a deprecated similar to sfCpus.
sfCpus返回的CPU中的聚类(等于都可用的CPU)的大小。在连续模式sfCpus返回1。 sfNodes是不推荐使用的类似sfCpus。
sfSession returns a string with the session-identification. It is mainly important if used with the sfCluster tool.
sfSession返回一个字符串的会话识别。这主要是重要如果使用与sfCluster的工具。
sfGetCluster gets the snow-cluster handler. Use for direct calling of snow functions.
sfGetCluster得到snow聚类处理程序。用于直接调用snow功能。
sfType returns the type of the current cluster backend (if used any). The value can be SOCK, MPI, PVM or NWS for parallel modes or "- sequential -" for sequential execution.
sfType返回当前聚类的后端(如果有的话)的类型。该值可以是SOCK,MPI,PVM或新创建的并行模式或“ - 顺序 - ”顺序执行。
sfSocketHosts gives the list with currently used hosts for socket clusters. Returns empty list if not used in socket mode (means: sfType() != 'SOCK').
sfSocketHosts给出了与目前使用的主机插座聚类的列表。如果不使用插座模式(指返回空列表:sfType() != 'SOCK')。
sfSetMaxCPUs enables to set a higher maximum CPU-count for this program. If you need higher limits, call sfSetMaxCPUs before sfInit with the new maximum amount.
sfSetMaxCPUs可以对这一计划提出了更高的最大CPU数。如果您需要更高的限制,调用“sfSetMaxCPUs前sfInit的新的最高金额。
参见----------See Also----------
See snow documentation for details on commands: link[snow]{snow-cluster}
看雪文档的命令的详细信息:link[snow]{snow-cluster}
实例----------Examples----------
## Not run: [#不运行:]
# Run program in plain sequential mode.[在简单的顺序模式下运行程序。]
sfInit( parallel=FALSE )
stopifnot( sfParallel() == FALSE )
sfStop()
# Run in parallel mode overwriting probably given values on[可能运行在并行模式覆盖给定值]
# commandline.[命令行。]
# Executes via Socket-cluster with 4 worker processes on[执行通过插座聚类与4个工作进程]
# localhost.[本地主机。]
# This is probably the best way to use parallel computing[这可能是最好的方式来使用并行计算]
# on a single machine, like a notebook, if you are not[在一台机器,就像一个笔记本,如果你不]
# using sfCluster.[使用sfCluster。]
# Uses Socketcluster (Default) - which can also be stated[使用Socketcluster(默认) - 也可以说]
# using type="SOCK".[使用类型=“袜子”。]
sfInit( parallel=TRUE, cpus=4 )
stopifnot( sfCpus() == 4 )
stopifnot( sfParallel() == TRUE )
sfStop()
# Run parallel mode (socket) with 4 workers on 3 specific machines.[有4名工人在3个特定的机器上运行并行模式(插座)。]
sfInit( parallel=TRUE, cpus=4, type="SOCK",
socketHosts=c( "biom7", "biom7", "biom11", "biom12" ) )
stopifnot( sfCpus() == 4 )
stopifnot( sfParallel() == TRUE )
sfStop()
# Hook into MPI cluster.[钩到MPI的聚类。]
# Note: you can use any kind MPI cluster Rmpi supports.[注意:您可以使用任何一种MPI聚类RMPI支持。]
sfInit( parallel=TRUE, cpus=4, type="MPI" )
sfStop()
# Hook into PVM cluster.[钩到PVM聚类。]
sfInit( parallel=TRUE, cpus=4, type="PVM" )
sfStop()
# Run in sfCluster-mode: settings are taken from commandline:[在sfCluster运行模式:设置都可以从命令行:]
# Runmode (sequential or parallel), amount of nodes and hosts which[Runmode(串行或并行),金额的节点和主机]
# are used.[被使用。]
sfInit()
# Session-ID from sfCluster (or XXXXXXXX as default)[会话ID默认情况下,从sfCluster(或XXXXXXXX)]
session <- sfSession()
# Calling a snow function: cluster handler needed.[雪功能调用需要聚类处理程序。]
parLapply( sfGetCluster(), 1:10, exp )
# Same using snowfall wrapper, no handler needed.[降雪包装,没有处理程序的需要。]
sfLapply( 1:10, exp )
sfStop()
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|