Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a deleted flag to keep track of invalid but not actually deleted handles
[simgrid.git] / src / smpi / include / private.hpp
index c2bc108..e890605 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -17,7 +17,7 @@ constexpr unsigned MPI_REQ_PERSISTENT     = 0x1;
 constexpr unsigned MPI_REQ_NON_PERSISTENT = 0x2;
 constexpr unsigned MPI_REQ_SEND           = 0x4;
 constexpr unsigned MPI_REQ_RECV           = 0x8;
-constexpr unsigned MPI_REQ_RECV_DELETE    = 0x10;
+constexpr unsigned MPI_REQ_PROBE          = 0x10;
 constexpr unsigned MPI_REQ_ISEND          = 0x20;
 constexpr unsigned MPI_REQ_SSEND          = 0x40;
 constexpr unsigned MPI_REQ_PREPARED       = 0x80;
@@ -27,6 +27,8 @@ constexpr unsigned MPI_REQ_ACCUMULATE     = 0x400;
 constexpr unsigned MPI_REQ_GENERALIZED    = 0x800;
 constexpr unsigned MPI_REQ_COMPLETE       = 0x1000;
 constexpr unsigned MPI_REQ_BSEND          = 0x2000;
+constexpr unsigned MPI_REQ_MATCHED        = 0x4000;
+constexpr unsigned MPI_REQ_CANCELLED      = 0x8000;
 
 enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED /*(=MPI_Init called)*/, FINALIZED };
 
@@ -506,7 +508,7 @@ struct papi_process_data {
   papi_counter_t counter_data;
   int event_set;
 };
-extern std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
+extern std::map</* computation unit name */ std::string, papi_process_data, std::less<>> units2papi_setup;
 
 extern std::unordered_map<std::string, double> location2speedup;
 
@@ -515,12 +517,12 @@ XBT_PUBLIC smpi_trace_call_location_t* smpi_trace_get_call_location();
 
 XBT_PRIVATE void private_execute_flops(double flops);
 
-
 #define CHECK_ARGS(test, errcode, ...)                                                                                 \
   if (test) {                                                                                                          \
-    if((errcode) != MPI_SUCCESS)                                                                                       \
+    int error_code_ = (errcode);                                                                                       \
+    if (error_code_ != MPI_SUCCESS)                                                                                    \
       XBT_WARN(__VA_ARGS__);                                                                                           \
-    return (errcode);                                                                                                  \
+    return error_code_;                                                                                                \
   }
 
 #define CHECK_MPI_NULL(num, val, err, ptr)                                                                             \
@@ -534,8 +536,12 @@ XBT_PRIVATE void private_execute_flops(double flops);
              "%s: param %d %s cannot be negative", __func__, (num), _XBT_STRINGIFY(val));
 #define CHECK_COMM2(num, comm)                                                                                         \
   CHECK_MPI_NULL((num), MPI_COMM_NULL, MPI_ERR_COMM, (comm))
+#define CHECK_DELETED(num, err, obj)                                                                                  \
+  CHECK_ARGS((obj->deleted() == true), (err),                                                \
+            "%s: param %d %s has already been freed", __func__, (num), _XBT_STRINGIFY(obj));
 #define CHECK_COMM(num)                                                                                                \
-  CHECK_COMM2((num), comm)
+  CHECK_COMM2((num), comm)                                                                                             \
+  CHECK_DELETED((num), MPI_ERR_COMM, comm)
 #define CHECK_REQUEST(num)                                                                                             \
   CHECK_ARGS(request == nullptr, MPI_ERR_REQUEST,                                                                      \
              "%s: param %d request cannot be NULL",__func__, (num));