Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mpi.send.Robj()崩溃R_R_Mpi_Mpich - Fatal编程技术网

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()