mpi.scatter(Rmpi)
mpi.scatter()所属R语言包:Rmpi
MPI\_Scatter and MPI\_Scatterv APIs
MPI \ _Scatter和MPI \ _Scatterv的API
译者:生物统计家园网 机器人LoveR
描述----------Description----------
mpi.scatter and mpi.scatterv are the inverse operations of mpi.gather and mpi.gatherv respectively.
mpi.scatter和mpi.scattervmpi.gather和mpi.gatherv分别是相反的操作。
用法----------Usage----------
mpi.scatter(x, type, rdata, root = 0, comm = 1)
mpi.scatterv(x, scounts, type, rdata, root = 0, comm = 1)
参数----------Arguments----------
参数:x
data to be scattered.
分散的数据。
参数:type
1 for integer, 2 for double, and 3 for character. Others are not supported.
1为整数,2双,和3的每个字符。其他不被支持。
参数:rdata
the receive buffer. Must be the same type as the sender
接收缓冲器。必须是相同的类型作为发件人
参数:scounts
int vector specifying the block length inside a message to be scattered to other members.
指定块的整数向量长度内消息被分散到其他成员。
参数:root
rank of the receiver
排名的接收器
参数:comm
a communicator number
一个通信号
Details
详细信息----------Details----------
mpi.scatter scatters the message x to all members. Each member receives a portion of x with dim as length(x)/size in rank order, where size is the total number of members in a comm. So the receive buffer can be prepared as either integer(length(x)/size) or double(length(x)/size). For mpi.scatterv, scounts counts the portions (different dims) of x sent to each member. Each member needs to prepare the receive buffer as either integer(scounts[i]) or double(scounts[i]).
mpi.scatter散射的消息x的所有成员。每个成员都收到了部分x的长度(x)/大小的排名顺序,其大小是成员总数的通讯暗淡。所以任一整数(长度(x)/尺寸)或双(长度(x)/尺寸)能够被制备为接收缓冲器。对于mpi.scatterv,scounts计数的x发送给每个成员的部分(不同变暗)。每个成员都需要准备接收缓冲区要么是整数(scounts [I])或双(scounts [I])。
值----------Value----------
For non-root members, mpi.scatter or scatterv returns the scattered message and ignores whatever is in x (or scounts). For the root member, it returns the portion belonging to itself.
对于非root成员,mpi.scatter或scatterv返回零散的消息,而忽略无论是在x(或scounts)。它的根成员,传回属于自己的部分。
(作者)----------Author(s)----------
Hao Yu
参考文献----------References----------
http://www-unix.mcs.anl.gov/mpi/www/www3/
参见----------See Also----------
mpi.gather, mpi.gatherv.
mpi.gather,mpi.gatherv。
实例----------Examples----------
## Not run: [#不运行:]
#Need 3 slaves to run properly[需要3个从机正常运行]
#Or run mpi.spawn.Rslaves(nslaves=3)[或运行mpi.spawn.Rslaves(nslaves = 3)]
num="123456789abcd"
scounts<-c(2,3,1,7)
mpi.bcast.cmd(strnum<-mpi.scatter(integer(1),type=1,rdata=integer(1),root=0))
strnum<-mpi.scatter(scounts,type=1,rdata=integer(1),root=0)
mpi.bcast.cmd(ans <- mpi.scatterv(string(1),scounts=0,type=3,rdata=string(strnum),
root=0))
mpi.scatterv(as.character(num),scounts=scounts,type=3,rdata=string(strnum),root=0)
mpi.remote.exec(ans)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|