diff --git a/ompi/group/group.h b/ompi/group/group.h index 319258819ff..1e87ecd8556 100644 --- a/ompi/group/group.h +++ b/ompi/group/group.h @@ -522,5 +522,14 @@ int ompi_group_div_ceil (int num, int den); */ int ompi_group_to_proc_name_array (ompi_group_t *group, opal_process_name_t **name_array, size_t *name_array_size); +/** + * Return instance from a group + */ + +static inline ompi_instance_t *ompi_group_get_instance(ompi_group_t *group) +{ + return group->grp_instance; +} + END_C_DECLS #endif /* OMPI_GROUP_H */ diff --git a/ompi/mpi/fortran/mpif-h/comm_create_from_group_f.c b/ompi/mpi/fortran/mpif-h/comm_create_from_group_f.c index 274ffd30e99..58e75c9af12 100644 --- a/ompi/mpi/fortran/mpif-h/comm_create_from_group_f.c +++ b/ompi/mpi/fortran/mpif-h/comm_create_from_group_f.c @@ -30,6 +30,7 @@ #include "ompi/mpi/fortran/base/fortran_base_strings.h" #include "ompi/constants.h" #include "ompi/instance/instance.h" +#include "ompi/group/group.h" #if OMPI_BUILD_MPI_PROFILING @@ -76,7 +77,7 @@ OMPI_GENERATE_F77_BINDINGS (MPI_COMM_CREATE_FROM_GROUP, void ompi_comm_create_from_group_f(MPI_Fint *group, char *stringtag, MPI_Fint *info, MPI_Fint *errhandler, MPI_Fint *newcomm, MPI_Fint *ierr, int name_len) { - int c_ierr; + int c_ierr, ret; MPI_Group c_group; char *c_tag; MPI_Comm c_comm; @@ -89,18 +90,13 @@ void ompi_comm_create_from_group_f(MPI_Fint *group, char *stringtag, MPI_Fint *i /* Convert the fortran string */ - c_ierr = ompi_fortran_string_f2c(stringtag, name_len, &c_tag); - if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); -#if 0 - if (OMPI_SUCCESS != (c = ompi_fortran_string_f2c(stringtag, name_len, + /* Convert the fortran string */ + if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(stringtag, name_len, &c_tag))) { -/* TODO - what error handler do we invoke here */ - c_ierr = OMPI_ERRHANDLER_INVOKE(((ompi_instance_t *)c_group, ret, - "MPI_COMM_CREATE_FROM_GROUP"); + c_ierr = OMPI_ERRHANDLER_INVOKE(ompi_group_get_instance(c_group), ret, "MPI_COMM_CREATE_FROM_GROUP"); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); return; } -#endif c_ierr = PMPI_Comm_create_from_group(c_group, c_tag, c_info, c_err, &c_comm); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); diff --git a/ompi/mpi/fortran/mpif-h/intercomm_create_from_groups_f.c b/ompi/mpi/fortran/mpif-h/intercomm_create_from_groups_f.c index 285838379ce..61e129ff25e 100644 --- a/ompi/mpi/fortran/mpif-h/intercomm_create_from_groups_f.c +++ b/ompi/mpi/fortran/mpif-h/intercomm_create_from_groups_f.c @@ -30,6 +30,7 @@ #include "ompi/mpi/fortran/base/fortran_base_strings.h" #include "ompi/constants.h" #include "ompi/instance/instance.h" +#include "ompi/group/group.h" #if OMPI_BUILD_MPI_PROFILING @@ -85,7 +86,7 @@ void ompi_intercomm_create_from_groups_f(MPI_Fint *local_group, MPI_Fint *local_ MPI_Fint *remote_leader, char *stringtag, MPI_Fint *info, MPI_Fint *errhandler, MPI_Fint *internewcomm, MPI_Fint *ierr, int name_len) { - int c_ierr; + int c_ierr, ret; MPI_Group c_lgroup, c_rgroup; char *c_tag; MPI_Comm c_intercomm; @@ -99,17 +100,13 @@ void ompi_intercomm_create_from_groups_f(MPI_Fint *local_group, MPI_Fint *local_ /* Convert the fortran string */ - c_ierr = ompi_fortran_string_f2c(stringtag, name_len, &c_tag); -/* TODO HPP */ -#if 0 + /* Convert the fortran string */ if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(stringtag, name_len, &c_tag))) { - c_ierr = OMPI_ERRHANDLER_INVOKE((ompi_instance_t *)c_session, ret, - "MPI_INTERCOMM_CREATE_FROM_GROUPS"); + c_ierr = OMPI_ERRHANDLER_INVOKE(ompi_group_get_instance(c_lgroup), ret, "MPI_INTERCOMM_CREATE_FROM_GROUPS"); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); return; } -#endif c_ierr = PMPI_Intercomm_create_from_groups(c_lgroup, OMPI_FINT_2_INT(*local_leader), c_rgroup, OMPI_FINT_2_INT(*remote_leader),