Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MPI_Abort : try to kill other processes from the communicator.
[simgrid.git] / src / smpi / bindings / smpi_pmpi.cpp
index 06567f1..99501be 100644 (file)
@@ -128,8 +128,13 @@ int PMPI_Abort(MPI_Comm comm, int /*errorcode*/)
 {
   smpi_bench_end();
   CHECK_COMM(1)
-  // Should kill all processes in comm instead.. but most real implementations also kill everything at this point
-  XBT_WARN("MPI_Abort was called, something went probably wrong in this simulation ! Killing this process");
+  XBT_WARN("MPI_Abort was called, something went probably wrong in this simulation ! Killing all processes sharing the same MPI_COMM_WORLD");
+  for (int i = 0; i < comm->size(); i++){
+    smx_actor_t actor = comm->group()->actor(i)->get_impl();
+    if(actor != SIMIX_process_self())
+      simgrid::kernel::actor::simcall([actor] { actor->exit(); });
+  }
+  // now ourself
   smx_actor_t actor = SIMIX_process_self();
   simgrid::kernel::actor::simcall([actor] { actor->exit(); });
   return MPI_SUCCESS;
@@ -243,6 +248,8 @@ int PMPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_f
 }
 
 int PMPI_Keyval_free(int* keyval) {
+  CHECK_NULL(1, MPI_ERR_ARG, keyval)
+  CHECK_MPI_NULL(1, MPI_KEYVAL_INVALID, MPI_ERR_KEYVAL, *keyval)
   return simgrid::smpi::Keyval::keyval_free<simgrid::smpi::Comm>(keyval);
 }