void mpi_info_get_valuelen_f(MPI_Fint *info, char *key, MPI_Fint *valuelen, MPI_Flogical *flag, MPI_Fint *ierr, int key_len) { int c_err, ret; MPI_Info c_info; char *c_key; OMPI_SINGLE_NAME_DECL(valuelen); OMPI_LOGICAL_NAME_DECL(flag); if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(key, key_len, &c_key))) { c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME); *ierr = OMPI_INT_2_FINT(c_err); return; } c_info = MPI_Info_f2c(*info); *ierr = OMPI_INT_2_FINT(MPI_Info_get_valuelen(c_info, c_key, OMPI_SINGLE_NAME_CONVERT(valuelen), OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag))); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_FINT(valuelen); OMPI_SINGLE_INT_2_LOGICAL(flag); } free(c_key); }
void mpi_comm_test_inter_f(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *ierr) { MPI_Comm c_comm = MPI_Comm_f2c (*comm); OMPI_LOGICAL_NAME_DECL(flag); *ierr = OMPI_INT_2_FINT(MPI_Comm_test_inter(c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag))); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_LOGICAL(flag); } }
void ompi_initialized_f(ompi_fortran_logical_t *flag, MPI_Fint *ierr) { int c_ierr; OMPI_LOGICAL_NAME_DECL(flag); c_ierr = MPI_Initialized(OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_LOGICAL(flag); } }
void ompi_is_thread_main_f(ompi_fortran_logical_t *flag, MPI_Fint *ierr) { int c_ierr; OMPI_LOGICAL_NAME_DECL(flag); c_ierr = PMPI_Is_thread_main(OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_LOGICAL(flag); } }
void ompi_file_get_atomicity_f(MPI_Fint *fh, ompi_fortran_logical_t *flag, MPI_Fint *ierr) { int c_ierr; MPI_File c_fh; OMPI_LOGICAL_NAME_DECL(flag); c_fh = PMPI_File_f2c(*fh); c_ierr = PMPI_File_get_atomicity(c_fh, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_LOGICAL(flag); } }
void ompi_win_get_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, MPI_Aint *attribute_val, ompi_fortran_logical_t *flag, MPI_Fint *ierr) { int c_ierr; MPI_Win c_win = PMPI_Win_f2c(*win); OMPI_LOGICAL_NAME_DECL(flag); /* This stuff is very confusing. Be sure to see the comment at the top of src/attributes/attributes.c. */ c_ierr = ompi_attr_get_fortran_mpi2(c_win->w_keyhash, OMPI_FINT_2_INT(*win_keyval), attribute_val, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); OMPI_SINGLE_INT_2_LOGICAL(flag); }
void ompi_attr_get_f(MPI_Fint *comm, MPI_Fint *keyval, MPI_Fint *attribute_val, ompi_fortran_logical_t *flag, MPI_Fint *ierr) { int c_ierr; MPI_Comm c_comm = MPI_Comm_f2c(*comm); OMPI_LOGICAL_NAME_DECL(flag); /* This stuff is very confusing. Be sure to see the comment at the top of src/attributes/attributes.c. */ c_ierr = ompi_attr_get_fortran_mpi1(c_comm->c_keyhash, OMPI_FINT_2_INT(*keyval), attribute_val, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); OMPI_SINGLE_INT_2_LOGICAL(flag); }
void ompi_iprobe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *status, MPI_Fint *ierr) { int c_ierr; MPI_Status *c_status; MPI_Comm c_comm; #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT MPI_Status c_status2; #endif OMPI_LOGICAL_NAME_DECL(flag); c_comm = MPI_Comm_f2c (*comm); /* See if we got MPI_STATUS_IGNORE */ if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { c_status = MPI_STATUS_IGNORE; } else { /* If sizeof(int) == sizeof(INTEGER), then there's no translation necessary -- let the underlying functions write directly into the Fortran status */ #if OMPI_SIZEOF_FORTRAN_INTEGER == SIZEOF_INT c_status = (MPI_Status *) status; #else c_status = &c_status2; #endif } c_ierr = MPI_Iprobe(OMPI_FINT_2_INT(*source), OMPI_FINT_2_INT(*tag), c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_LOGICAL(flag); #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT if (MPI_STATUS_IGNORE != c_status) { MPI_Status_c2f(c_status, status); } #endif } }
void mpi_testany_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *index, ompi_fortran_logical_t *flag, MPI_Fint *status, MPI_Fint *ierr) { MPI_Request *c_req; MPI_Status c_status; int i; OMPI_LOGICAL_NAME_DECL(flag); OMPI_SINGLE_NAME_DECL(index); c_req = (MPI_Request *) malloc(OMPI_FINT_2_INT(*count) * sizeof(MPI_Request)); if (c_req == NULL) { *ierr = OMPI_INT_2_FINT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME)); return; } for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) { c_req[i] = MPI_Request_f2c(array_of_requests[i]); } *ierr = OMPI_INT_2_FINT(MPI_Testany(OMPI_FINT_2_INT(*count), c_req, OMPI_SINGLE_NAME_CONVERT(index), OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), &c_status)); OMPI_SINGLE_INT_2_LOGICAL(flag); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { /* Increment index by one for fortran conventions */ OMPI_SINGLE_INT_2_FINT(index); if (*flag && MPI_UNDEFINED != *(OMPI_SINGLE_NAME_CONVERT(index))) { array_of_requests[OMPI_INT_2_FINT(*index)] = c_req[OMPI_INT_2_FINT(*index)]->req_f_to_c_index; ++(*index); } if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { MPI_Status_c2f(&c_status, status); } } free(c_req); }
void mpi_request_get_status_f(MPI_Fint *request, ompi_fortran_logical_t *flag, MPI_Fint *status, MPI_Fint *ierr) { MPI_Status c_status; MPI_Request c_req = MPI_Request_f2c( *request ); OMPI_LOGICAL_NAME_DECL(flag); /* This seems silly, but someone will do it */ if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { *flag = OMPI_INT_2_LOGICAL(0); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); } else { *ierr = OMPI_INT_2_FINT(MPI_Request_get_status(c_req, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), &c_status)); OMPI_SINGLE_INT_2_LOGICAL(flag); MPI_Status_c2f( &c_status, status ); } }
void mpi_test_f(MPI_Fint *request, MPI_Flogical *flag, MPI_Fint *status, MPI_Fint *ierr) { MPI_Request c_req = MPI_Request_f2c(*request); MPI_Status c_status; OMPI_LOGICAL_NAME_DECL(flag); *ierr = OMPI_INT_2_FINT(MPI_Test(&c_req, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), &c_status)); OMPI_SINGLE_INT_2_LOGICAL(flag); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { *request = OMPI_INT_2_FINT(c_req->req_f_to_c_index); if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { MPI_Status_c2f(&c_status, status); } } }
void ompi_dist_graph_neighbors_count_f(MPI_Fint *comm, MPI_Fint *inneighbors, MPI_Fint *outneighbors, ompi_fortran_logical_t *weighted, MPI_Fint *ierr) { MPI_Comm c_comm; OMPI_SINGLE_NAME_DECL(inneighbors); OMPI_SINGLE_NAME_DECL(outneighbors); OMPI_LOGICAL_NAME_DECL(weighted); c_comm = MPI_Comm_f2c(*comm); *ierr = OMPI_INT_2_FINT(MPI_Dist_graph_neighbors_count(c_comm, OMPI_SINGLE_NAME_CONVERT(inneighbors), OMPI_SINGLE_NAME_CONVERT(outneighbors), OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted))); OMPI_SINGLE_INT_2_LOGICAL(weighted); if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_FINT(inneighbors); OMPI_SINGLE_INT_2_FINT(outneighbors); } }
void mpi_info_get_f(MPI_Fint *info, char *key, MPI_Fint *valuelen, char *value, ompi_fortran_logical_t *flag, MPI_Fint *ierr, int key_len, int value_len) { int c_err, ret; MPI_Info c_info; char *c_key = NULL, c_value[MPI_MAX_INFO_VAL + 1]; OMPI_LOGICAL_NAME_DECL(flag); if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(key, key_len, &c_key))) { c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME); *ierr = OMPI_INT_2_FINT(c_err); return; } c_info = MPI_Info_f2c(*info); *ierr = OMPI_INT_2_FINT(MPI_Info_get(c_info, c_key, OMPI_FINT_2_INT(*valuelen), c_value, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag))); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_LOGICAL(flag); /* If we found the info key, copy the value back to the Fortran string (note: all Fortran compilers have FALSE == 0, so just check for any nonzero value, because not all Fortran compilers have TRUE == 1). Note: use the full length of the Fortran string, not *valuelen. See comment in ompi/mpi/fortran/base/strings.c. */ if (*flag && OMPI_SUCCESS != (ret = ompi_fortran_string_c2f(c_value, value, value_len))) { c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME); *ierr = OMPI_INT_2_FINT(c_err); free(c_key); return; } } free(c_key); }
void ompi_iprobe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *status, MPI_Fint *ierr) { int c_ierr; MPI_Comm c_comm; OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2) OMPI_LOGICAL_NAME_DECL(flag); c_comm = PMPI_Comm_f2c (*comm); OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status) c_ierr = PMPI_Iprobe(OMPI_FINT_2_INT(*source), OMPI_FINT_2_INT(*tag), c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_LOGICAL(flag); OMPI_FORTRAN_STATUS_RETURN(c_status,c_status2,status,c_ierr) }
void ompi_test_cancelled_f(MPI_Fint *status, ompi_fortran_logical_t *flag, MPI_Fint *ierr) { int c_ierr; MPI_Status c_status; OMPI_LOGICAL_NAME_DECL(flag); /* This seems silly, but someone will do it */ if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { *flag = OMPI_INT_2_LOGICAL(0); c_ierr = MPI_SUCCESS; } else { c_ierr = PMPI_Status_f2c( status, &c_status ); if (MPI_SUCCESS == c_ierr) { c_ierr = PMPI_Test_cancelled(&c_status, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)); OMPI_SINGLE_INT_2_LOGICAL(flag); } } if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); }
void mpi_info_get_f(MPI_Fint *info, char *key, MPI_Fint *valuelen, char *value, ompi_fortran_logical_t *flag, MPI_Fint *ierr, int key_len, int value_len) { int c_err, ret; MPI_Info c_info; char *c_key = NULL, c_value[MPI_MAX_INFO_VAL + 1]; OMPI_LOGICAL_NAME_DECL(flag); if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(key, key_len, &c_key))) { c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME); *ierr = OMPI_INT_2_FINT(c_err); return; } c_info = MPI_Info_f2c(*info); *ierr = OMPI_INT_2_FINT(MPI_Info_get(c_info, c_key, OMPI_FINT_2_INT(*valuelen), c_value, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag))); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { OMPI_SINGLE_INT_2_LOGICAL(flag); /* Use the full length of the Fortran string, not *valuelen. See comment in ompi/mpi/f77/strings.c. */ if (OMPI_SUCCESS != (ret = ompi_fortran_string_c2f(c_value, value, value_len))) { c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME); *ierr = OMPI_INT_2_FINT(c_err); free(c_key); return; } } free(c_key); }