0

I'm trying to implement a 1d partitioning breadth first search using MPI_Alltoall communication (to simulate distributed memory). But compiling the code gives the following error:

PMPI_Waitall(392): MPI_Waitall(count=-1, req_array=0x7fff6c8c17a0, status_array=0x1) failed
PMPI_Waitall(359): Negative count, value is -1
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=940193794
:
system msg for write_line failure : Bad file descriptor

Here's my code (a part of it):

  //get status of send and recieve count:
  int send_flag;
  MPI_Status send_status;
  MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &send_flag, &send_status);

  int rcv_flag;
  MPI_Status rcv_status;
  MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &rcv_flag, &rcv_status);

  int send_count;
  int rcv_count;
  MPI_Get_count(&send_status, MPI_INT, &send_count);
  MPI_Get_count(&rcv_status, MPI_INT, &rcv_count);

  //send N_p to all other processes with MPI_Alltoall
  int rcv_buffer;
  MPI_Alltoall(&N_p, send_count, MPI_INT, &N_p_rcv, rcv_count, MPI_INT, MPI_COMM_WORLD);
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
TinyNinja
  • 1
  • 1
  • 1
    You don't check `send_flag` and `rcv_flag`. According to the documentation, if these flags are `false` after `MPI_Iprobe` call, the status is _undefined_. See the example [here](http://mpi.deino.net/mpi_functions/MPI_Iprobe.html). – Daniel Langr Nov 19 '19 at 16:19
  • If the problem persists, please post a [MCVE]. Note your code suggests you might want to use `MPI_Probe()` instead of `MPI_Iprobe()`, or you do not even receive the buffer you are probing. – Gilles Gouaillardet Nov 19 '19 at 18:06

0 Answers0