[mpich2-dev] regression in datatype decoding

Dave Goodell goodell at mcs.anl.gov
Tue Oct 2 13:27:20 CDT 2012


Thanks for letting us know, Lisandro.  I'll take a look at it right now and see if I can find the bug.  Nice catch :)

-Dave

On Oct 2, 2012, at 12:41 PM CDT, Lisandro Dalcin wrote:

> This morning I've svn updated mpich2-dev and rebuilt. I think I've
> found a regression running mpi4py testsuite (I believe last time I
> tried all my tests passed, but I could be confused).
> 
> To help you debug the issue, see the C program at the end. On decoding
> a type created with MPI_Type_create_hindexed_block(), I expect to get
> displacements in the array of addresses, however I'm getting the
> displacements in the array of integers. This is my ouput for the C
> code below:
> 
> $ mpicc decode.c
> $ ./a.out
> integers:  4 2 0 8 16 24
> addresses:
> datatypes: MPI_INT,
> 
> This smells as copy&paste oversight from MPI_Type_create_indexed_block().
> 
> #include <mpi.h>
> #include <stdlib.h>
> #include <stdio.h>
> 
> int main(int argc, char* argv[])
> {
>  MPI_Datatype t;
>  int count = 4;
>  int blocklength = 2;
>  MPI_Aint displacements[] ={0, 8, 16, 24};
> 
>  MPI_Init(0,0);
> 
>  MPIX_Type_create_hindexed_block(count, blocklength,
>                                  displacements, MPI_INT,
>                                  &t);
>  MPI_Type_commit(&t);
>  {
>    int ni, na, nd, combiner;
>    int i[1024];
>    MPI_Aint a[1024];
>    MPI_Datatype d[1024];
>    int k;
>    MPI_Type_get_envelope(t, &ni, &na, &nd, &combiner);
>    MPI_Type_get_contents(t, ni, na, nd, i, a, d);
> 
>    printf("integers:  ");
>    for (k=0;k<ni;k++) printf("%d ",i[k]);
>    printf("\n");
> 
>    printf("addresses: ");
>    for (k=0;k<na;k++) printf("%d ",a[k]);
>    printf("\n");
> 
>    printf("datatypes: ");
>    for (k=0;k<nd;k++) {
>      char name[MPI_MAX_OBJECT_NAME]; int n;
>      MPI_Type_get_name(d[k],name,&n);
>      printf("%s, ",name);
>    }
>    printf("\n");
> 
>  }
> 
>  MPI_Type_free(&t);
>  MPI_Finalize();
> }
> 
> 
> 
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169



More information about the mpich2-dev mailing list