首页 > 解决方案 > 进行并行计算时运行 Rmpi​​ 出错

问题描述

我正在尝试使用以下行在 R 中运行并行计算

library(parallel)
library(snow)
library(snowFT)
library(VGAM)
library(dplyr)
library(Rmpi)

nCores <- detectCores() - 1
cl <- makeCluster(nCores)

然后R返回一个错误

Error in Rmpi::mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count, : Internal MPI error!, error stack: MPI_Comm_spawn(cmd="C:/R/R-40~1.2/bin/x64/Rscript.exe", argv=0x00000223DB137530, maxprocs=11, MPI_INFO_NULL, root=0, MPI_COMM_SELF, intercomm=0x00000223DCFCD998, errors=0x00000223DA9FC9E8) failed Internal MPI error! FAILspawn not supported without process manager
 3. Rmpi::mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count, intercomm = intercomm)
 2. makeMPIcluster(spec, ...)
 1. makeCluster(nCores)

我试图从这里在 Windows 上安装 MPICH2 ,但最终的 cmd 命令mpiexec -validate总是返回FAIL

您能否详细说明如何解决此问题?

标签: rwindowsparallel-processingmpi

解决方案


问题是makeCluster(nCores)被多个包使用。因此,我用它parallel::makeCluster(nCores)来解决这个问题。


推荐阅读