找回密码
 注册
查看: 1654|回复: 0

R语言 snowfall包 snowfall-tools()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 11:05:45 | 显示全部楼层 |阅读模式
snowfall-tools(snowfall)
snowfall-tools()所属R语言包:snowfall

                                        Cluster tools
                                         聚类工具

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Tools for cluster usage. Allow easier handling of cluster programming.
聚类使用的工具。允许聚类编程更容易处理。


用法----------Usage----------


sfLibrary( package, pos=2,
           lib.loc=NULL, character.only=FALSE,
           warn.conflicts=TRUE,
           keep.source=getOption("keep.source.pkgs"),
           verbose=getOption("verbose"), version,
           stopOnError=TRUE )
sfSource( file, encoding = getOption("encoding"), stopOnError = TRUE )
sfExport( ..., list=NULL, local=TRUE, namespace=NULL, debug=FALSE, stopOnError = TRUE )
sfExportAll( except=NULL, debug=FALSE )

sfRemove( ..., list=NULL, master=FALSE, debug=FALSE )
sfRemoveAll( except=NULL, debug=FALSE, hidden=TRUE )

sfCat( ..., sep=" ", master=TRUE )

sfClusterSplit( seq )
sfClusterCall( fun, ..., stopOnError=TRUE )
sfClusterEval( expr, stopOnError=TRUE )

sfClusterSetupRNG( type="RNGstream", ... )
sfClusterSetupRNGstream( seed=rep(12345,6), ... )
sfClusterSetupSPRNG( seed=round(2^32*runif(1)), prngkind="default", para=0, ... )

sfTest()



参数----------Arguments----------

参数:expr
expression to evaluate
要计算的表达式


参数:seq
vector to split
矢量分裂


参数:fun
function to call
要调用的函数


参数:list
character vector with names of objects to export
要导出的对象的名称的字符向量


参数:local
a logical indicating if variables should taken from local scope(s) or only from global.
逻辑表示如果变量应该从本地(S)或只从全球范围。


参数:namespace
a character given a namespace where to search for the object.
字符搜索对象的命名空间。


参数:debug
a logical indicating extended information is given upon action to be done (e.g. print exported variables, print context of local variables etc.).
逻辑显示扩展信息时做的动作(如打印导出的变量,打印范围内的局部变量等)。


参数:except
character vector with names of objects not to export/remove
矢量对象的名称字符不出口/删除


参数:hidden
also remove hidden names (starting with a dot)?
也可以删除隐藏的名称(出发点)?


参数:sep
a character string separating elements in x
一个字符的字符串,在x中的元素分离


参数:master
a logical indicating if executed on master as well
如果执行主站和逻辑指示


参数:...
additional arguments to pass to standard function
额外的参数传递给标准功能


参数:package
name of the package. Check library for details.
包的名称。检查library详细信息。


参数:pos
position in search path to load library.
加载库的搜索路径中的位置。


参数:warn.conflicts
warn on conflicts (see "library").
警告冲突(见“库”)。


参数:keep.source
see "library".
请参阅“库”。


参数:verbose
enable verbose messages.
启用详细消息。


参数:version
version of library to load (see "library").
版本库来载入(见“库”)。


参数:encoding
encoding of library to load (see "library").
编码库来载入(见“库”)。


参数:lib.loc
a character vector describing the location of the R library trees to search through, or 'NULL'. Check library for details.
字符向量描述R库的树型的位置搜索,或NULL。检查library详细信息。


参数:character.only
a logical indicating package can be assumed to be a character string. Check library for details.
逻辑指示包可以被假定为一个字符串。检查library详细信息。


参数:file
filename of file to read. Check source for details
文件名的文件中读取。 source


参数:stopOnError
a logical indicating if function stops on failure or still returns. Default is TRUE.
逻辑故障或仍返回功能停止。默认是TRUE。


参数:type
a character determine which random number generator should be used for clusters. Allowed values are "RNGstream" for L'Ecuyer's RNG or "SPRNG" for Scalable Parallel Random Number Generators.
一个字符确定应该用于聚类的随机数发生器。允许的值是为LEcuyers的RNG或可伸缩的并行随机数发生器的的“SPRNG”的“RNGstream”。


参数:para
additional parameters for the RNGs.
附加参数的随机数据生成器。


