X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/13667460824c1a4d55d44f96adaee6eeda2394f4..2807fde4fd1f59c230d69a934634c5dfb77905f2:/src/smpi/mpi/smpi_comm.cpp diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index 23a4bd6ad7..4998ea0c11 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -4,7 +4,6 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "smpi_comm.hpp" -#include "private.h" #include "private.hpp" #include "simgrid/s4u/Host.hpp" #include "smpi_coll.hpp" @@ -13,7 +12,7 @@ #include "smpi_request.hpp" #include "smpi_status.hpp" #include "smpi_win.hpp" -#include "src/simix/smx_private.h" +#include "src/simix/smx_private.hpp" #include #include #include @@ -65,7 +64,7 @@ int Comm::dup(MPI_Comm* newcomm){ if (not attributes()->empty()) { int flag; void* value_out; - for(auto it : *attributes()){ + for (auto const& it : *attributes()) { smpi_key_elem elem = keyvals_.at(it.first); if (elem != nullptr && elem->copy_fn.comm_copy_fn != MPI_NULL_COPY_FN) { ret = elem->copy_fn.comm_copy_fn(this, it.first, nullptr, it.second, &value_out, &flag); @@ -222,7 +221,7 @@ MPI_Comm Comm::split(int color, int key) } MPI_Request* requests = xbt_new(MPI_Request, rankmap.size()); int reqs = 0; - for (const auto& rank : rankmap) { + for (auto const& rank : rankmap) { if (rank.second != 0) { group_snd[reqs]=new Group(group_out); requests[reqs] = Request::isend(&(group_snd[reqs]), 1, MPI_PTR, rank.second, system_tag, this); @@ -264,7 +263,7 @@ void Comm::cleanup_smp(){ if (non_uniform_map_ != nullptr) xbt_free(non_uniform_map_); if (leaders_map_ != nullptr) - xbt_free(leaders_map_); + delete[] leaders_map_; } void Comm::unref(Comm* comm){ @@ -333,11 +332,10 @@ void Comm::init_smp(){ MPI_Comm comm_intra = new Comm(group_intra, nullptr); leader=min_index; - int * leaders_map= static_cast(xbt_malloc0(sizeof(int)*comm_size)); - int * leader_list= static_cast(xbt_malloc0(sizeof(int)*comm_size)); - for(i=0; iset_replaying(true); @@ -452,11 +450,9 @@ MPI_Comm Comm::f2c(int id) { return MPI_COMM_WORLD; } else if(F2C::f2c_lookup() != nullptr && id >= 0) { char key[KEY_SIZE]; - try { - return static_cast(F2C::f2c_lookup()->at(get_key_id(key, id))); - } catch (std::out_of_range& unfound) { - return MPI_COMM_NULL; - } + const auto& lookup = F2C::f2c_lookup(); + auto comm = lookup->find(get_key_id(key, id)); + return comm == lookup->end() ? MPI_COMM_NULL : static_cast(comm->second); } else { return MPI_COMM_NULL; } @@ -486,7 +482,7 @@ void Comm::remove_rma_win(MPI_Win win){ } void Comm::finish_rma_calls(){ - for(auto it : rma_wins_){ + for (auto const& it : rma_wins_) { if(it->rank()==this->rank()){//is it ours (for MPI_COMM_WORLD)? int finished = it->finish_comms(); XBT_DEBUG("Barrier for rank %d - Finished %d RMA calls",this->rank(), finished);