From 50112236f62426d55750da4901ab88456a272e7f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 14 Mar 2017 00:22:32 +0100 Subject: [PATCH 1/1] fix the prototype of s4u::Host::processes() to not return a swag of smx_actors --- include/simgrid/s4u/host.hpp | 2 +- src/msg/msg_host.cpp | 4 +++- src/s4u/s4u_host.cpp | 12 ++++++------ src/smpi/smpi_comm.cpp | 24 +++++++++++------------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index e2eb92cd8a..7af3255fe6 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -87,7 +87,7 @@ public: xbt_dict_t properties(); const char*property(const char*key); void setProperty(const char*key, const char *value); - xbt_swag_t processes(); + void processes(std::vector* list); double getPstateSpeed(int pstate_index); int pstatesCount() const; void setPstate(int pstate_index); diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 7bef21b2f5..51972e0526 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -8,6 +8,8 @@ #include "simgrid/s4u/storage.hpp" #include "src/msg/msg_private.h" #include "src/simix/ActorImpl.hpp" +#include "src/simix/smx_host_private.h" + XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg); @@ -146,7 +148,7 @@ void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto) { xbt_assert((host != nullptr), "Invalid parameters"); smx_actor_t actor = NULL; - xbt_swag_foreach(actor, host->processes()) { + xbt_swag_foreach(actor, host->extension()->process_list) { msg_process_t p = actor->ciface(); xbt_dynar_push(whereto, &p); } diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index f792b9c951..e3c363563c 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2006-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2006-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. */ @@ -195,11 +194,12 @@ void Host::setProperty(const char*key, const char *value){ } /** Get the processes attached to the host */ -xbt_swag_t Host::processes() +void Host::processes(std::vector* list) { - return simgrid::simix::kernelImmediate([this] { - return this->extension()->process_list; - }); + smx_actor_t actor = NULL; + xbt_swag_foreach(actor, this->extension()->process_list) { + list->push_back(actor->iface()); + } } /** @brief Get the peak processor speed (in flops/s), at the specified pstate */ diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index 973b24db80..aa6c13e920 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -358,28 +358,26 @@ 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()->processes(); - int intra_comm_size = 0; - int i =0; - int min_index=INT_MAX;//the minimum index will be the leader - smx_actor_t process = nullptr; - xbt_swag_foreach(process, process_list) { - int index = process->pid -1; + 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++; + intra_comm_size++; //the process is in the comm if(index < min_index) min_index=index; - i++; } } XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size); MPI_Group group_intra = new Group(intra_comm_size); - i=0; - process = nullptr; - xbt_swag_foreach(process, process_list) { - int index = process->pid -1; + int i = 0; + actor = nullptr; + xbt_swag_foreach(actor, process_list) { + int index = actor->pid -1; if(this->group()->rank(index)!=MPI_UNDEFINED){ group_intra->set_mapping(index, i); i++; -- 2.20.1