mpi.send.Robj()崩溃R
我是mpi.send.Robj()崩溃R,r,mpi,mpich,R,Mpi,Mpich,我是Rmpi软件包的新手,并尝试使用MPI进行发送/接收数据的第一次演示。但是,每次在我的代码中调用mpi.send.Robj()时,R总是崩溃。我把代码贴在这里,希望有人能给我一个提示。我在Windows7 64位中使用mpich2 1.4.1p、Rmpi 0.6-3 MakeCluster <- function(count){ comm = 1 pcl <- vector("list", count) for (i in seq(along = pcl)) pcl
Rmpi
软件包的新手,并尝试使用MPI进行发送/接收数据的第一次演示。但是,每次在我的代码中调用mpi.send.Robj()
时,R总是崩溃。我把代码贴在这里,希望有人能给我一个提示。我在Windows7 64位中使用mpich2 1.4.1p、Rmpi 0.6-3
MakeCluster <- function(count){
comm = 1
pcl <- vector("list", count)
for (i in seq(along = pcl)) pcl[[i]] <- newMPInode(i, comm)
class(pcl) <- c("spawnedMPIcluster", "MPIcluster", "cluster")
setMPIcluster(pcl)
pcl
}
library('Rmpi')
mpi.spawn.Rslaves(nslaves=3)
pcl = MakeCluster(mpi.comm.size()-1)
srecv<-function(){
if(mpi.comm.rank() > 0 )
mpi.recv.Robj(0, mpi.any.tag(), comm = 1)
}
mpi.bcast.Robj2slave(srecv)
x = 5:10
for (i in seq_along(pcl)) {
mpi.send.Robj(x[i], pcl[i]$rank, tag = pcl[i]$tag, pcl[i]$comm)
}
# R crashes in the above loop, or with single call to `mpi.send.Robj` like
# i = 1
# mpi.send.Robj(x[i], pcl[i]$rank, tag = pcl[i]$tag, pcl[i]$comm)
mpi.remote.exec(srecv())
srecv<-function(rank){
if(mpi.comm.rank() == rank)
mpi.recv(x, 1, 0, mpi.any.tag(), comm = 1)
}
mpi.bcast.Robj2slave(srecv)
x = 1L
mpi.bcast.Robj2slave(x)
# send to slaves
x = 109L
mpi.send(x, 1, 3, 1, 1)
mpi.bcast.cmd(srecv(3))
#check results
mpi.remote.exec(x)
mpi.close.Rslaves()