Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in irecv for derived datatypes #11

Open
gold2718 opened this issue Jan 16, 2018 · 4 comments
Open

Bug in irecv for derived datatypes #11

gold2718 opened this issue Jan 16, 2018 · 4 comments
Assignees
Labels

Comments

@gold2718
Copy link

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
Copy link
Author

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
Copy link
Author

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

@jedwards4b
Copy link
Contributor

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

@rljacob
Copy link
Member

rljacob commented Nov 22, 2023

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.

@gold2718 gold2718 assigned gold2718 and jedwards4b and unassigned gold2718 Dec 24, 2023
@gold2718 gold2718 added the bug label Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants