[mpich2-dev] Problem with MPI_Type_commit() and assert in segment_ops.c

Joe Ratterman jratt0 at gmail.com
Tue Jun 9 15:13:34 CDT 2009


The specifics of this test come from an MPI excerciser that gathered (using
MPIR_Gather) a variety of types, including MPI_SHORT_INT.  The way that
gather is implemented, it created and then sent a struct datatype of the
tmp-data from the software tree and the local-data.  I pulled out the
important bits, and got this test-case.  It asserts on PPC32 Linux 1.1 and
BGP 1.1rc0, but runs fine on 1.0.7.  The addresses/displacements are fake,
but were originally based on the actual values used inside MPIR_Gather.  It
does the type-create on the first two types just to show that it doesn't
always fail.

Error message:

Creating  addr=[0x1,0x2]  types=[8c000003,4c00010d]  struct_displs=[1,2]
 blocks=[256,256]  MPI_BOTTOM=(nil)
foo:25
Assertion failed in file segment_ops.c at line 994: *lengthp > 0
internal ABORT - process 0



Code

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

void foo(void *sendbuf,
         MPI_Datatype sendtype,
         void *recvbuf,
         MPI_Datatype recvtype)
{
  int blocks[2];
  MPI_Aint struct_displs[2];
  MPI_Datatype types[2], tmp_type;

  blocks[0] = 256;
  struct_displs[0] = (size_t)sendbuf;
  types[0] = sendtype;
  blocks[1] = 256;
  struct_displs[1] = (size_t)recvbuf;
  types[1] = MPI_BYTE;

  printf("Creating  addr=[%p,%p]  types=[%x,%x]  struct_displs=[%x,%x]
 blocks=[%d,%d]  MPI_BOTTOM=%p\n",
         sendbuf, recvbuf, types[0], types[1], struct_displs[0],
struct_displs[1], blocks[0], blocks[1], MPI_BOTTOM);
  MPI_Type_create_struct(2, blocks, struct_displs, types, &tmp_type);
  printf("%s:%d\n", __func__, __LINE__);
  MPI_Type_commit(&tmp_type);
  printf("%s:%d\n", __func__, __LINE__);
  MPI_Type_free  (&tmp_type);
  puts("Done");
}


int main()
{
  MPI_Init(NULL, NULL);

  foo((void*)0x1,
      MPI_FLOAT_INT,
      (void*)0x2,
      MPI_BYTE);
  sleep(1);
  foo((void*)0x1,
      MPI_DOUBLE_INT,
      (void*)0x2,
      MPI_BYTE);
  sleep(1);
  foo((void*)0x1,
      MPI_SHORT_INT,
      (void*)0x2,
      MPI_BYTE);

  MPI_Finalize();
  return 0;
}




I don't know anything about how this might be fixed, but we are looking into
it as well.

Thanks,
Joe Ratterman
jratt at us.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich2-dev/attachments/20090609/d83c3060/attachment.htm>


More information about the mpich2-dev mailing list