Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: add option to inject a barrier before every collective call, to allow better...
[simgrid.git] / src / smpi / bindings / smpi_pmpi.cpp
index 6f205a2c9055a834038ccca52ddb78170cf6cd46..ef203b059b25cf4d546e6f7cb91987273eaf0d65 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "private.hpp"
+#include "simgrid/host.h"
 #include "simgrid/instr.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
@@ -53,10 +54,10 @@ int PMPI_Init(int*, char***)
 
   simgrid::smpi::ActorExt::init();
   TRACE_smpi_init(simgrid::s4u::this_actor::get_pid(), __func__);
+  smpi_mpi_init();
   smpi_bench_begin();
   smpi_process()->mark_as_initialized();
 
-  smpi_mpi_init();
   CHECK_COLLECTIVE(smpi_process()->comm_world(), "MPI_Init")
 
   return MPI_SUCCESS;
@@ -201,10 +202,9 @@ int PMPI_Get_count(const MPI_Status * status, MPI_Datatype datatype, int *count)
   } else if (not datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else {
-    size_t size = datatype->size();
-    if (size == 0) {
+    if (datatype->size() == 0) {
       *count = 0;
-    } else if (status->count % size != 0) {
+    } else if (status->count % datatype->size() != 0) {
       *count = MPI_UNDEFINED;
     } else {
       *count = simgrid::smpi::Status::get_count(status, datatype);