ESMCI / mpi-serial

A one-processor version of MPI
BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

Bug in irecv for derived datatypes #11

Open gold2718 opened 6 years ago

gold2718 commented 6 years ago

The following demonstrates a bug in using mpi derived types in the receive buffer, this is showing up when running (cesm) cam-se using mpi-serial. @gold2718 reported to pio, but it's an mpi-serial bug. Run using mpi on a single processor the result is: -1 0 -1 1 -1 2 -1 3

however with mpi-serial the derived type is not respected and you get 0 1 2 3 -1 -1 -1 -1

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

int main(int argc, char **argv)
{
  int mpierr;
  int blocksize=1;
  int len=4;
  int displace[len];
  MPI_Datatype mtype;
  int sbuf[8];
  int rbuf[8];
  int i;
  MPI_Request rcvid;
  MPI_Status status;

  mpierr = MPI_Init(&argc, &argv);

  for (i=0;i<8;i++){
    sbuf[i] = i;
  }
  for (i=0;i<8;i++){
    rbuf[i] = -1;
  }
  for (i=0;i<len;i++)
    displace[i]=1+i*2;

  mpierr = MPI_Type_create_indexed_block(len, blocksize, displace,
                     MPI_INT, &mtype);
  mpierr = MPI_Type_commit(&mtype);

  mpierr = MPI_Irecv(rbuf, 1, mtype,
             0, 1, MPI_COMM_WORLD, &rcvid);
  mpierr = MPI_Send(sbuf, 4, MPI_INT,
            0, 1, MPI_COMM_WORLD);

  mpierr = MPI_Wait(&rcvid, &status);

  for (i=0;i<8;i++)
    printf(" %d",rbuf[i]);
  printf("\n");

  mpierr = MPI_Finalize();

}
gold2718 commented 6 years ago

I added tests (one C, one Fortran) to my fork which demonstrate this failure with make tests. If someone can help with the irecv bug, I can submit a PR with those tests.

gold2718 commented 6 years ago

@rloy, is there any way you could help debug this?

jedwards4b commented 1 year ago

This issue has been outstanding since 2018 - is anyone supporting this library?

rljacob commented 11 months ago

No one is doing development on it. I'll handle PRs and try to fix simple bugs. Haven't looked at this to see if its simple.