A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[SMPI] Declare loop variable within the loop.
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_comm.cpp
diff --git
a/src/smpi/mpi/smpi_comm.cpp
b/src/smpi/mpi/smpi_comm.cpp
index
4998ea0
..
9efc299
100644
(file)
--- a/
src/smpi/mpi/smpi_comm.cpp
+++ b/
src/smpi/mpi/smpi_comm.cpp
@@
-33,14
+33,14
@@
int Comm::keyval_id_=0;
Comm::Comm(MPI_Group group, MPI_Topology topo) : group_(group), topo_(topo)
{
Comm::Comm(MPI_Group group, MPI_Topology topo) : group_(group), topo_(topo)
{
- refcount_
=
1;
- topoType_ = MPI_INVALID_TOPO;
- intra_comm_ = MPI_COMM_NULL;
- leaders_comm_ = MPI_COMM_NULL;
- is_uniform_
=
1;
+ refcount_
=
1;
+ topoType_
= MPI_INVALID_TOPO;
+ intra_comm_
= MPI_COMM_NULL;
+ leaders_comm_
= MPI_COMM_NULL;
+ is_uniform_
=
1;
non_uniform_map_ = nullptr;
non_uniform_map_ = nullptr;
- leaders_map_ = nullptr;
- is_blocked_
=
0;
+ leaders_map_
= nullptr;
+ is_blocked_
=
0;
}
void Comm::destroy(Comm* comm)
}
void Comm::destroy(Comm* comm)
@@
-58,8
+58,8
@@
int Comm::dup(MPI_Comm* newcomm){
smpi_switch_data_segment(smpi_process()->index());
}
MPI_Group cp = new Group(this->group());
smpi_switch_data_segment(smpi_process()->index());
}
MPI_Group cp = new Group(this->group());
- (*newcomm) = new Comm(cp, this->topo());
- int ret = MPI_SUCCESS;
+ (*newcomm)
= new Comm(cp, this->topo());
+ int ret
= MPI_SUCCESS;
if (not attributes()->empty()) {
int flag;
if (not attributes()->empty()) {
int flag;
@@
-302,14
+302,11
@@
void Comm::init_smp(){
}
//identify neighbours in comm
//get the indexes of all processes sharing the same simix host
}
//identify neighbours in comm
//get the indexes of all processes sharing the same simix host
-
xbt_swag_t
process_list = sg_host_self()->extension<simgrid::simix::Host>()->process_list;
+
const auto&
process_list = sg_host_self()->extension<simgrid::simix::Host>()->process_list;
int intra_comm_size = 0;
int min_index = INT_MAX; // the minimum index will be the leader
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;
-
+ for (auto const& 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 (this->group()->rank(index) != MPI_UNDEFINED) {
intra_comm_size++;
// the process is in the comm
@@
-320,9
+317,8
@@
void Comm::init_smp(){
XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
MPI_Group group_intra = new Group(intra_comm_size);
int i = 0;
XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
MPI_Group group_intra = new Group(intra_comm_size);
int i = 0;
- actor = nullptr;
- xbt_swag_foreach(actor, process_list) {
- int index = actor->pid -1;
+ for (auto const& actor : process_list) {
+ int index = actor.pid - 1;
if(this->group()->rank(index)!=MPI_UNDEFINED){
group_intra->set_mapping(index, i);
i++;
if(this->group()->rank(index)!=MPI_UNDEFINED){
group_intra->set_mapping(index, i);
i++;
@@
-348,11
+344,10
@@
void Comm::init_smp(){
}else{
delete[] leaders_map;
}
}else{
delete[] leaders_map;
}
- int j=0;
int leader_group_size = 0;
for(i=0; i<comm_size; i++){
int already_done = 0;
int leader_group_size = 0;
for(i=0; i<comm_size; i++){
int already_done = 0;
- for (j = 0; j < leader_group_size; j++) {
+ for (
int
j = 0; j < leader_group_size; j++) {
if (leaders_map_[i] == leader_list[j]) {
already_done = 1;
}
if (leaders_map_[i] == leader_list[j]) {
already_done = 1;
}