参数:seed
Seed for the RNG.
为RNG种子。


参数:prngkind
type of RNG, see snow documentation.
类型的RNG,看雪文档。


Details

详细信息----------Details----------

The current functions are little helpers to make cluster programming easier. All of these functions also work in sequential mode without any further code changes.
目前的功能是使聚类编程更容易的小帮手。所有这些功能也没有任何额外的代码更改工作在连续模式。

sfLibrary loads an R-package on all nodes, including master. Use this function if slaves need this library, too. Parameters are identically to the R-build in funtion library. If a relative path is given in lib.loc, it is converted to an absolute path.\ As default sfLibrary stops on any error, but this can be prevented by setting stopOnError=FALSE, the function is returning FALSE then. On success TRUE is returned.
sfLibraryR-包加载的所有节点上,包括主。奴隶使用此功能,如果需要这个库了。参数是相同的R-建立在FUNTION library。如果是相对路径,在lib.loc,它转换成一个绝对路径\作为默认:sfLibrary停止任何错误,但是这是可以预防的设置stopOnError=FALSE,功能是返回FALSE然后。在成功TRUE返回。

sfSource loads a sourcefile on all nodes, including master. Use this function if the slaves need the code as well. Make sure the file is accessible on all nodes under the same path. The loading is done on slaves using source with fixes parameters: local=FALSE, chdir=FALSE, echo=FALSE, so the files is loaded global without changing of directory.\ As default sfSource stops on any error, but this can be prevented by setting stopOnError=FALSE, the function is returning FALSE then. On success TRUE is returned.
sfSource加载一个源文件,包括船长在内的所有节点上。使用此功能,如果奴隶需要的代码。确保访问该文件的同一路径下的所有节点上。加载完成的奴隶使用source修正参数:local=FALSE, chdir=FALSE, echo=FALSE,这样的文件被载入全球不改变的目录。\作为默认sfSource停在任何错误,但是这可能是防止通过设置stopOnError=FALSE,该函数返回FALSE然后。在成功TRUE返回。

sfExport exports variables from the master to all slaves. Use this function if slaves need acccess to these variables as well. sfExport features two execution modes: local and global. If using local mode (default), variables for export are searched backwards from current environment to globalenv(). Use this mode if you want to export local variables from functions or other scopes to the slaves. In global mode only global variables from master are exported.\ Note: all exported variables are global on the slaves!\ If you have many identical named variables in different scopes, use argument debug=TRUE to view the context the exported variable is coming from.\ Variables are given as their names or as a character vector with their names using argument list.
sfExport出口从主站向所有从站的变量。如果奴隶需要acccess的,以及对这些变量的使用此功能。 sfExport有两种执行模式:本地和全球。如果使用本地模式(默认),变量为出口从当前的环境下向后搜索globalenv()。这种模式下,如果你想使用,导出本地变量函数或其他范围的奴隶。在全局配置模式下,只有全局变量从主出口。\注:所有导出的变量是全局的奴隶!\如果你有很多相同的命名变量在不同的范围,使用参数debug=TRUE查看上下文导出的变量是他们的名字或他们的名字使用参数list字符向量。\变量。

sfExportAll exports all global variables from the master to all slaves with exception of the given list. Use this functions if you want to export mostly all variables to all slaves.\Argument list is a character vector with names of the variables not to export.
sfExportAll出口从主站向所有从站,除给定列表中的所有的全局变量。使用此功能,如果你想向所有从站出口的主要是所有的变量。\参数list是一个字符向量名称的变量不出口。

sfRemove removes a list of global (previous exported or generated) variables from slaves and (optional) master. Use this function if there are large further unused variables left on slave. Basically this is only interesting if you have more than one explicit parallel task in your program - where the danger is slaves memory usage exceed.\ If argument master is given, the variables are removed from master as well (default is FALSE).\ Give names of variables as arguments, or use argument list as a character vector with the names. For deep cleaning of slave memory use sfRemoveAll.
sfRemove删除的列表,全球(从奴隶和(可选)主以前出口或产生)的变量。使用此功能,如果有大进一步从机上留下的未使用的变量。基本上,这是唯一有趣的,如果你有一个以上的在你的程序中显式并行任务 - 其中的危险是奴隶的内存使用超过\如果参数master,从主变量以及(默认为FALSE )\给变量作为参数的名称,或者使用参数list字符向量的名字。对于深层清洁的从内存中使用sfRemoveAll。

