Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
factor verbose logging
authorsuter <frederic.suter@cc.in2p3.fr>
Fri, 21 Dec 2012 11:37:36 +0000 (12:37 +0100)
committersuter <frederic.suter@cc.in2p3.fr>
Fri, 21 Dec 2012 11:37:36 +0000 (12:37 +0100)
add dummy actions for unimplemented MPI calls needed by NPB codes

src/smpi/smpi_replay.c

index 4af254f..eceb8a2 100644 (file)
@@ -15,6 +15,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
 int communicator_size = 0;
 static int active_processes = 0;
 
+void log_timed_action (const char *const *action, double clock){
+  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
+    char *name = xbt_str_join_array(action, " ");
+    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
+    free(name);
+  }
+}
+
 typedef struct {
   xbt_dynar_t isends; /* of MPI_Request */
   xbt_dynar_t irecvs; /* of MPI_Request */
@@ -65,25 +73,29 @@ static void action_comm_size(const char *const *action)
   double clock = smpi_process_simulated_elapsed();
 
   communicator_size = parse_double(action[2]);
+  log_timed_action (action, clock);
+}
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+static void action_comm_split(const char *const *action)
+{
+  double clock = smpi_process_simulated_elapsed();
+
+  log_timed_action (action, clock);
 }
 
+static void action_comm_dup(const char *const *action)
+{
+  double clock = smpi_process_simulated_elapsed();
+
+  log_timed_action (action, clock);
+}
 
 static void action_compute(const char *const *action)
 {
   double clock = smpi_process_simulated_elapsed();
   smpi_execute_flops(parse_double(action[2]));
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_send(const char *const *action)
@@ -101,11 +113,7 @@ static void action_send(const char *const *action)
 
   smpi_mpi_send(NULL, size, MPI_BYTE, to , 0, MPI_COMM_WORLD);
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 
   #ifdef HAVE_TRACING
   TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
@@ -139,12 +147,7 @@ static void action_Isend(const char *const *action)
 
   xbt_dynar_push(globals->isends,&request);
 
-  //TODO do the asynchronous cleanup
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_recv(const char *const *action) {
@@ -168,11 +171,7 @@ static void action_recv(const char *const *action) {
   TRACE_smpi_computing_in(rank);
 #endif
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_Irecv(const char *const *action)
@@ -197,12 +196,7 @@ static void action_Irecv(const char *const *action)
 #endif
   xbt_dynar_push(globals->irecvs,&request);
 
-  //TODO do the asynchronous cleanup
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_wait(const char *const *action){
@@ -237,11 +231,13 @@ static void action_wait(const char *const *action){
   TRACE_smpi_computing_in(rank);
 #endif
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
+}
+
+static void action_waitall(const char *const *action){
+  double clock = smpi_process_simulated_elapsed();
+//  smpi_mpi_waitall(count, requests, status);
+  log_timed_action (action, clock);
 }
 
 static void action_barrier(const char *const *action){
@@ -257,11 +253,7 @@ static void action_barrier(const char *const *action){
   TRACE_smpi_computing_in(rank);
 #endif
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_bcast(const char *const *action)
@@ -281,11 +273,7 @@ static void action_bcast(const char *const *action)
   TRACE_smpi_computing_in(rank);
 #endif
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_reduce(const char *const *action)
@@ -304,11 +292,7 @@ static void action_reduce(const char *const *action)
   TRACE_smpi_computing_in(rank);
 #endif
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
 }
 
 static void action_allReduce(const char *const *action) {
@@ -328,30 +312,43 @@ static void action_allReduce(const char *const *action) {
   TRACE_smpi_computing_in(rank);
 #endif
 
-  if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process_simulated_elapsed()-clock);
-    free(name);
-  }
+  log_timed_action (action, clock);
+}
+
+static void action_allToAll(const char *const *action) {
+  double clock = smpi_process_simulated_elapsed();
+
+  log_timed_action (action, clock);
+}
+
+static void action_allToAllv(const char *const *action) {
+  double clock = smpi_process_simulated_elapsed();
+
+  log_timed_action (action, clock);
 }
 
 void smpi_replay_init(int *argc, char***argv){
   PMPI_Init(argc, argv);
   if (!smpi_process_index()){
     _xbt_replay_action_init();
-    xbt_replay_action_register("init",     action_init);
-    xbt_replay_action_register("finalize", action_finalize);
-    xbt_replay_action_register("comm_size",action_comm_size);
-    xbt_replay_action_register("send",     action_send);
-    xbt_replay_action_register("Isend",    action_Isend);
-    xbt_replay_action_register("recv",     action_recv);
-    xbt_replay_action_register("Irecv",    action_Irecv);
-    xbt_replay_action_register("wait",     action_wait);
-    xbt_replay_action_register("barrier",  action_barrier);
-    xbt_replay_action_register("bcast",    action_bcast);
-    xbt_replay_action_register("reduce",   action_reduce);
-    xbt_replay_action_register("allReduce",action_allReduce);
-    xbt_replay_action_register("compute",  action_compute);
+    xbt_replay_action_register("init",       action_init);
+    xbt_replay_action_register("finalize",   action_finalize);
+    xbt_replay_action_register("comm_size",  action_comm_size);
+    xbt_replay_action_register("comm_split", action_comm_split);
+    xbt_replay_action_register("comm_dup",   action_comm_dup);
+    xbt_replay_action_register("send",       action_send);
+    xbt_replay_action_register("Isend",      action_Isend);
+    xbt_replay_action_register("recv",       action_recv);
+    xbt_replay_action_register("Irecv",      action_Irecv);
+    xbt_replay_action_register("wait",       action_wait);
+    xbt_replay_action_register("waitAll",    action_waitall);
+    xbt_replay_action_register("barrier",    action_barrier);
+    xbt_replay_action_register("bcast",      action_bcast);
+    xbt_replay_action_register("reduce",     action_reduce);
+    xbt_replay_action_register("allReduce",  action_allReduce);
+    xbt_replay_action_register("allToAll",   action_allToAll);
+    xbt_replay_action_register("allToAllV",  action_allToAllv);
+    xbt_replay_action_register("compute",    action_compute);
   }
 
   xbt_replay_action_runner(*argc, *argv);