Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add checks for comms and datatypes as well
[simgrid.git] / src / smpi / bindings / smpi_pmpi.cpp
index 76da5cd..6b831d5 100644 (file)
@@ -1,15 +1,16 @@
-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2019. 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. */
 
 #include "private.hpp"
+#include "simgrid/instr.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "smpi_comm.hpp"
 #include "smpi_datatype_derived.hpp"
 #include "smpi_status.hpp"
-#include "src/simix/ActorImpl.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
@@ -19,8 +20,11 @@ void TRACE_smpi_set_category(const char *category)
 {
   //need to end bench otherwise categories for execution tasks are wrong
   smpi_bench_end();
-  if (category != nullptr)
-    TRACE_internal_smpi_set_category(category);
+  if (category != nullptr) {
+    // declare category
+    TRACE_category(category);
+    smpi_process()->set_tracing_category(category);
+  }
   //begin bench after changing process's category
   smpi_bench_begin();
 }
@@ -79,7 +83,7 @@ int PMPI_Get_version (int *version,int *subversion){
 
 int PMPI_Get_library_version (char *version,int *len){
   smpi_bench_end();
-  snprintf(version, MPI_MAX_LIBRARY_VERSION_STRING, "SMPI Version %d.%d. Copyright The Simgrid Team 2007-2018",
+  snprintf(version, MPI_MAX_LIBRARY_VERSION_STRING, "SMPI Version %d.%d. Copyright The Simgrid Team 2007-2019",
            SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR);
   *len = strlen(version) > MPI_MAX_LIBRARY_VERSION_STRING ? MPI_MAX_LIBRARY_VERSION_STRING : strlen(version);
   smpi_bench_begin();
@@ -122,8 +126,8 @@ int PMPI_Abort(MPI_Comm /*comm*/, int /*errorcode*/)
 {
   smpi_bench_end();
   // FIXME: should kill all processes in comm instead
-  smx_actor_t process = SIMIX_process_self();
-  simgrid::simix::simcall([process] { SIMIX_process_kill(process, process); });
+  smx_actor_t actor = SIMIX_process_self();
+  simgrid::simix::simcall([actor] { actor->exit(); });
   return MPI_SUCCESS;
 }
 
@@ -211,7 +215,7 @@ int PMPI_Error_class(int errorcode, int* errorclass) {
 }
 
 int PMPI_Error_string(int errorcode, char* string, int* resultlen){
-  if (errorcode<0 || string ==nullptr){
+  if (errorcode<0 || errorcode>= MPI_MAX_ERROR_STRING || string ==nullptr){
     return MPI_ERR_ARG;
   } else {
     static const char *smpi_error_string[] = {