Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Added XBT_DEBUG statements to smpi_win.cpp
[simgrid.git] / src / smpi / mpi / smpi_win.cpp
index f2782d153e2c88e880fdf83877000c8ea1770ef1..33b7f66e63a113b79bd97219284f75520a533d34 100644 (file)
@@ -3,7 +3,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "private.h"
+#include "smpi_win.hpp"
+#include "private.hpp"
 #include "smpi_coll.hpp"
 #include "smpi_comm.hpp"
 #include "smpi_datatype.hpp"
@@ -11,7 +12,6 @@
 #include "smpi_keyvals.hpp"
 #include "smpi_process.hpp"
 #include "smpi_request.hpp"
-#include "smpi_win.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_rma, smpi, "Logging specific to SMPI (RMA operations)");
 
@@ -195,7 +195,7 @@ int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : recv_win->lockers_)
+    for (auto const& it : recv_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -252,7 +252,7 @@ int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : send_win->lockers_)
+    for (auto const& it : send_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -307,14 +307,14 @@ int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
 int Win::accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Request* request)
 {
-
+  XBT_DEBUG("Entering MPI_Win_Accumulate");
   //get receiver pointer
   MPI_Win recv_win = connected_wins_[target_rank];
 
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : recv_win->lockers_)
+    for (auto const& it : recv_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -355,6 +355,7 @@ int Win::accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
       xbt_mutex_release(mut_);
     }
 
+  XBT_DEBUG("Leaving MPI_Win_Accumulate");
   return MPI_SUCCESS;
 }
 
@@ -368,7 +369,7 @@ int Win::get_accumulate( void *origin_addr, int origin_count, MPI_Datatype origi
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : send_win->lockers_)
+    for (auto const& it : send_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -405,7 +406,7 @@ int Win::compare_and_swap(void *origin_addr, void *compare_addr,
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : send_win->lockers_)
+    for (auto const& it : send_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -413,7 +414,7 @@ int Win::compare_and_swap(void *origin_addr, void *compare_addr,
   }
 
   XBT_DEBUG("Entering MPI_Compare_and_swap with %d", target_rank);
-  MPI_Request req;
+  MPI_Request req = MPI_REQUEST_NULL;
   xbt_mutex_acquire(send_win->atomic_mut_);
   get(result_addr, 1, datatype, target_rank,
               target_disp, 1, datatype, &req);
@@ -446,6 +447,7 @@ int Win::start(MPI_Group group, int assert){
     int size          = group->size();
     MPI_Request* reqs = xbt_new0(MPI_Request, size);
 
+  XBT_DEBUG("Entering MPI_Win_Start");
     while (j != size) {
       int src = group->index(j);
       if (src != smpi_process()->index() && src != MPI_UNDEFINED) {
@@ -464,6 +466,7 @@ int Win::start(MPI_Group group, int assert){
   opened_++; //we're open for business !
   group_=group;
   group->ref();
+  XBT_DEBUG("Leaving MPI_Win_Start");
   return MPI_SUCCESS;
 }
 
@@ -474,6 +477,7 @@ int Win::post(MPI_Group group, int assert){
   int size = group->size();
   MPI_Request* reqs = xbt_new0(MPI_Request, size);
 
+  XBT_DEBUG("Entering MPI_Win_Post");
   while(j!=size){
     int dst=group->index(j);
     if(dst!=smpi_process()->index() && dst!=MPI_UNDEFINED){
@@ -493,6 +497,7 @@ int Win::post(MPI_Group group, int assert){
   opened_++; //we're open for business !
   group_=group;
   group->ref();
+  XBT_DEBUG("Leaving MPI_Win_Post");
   return MPI_SUCCESS;
 }