Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branches 'master' and 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 21 Oct 2016 20:09:51 +0000 (22:09 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 21 Oct 2016 20:09:51 +0000 (22:09 +0200)
src/smpi/instr_smpi.cpp
src/smpi/smpi_replay.cpp
tools/cmake/DefinePackages.cmake
tools/cmake/Modules/FindGFortran.cmake [deleted file]

index 4c60542..73ee64b 100644 (file)
@@ -93,21 +93,15 @@ XBT_PRIVATE char *smpi_container(int rank, char *container, int n)
   return container;
 }
 
-static char *TRACE_smpi_get_key(int src, int dst, char *key, int n);
+static char *TRACE_smpi_get_key(int src, int dst, char *key, int n, int send);
 
-static char *TRACE_smpi_put_key(int src, int dst, char *key, int n)
+static char *TRACE_smpi_put_key(int src, int dst, char *key, int n, int send)
 {
   //get the dynar for src#dst
   char aux[INSTR_DEFAULT_STR_SIZE];
-  snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
+  snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d#%d", src, dst, send);
   xbt_dynar_t d = static_cast<xbt_dynar_t>(xbt_dict_get_or_null(keys, aux));
 
-  if(xbt_dynar_is_empty(d) == 0){
-    //receive was already pushed, perform a get instead
-    TRACE_smpi_get_key(src , dst, key ,n);
-    return key;
-  }
-
   if (d == nullptr) {
     d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
     xbt_dict_set(keys, aux, d, nullptr);
@@ -125,15 +119,15 @@ static char *TRACE_smpi_put_key(int src, int dst, char *key, int n)
   return key;
 }
 
-static char *TRACE_smpi_get_key(int src, int dst, char *key, int n)
+static char *TRACE_smpi_get_key(int src, int dst, char *key, int n, int send)
 {
   char aux[INSTR_DEFAULT_STR_SIZE];
-  snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
+  snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d#%d", src, dst, send==1?0:1);
   xbt_dynar_t d = static_cast<xbt_dynar_t>(xbt_dict_get_or_null(keys, aux));
 
-  // sometimes the receive may be posted before the send
+  // first posted
   if(xbt_dynar_is_empty(d)){
-      TRACE_smpi_put_key(src, dst, key, n);
+      TRACE_smpi_put_key(src, dst, key, n, send);
       return key;
   }
 
@@ -414,13 +408,13 @@ void TRACE_smpi_send(int rank, int src, int dst, int size)
     return;
 
   char key[INSTR_DEFAULT_STR_SIZE] = {0};
-  TRACE_smpi_put_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
+  TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE,1);
 
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(src, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = PJ_container_get (str);
   type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root());
-
+  XBT_DEBUG("Send tracing from %d to %d, with key %s", src, dst, key);
   new_pajeStartLinkWithSize (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key, size);
 }
 
@@ -430,12 +424,12 @@ void TRACE_smpi_recv(int rank, int src, int dst)
     return;
 
   char key[INSTR_DEFAULT_STR_SIZE] = {0};
-  TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
+  TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE,0);
 
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(dst, str, INSTR_DEFAULT_STR_SIZE);
   container_t container = PJ_container_get (str);
   type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root());
-
+  XBT_DEBUG("Recv tracing from %d to %d, with key %s", src, dst, key);
   new_pajeEndLink (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key);
 }
index 149ec5f..4e8afaa 100644 (file)
@@ -436,13 +436,25 @@ static void action_waitall(const char *const *action){
    extra->type = TRACING_WAITALL;
    extra->send_size=count_requests;
    TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__,extra);
-
+   int* recvs_snd= xbt_new0(int,count_requests);
+   int* recvs_rcv= xbt_new0(int,count_requests);
+   unsigned int i=0;
+   for (auto req : *(get_reqq_self())){
+     if (req && req->recv){
+       recvs_snd[i]=req->src;
+       recvs_rcv[i]=req->dst;
+     }else
+       recvs_snd[i]=-100;
+     i++;
+   }
    smpi_mpi_waitall(count_requests, &(*get_reqq_self())[0], status);
 
-   for (auto req : *(get_reqq_self())){
-     if (req && req->recv)
-       TRACE_smpi_recv(rank_traced, req->src, req->dst);
+   for (i=0; i<count_requests;i++){
+     if (recvs_snd[i]!=-100)
+       TRACE_smpi_recv(rank_traced, recvs_snd[i], recvs_rcv[i]);
    }
+   xbt_free(recvs_rcv);
+   xbt_free(recvs_snd);
    TRACE_smpi_ptp_out(rank_traced, -1, -1, __FUNCTION__);
   }
   log_timed_action (action, clock);
index de42ac2..c66284e 100644 (file)
@@ -999,7 +999,6 @@ set(CMAKE_SOURCE_FILES
   tools/cmake/Java.cmake
   tools/cmake/MakeLib.cmake
   tools/cmake/MakeLibWin.cmake
-  tools/cmake/Modules/FindGFortran.cmake
   tools/cmake/Modules/FindGraphviz.cmake
   tools/cmake/Modules/FindLibdw.cmake
   tools/cmake/Modules/FindLibunwind.cmake
diff --git a/tools/cmake/Modules/FindGFortran.cmake b/tools/cmake/Modules/FindGFortran.cmake
deleted file mode 100644 (file)
index 67741a3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-if(DEFINED ENV{FC})
-  set (GFORTRAN_EXE $ENV{FC})
-else()
-  find_program(GFORTRAN_EXE
-    NAME gfortran
-    PATH_SUFFIXES bin/
-    PATHS
-    /opt
-    /opt/local
-    /opt/csw
-    /sw
-    /usr
-  )
-endif()
-
-mark_as_advanced(GFORTRAN_EXE)
-
-message(STATUS "Looking for bin gfortran")
-set(SMPI_FORTRAN 0)
-if(NOT WIN32 AND NOT APPLE)
-  if(GFORTRAN_EXE)
-    message(STATUS "Found gfortran: ${GFORTRAN_EXE}")
-    set(SMPI_FORTRAN 1)
-  else()
-    message(STATUS "Looking for bin gfortran - not found")
-  endif()
-else()
-  message(STATUS "SMPI Fortran is disabled on Windows and MacOS platforms. Please contact the SimGrid team if you need it.")
-endif()
-
-if(NOT SMPI_FORTRAN)
-  message("-- Fortran support for smpi is disabled.")
-endif()