Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
reduce the use of simcall_process_sleep() -> this_actor::sleep_for()
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 10 Aug 2019 08:35:55 +0000 (10:35 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 10 Aug 2019 08:35:55 +0000 (10:35 +0200)
src/smpi/colls/reduce/reduce-arrival-pattern-aware.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/mpi/smpi_request.cpp

index bd9906b..1ff8bd4 100644 (file)
@@ -85,11 +85,10 @@ int Coll_reduce_arrival_pattern_aware::reduce(const void *buf, void *rbuf,
 
         for (i = 1; i < size; i++) {
           if (already_received[i] == 0) {
 
         for (i = 1; i < size; i++) {
           if (already_received[i] == 0) {
-            Request::iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
-                             MPI_STATUSES_IGNORE);
-            simcall_process_sleep(0.0001);
+            Request::iprobe(i, MPI_ANY_TAG, comm, &flag_array[i], MPI_STATUSES_IGNORE);
+            simgrid::s4u::this_actor::sleep_for(0.0001);
+          }
             }
             }
-        }
 
         header_index = 0;
         /* recv 1-byte message */
 
         header_index = 0;
         /* recv 1-byte message */
index efecf03..ac32fa2 100644 (file)
@@ -176,7 +176,7 @@ static unsigned int private_sleep(double secs)
   int rank = simgrid::s4u::this_actor::get_pid();
   TRACE_smpi_sleeping_in(rank, secs);
 
   int rank = simgrid::s4u::this_actor::get_pid();
   TRACE_smpi_sleeping_in(rank, secs);
 
-  simcall_process_sleep(secs);
+  simgrid::s4u::this_actor::sleep_for(secs);
 
   TRACE_smpi_sleeping_out(rank);
 
 
   TRACE_smpi_sleeping_out(rank);
 
@@ -223,7 +223,7 @@ int smpi_gettimeofday(struct timeval* tv, struct timezone* tz)
 #endif
   }
   if (smpi_wtime_sleep > 0)
 #endif
   }
   if (smpi_wtime_sleep > 0)
-    simcall_process_sleep(smpi_wtime_sleep);
+    simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
   smpi_bench_begin();
   return 0;
 }
   smpi_bench_begin();
   return 0;
 }
@@ -241,7 +241,7 @@ int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp)
     tp->tv_nsec = static_cast<long int>((now - tp->tv_sec) * 1e9);
   }
   if (smpi_wtime_sleep > 0)
     tp->tv_nsec = static_cast<long int>((now - tp->tv_sec) * 1e9);
   }
   if (smpi_wtime_sleep > 0)
-    simcall_process_sleep(smpi_wtime_sleep);
+    simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
   smpi_bench_begin();
   return 0;
 }
   smpi_bench_begin();
   return 0;
 }
@@ -254,7 +254,7 @@ double smpi_mpi_wtime()
     smpi_bench_end();
     time = SIMIX_get_clock();
     if (smpi_wtime_sleep > 0)
     smpi_bench_end();
     time = SIMIX_get_clock();
     if (smpi_wtime_sleep > 0)
-      simcall_process_sleep(smpi_wtime_sleep);
+      simgrid::s4u::this_actor::sleep_for(smpi_wtime_sleep);
     smpi_bench_begin();
   } else {
     time = SIMIX_get_clock();
     smpi_bench_begin();
   } else {
     time = SIMIX_get_clock();
index 739ed60..0feadab 100644 (file)
@@ -723,5 +723,5 @@ void SMPI_finalize()
 void smpi_mpi_init() {
   smpi_init_fortran_types();
   if(smpi_init_sleep > 0)
 void smpi_mpi_init() {
   smpi_init_fortran_types();
   if(smpi_init_sleep > 0)
-    simcall_process_sleep(smpi_init_sleep);
+    simgrid::s4u::this_actor::sleep_for(smpi_init_sleep);
 }
 }
index e0ae66c..0473991 100644 (file)
@@ -439,7 +439,7 @@ void Request::start()
     }
 
     if(sleeptime > 0.0){
     }
 
     if(sleeptime > 0.0){
-      simcall_process_sleep(sleeptime);
+      simgrid::s4u::this_actor::sleep_for(sleeptime);
       XBT_DEBUG("sending size of %zu : sleep %f ", size_, sleeptime);
     }
 
       XBT_DEBUG("sending size of %zu : sleep %f ", size_, sleeptime);
     }
 
@@ -540,7 +540,7 @@ int Request::test(MPI_Request * request, MPI_Status * status, int* flag) {
   }
   
   if(smpi_test_sleep > 0)
   }
   
   if(smpi_test_sleep > 0)
-    simcall_process_sleep(nsleeps*smpi_test_sleep);
+    simgrid::s4u::this_actor::sleep_for(nsleeps * smpi_test_sleep);
 
   Status::empty(status);
   *flag = 1;
 
   Status::empty(status);
   *flag = 1;
@@ -636,7 +636,7 @@ int Request::testany(int count, MPI_Request requests[], int *index, int* flag, M
     //multiplier to the sleeptime, to increase speed of execution, each failed testany will increase it
     static int nsleeps = 1;
     if(smpi_test_sleep > 0)
     //multiplier to the sleeptime, to increase speed of execution, each failed testany will increase it
     static int nsleeps = 1;
     if(smpi_test_sleep > 0)
-      simcall_process_sleep(nsleeps*smpi_test_sleep);
+      simgrid::s4u::this_actor::sleep_for(nsleeps * smpi_test_sleep);
     try{
       i = simcall_comm_testany(comms.data(), comms.size()); // The i-th element in comms matches!
     } catch (const Exception&) {
     try{
       i = simcall_comm_testany(comms.data(), comms.size()); // The i-th element in comms matches!
     } catch (const Exception&) {
@@ -854,8 +854,8 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
     //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
     double sleeptime =
         simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::Host>()->orecv(req->real_size());
     //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
     double sleeptime =
         simgrid::s4u::Actor::self()->get_host()->extension<simgrid::smpi::Host>()->orecv(req->real_size());
-    if(sleeptime > 0.0){
-      simcall_process_sleep(sleeptime);
+    if (sleeptime > 0.0) {
+      simgrid::s4u::this_actor::sleep_for(sleeptime);
       XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);
     }
     unref(&(req->detached_sender_));
       XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);
     }
     unref(&(req->detached_sender_));