特定计算机的MPI All_reduce问题

时间:2018-07-23 07:34:26

标签: mpi

我正在尝试放置一些MPI集群。我有3台计算机,并按照这些说明(以法语表示抱歉):https://www.supinfo.com/articles/single/922-parallelisation-linux-mettre-place-cluster-mpi

我已经用这段代码重现了这个问题:

#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char** argv)
{
    MPI_Init(&argc,&argv);

    int world_size;
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);

    int world_rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

    char pro_name[MPI_MAX_PROCESSOR_NAME];
    int name_len;
    MPI_Get_processor_name(pro_name, &name_len);

    printf("HW! I'm pro %s, rank %d, out of %d processors.\n", pro_name, world_rank, world_size);


    int sum;
    MPI_Allreduce(&world_size, &sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);

    printf("sum = %d\n", sum);

    MPI_Finalize();
}

我这样运行:

mpicc -o test_mpi test_mpi.c
mpirun --hostfile build_mpi/mpi_hostfile test_mpi

它可以正确打印以下内容:

HW! I'm pro master, rank 0, out of 2 processors.
HW! I'm pro slave1, rank 1, out of 2 processors.
sum = 4
sum = 4

但是当我在群集中添加第三台计算机时,我只会得到以下内容:

HW! I'm pro master, rank 0, out of 3 processors.
HW! I'm pro slave1, rank 1, out of 3 processors.
HW! I'm pro slave2, rank 2, out of 3 processors.

它不想执行All_reduce指令,它被阻塞在那里,没有错误消息!我要杀了它。对于主服务器和从属服务器2,它们都不起作用。

我不确定交流问题。由于使用ssh-copy-id,所有计算机都可以互相了解,并且每个人都可以ping通其他计算机。共享文件夹是通过sshfs完成的。

是防火墙吗? MPI是否使用其他端口来通信标准输出(ssh 22端口)和内部通信(MPI_Allreduce)? 还有其他想法吗?

每台机器都具有ubuntu 16.04和MPI 1.10.2。 非常感谢您的宝贵时间。

0 个答案:

没有答案