[英]Why only one node works when parallelize R code on a slurm cluster
My testing code is我的测试代码是
rm(list = ls())
library(parallel)
#setwd("/home/121090562/TestWorkspace/")
fun <- function(x){
return (x+1);
}
cl <- makeCluster(80)
ptm <- proc.time()
system.time({
res <- parLapply(cl, 1:50000000, fun)
});
print(proc.time() - ptm)
stopCluster(cl)
I want to use two nodes, each node has 40 CPUs, but only one node works instead of 2, which means only 40 CPUs work.我想使用两个节点,每个节点有 40 个 CPU,但只有一个节点工作而不是 2 个,这意味着只有 40 个 CPU 工作。
the job file is工作文件是
#!/bin/bash
#SBATCH --job-name Cores.R
#SBATCH --partition warshel-cpu
#SBATCH --nodes=2
#SBATCH --time 1-00:00:00
#SBATCH --ntasks 80
#SBATCH --output /...
#SBATCH --error /...
cd /...
R --vanilla --slave < Cores.R
Without using something like the Rmpi
package (or SlurmCluster
(?)), R has no way of doing inter-node communication.如果不使用
Rmpi
package(或SlurmCluster
(?))之类的东西,R 就无法进行节点间通信。 Your current setup is limited to a single node only.您当前的设置仅限于单个节点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.