如何解决当节点数大于 3 时 MPI 程序不执行
将节点数设置为3,执行以下命令时程序会正常运行:
[changmx@gpu02 mpiTest]$ mpiexec -n 4 -host gpu02,gpu03,gpu04 helloworld
[gpu04:16537] [[37424,0],2] remote spawn is NULL!
[gpu03:01562] [[37424,1] remote spawn is NULL!
Hello World! Process 1 of 4 on gpu02
Hello World! Process 3 of 4 on gpu04
Hello World! Process 0 of 4 on gpu02
Hello World! Process 2 of 4 on gpu03
[changmx@gpu02 mpiTest]$ mpiexec -n 4 -host gpu02,gpu05 helloworld
[gpu03:01597] [[37381,1] remote spawn is NULL!
[gpu05:26312] [[37381,2] remote spawn is NULL!
Hello World! Process 0 of 4 on gpu02
Hello World! Process 1 of 4 on gpu02
Hello World! Process 2 of 4 on gpu03
Hello World! Process 3 of 4 on gpu05
但是当节点数为4时,程序既不执行也不退出,除非我按Ctrl C退出:
[changmx@gpu02 mpiTest]$ mpiexec -n 4 -host gpu02,gpu04,gpu05 helloworld
[gpu04:16671] [[37833,2] remote spawn is NULL!
[gpu03:01731] [[37833,1] remote spawn is NULL!
以下是我的源代码:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <mpi.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
int main(int argc,char *argv[])
{
int myrank,numprocs;
int namelen = 20;
char process_name[namelen];
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
MPI_Get_processor_name(process_name,&namelen);
printf("Hello World! Process %d of %d on %s\n",myrank,numprocs,process_name);
MPI_Finalize();
}
我的 Open MPI 版本是 1.8.8。
解决方法
这个问题应该是我的 Open MPI 安装不正确造成的。当我更改Open MPI版本时,这个问题没有再出现。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。