MPI_Gather在Oracle VM VirtualBox的CentOS 7群集上失败,但在真实群集中运行良好

时间:2018-11-27 07:04:43

标签: virtual-machine mpi virtualbox cluster-computing

直接问题:我的MPI_Gather_demo(如下所示)非常简单。但是它不能在我的VM群集中工作。

[mindle@master shared_folder]$ mpirun -n 4 --hosts master,node1 ./MPI_Gather_demo
[mpiexec@master.cluster] control_cb (pm/pmiserv/pmiserv_cb.c:200): assert (!closed) failed
[mpiexec@master.cluster] HYDT_dmxu_poll_wait_for_event (tools/demux/demux_poll.c:76): callback returned error status
[mpiexec@master.cluster] HYD_pmci_wait_for_completion (pm/pmiserv/pmiserv_pmci.c:198): error waiting for event
[mpiexec@master.cluster] main (ui/mpich/mpiexec.c:344): process manager error waiting for completion
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>

void print_short_array(short *array, int size);

int main() {
#define MASTER 0

    MPI_Init(NULL, NULL);

    int world_size, world_rank;
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

    short *sum_data = NULL;

    short local_data = world_rank + 1;

    if (world_rank == MASTER) {
        sum_data = (short *)malloc(world_size * sizeof(short));
        assert(sum_data != NULL);
    }

    // ---- the function is here ----
    MPI_Gather(&local_data, 1, MPI_SHORT, sum_data, 1, MPI_SHORT,
        MASTER, MPI_COMM_WORLD);

    if (world_rank == MASTER) {
        print_short_array(sum_data, world_size);
    }

    MPI_Finalize();
    return 0;
}

void print_short_array(short *array, int size) {
    printf("{");
    int i;
    for (i = 0; i < size; i++) {
        if (i == size - 1)
            printf("%d}\n", array[i]);
        else
            printf("%d, ", array[i]);
    }
}

但是它可以在单个VM中正常工作,如下所示:

[mindle@master shared_folder]$ mpirun -n 4 ./MPI_Gather_demo
{1, 2, 3, 4}

在一个真实的群集(Alibaba cloud的四个E-HPC节点)中,该程序也可以正常工作。

环境:我在 CentOS 7 中使用 Oracle VM VirtualBox 在虚拟集群中使用了MPI。我正在使用的MPI实现是 mpich-3.2

我将这些设置为OK:

    每个虚拟机的
  • 静态IP地址
  • 主服务器和节点之间的
  • 无密码SSH
  • / etc / hosts在每个VM中添加ip地址,ping可以

此外:对于另一个名为MyMPI_Hello.chere,未使用MPI_Gather)的测试程序,我的VM群集可以正常工作。

[mindle@master mpi_cloud]$ mpirun -n 4 -f mpi_file /mpi_cloud/a.out 
Hello World! Process 0 of 4 on master.cluster
Hello World! Process 1 of 4 on node1.cluster
Hello World! Process 2 of 4 on node2.cluster
Hello World! Process 3 of 4 on node3.cluster

核心问题是为什么MPI_Gather功能在我的VM群集中崩溃,而在实际群集中却无法正常工作。

要复制::如果您有VM群集,请检查是否要使用MPI_Gather_demo.c复制我的错误并找到任何解决方案。

0 个答案:

没有答案
相关问题