Artem Mostyaev
Artem Mostyaev

Reputation: 3908

MPI_Wait crashes simple program

I wrote simple program with MPI and it crashes after calling MPI_Wait:

MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);

MPI_Request request;
double test = 0;
if (rank == 0) {
    MPI_Isend(&test, 1, MPI_DOUBLE, 1, 2, MPI_COMM_WORLD, &request);
} else {
    MPI_Irecv(&test, 1, MPI_DOUBLE, 0, 2, MPI_COMM_WORLD, &request);
    MPI_Wait(&request, NULL);
}

I've overlooked the code may times, but can't understand why the program crashes.
I'm using Visual Studio 2010.

Upvotes: 1

Views: 221

Answers (1)

Paul
Paul

Reputation: 84

I think you need to use MPI_STATUS_IGNORE rather than NULL. Disclaimer: I have never used this library.

https://www.mpi-forum.org/docs/mpi-2.0/mpi-20-html/node47.htm

Upvotes: 2

Related Questions