From: degomme Date: Fri, 10 Jul 2015 13:32:53 +0000 (+0200) Subject: Fix fortran mpi_type_struct and mpi_type_create_struct functions X-Git-Tag: v3_12~519 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a7c0b25e52a835bda2ddfb5d77a510c843d1b918?ds=sidebyside Fix fortran mpi_type_struct and mpi_type_create_struct functions --- diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index b044802389..405e6c8aa7 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -1357,18 +1357,30 @@ void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, void mpi_type_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr) { MPI_Datatype tmp; - *ierr = MPI_Type_struct(*count, blocklens, indices, (MPI_Datatype*)old_types, &tmp); + int i=0; + MPI_Datatype* types = (MPI_Datatype*)xbt_malloc(*count*sizeof(MPI_Datatype)); + for(i=0; i< *count; i++){ + types[i] = smpi_type_f2c(old_types[i]); + } + *ierr = MPI_Type_struct(*count, blocklens, indices, types, &tmp); if(*ierr == MPI_SUCCESS) { *newtype = smpi_type_c2f(tmp); } + xbt_free(types); } void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr) { MPI_Datatype tmp; - *ierr = MPI_Type_create_struct(*count, blocklens, indices, (MPI_Datatype*)old_types, &tmp); + int i=0; + MPI_Datatype* types = (MPI_Datatype*)xbt_malloc(*count*sizeof(MPI_Datatype)); + for(i=0; i< *count; i++){ + types[i] = smpi_type_f2c(old_types[i]); + } + *ierr = MPI_Type_create_struct(*count, blocklens, indices, types, &tmp); if(*ierr == MPI_SUCCESS) { *newtype = smpi_type_c2f(tmp); } + xbt_free(types); } void mpi_ssend_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr) {