Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MPI_UNIVERSE_SIZE now initialized to the total amount of hosts in the platform
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 20 Jul 2023 10:03:29 +0000 (12:03 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 20 Jul 2023 10:03:29 +0000 (12:03 +0200)
ChangeLog
src/smpi/bindings/smpi_pmpi_comm.cpp
src/smpi/include/private.hpp
src/smpi/internals/smpi_actor.cpp
src/smpi/internals/smpi_deployment.cpp

index ffd9356..fd83eff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@ S4U:
 
 SMPI:
  - New SMPI_app_instance_join(): wait for the completion of a started MPI instance
+ - MPI_UNIVERSE_SIZE now initialized to the total amount of hosts in the platform
 
 Python:
  - Make the host_load plugin available from Python. See examples/python/plugin-host-load
index d7efa43..c30dfda 100644 (file)
@@ -6,9 +6,10 @@
 #include <climits>
 
 #include "private.hpp"
+#include "simgrid/s4u/Engine.hpp"
 #include "smpi_comm.hpp"
-#include "smpi_info.hpp"
 #include "smpi_errhandler.hpp"
+#include "smpi_info.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
@@ -248,7 +249,7 @@ int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
     return MPI_SUCCESS;
   case MPI_UNIVERSE_SIZE:
     *flag = 1;
-    universe_size                   = smpi_get_universe_size();
+    universe_size                   = simgrid::s4u::Engine::get_instance()->get_host_count();
     *static_cast<int**>(attr_value) = &universe_size;
     return MPI_SUCCESS;
   case MPI_LASTUSEDCODE:
index 2133849..cae46b9 100644 (file)
@@ -74,7 +74,6 @@ using MPIR_Dist_Graph_Topology = SMPI_Dist_Graph_topology*;
 
 XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process();
 XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
-XBT_PRIVATE int smpi_get_universe_size();
 
 XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank,
                                                   const simgrid::s4u::Actor* actor);
index 66917b4..83bb798 100644 (file)
@@ -224,9 +224,6 @@ int ActorExt::sampling() const
 
 void ActorExt::init()
 {
-  xbt_assert(smpi_get_universe_size() != 0, "SimGrid was not initialized properly before entering MPI_Init. "
-                                            "Aborting, please check compilation process and use smpirun.");
-
   ActorExt* ext = smpi_process();
   // if we are in MPI_Init and argc handling has already been done.
   if (ext->initialized())
index c39bbd5..9c9d7c8 100644 (file)
@@ -15,15 +15,12 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi);
 
 namespace simgrid::smpi::app {
 
-static int universe_size = 0;
-
 class Instance {
 public:
   explicit Instance(int max_no_processes) : size_(max_no_processes)
   {
     auto* group = new simgrid::smpi::Group(size_);
     comm_world_ = new simgrid::smpi::Comm(group, nullptr, false, -1);
-    universe_size += max_no_processes;
     bar_ = s4u::Barrier::create(size_);
   }
   s4u::BarrierPtr bar_;
@@ -124,11 +121,6 @@ void smpi_deployment_cleanup_instances(){
   smpi_instances.clear();
 }
 
-int smpi_get_universe_size()
-{
-  return simgrid::smpi::app::universe_size;
-}
-
 /** @brief Auxiliary method to get list of hosts to deploy app */
 static std::vector<simgrid::s4u::Host*> smpi_get_hosts(const simgrid::s4u::Engine* e, const std::string& hostfile)
 {