Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Mainly on 32 bits systems, target_disp can be seen as negative in one case.
authordegomme <augustin.degomme@unibas.ch>
Tue, 28 Mar 2017 00:05:53 +0000 (02:05 +0200)
committerdegomme <augustin.degomme@unibas.ch>
Tue, 28 Mar 2017 00:05:53 +0000 (02:05 +0200)
This is due to the fact that in this case, the disp is actually an address, which is stored in a signed type.
We can't do much about that, and all MPI libraries I checked have this particular check disabled for this case.

src/smpi/smpi_pmpi.cpp
src/smpi/smpi_win.cpp
src/smpi/smpi_win.hpp

index 64ff2a3..1fc6775 100644 (file)
@@ -2615,7 +2615,8 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (target_disp <0){
+  } else if (win->dynamic()!=0 && target_disp <0){ 
+    //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
@@ -2648,7 +2649,8 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (target_disp <0){
+  } else if (win->dynamic()!=0 && target_disp <0){ 
+    //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
             (origin_addr==nullptr && origin_count > 0)){
@@ -2682,7 +2684,8 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (target_disp <0){
+  } else if (win->dynamic()!=0 && target_disp <0){ 
+    //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
@@ -2719,7 +2722,8 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (target_disp <0){
+  } else if (win->dynamic()!=0 && target_disp <0){ 
+    //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
     retval = MPI_ERR_ARG;
   } else if ((origin_count < 0 || target_count < 0 || result_count <0) ||
              (origin_addr==nullptr && origin_count > 0) ||
index 4db32e7..59ce760 100644 (file)
@@ -14,7 +14,7 @@ namespace smpi{
 std::unordered_map<int, smpi_key_elem> Win::keyvals_;
 int Win::keyval_id_=0;
 
-Win::Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated): base_(base), size_(size), disp_unit_(disp_unit), assert_(0), info_(info), comm_(comm), allocated_(allocated){
+Win::Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated, int dynamic): base_(base), size_(size), disp_unit_(disp_unit), assert_(0), info_(info), comm_(comm), allocated_(allocated), dynamic_(dynamic){
   int comm_size = comm->size();
   rank_      = comm->rank();
   XBT_DEBUG("Creating window");
@@ -130,6 +130,10 @@ int Win::disp_unit(){
   return disp_unit_;
 }
 
+int Win::dynamic(){
+  return dynamic_;
+}
+
 void Win::set_info(MPI_Info info){
   if(info_!= MPI_INFO_NULL)
     info->ref();
index 13dde7b..5beb90c 100644 (file)
@@ -35,13 +35,14 @@ class Win : public F2C, public Keyval {
   int rank_; // to identify owner for barriers in MPI_COMM_WORLD
   int mode_; // exclusive or shared lock
   int allocated_;
+  int dynamic_;
 
 public:
   static std::unordered_map<int, smpi_key_elem> keyvals_;
   static int keyval_id_;
 
-  Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated = 0);
-  Win(MPI_Info info, MPI_Comm comm) : Win(MPI_BOTTOM, 0, 1, info, comm) {};
+  Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated = 0, int dynamic = 0);
+  Win(MPI_Info info, MPI_Comm comm) : Win(MPI_BOTTOM, 0, 1, info, comm, 0, 1) {};
   ~Win();
   int attach (void *base, MPI_Aint size);
   int detach (void *base);
@@ -49,6 +50,7 @@ public:
   void get_group( MPI_Group* group);
   void set_name( char* name);
   int rank();
+  int dynamic();
   int start(MPI_Group group, int assert);
   int post(MPI_Group group, int assert);
   int complete();