英文:
OpenMP and OpenMPI using SLURM
问题
我正在尝试理解如何正确编写SLURM脚本以最大化并行性。
例如,让我们提出以下场景:我有一个使用OpenMPI编写的程序,而OpenMP具有以下特征:
- 该程序有6个MPI进程
- 每个进程使用4个线程
该程序必须在一个具有6个节点的集群上运行,每个节点有2个CPU,每个CPU有8个核心。
为了使程序以适当的资源数量执行并且可以同时执行最大数量的程序实例,应设置SLURM脚本中的哪些值?
通过查看互联网,我发现有许多选项,例如:
- --ntasks
- --nodes
- --tasks-per-node
- --cpus-per-task
- --ntasks-per-core
- --ntasks-per-node
- --ntasks-per-socket
- --threads-per-core
- --cores-per-socket
- --sockets-per-node
我建议:
--ntasks → 6 # MPI进程的数量
--nodes → 6 # 节点的数量
--tasks-per-node → 1 # 每个节点的MPI进程数量
--cpus-per-task → 4 # 每个MPI进程的线程数量
但我不确定,因为我没有经验。
任何帮助都将不胜感激!
英文:
I am trying to understand how to correctly write SLURM scripts to maximize parallelism.
For example, let's propose the following escenario: I have a program written in OpenMPI and OpenMP has the following characteristics:
- The program has 6 MPI processes
- Each process uses 4 threads
The program has to run in a cluster that has 6 nodes; each node has 2 CPUs and each CPU
has 8 cores.
What values should be set in my SLURM script so that the program
is executed using the adequate number of resources AND the maximum number
of instances of the program can be executed simultaneously?
By looking at the internet, I have found that there are many options such as:
- --ntasks
- --nodes
- --tasks-per-node
- --cpus-per-task
- --ntasks-per-core
- --ntasks-per-node
- --ntasks-per-socket
- --threads-per-core
- --cores-per-socket
- --sockets-per-node
I would say:
-- ntasks → 6 # Number of MPI processes
-- nodes→ 6 # Number of nodes
-- tasks-per-node → 1 # Number of MPI processes per node
-- cpus-per-task → 4 # Number of threads per MPI process
But I am not sure since I have no experience.
Any help will be appreciated!
答案1
得分: 1
在一个均匀的集群和最佳网络设置的情况下,两个最重要的参数是
ntasks=6
MPI进程的数量cpus-per-task=4
每个进程的线程数
这足以让Slurm正确分配资源给您的作业,通过不指定更多的约束条件,您正在让Slurm尽其所能地优化资源使用,并使作业吞吐量尽可能高。
英文:
Assuming an homogeneous cluster and an optimal network setting, the two most important parameters are
ntasks=6
the number of MPI processescpus-per-task=4
the number of threads per process
This is sufficient for Slurm to correctly allocate resources for your job, and by not specifying more constraints, you are letting Slurm optimise the resource usage the best it can and make the job throughput as high as possible.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论