r - Linux集群、Rmpi和进程数

标签 r linux bash mpi cluster-computing

自 11 月初以来,我一直致力于在 Linux 集群中运行并行作业。我已经在互联网上搜索了很多信息,但我就是无法进步。当我开始使用集群在 R 中搜索并行性时,我发现了 Rmpi​​。它看起来很简单,但现在我不知道该怎么做。我有一个脚本来发送我的工作:

#PBS -S /bin/bash
#PBS -N ANN_residencial
#PBS -q linux.q
#PBS -l nodes=8:ppn=8

cd $PBS_O_WORKDIR

source /hpc/modulos/bash/R-3.3.0.sh

export LD_LIBRARY_PATH=/hpc/nlopt-2.4.2/lib:$LD_LIBRARY_PATH
export CPPFLAGS='-I/hpc/nlopt-2.4.2/include '$CPPFLAGS
export PKG_CONFIG_PATH=/hpc/nlopt-2.4.2/lib/pkgconfig:$PKG_CONFIG_PATH

# OPENMPI 1.10 + GCC 5.3
source /hpc/modulos/bash/openmpi-1.10-gcc53.sh
mpiexec --mca orte_base_help_aggregate 0 -np 1 -hostfile ${PBS_NODEFILE} /hpc/R-3.3.0/bin/R --slave -f sunhpc_mpi.r

这是我的 R 程序的开始:

library(caret)
library(Rmpi)
library(doMPI)

cl <- startMPIcluster()
registerDoMPI(cl)

所以这是我的问题:

1- 这样我应该初始化进程吗(即使用 starMPIcluster whitout 参数并在命令行使用 -np 1)?

2- 为什么当我使用此命令时,MPI 会提示它的帧数?

An MPI process has executed an operation involving a call to the
"fork()" system call to create a child process....

OBS:他说对于所有 64 个进程(因为有 8 个节点和 8 个 cpu,而我正在创建 63 个进程)

3- 为什么当我在 60 个 CPU 的机器上使用这个命令时,他只产生了两个 worker ?

最佳答案

我终于明白了!

要在集群中使用 Rmpi​​ 在 R 中运行并行程序,您需要根据系统配置作业脚本。接下来在命令行上:

mpiexec --mca orte_base_help_aggregate 0 -np 1 -hostfile ${PBS_NODEFILE} /hpc/R-3.3.0/bin/R --slave -f sunhpc_mpi.r

你必须修改为:

mpiexec -np NUM_PROC -hostfile ${PBS_NODEFILE}/hpc/R-3.3.0/bin/R --slave -f sunhpc_mpi.r

在 R 代码上,您不能详细说明任何“startMPIcluster()”,因此,代码将与我上面写的完全一样。

关于r - Linux集群、Rmpi和进程数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41047951/

相关文章:

r - 将 Excel 移动平均计算器转移到 R

linux - 有什么方法可以显示包含 'find' 、 'xargs' 的命令生成的命令?

android - 位置无关的可执行文件和 Android

python - 使用子进程通过 Python 测试与 MySQL 的连接

Python 的 subprocess.Popen() 结果与命令行不同?

bash - .login 未在 CentOS 登录时调用

r - 如何绘制每条线之间具有特定距离的图形

r - write.csv 精度 R

linux - diff 命令不工作 "missing operand after ` diff'"

r - 比较两个字符串并查找差异并显示它们以便在 R 中查看(类似于 git diff)?