Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Const for MPI_Type_struct and MPI_Type_hindexed.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 29 Apr 2019 12:51:26 +0000 (14:51 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 29 Apr 2019 14:08:52 +0000 (16:08 +0200)
include/smpi/smpi.h
src/smpi/bindings/smpi_mpi.cpp
src/smpi/bindings/smpi_pmpi_type.cpp

index e55d9c1..8b0e629 100644 (file)
@@ -438,7 +438,7 @@ MPI_CALL(XBT_PUBLIC int, MPI_Type_lb, (MPI_Datatype datatype, MPI_Aint* disp));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_ub, (MPI_Datatype datatype, MPI_Aint* disp));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_commit, (MPI_Datatype * datatype));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_hindexed,
-         (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+         (int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hindexed,
          (int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hindexed_block,
@@ -454,7 +454,7 @@ MPI_CALL(XBT_PUBLIC int, MPI_Type_create_indexed,
 MPI_CALL(XBT_PUBLIC int, MPI_Type_create_indexed_block,
          (int count, int blocklength, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_struct,
-         (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype));
+         (int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types, MPI_Datatype* newtype));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_create_struct,
          (int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types, MPI_Datatype* newtype));
 MPI_CALL(XBT_PUBLIC int, MPI_Type_vector,
index d0081a6..fda923a 100644 (file)
@@ -240,7 +240,7 @@ WRAPPED_PMPI_CALL(int,MPI_Type_get_attr ,(MPI_Datatype type, int type_keyval, vo
 WRAPPED_PMPI_CALL(int,MPI_Type_get_extent,(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent),(datatype, lb, extent))
 WRAPPED_PMPI_CALL(int,MPI_Type_get_name,(MPI_Datatype datatype, char * name, int* len),(datatype,name,len))
 WRAPPED_PMPI_CALL(int,MPI_Type_get_true_extent,(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent),(datatype, lb, extent))
-WRAPPED_PMPI_CALL(int,MPI_Type_hindexed,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_hindexed,(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Type_hvector,(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklen, stride, old_type, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Type_indexed,(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Type_lb,(MPI_Datatype datatype, MPI_Aint * disp),(datatype, disp))
@@ -248,7 +248,7 @@ WRAPPED_PMPI_CALL(int,MPI_Type_set_attr ,(MPI_Datatype type, int type_keyval, vo
 WRAPPED_PMPI_CALL(int,MPI_Type_set_name,(MPI_Datatype datatype, const char * name),(datatype, name))
 WRAPPED_PMPI_CALL(int,MPI_Type_size,(MPI_Datatype datatype, int *size),(datatype, size))
 WRAPPED_PMPI_CALL(int,MPI_Type_size_x,(MPI_Datatype datatype, MPI_Count *size),(datatype, size))
-WRAPPED_PMPI_CALL(int,MPI_Type_struct,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_struct,(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types, MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Type_ub,(MPI_Datatype datatype, MPI_Aint * disp),(datatype, disp))
 WRAPPED_PMPI_CALL(int,MPI_Type_vector,(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklen, stride, old_type, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Unpack,(const void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) ,(inbuf, insize, position, outbuf, outcount, type, comm))
index 7d3e0db..868a2a9 100644 (file)
@@ -196,7 +196,8 @@ int PMPI_Type_create_indexed_block(int count, int blocklength, const int* indice
   }
 }
 
-int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
+int PMPI_Type_hindexed(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type,
+                       MPI_Datatype* new_type)
 {
   if (old_type == MPI_DATATYPE_NULL) {
     return MPI_ERR_TYPE;
@@ -209,7 +210,7 @@ int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatyp
 
 int PMPI_Type_create_hindexed(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type,
                               MPI_Datatype* new_type) {
-  return PMPI_Type_hindexed(count, const_cast<int*>(blocklens),const_cast<MPI_Aint*>(indices),old_type,new_type);
+  return PMPI_Type_hindexed(count, blocklens, indices, old_type, new_type);
 }
 
 int PMPI_Type_create_hindexed_block(int count, int blocklength, const MPI_Aint* indices, MPI_Datatype old_type,
@@ -228,7 +229,9 @@ int PMPI_Type_create_hindexed_block(int count, int blocklength, const MPI_Aint*
   }
 }
 
-int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
+int PMPI_Type_struct(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,
+                     MPI_Datatype* new_type)
+{
   if (count<0){
     return MPI_ERR_COUNT;
   } else {
@@ -241,7 +244,7 @@ int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype*
 
 int PMPI_Type_create_struct(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,
                             MPI_Datatype* new_type) {
-  return PMPI_Type_struct(count, const_cast<int*>(blocklens), const_cast<MPI_Aint*>(indices), const_cast<MPI_Datatype*>(old_types), new_type);
+  return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
 }