我从网上下载了一个R脚本,说它“必须在MPI环境中运行”。现在,我几乎不了解MPI,只是它用于并行计算,而且很难找到有关如何设置和使用它的简单教程。
有人可以给我一份简单,循序渐进的指南,以介绍如何安装该脚本,如何执行该脚本以及如何运行该脚本吗?
提前致谢。
编辑,这是我尝试过的:
具体问题:
> # number of available slots is passed via environment variable
> slots <- as.integer(Sys.getenv("NSLOTS"))
给出NA_integer_
。如果我使用以下代码(即我将Sys.getenv(“NSLOTS”)替换为标量)
> slots <- as.integer(4)
> cl <- snow::makeMPIcluster(slots)
我得到了错误Error in mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count, : Other MPI error, error stack: MPI_Comm_spawn(cmd="C:/PROGRA~1/R/R-31~1.0/bin/Rscript.exe", argv=0x0000000009A12CA8, maxprocs=4, MPI_INFO_NULL, root=0, MPI_COMM_SELF, intercomm=0x000000000A2FF8B0, errors=0x00000000100E3C70) failed Function not implemented
因此,我怀疑我没有正确配置我的MPI环境。
最佳答案
试试这行,...
> require(parallel)
> nCores <- 8 # manually for non-cluster machines
> cl <- makeCluster(nCores) # by default this uses the PSOCK mechanism as in the SNOW package
关于r - 如何在Windows R上设置和使用MPI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30012276/