void ompi_group_translate_ranks_f(MPI_Fint *group1, MPI_Fint *n, MPI_Fint *ranks1, MPI_Fint *group2, MPI_Fint *ranks2, MPI_Fint *ierr) { int c_ierr; ompi_group_t *c_group1, *c_group2; OMPI_ARRAY_NAME_DECL(ranks1); OMPI_ARRAY_NAME_DECL(ranks2); /* Make the fortran to c representation conversion */ c_group1 = MPI_Group_f2c(*group1); c_group2 = MPI_Group_f2c(*group2); OMPI_ARRAY_FINT_2_INT(ranks1, *n); OMPI_ARRAY_FINT_2_INT_ALLOC(ranks2, *n); c_ierr = MPI_Group_translate_ranks(c_group1, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(ranks1), c_group2, OMPI_ARRAY_NAME_CONVERT(ranks2) ); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_ARRAY_INT_2_FINT(ranks2, *n); } else { OMPI_ARRAY_FINT_2_INT_CLEANUP(ranks2); } OMPI_ARRAY_FINT_2_INT_CLEANUP(ranks1); }
FORTRAN_API void FORT_CALL mpi_group_compare_ ( MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *result, MPI_Fint *__ierr ) { int l_result; *__ierr = MPI_Group_compare( MPI_Group_f2c(*group1), MPI_Group_f2c(*group2), &l_result ); *result = l_result; }
FORTRAN_API void FORT_CALL mpi_group_excl_ ( MPI_Fint *group, MPI_Fint *n, MPI_Fint *ranks, MPI_Fint *newgroup, MPI_Fint *__ierr ) { MPI_Group l_newgroup; if (sizeof(MPI_Fint) == sizeof(int)) *__ierr = MPI_Group_excl( MPI_Group_f2c(*group), *n, ranks, &l_newgroup ); else { int *l_ranks; int i; MPIR_FALLOC(l_ranks,(int*)MALLOC(sizeof(int)* (int)*n), MPIR_COMM_WORLD, MPI_ERR_EXHAUSTED, "MPI_Group_excl"); for (i=0; i<*n; i++) l_ranks[i] = (int)ranks[i]; *__ierr = MPI_Group_excl( MPI_Group_f2c(*group), (int)*n, l_ranks, &l_newgroup ); FREE( l_ranks ); } if (*__ierr == MPI_SUCCESS) *newgroup = MPI_Group_c2f(l_newgroup); }
/* See the comments in group_rinclf.c. ranges is correct without changes */ EXPORT_MPI_API void FORTRAN_API mpi_group_range_excl_ ( MPI_Fint *group, MPI_Fint *n, MPI_Fint ranges[][3], MPI_Fint *newgroup, MPI_Fint *__ierr ) { MPI_Group l_newgroup; if (sizeof(MPI_Fint) == sizeof(int)) *__ierr = MPI_Group_range_excl(MPI_Group_f2c(*group),*n, ranges, &l_newgroup); else { int *l_ranges; int i; int j = 0; MPIR_FALLOC(l_ranges,(int*)MALLOC(sizeof(int)* ((int)*n * 3)), MPIR_COMM_WORLD, MPI_ERR_EXHAUSTED, "MPI_Group_range_excl"); for (i=0; i<*n; i++) { l_ranges[j++] = (int)ranges[i][0]; l_ranges[j++] = (int)ranges[i][1]; l_ranges[j++] = (int)ranges[i][2]; } *__ierr = MPI_Group_range_excl(MPI_Group_f2c(*group), (int)*n, (int (*)[3])l_ranges, &l_newgroup); FREE( l_ranges ); } *newgroup = MPI_Group_c2f(l_newgroup); }
FORTRAN_API void FORT_CALL mpi_group_union_ ( MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *group_out, MPI_Fint *__ierr ) { MPI_Group l_group_out; *__ierr = MPI_Group_union( MPI_Group_f2c(*group1), MPI_Group_f2c(*group2), &l_group_out ); if (*__ierr == MPI_SUCCESS) *group_out = MPI_Group_c2f( l_group_out ); }
void mpi_group_union_f(MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *newgroup, MPI_Fint *ierr) { ompi_group_t *c_group1, *c_group2, *c_newgroup; /* Make the fortran to c representation conversion */ c_group1 = MPI_Group_f2c(*group1); c_group2 = MPI_Group_f2c(*group2); *ierr = OMPI_INT_2_FINT(MPI_Group_union(c_group1, c_group2, &c_newgroup)); /* translate the results from c to fortran */ if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { *newgroup = c_newgroup->grp_f_to_c_index; } }
FORTRAN_API void FORT_CALL mpi_group_free_ ( MPI_Fint *group, MPI_Fint *__ierr ) { MPI_Group l_group = MPI_Group_f2c(*group); *__ierr = MPI_Group_free(&l_group); if (*__ierr == MPI_SUCCESS) *group = MPI_Group_c2f(l_group); }
void ompi_group_difference_f(MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *newgroup, MPI_Fint *ierr) { int c_ierr; ompi_group_t *c_group1, *c_group2, *c_newgroup; /* Make the fortran to c representation conversion */ c_group1 = MPI_Group_f2c(*group1); c_group2 = MPI_Group_f2c(*group2); c_ierr = MPI_Group_difference(c_group1, c_group2, &c_newgroup); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); /* translate the results from c to fortran */ if (MPI_SUCCESS == c_ierr) { *newgroup = c_newgroup->grp_f_to_c_index; } }
void mpi_group_compare_f(MPI_Fint *group1, MPI_Fint *group2, MPI_Fint *result, MPI_Fint *ierr) { ompi_group_t *c_group1, *c_group2; OMPI_SINGLE_NAME_DECL(result); /* make the fortran to c representation conversion */ c_group1 = MPI_Group_f2c(*group1); c_group2 = MPI_Group_f2c(*group2); *ierr = OMPI_INT_2_FINT(MPI_Group_compare(c_group1, c_group2, OMPI_SINGLE_NAME_CONVERT(result) )); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_FINT(result); } }
void mpi_win_post_f(MPI_Fint *group, MPI_Fint *assert, MPI_Fint *win, MPI_Fint *ierr) { MPI_Win c_win = MPI_Win_f2c(*win); MPI_Group c_grp = MPI_Group_f2c(*group); *ierr = OMPI_INT_2_FINT(MPI_Win_post(c_grp, OMPI_FINT_2_INT(*assert), c_win)); }
void mpif_comm_create_(MPI_Fint *comm, MPI_Fint *group, MPI_Fint *newcomm, int *error) { MPI_Comm comm_c = MPI_Comm_f2c(*comm); MPI_Comm newcomm_c; MPI_Group group_c = MPI_Group_f2c(*group); *error = MPI_Comm_create(comm_c, group_c, &newcomm_c); *newcomm = MPI_Comm_c2f(newcomm_c); }
void ompi_win_post_f(MPI_Fint *group, MPI_Fint *assert, MPI_Fint *win, MPI_Fint *ierr) { int c_ierr; MPI_Win c_win = MPI_Win_f2c(*win); MPI_Group c_grp = MPI_Group_f2c(*group); c_ierr = MPI_Win_post(c_grp, OMPI_FINT_2_INT(*assert), c_win); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); }
void mpi_group_size_f(MPI_Fint *group, MPI_Fint *size, MPI_Fint *ierr) { ompi_group_t *c_group; OMPI_SINGLE_NAME_DECL(size); /* Make the fortran to c representation conversion */ c_group = MPI_Group_f2c(*group); *ierr = OMPI_INT_2_FINT(MPI_Group_size(c_group, OMPI_SINGLE_NAME_CONVERT(size))); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_FINT(size); } }
void ompi_group_rank_f(MPI_Fint *group, MPI_Fint *rank, MPI_Fint *ierr) { int c_ierr; ompi_group_t *c_group; OMPI_SINGLE_NAME_DECL(rank); /* Make the fortran to c representation conversion */ c_group = MPI_Group_f2c(*group); c_ierr = MPI_Group_rank(c_group, OMPI_SINGLE_NAME_CONVERT(rank)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_FINT(rank); } }
MPI_Fint c2fgroup_ (MPI_Fint *group) { MPI_Group cGroup = MPI_Group_f2c(*group); int cSize, wSize, cRank, wRank; /* We pass in the group of comm world */ MPI_Comm_size( MPI_COMM_WORLD, &wSize ); MPI_Comm_rank( MPI_COMM_WORLD, &wRank ); MPI_Group_size( cGroup, &cSize ); MPI_Group_rank( cGroup, &cRank ); if (wSize != cSize || wRank != cRank) { fprintf( stderr, "Group: Did not get expected size,rank (got %d,%d)", cSize, cRank ); return 1; } return 0; }
void mpi_group_range_excl_f(MPI_Fint *group, MPI_Fint *n, MPI_Fint ranges[][3], MPI_Fint *newgroup, MPI_Fint *ierr) { ompi_group_t *c_group, *c_newgroup; OMPI_2_DIM_ARRAY_NAME_DECL(ranges, 3); /* Make the fortran to c representation conversion */ c_group = MPI_Group_f2c(*group); OMPI_2_DIM_ARRAY_FINT_2_INT(ranges, *n, 3); *ierr = OMPI_INT_2_FINT(MPI_Group_range_excl(c_group, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(ranges), &c_newgroup)); /* translate the results from c to fortran */ if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { *newgroup = c_newgroup->grp_f_to_c_index; } OMPI_ARRAY_FINT_2_INT_CLEANUP(ranges); }
void ompi_group_excl_f(MPI_Fint *group, MPI_Fint *n, MPI_Fint *ranks, MPI_Fint *newgroup, MPI_Fint *ierr) { int c_ierr; ompi_group_t *c_group, *c_newgroup; OMPI_ARRAY_NAME_DECL(ranks); /* Make the fortran to c representation conversion */ c_group = MPI_Group_f2c(*group); OMPI_ARRAY_FINT_2_INT(ranks, *n); c_ierr = MPI_Group_excl(c_group, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(ranks), &c_newgroup); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); /* translate the results from c to fortran */ if (MPI_SUCCESS == c_ierr) { *newgroup = c_newgroup->grp_f_to_c_index; } }
EXPORT_MPI_API void FORTRAN_API mpi_group_size_ ( MPI_Fint *group, MPI_Fint *size, MPI_Fint *__ierr ) { int l_size; *__ierr = MPI_Group_size( MPI_Group_f2c(*group), &l_size ); *size = l_size; }
FORTRAN_API void FORT_CALL mpi_group_rank_ ( MPI_Fint *group, MPI_Fint *rank, MPI_Fint *__ierr ) { int l_rank; *__ierr = MPI_Group_rank( MPI_Group_f2c(*group), &l_rank ); *rank = l_rank; }