X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/43f7ca1cac5ab1858e318fdd6239d0a0c3b3d893..fbcf6ab31cae1988be858f9f894dafe529c575d7:/src/smpi/bindings/smpi_pmpi_group.cpp diff --git a/src/smpi/bindings/smpi_pmpi_group.cpp b/src/smpi/bindings/smpi_pmpi_group.cpp index 8adeecc422..4155bf6e6f 100644 --- a/src/smpi/bindings/smpi_pmpi_group.cpp +++ b/src/smpi/bindings/smpi_pmpi_group.cpp @@ -1,20 +1,18 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2019. 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 "private.h" -#include "smpi_comm.hpp" +#include "private.hpp" #include "smpi_coll.hpp" +#include "smpi_comm.hpp" #include "smpi_datatype_derived.hpp" #include "smpi_op.hpp" -#include "smpi_process.hpp" +#include "src/smpi/include/smpi_actor.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi); - /* PMPI User level calls */ -extern "C" { // Obviously, the C MPI interface should use the C linkage int PMPI_Group_free(MPI_Group * group) { @@ -47,12 +45,12 @@ int PMPI_Group_rank(MPI_Group group, int *rank) } else if (rank == nullptr) { return MPI_ERR_ARG; } else { - *rank = group->rank(smpi_process()->index()); + *rank = group->rank(simgrid::s4u::this_actor::get_pid()); return MPI_SUCCESS; } } -int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1, MPI_Group group2, int *ranks2) +int PMPI_Group_translate_ranks(MPI_Group group1, int n, const int *ranks1, MPI_Group group2, int *ranks2) { if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) { return MPI_ERR_GROUP; @@ -61,8 +59,8 @@ int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1, MPI_Group g if(ranks1[i]==MPI_PROC_NULL){ ranks2[i]=MPI_PROC_NULL; }else{ - int index = group1->index(ranks1[i]); - ranks2[i] = group2->rank(index); + simgrid::s4u::ActorPtr actor = group1->actor(ranks1[i]); + ranks2[i] = group2->rank(actor); } } return MPI_SUCCESS; @@ -116,7 +114,7 @@ int PMPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group * newgro } } -int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup) +int PMPI_Group_incl(MPI_Group group, int n, const int *ranks, MPI_Group * newgroup) { if (group == MPI_GROUP_NULL) { return MPI_ERR_GROUP; @@ -127,7 +125,7 @@ int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup) } } -int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup) +int PMPI_Group_excl(MPI_Group group, int n, const int *ranks, MPI_Group * newgroup) { if (group == MPI_GROUP_NULL) { return MPI_ERR_GROUP; @@ -136,9 +134,8 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup) } else { if (n == 0) { *newgroup = group; - if (group != MPI_COMM_WORLD->group() - && group != MPI_COMM_SELF->group() && group != MPI_GROUP_EMPTY) - group->ref(); + if (group != MPI_COMM_WORLD->group() && group != MPI_COMM_SELF->group() && group != MPI_GROUP_EMPTY) + group->ref(); return MPI_SUCCESS; } else if (n == group->size()) { *newgroup = MPI_GROUP_EMPTY; @@ -191,6 +188,3 @@ MPI_Group PMPI_Group_f2c(MPI_Fint group){ MPI_Fint PMPI_Group_c2f(MPI_Group group){ return group->c2f(); } - - -}