*ierr = MPI_Group_incl(simgrid::smpi::Group::f2c(*group), *n, ranks, &tmp);
if(*ierr == MPI_SUCCESS) {
- *group_out = tmp->add_f();
+ *group_out = tmp->c2f();
}
}
}
void mpi_group_free_ (int* group, int* ierr){
- MPI_Group tmp = simgrid::smpi::Group::f2c(*group);
- *ierr = MPI_Group_free(&tmp);
- if(*ierr == MPI_SUCCESS) {
- simgrid::smpi::F2C::free_f(*group);
- }
+ MPI_Group tmp = simgrid::smpi::Group::f2c(*group);
+ if(tmp != MPI_COMM_WORLD->group() && tmp != MPI_GROUP_EMPTY){
+ simgrid::smpi::Group::unref(tmp);
+ simgrid::smpi::F2C::free_f(*group);
+ }
+ *ierr = MPI_SUCCESS;
}
void mpi_group_size_ (int* group, int *size, int* ierr){
void mpi_comm_free_(int* comm, int* ierr) {
MPI_Comm tmp = simgrid::smpi::Comm::f2c(*comm);
-
- *ierr = MPI_Comm_free(&tmp);
-
- if(*ierr == MPI_SUCCESS) {
+ if(tmp != MPI_COMM_WORLD && tmp != MPI_COMM_NULL) {
+ simgrid::smpi::Comm::destroy(tmp);
simgrid::smpi::Comm::free_f(*comm);
}
+ *ierr = MPI_SUCCESS;
}
void mpi_comm_split_(int* comm, int* color, int* key, int* comm_out, int* ierr) {