Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MPI_Fetch_and_op call, which is just a get_accumulate with specific params
[simgrid.git] / src / smpi / smpi_pmpi.cpp
index 1fc6775..d09c579 100644 (file)
@@ -2615,7 +2615,7 @@ 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 (win->dynamic()!=0 && 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) ||
@@ -2649,7 +2649,7 @@ 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 (win->dynamic()!=0 && 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) ||
@@ -2684,7 +2684,7 @@ 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 (win->dynamic()!=0 && 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) ||
@@ -2722,7 +2722,7 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
     retval = MPI_SUCCESS;
   } else if (target_rank <0){
     retval = MPI_ERR_RANK;
-  } else if (win->dynamic()!=0 && 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) ||
@@ -2752,6 +2752,10 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
   return retval;
 }
 
+int PMPI_Fetch_and_op(void *origin_addr, void *result_addr, MPI_Datatype dtype, int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win){
+  return PMPI_Get_accumulate(origin_addr, origin_addr==nullptr?0:1, dtype, result_addr, 1, dtype, target_rank, target_disp, 1, dtype, op, win);
+}
+
 int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
   int retval = 0;
   smpi_bench_end();
@@ -2975,7 +2979,7 @@ int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
 int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
   static int one = 1;
   static int zero = 0;
-  static int tag_ub = 1000000;
+  static int tag_ub = INT_MAX;
   static int last_used_code = MPI_ERR_LASTCODE;
 
   if (comm==MPI_COMM_NULL){