OpenMPI mpirun宇宙大小 [英] OpenMPI mpirun universe size
本文介绍了OpenMPI mpirun宇宙大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道我是否可能理解不正确.但是,这就是我想使用OpenMPI达到的目标,特别是仅从mpirun开始:
I do not know if I perhaps understand this incorrectly. But here is what I want to achieve with OpenMPI in particular just starting with mpirun:
- 我想使用-np参数创建一个单一进程,该参数将世界大小指定为1
- 然后我想将Universe的大小设置为任意数字(出于参数10),我该怎么做?
以下两个命令:
- MPI_Comm_size(MPI_COMM_WORLD,& world_size);
- MPI_Attr_get(MPI_COMM_WORLD,MPI_UNIVERSE_SIZE,& universe_size, & flag);
- MPI_Comm_size(MPI_COMM_WORLD, &world_size);
- MPI_Attr_get(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, &universe_size, &flag);
使world_size
的输出为1,而universe_size
的输出为1.
yield the output of world_size
as 1 and universe_size
as 1.
推荐答案
好,所以我找到了两种方法:
Ok, so I found 2 ways of doing this:
- 隐式:mpirun -np 1 -H localhost,localhost,...,localhost可执行文件
- 显式:只需在应用程序本身中为Universe_size分配一个值,它将正常工作.
谢谢任何看过这个的人.
Thank you for anyone that looked at this.
这篇关于OpenMPI mpirun宇宙大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文