X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/165f0d8397015d910184a9869d045037af0b2edc..e3fadd982b32226eadb5c98dd05dfb133457ea36:/src/smpi/smpi_comm.cpp diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index 9bb515e123..857fc9a881 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -1,20 +1,21 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2017. 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 -#include +#include "simgrid/s4u/Host.hpp" +#include -#include -#include -#include - -#include - -#include "private.h" #include "src/simix/smx_private.h" +#include "src/smpi/private.h" +#include "src/smpi/private.hpp" +#include "src/smpi/smpi_comm.hpp" +#include "src/smpi/smpi_coll.hpp" +#include "src/smpi/smpi_datatype.hpp" +#include "src/smpi/smpi_process.hpp" +#include "src/smpi/smpi_request.hpp" +#include "src/smpi/smpi_status.hpp" +#include "src/smpi/smpi_win.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)"); @@ -22,7 +23,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm MPI_Comm MPI_COMM_UNINITIALIZED=&mpi_MPI_COMM_UNINITIALIZED; /* Support for cartesian topology was added, but there are 2 other types of topology, graph et dist graph. In order to - * support them, we have to add a field MPIR_Topo_type, and replace the MPI_Topology field by an union. */ + * support them, we have to add a field SMPI_Topo_type, and replace the MPI_Topology field by an union. */ static int smpi_compare_rankmap(const void *a, const void *b) { @@ -80,7 +81,7 @@ int Comm::dup(MPI_Comm* newcomm){ (*newcomm) = new Comm(cp, this->topo()); int ret = MPI_SUCCESS; - if(!attributes()->empty()){ + if (not attributes()->empty()) { int flag; void* value_out; for(auto it : *attributes()){ @@ -172,7 +173,7 @@ MPI_Comm Comm::get_leaders_comm(){ } MPI_Comm Comm::get_intra_comm(){ - if (this == MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD) + if (this == MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD) return smpi_process()->comm_intra(); else return intra_comm_; } @@ -252,7 +253,7 @@ MPI_Comm Comm::split(int color, int key) } if(i != 0 && group_out != MPI_COMM_WORLD->group() && group_out != MPI_GROUP_EMPTY) Group::unref(group_out); - + Request::waitall(reqs, requests, MPI_STATUS_IGNORE); xbt_free(requests); } @@ -319,8 +320,8 @@ void Comm::init_smp(){ smpi_process()->comm_world()->init_smp(); int comm_size = this->size(); - - // If we are in replay - perform an ugly hack + + // If we are in replay - perform an ugly hack // tell SimGrid we are not in replay for a while, because we need the buffers to be copied for the following calls bool replaying = false; //cache data to set it back again after if(smpi_process()->replaying()){ @@ -333,19 +334,20 @@ void Comm::init_smp(){ } //identify neighbours in comm //get the indexes of all processes sharing the same simix host - xbt_swag_t process_list = SIMIX_host_self()->extension()->process_list; - int intra_comm_size = 0; - int min_index = INT_MAX;//the minimum index will be the leader - smx_actor_t actor = nullptr; - xbt_swag_foreach(actor, process_list) { - int index = actor->pid -1; - - if(this->group()->rank(index)!=MPI_UNDEFINED){ - intra_comm_size++; - //the process is in the comm - if(index < min_index) - min_index=index; - } + xbt_swag_t process_list = sg_host_self()->extension()->process_list; + int intra_comm_size = 0; + int min_index = INT_MAX; // the minimum index will be the leader + smx_actor_t actor = nullptr; + xbt_swag_foreach(actor, process_list) + { + int index = actor->pid - 1; + + if (this->group()->rank(index) != MPI_UNDEFINED) { + intra_comm_size++; + // the process is in the comm + if (index < min_index) + min_index = index; + } } XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size); MPI_Group group_intra = new Group(intra_comm_size); @@ -470,9 +472,9 @@ void Comm::init_smp(){ is_blocked_=global_blocked; } xbt_free(leader_list); - + if(replaying) - smpi_process()->set_replaying(true); + smpi_process()->set_replaying(true); } MPI_Comm Comm::f2c(int id) {