使用 GNU Parallel 等与 PBS 队列系统在多个节点上作为单个作业运行超过 2 个或更多的 MPI 代码

问题描述

我试图在 PBS 队列系统中作为单个作业在多个节点上运行 1 个以上的 MPI 代码(例如 2 个)。

例如对于我的集群,1 个节点 = 12 个进程

我需要将 2 个代码(abc1.out 和 abc2.out)作为单个作业运行,每个代码使用 24 个过程。因此,我需要 4x12 内核来完成这项工作。我需要一个可以为每个代码分配 2x12 的软件。

有人建议:

How to run several commands in one PBS job submission

即:

(cd jobdir1; myexecutable argument1 argument2) &

(cd jobdir2; myexecutable argument1 argument2) &

等待

但它不起作用。代码没有分布在所有进程中。

可以使用 GNU 并行吗?因为我在某处读到它不能跨多个节点工作。

如果是,PBS队列系统的命令行是什么

如果没有,有没有可以做到这一点的软件?

这与我的最终目标相似,但要复杂得多。

感谢您的帮助。

解决方法

看着 https://hpcc.umd.edu/hpcc/help/running.html#mpi,您似乎需要使用 $PBS_NODEFILE

让我们假设您有 $PBS_NODEFILE 包含 4 个保留节点。然后,您需要一种将这些拆分为 2x2 的方法。这可能会:

run_one_set() {
  cat > nodefile.$$
  mpdboot -n 2 -f nodefile.$$
  mpiexec -n 1 YOUR_PROGRAM
  mpdallexit
  rm nodefile.$$
}
export -f run_one_set
cat $PBS_NODEFILE | parallel --pipe -N2 run_one_set

(完全未经测试)。

,

感谢您的建议。

顺便说一句,我尝试使用 gnu parallel,到目前为止,它仅适用于单个节点内的作业。经过反复试验,我终于找到了解决方案。

假设每个节点有 12 个进程。并且您需要运行 2 个作业,每个作业需要 24 个进程。

所以你可以请求:

#PBS -l select=4:ncpus=12:mpiprocs=12:mem=32gb:ompthreads=1

然后

sort -u $PBS_NODEFILE > unique-nodelist.txt
sed -n '1,2p' unique-nodelist.txt > host.txt
sed 's/.*/& slots=12/' host.txt > host1.txt

sed -n '3,4p' unique-nodelist.txt > host.txt
sed 's/.*/& slots=12/' host.txt > host2.txt

mv host1.txt 1/
mv host2.txt 2/

(cd 1; ./run_solver.sh) &
(cd 2; ./run_solver.sh) &
wait

上面所做的是获取使用的节点,删除重复

每个作业分成 2 个节点

转到目录 1 和 2 并使用 run_solver.sh 运行作业

在目录 1 中作业 1 的 run_solver.sh 中:

...
mpirun -n 24 --hostfile host1.txt abc

在目录 2 中作业 2 的 run_solver.sh 中:

...
mpirun -n 24 --hostfile host2.txt def

注意不同的主机名。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...