mpi.applyLB(Rmpi)
mpi.applyLB()所属R语言包:Rmpi
(Load balancing) parallel apply
(负载平衡),并行应用
译者:生物统计家园网 机器人LoveR
描述----------Description----------
(Load balancing) parallellapply and related functions.
(负载平衡)平行lapply和相关的功能。
用法----------Usage----------
mpi.applyLB(x, fun, ..., apply.seq=NULL, comm=1)
mpi.parApply(x, MARGIN, fun, ..., job.num = mpi.comm.size(comm)-1,
apply.seq=NULL, comm=1)
mpi.parLapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL,
comm=1)
mpi.parSapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL,
simplify=TRUE, USE.NAMES = TRUE, comm=1)
mpi.parRapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL,
comm=1)
mpi.parCapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL,
comm=1)
mpi.parReplicate(n, expr, job.num=mpi.comm.size(comm)-1, apply.seq=NULL,
simplify = TRUE, comm=1)
mpi.parMM (A, B, job.num=mpi.comm.size(comm)-1, comm=1)
参数----------Arguments----------
参数:x
an array or matrix.
阵列或矩阵。
参数:MARGIN
vector specifying the dimensions to use.
向量确定的尺寸来使用。
参数:fun
a function.
一个函数。
参数:simplify
logical; should the result be simplified to a vector or matrix if possible?
逻辑,结果被简化为一个向量或矩阵如果可能的话吗?
参数:USE.NAMES
logical; if TRUE and if x is character, use x as names for the result unless it had names already.
逻辑;如果TRUE和x是字符,请使用xnames的结果,除非它的名称。
参数:n
number of replications.
复制数量。
参数:A
a matrix
矩阵
参数:B
a matrix
矩阵
参数:expr
expression to evaluate repeatedly.
表达反复评估。
参数:job.num
Total job numbers. If job numbers is bigger than total slave numbers (default value), a load balancing approach is used.
总就业数字。如果工作数大于总的站号(默认值),负载均衡的方法是使用。
参数:apply.seq
if reproducing the same computation (simulation) is desirable, set it to the integer vector .mpi.applyLB generated in previous computation (simulation).
如果复制相同的计算(模拟)是可取的,将其设置为整数向量。mpi.applyLB在以前的计算(模拟)。
参数:...
optional arguments to fun
可选参数fun
参数:comm
a communicator number
一个通信号
Details
详细信息----------Details----------
Unless length of x is no more than total slave numbers (slave.num) and in this case mpi.applyLB is the same as mpi.apply, mpi.applyLB sends a next job to a slave who just delivered a finished job. The sequence of slaves who deliver results to master are saved into .mpi.applyLB. It keeps track which part of results done by which slaves. .mpi.applyLB can be used to reproduce the same simulation result if the same seed is used and the argument apply.seq is equal to .mpi.applyLB.
除非长度x是不超过总的从站的号码(slave.num),并在这种情况下,mpi.applyLB是相同mpi.apply,mpi.applyLB发送到下一个作业奴隶刚刚发表了完成的工作。保存到.mpi.applyLB序列的成果,来主的奴隶。它可以跟踪哪一部分的结果做它的奴隶。 .mpi.applyLB可以使用相同的模拟结果,如果使用相同的种子和参数apply.seq等于.mpi.applyLB重现。
With the default value of argument job.num which is slave.num, mpi.parApply, mpi.parLapply, mpi.parSapply, mpi.parRapply, mpi.parCapply, mpi.parSapply, and mpi.parMM are clones of snow's parApply, parLappy, parSapply, parRapply, parCapply, parSapply, and parMM, respectively. When job.num is bigger than slave.num, a load balancing approach is used.
使用缺省值的参数job.num这是slave.num,mpi.parApply,mpi.parLapply,mpi.parSapply,mpi.parRapply,mpi.parCapply,<X >和mpi.parSapply是mpi.parMM小号parApply,parLappy,parSapply,parRapply,parCapply,parSapply,并parMM,分别克隆。当snow是大于slave.num,负载均衡的方法是使用。
警告----------Warning----------
When using the argument apply.seq with .mpi.applyLB, be sure all settings are the same as before, i.e., the same data, job.num, slave.num, and seed. Otherwise a deadlock could occur. Notice that apply.seq is useful only if job.num is bigger than slave.num.
当使用参数apply.seq.mpi.applyLB,确保所有的设置都和以前一样,即相同数据,job.num,slave.num,和种子。否则,可能发生死锁。注意,apply.seq是有用的,只有job.num大于slave.num。
参见----------See Also----------
mpi.apply
mpi.apply
实例----------Examples----------
## Not run: [#不运行:]
#Assume that there are some slaves running[假设,有一些从站运行]
#mpi.applyLB[mpi.applyLB]
x=1:7
mpi.applyLB(x,rnorm,mean=2,sd=4)
#get the same simulation [得到相同的模拟]
mpi.remote.exec(set.seed(111))
mpi.applyLB(x,rnorm,mean=2,sd=4)
mpi.remote.exec(set.seed(111))
mpi.applyLB(x,rnorm,mean=2,sd=4,apply.seq=.mpi.applyLB)
#mpi.parApply[mpi.parApply]
x=1:24
dim(x)=c(2,3,4)
mpi.parApply(x, MARGIN=c(1,2), fun=mean,job.num = 5)
#mpi.parLapply[mpi.parLapply]
mdat <- matrix(c(1,2,3, 7,8,9), nrow = 2, ncol=3, byrow=TRUE,
dimnames = list(c("R.1", "R.2"), c("C.1", "C.2", "C.3")))
mpi.parLapply(mdat, rnorm)
#mpi.parSapply[mpi.parSapply]
mpi.parSapply(mdat, rnorm)
#mpi.parMM[mpi.parMM]
A=matrix(1:1000^2,ncol=1000)
mpi.parMM(A,A)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|