Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow insertion of time inside gettimeofday and clock_gettime
authorAugustin Degomme <degomme@wasabi>
Mon, 10 Sep 2018 11:39:29 +0000 (13:39 +0200)
committerAugustin Degomme <degomme@wasabi>
Mon, 10 Sep 2018 11:39:29 +0000 (13:39 +0200)
Done with --cfg=smpi/wtime, which was previously only for MPI_Wtime.
This should avoid some infinite loops. Keep 0 as default for now.

src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp

index 85191c7..96996c0 100644 (file)
@@ -35,6 +35,8 @@ SharedMallocType smpi_cfg_shared_malloc = SharedMallocType::GLOBAL;
 double smpi_total_benched_time = 0;
 
 extern "C" XBT_PUBLIC void smpi_execute_flops_(double* flops);
+extern "C" XBT_PUBLIC simgrid::config::Flag<double> smpi_wtime_sleep;
+
 void smpi_execute_flops_(double *flops)
 {
   smpi_execute_flops(*flops);
@@ -232,6 +234,8 @@ int smpi_gettimeofday(struct timeval* tv, struct timezone* tz)
     tv->tv_usec = static_cast<suseconds_t>((now - tv->tv_sec) * 1e6);
 #endif
   }
+  if(smpi_wtime_sleep > 0)
+    simcall_process_sleep(smpi_wtime_sleep);
   smpi_bench_begin();
   return 0;
 }
@@ -248,6 +252,8 @@ int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp)
     tp->tv_sec = static_cast<time_t>(now);
     tp->tv_nsec = static_cast<long int>((now - tp->tv_sec) * 1e9);
   }
+  if(smpi_wtime_sleep > 0)
+    simcall_process_sleep(smpi_wtime_sleep);
   smpi_bench_begin();
   return 0;
 }
index e75aef9..0c5d88a 100644 (file)
@@ -95,7 +95,7 @@ MPI_Errhandler *MPI_ERRHANDLER_NULL = nullptr;
 // No instance gets manually created; check also the smpirun.in script as
 // this default name is used there as well (when the <actor> tag is generated).
 static const std::string smpi_default_instance_name("smpirun");
-static simgrid::config::Flag<double> smpi_wtime_sleep(
+XBT_PRIVATE simgrid::config::Flag<double> smpi_wtime_sleep(
   "smpi/wtime", "Minimum time to inject inside a call to MPI_Wtime", 0.0);
 static simgrid::config::Flag<double> smpi_init_sleep(
   "smpi/init", "Time to inject inside a call to MPI_Init", 0.0);