Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Attempt to fix problems with complex datatype copy in smpi
authorAugustin Degomme <degomme@idpann.imag.fr>
Mon, 8 Apr 2013 17:59:23 +0000 (19:59 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Tue, 9 Apr 2013 10:00:52 +0000 (12:00 +0200)
src/smpi/smpi_mpi_dt.c
src/smpi/smpi_mpi_dt_private.h

index 29471e9..59512b6 100644 (file)
@@ -177,13 +177,12 @@ int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     }else{
       s_smpi_subtype_t *subtype =  sendtype->substruct;
 
     }else{
       s_smpi_subtype_t *subtype =  sendtype->substruct;
 
-      s_smpi_mpi_vector_t* type_c = (s_smpi_mpi_vector_t*)sendtype;
 
 
-      void * buf_tmp = xbt_malloc(count * type_c->size_oldtype);
+      void * buf_tmp = xbt_malloc(count);
 
       subtype->serialize( sendbuf, buf_tmp,1, subtype);
       subtype =  recvtype->substruct;
 
       subtype->serialize( sendbuf, buf_tmp,1, subtype);
       subtype =  recvtype->substruct;
-      subtype->unserialize(recvbuf, buf_tmp,1, subtype);
+      subtype->unserialize( buf_tmp, recvbuf,1, subtype);
 
       free(buf_tmp);
     }
 
       free(buf_tmp);
     }
index 608beff..656754d 100644 (file)
@@ -42,42 +42,44 @@ extern MPI_Datatype MPI_PTR;
 
 typedef struct s_smpi_mpi_vector{
   s_smpi_subtype_t base;
 
 typedef struct s_smpi_mpi_vector{
   s_smpi_subtype_t base;
+  MPI_Datatype old_type;
+  size_t size_oldtype;
   size_t block_stride;
   size_t block_length;
   size_t block_count;
   size_t block_stride;
   size_t block_length;
   size_t block_count;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
 } s_smpi_mpi_vector_t;
 
 typedef struct s_smpi_mpi_hvector{
   s_smpi_subtype_t base;
 } s_smpi_mpi_vector_t;
 
 typedef struct s_smpi_mpi_hvector{
   s_smpi_subtype_t base;
+  MPI_Datatype old_type;
+  size_t size_oldtype;
   MPI_Aint block_stride;
   size_t block_length;
   size_t block_count;
   MPI_Aint block_stride;
   size_t block_length;
   size_t block_count;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
 } s_smpi_mpi_hvector_t;
 
 typedef struct s_smpi_mpi_indexed{
   s_smpi_subtype_t base;
 } s_smpi_mpi_hvector_t;
 
 typedef struct s_smpi_mpi_indexed{
   s_smpi_subtype_t base;
+  MPI_Datatype old_type;
+  size_t size_oldtype;
   int* block_lengths;
   int* block_indices;
   size_t block_count;
   int* block_lengths;
   int* block_indices;
   size_t block_count;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
 } s_smpi_mpi_indexed_t;
 
 typedef struct s_smpi_mpi_hindexed{
   s_smpi_subtype_t base;
 } s_smpi_mpi_indexed_t;
 
 typedef struct s_smpi_mpi_hindexed{
   s_smpi_subtype_t base;
+  MPI_Datatype old_type;
+  size_t size_oldtype;
   int* block_lengths;
   MPI_Aint* block_indices;
   size_t block_count;
   int* block_lengths;
   MPI_Aint* block_indices;
   size_t block_count;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
 } s_smpi_mpi_hindexed_t;
 
 typedef struct s_smpi_mpi_struct{
   s_smpi_subtype_t base;
 } s_smpi_mpi_hindexed_t;
 
 typedef struct s_smpi_mpi_struct{
   s_smpi_subtype_t base;
+  MPI_Datatype old_type;
+  size_t size_oldtype;
   int* block_lengths;
   MPI_Aint* block_indices;
   size_t block_count;
   int* block_lengths;
   MPI_Aint* block_indices;
   size_t block_count;