【发布时间】:2021-03-25 09:24:47
【问题描述】:
设置节点数为3,执行以下命令后程序正常运行:
[changmx@gpu02 mpiTest]$ mpiexec -n 4 -host gpu02,gpu03,gpu04 helloworld
[gpu04:16537] [[37424,0],2] remote spawn is NULL!
[gpu03:01562] [[37424,0],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,gpu03,gpu05 helloworld
[gpu03:01597] [[37381,0],1] remote spawn is NULL!
[gpu05:26312] [[37381,0],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,gpu03,gpu04,gpu05 helloworld
[gpu04:16671] [[37833,0],2] remote spawn is NULL!
[gpu03:01731] [[37833,0],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。
【问题讨论】:
-
1.8.8是传统的 Open MPI。你真的应该升级到受支持的版本。 -
@Gilles Gouaillardet 感谢您的回复,我没有对服务器的 root 访问权限,因此我正在尝试在不升级软件的情况下解决此问题。
-
您不需要root权限,只需在您的用户目录中构建并安装Open MPI
-
如果这是一个学生环境,那么安装 MPI 可能超出了作业的范围。只需将问题报告给系统管理员,现在使用 3 台或更少的主机。
-
你的程序应该做的第一件事是
MPI_Init。