MPI_Gather:主从程序中的分段错误

时间:2017-10-01 19:01:39

标签: c++ mpi mpich

以下是一个简单的程序,其中所有Slaves进程将其排名(作为令牌)发送到主进程。

程序执行时大部分时间都能正常运行,但会引发Segmentation Fault其他程序。

int token = rank;
vector<int> recvData(world_size);

MPI_Gather(&token, 1, MPI_INT, &recvData[0], 1, MPI_INT, 0, MPI_COMM_WORLD);

if(rank == 0)
{
    // Root process
    for (int irank = 1; irank < world_size; irank++)
    {
        cout << "Token received from rank " << irank << " = " << recvData[irank] << endl;
    }
}

Full code here

以下是错误消息:

YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault:
11 (signal 11) This typically refers to a problem with your
application. Please see the FAQ page for debugging suggestions

Full Error here

有没有办法避免这种情况?

编辑1: 以下是以详细模式(两种情况)运行时mpirun的输出:

i)Success Case

ii)Segmentation Fault Case

P.S。:我今天向similar question询问了这个问题,并建议使用MPI_Gather(),但问题仍然存在。

0 个答案:

没有答案
相关问题