r - 如何在Windows R上设置和使用MPI

标签 r mpi

我从网上下载了一个R脚本,说它“必须在MPI环境中运行”。现在,我几乎不了解MPI,只是它用于并行计算,而且很难找到有关如何设置和使用它的简单教程。
有人可以给我一份简单,循序渐进的指南,以介绍如何安装该脚本,如何执行该脚本以及如何运行该脚本吗?
提前致谢。
编辑,这是我尝试过的:

  • 我安装了Microsoft MPI
  • 我在R
  • 中安装并加载了RMpi软件包

    具体问题:
    > # 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/

    相关文章:

    c++ - 不同线程中的 MPI_Barrier,行为?

    c++ - MPJ Express Scatterv和Gatherv,int[]位移的目的是什么?

    r - 在R中合并具有不同列数的数据框列表?

    r - 在 R 中的 ggplot2 中外推散点图的线性拟合

    r - 使用列来控制 Shiny 仪表板中的 tabBox 内容

    c - MPI代码链接错误: undefined reference to `ceil'

    c++ - 如何使用mpirun为不同的程序使用不同的CPU内核?

    r - 合并R中的两个数据框并找到共同值和不匹配值

    r - 将函数参数传递给 dplyr 和 ggplot

    c++ - 如何在 C++ 中使用 MPI 而不是 C malloc/calloc 动态分配内存?