Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More int -> aid_t.
[simgrid.git] / src / smpi / mpi / smpi_comm.cpp
index c122652..84ffe79 100644 (file)
@@ -12,7 +12,7 @@
 #include "src/smpi/include/smpi_actor.hpp"
 #include "src/surf/HostImpl.hpp"
 
-#include <climits>
+#include <limits>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)");
 
@@ -369,11 +369,11 @@ void Comm::unref(Comm* comm){
 MPI_Comm Comm::find_intra_comm(int * leader){
   //get the indices of all processes sharing the same simix host
   int intra_comm_size     = 0;
-  int min_index           = INT_MAX; // the minimum index will be the leader
+  aid_t min_index         = std::numeric_limits<aid_t>::max(); // the minimum index will be the leader
   sg_host_self()->get_impl()->foreach_actor([this, &intra_comm_size, &min_index](auto& actor) {
-    if (this->group()->rank(actor.get_pid()) != MPI_UNDEFINED) { // Is this process in the current group?
+    aid_t index = actor.get_pid();
+    if (this->group()->rank(index) != MPI_UNDEFINED) { // Is this process in the current group?
       intra_comm_size++;
-      int index = actor.get_pid();
       if (index < min_index)
         min_index = index;
     }