sfRemoveAll removes all global variables from the slaves. Use this functions if you want to remove mostly all variables on the slaves.  Argument list is a character vector with names of the variables not to remove.
sfRemoveAll从奴隶中删除所有的全局变量。使用此功能,如果你要删除的大多是所有变量的奴隶。参数list名称的变量不删除的字符向量。

sfCat is a debugging function printing a message on all slaves (which appear in the logfiles).
sfCat是所有从站(出现在log文件)的调试功能打印一条消息。

sfClusterSplit splits a vector into one consecutive piece for each cluster and returns as a list with length equal to the number of cluster nodes. Wrapper for snow function clusterSplit.
sfClusterSplit将一个向量为每个聚类的聚类节点的数量相等长度的列表,并返回到一个连续的一块。包装器snow功能clusterSplit。

sfClusterCall calls a function on each node and returns list of results. Wrapper for snow function clusterCall.
sfClusterCall在每个节点上,并返回结果列表中调用一个函数。包装器snow功能clusterCall。

sfClusterEvalQ evaluates a literal expression on all nodes. Wrapper for snow function clusterEvalQ.
sfClusterEvalQ评估的所有节点上的文字表达。包装器snow功能clusterEvalQ。

sfTest is a simple unit-test for most of the build in functions. It runs tests and compares the results for the correct behavior. Note there are some warnings if using, this is intended (as behavior for some errors is tested, too). use this if you are not sure all nodes are running your R-code correctly (but mainly it is implemented for development).
sfTest是一个简单的单元测试大部分构建在功能。它运行测试和比较的结果是正确的行为。注意:如果使用有一些警告,这样做的目的(如一些错误的行为进行了测试,太)。如果你不知道所有的节点都在运行R-代码正确(但主要是实现它的发展)。


参见----------See Also----------

See snow documentation for details on wrapper-commands: snow-parallel
见snow文件的详细信息,包装命令:snow-parallel


实例----------Examples----------


## Not run: [#不运行:]
    sfInit( parallel=FALSE )

    ## Now works both in parallel as in sequential mode without[#现在工作在连续模式下,无论是在平行没有]
    ## explicit cluster handler.[#明确聚类的处理程序。]
    sfClusterEval( cat( "yummie\n" ) );

    ## Load a library on all slaves. Stop if fails.[#加载一个库的所有奴隶。如果失败则停止。]
    sfLibrary( tools )
    sfLibrary( "tools", character.only=TRUE )  ## Alternative.[#替代。]

    ## Execute in cluster or sequential.[#在聚类或顺序执行。]
    sfLapply( 1:10, exp )

    ## Export global Var[#导出的全局变量]
    gVar <- 99
    sfExport( "gVar" )

    ## If there are local variables with same name which shall not[#如果有局部变量具有相同的名称不得]
    ## be exported.[#出口。]
    sfExport( "gVar", local=FALSE )

    ## Export local variables[#导出的局部变量。]
    var1 &lt;- 1    ## Define global[#定义全局]
    var2 <- "a"

    f1 <- function() {
      var1 <- 2
      var3 <- "x"

      f2 <- function() {
        var1 <- 3

        sfExport( "var1", "var2", "var3", local=TRUE )
        sfClusterCall( var1 )    ## 3[#3]
        sfClusterCall( var2 )    ## "a"[#“a”的]
        sfClusterCall( var3 )    ## "x"[#“x”的]
      }

      f2()
    }

    f1()

    ## Init random number streams (snows functions, build upon[#初始化随机数流(积雪功能,建立在]
    ## packages rlecuyer/rsprng).[#的包rlecuyer / rsprng)。]
    sfClusterCall( runif, 4 )

    sfClusterSetupRNG()         ## L'Ecuyer is default.[#LEcuyer是默认的。]
    sfClusterCall( runif, 4 )

    sfClusterSetupRNG( type="SPRNG", seed = 9876)
    sfClusterCall( runif, 4 )

    ## Run unit-test on main functions.[运行单元测试的主要功能。]
    sfTest()

## End(Not run)[#(不执行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-7 07:31 , Processed in 0.039958 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表