按主持人分组MPI任务 [英] Group MPI tasks by host

查看:108
本文介绍了按主持人分组MPI任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想轻松地在群集的每台计算机上独立进行集体通信.假设我有4台机器,每台机器上有8个内核,我的mpi程序将运行32个MPI任务.我想要的是给定功能:

I want to easily perform collective communications indepandently on each machine of my cluster. Let say I have 4 machines with 8 cores on each, my mpi program would run 32 MPI tasks. What I would like is, for a given function:

  • 在每个主机上,只有一个任务执行计算,其他任务在此计算期间不执行任何操作.在我的示例中,将执行4个MPI任务,而其他28个任务正在等待.
  • 一旦完成计算,每个MPI任务将仅与本地任务(在同一主机上运行的任务)执行集体通信.

从概念上讲,我知道我必须为每个主机创建一个通讯器.我四处搜寻,没有发现任何明确的内容.我对MPI小组和传播者不太满意.这是我的两个问题:

Conceptually, I understand I must create one communicator for each host. I searched around, and found nothing explicitly doing that. I am not really comfortable with MPI groups and communicators. Here my two questions:

  • 对于这样的行为,MPI_Get_processor_name是否足够唯一?
  • 更一般地说,您是否有一段代码可以做到这一点?

推荐答案

规范指出,MPI_Get_processor_name返回实际(相对于虚拟)节点的唯一说明符",因此我认为您可以那.我猜您会聚在一起汇编所有主机名,然后分配处理器组以启动它们的通信器.或dup MPI_COMM_WORLD,将名称转换为整数散列,然后使用mpi_comm_split对集合进行分区.

The specification says that MPI_Get_processor_name returns "A unique specifier for the actual (as opposed to virtual) node", so I think you'd be ok with that. I guess you'd do a gather to assemble all the host names and then assign groups of processors to go off and make their communicators; or dup MPI_COMM_WORLD, turn the names into integer hashes, and use mpi_comm_split to partition the set.

您还可以采用janneb建议的方法,并使用特定于实现的选项进行mpirun,以确保MPI实现以这种方式分配任务; OpenMPI使用--byslot生成此顺序;使用mpich2,您可以使用-print-rank-map查看映射.

You could also take the approach janneb suggests and use implementation-specific options to mpirun to ensure that the MPI implementation assigns tasks that way; OpenMPI uses --byslot to generate this ordering; with mpich2 you can use -print-rank-map to see the mapping.

但这真的是您想要做的吗?如果在一个处理器正在工作时其他进程处于空闲状态,这比每个冗余执行计算的人都更好吗? (或者这是占用大量内存或I/O的资源,您是否担心争用?)如果要执行很多操作-处理节点并行化与节点外并行化非常不同-那么您可能需要考虑混合编程模型-按照HPM的建议,每个节点运行一个MPI任务和MPI_spawning子任务,或者使用OpenMP进行节点通信.

But is this really what you want to do? If the other processes are sitting idle while one processor is working, how is this better than everyone redundantly doing the calculation? (Or is this very memory or I/O intensive, and you're worried about contention?) If you're going to be doing a lot of this -- treating on-node parallelization very different from off-node parallelization -- then you may want to think about hybrid programming models - running one MPI task per node and MPI_spawning subtasks or using OpenMP for on-node communications, both as suggested by HPM.

这篇关于按主持人分组MPI任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