Skip to content

Commit

Permalink
sessions: handle error better in fortran
Browse files Browse the repository at this point in the history
comm_create_from_group

and

intercomm_create_from_groups

related to #56

Signed-off-by: Howard Pritchard <howardp@lanl.gov>
  • Loading branch information
hppritcha committed Jun 16, 2021
1 parent 5536730 commit 1e5266f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
9 changes: 9 additions & 0 deletions ompi/group/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
14 changes: 5 additions & 9 deletions ompi/mpi/fortran/mpif-h/comm_create_from_group_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
11 changes: 4 additions & 7 deletions ompi/mpi/fortran/mpif-h/intercomm_create_from_groups_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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),
Expand Down

0 comments on commit 1e5266f

Please sign in to comment.