void ompi_sendrecv_replace_f(char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *sendtag, MPI_Fint *source, MPI_Fint *recvtag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) { int c_ierr; MPI_Datatype c_type = PMPI_Type_f2c(*datatype); MPI_Comm c_comm; MPI_Status c_status; c_comm = PMPI_Comm_f2c (*comm); c_ierr = PMPI_Sendrecv_replace(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), c_type, OMPI_FINT_2_INT(*dest), OMPI_FINT_2_INT(*sendtag), OMPI_FINT_2_INT(*source), OMPI_FINT_2_INT(*recvtag), c_comm, &c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr && !OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { PMPI_Status_c2f(&c_status, status); } }
void mpi_sendrecv_f(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, MPI_Fint *dest, MPI_Fint *sendtag, char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *source, MPI_Fint *recvtag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) { MPI_Comm c_comm; MPI_Datatype c_sendtype = MPI_Type_f2c(*sendtype); MPI_Datatype c_recvtype = MPI_Type_f2c(*recvtype); MPI_Status c_status; c_comm = MPI_Comm_f2c (*comm); *ierr = OMPI_INT_2_FINT(MPI_Sendrecv(OMPI_F2C_BOTTOM(sendbuf), OMPI_FINT_2_INT(*sendcount), c_sendtype, OMPI_FINT_2_INT(*dest), OMPI_FINT_2_INT(*sendtag), OMPI_F2C_BOTTOM(recvbuf), *recvcount, c_recvtype, OMPI_FINT_2_INT(*source), OMPI_FINT_2_INT(*recvtag), c_comm, &c_status)); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr) && !OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { MPI_Status_c2f(&c_status, status); } }
void mpi_waitall_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *array_of_statuses, MPI_Fint *ierr) { MPI_Request *c_req; MPI_Status *c_status; int i; c_req = (MPI_Request *) malloc(OMPI_FINT_2_INT(*count) * (sizeof(MPI_Request) + sizeof(MPI_Status))); if (NULL == c_req) { *ierr = OMPI_INT_2_FINT(OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME)); return; } c_status = (MPI_Status*) (c_req + OMPI_FINT_2_INT(*count)); 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_Waitall(OMPI_FINT_2_INT(*count), c_req, c_status)); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) { array_of_requests[i] = c_req[i]->req_f_to_c_index; if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) && !OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) { MPI_Status_c2f( &c_status[i], &array_of_statuses[i * (sizeof(MPI_Status) / sizeof(int))]); } } } free(c_req); }
void ompi_status_set_elements_f(MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr) { int c_ierr; MPI_Datatype c_type = PMPI_Type_f2c(*datatype); MPI_Status c_status; /* This seems silly, but someone will do it */ if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { c_ierr = MPI_SUCCESS; } else { PMPI_Status_f2c( status, &c_status ); c_ierr = PMPI_Status_set_elements(&c_status, c_type, OMPI_FINT_2_INT(*count)); /* If datatype is really being set, then that needs to be converted.... */ if (MPI_SUCCESS == c_ierr) { PMPI_Status_c2f(&c_status, status); } } if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); }
void ompi_test_fortran_constants_f(char *bottom, char *in_place, char *argv, char *argvs, char *status, char *statuses, MPI_Fint *flag) { *flag = 1; if (!OMPI_IS_FORTRAN_BOTTOM(bottom)) { fprintf(stderr, "WARNING: Fortran MPI_BOTTOM not recognized properly\n"); *flag = 0; } if (!OMPI_IS_FORTRAN_IN_PLACE(in_place)) { fprintf(stderr, "WARNING: Fortran MPI_IN_PLACE not recognized properly\n"); *flag = 0; } if (!OMPI_IS_FORTRAN_ARGV_NULL(argv)) { fprintf(stderr, "WARNING: Fortran MPI_ARGV_NULL not recognized properly\n"); *flag = 0; } if (!OMPI_IS_FORTRAN_ARGVS_NULL(argvs)) { fprintf(stderr, "WARNING: Fortran MPI_ARGVS_NULL not recognized properly\n"); *flag = 0; } if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { fprintf(stderr, "WARNING: Fortran MPI_STATUS_IGNORE not recognized properly\n"); *flag = 0; } if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(statuses)) { fprintf(stderr, "WARNING: Fortran MPI_STATUSES not recognized properly\n"); *flag = 0; } }
void mpi_file_read_all_end_f(MPI_Fint *fh, char *buf, MPI_Fint *status, MPI_Fint *ierr) { MPI_Status *c_status; #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT MPI_Status c_status2; #endif MPI_File c_fh = MPI_File_f2c(*fh); /* 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 } *ierr = OMPI_INT_2_FINT(MPI_File_read_all_end(c_fh, buf, c_status)); #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr) && MPI_STATUS_IGNORE != c_status) { MPI_Status_c2f(c_status, status); } #endif }
void ompi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *indx, MPI_Fint *status, MPI_Fint *ierr) { MPI_Request *c_req; MPI_Status c_status; int i, c_ierr; OMPI_SINGLE_NAME_DECL(indx); /* Shortcut to avoid malloc(0) if *count==0. We're intentionally skipping other parameter error checks. */ if (OPAL_UNLIKELY(0 == OMPI_FINT_2_INT(*count))) { *indx = OMPI_INT_2_FINT(MPI_UNDEFINED); PMPI_Status_c2f(&ompi_status_empty, status); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); return; } c_req = (MPI_Request *) malloc(OMPI_FINT_2_INT(*count) * sizeof(MPI_Request)); if (NULL == c_req) { c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); return; } for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) { c_req[i] = PMPI_Request_f2c(array_of_requests[i]); } c_ierr = PMPI_Waitany(OMPI_FINT_2_INT(*count), c_req, OMPI_SINGLE_NAME_CONVERT(indx), &c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { /* Increment index by one for fortran conventions */ OMPI_SINGLE_INT_2_FINT(indx); if (MPI_UNDEFINED != *(OMPI_SINGLE_NAME_CONVERT(indx))) { array_of_requests[OMPI_INT_2_FINT(*indx)] = c_req[OMPI_INT_2_FINT(*indx)]->req_f_to_c_index; ++(*indx); } if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { PMPI_Status_c2f(&c_status, status); } } free(c_req); }
void ompi_wait_f(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr) { int c_ierr; MPI_Request c_req = MPI_Request_f2c(*request); MPI_Status c_status; c_ierr = MPI_Wait(&c_req, &c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_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_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_get_count_f(MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr) { MPI_Datatype c_type = MPI_Type_f2c(*datatype); MPI_Status c_status; OMPI_SINGLE_NAME_DECL(count); if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { *count = OMPI_INT_2_FINT(0); *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); } else { *ierr = OMPI_INT_2_FINT(MPI_Status_f2c(status, &c_status)); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { *ierr = OMPI_INT_2_FINT(MPI_Get_count(&c_status, c_type, OMPI_SINGLE_NAME_CONVERT(count))); OMPI_SINGLE_INT_2_FINT(count); } } }
void mpi_status_set_cancelled_f(MPI_Fint *status, ompi_fortran_logical_t *flag, MPI_Fint *ierr) { MPI_Status c_status; /* This seems silly, but someone will do it */ if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { *ierr = OMPI_INT_2_FINT(MPI_SUCCESS); } else { MPI_Status_f2c( status, &c_status ); *ierr = OMPI_INT_2_FINT(MPI_Status_set_cancelled(&c_status, OMPI_LOGICAL_2_INT(*flag))); if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { MPI_Status_c2f(&c_status, status); } } }
void ompi_get_elements_x_f(MPI_Fint *status, MPI_Fint *datatype, MPI_Count *count, MPI_Fint *ierr) { int c_ierr; MPI_Datatype c_type = MPI_Type_f2c(*datatype); MPI_Status c_status; OMPI_SINGLE_NAME_DECL(count); if (OMPI_IS_FORTRAN_STATUS_IGNORE(status)) { *count = OMPI_INT_2_FINT(0); c_ierr = MPI_SUCCESS; } else { c_ierr = MPI_Status_f2c(status, &c_status); if (MPI_SUCCESS == c_ierr) { c_ierr = MPI_Get_elements_x(&c_status, c_type, count); } } if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); }
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); }
int MPI_Status_f2c(MPI_Fint *f_status, MPI_Status *c_status) { int i, *c_ints; OPAL_CR_NOOP_PROGRESS(); if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); /* MPI-2:4.12.5 says that if you pass in MPI_STATUS[ES]_IGNORE, it's erroneous */ if (NULL == f_status || #if OMPI_WANT_F77_BINDINGS || OMPI_WANT_F90_BINDINGS /* This section is #if'ed out if we are not building the fortran bindings because these macros check values against constants that only exist if the fortran bindings exist. */ OMPI_IS_FORTRAN_STATUS_IGNORE(f_status) || OMPI_IS_FORTRAN_STATUSES_IGNORE(f_status) || #endif NULL == c_status) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_IN_STATUS, FUNC_NAME); } } /* We can't use OMPI_FINT_2_INT here because of some complications with include files. :-( So just do the casting manually. */ c_ints = (int*)c_status; for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) c_ints[i] = (int)f_status[i]; /* c_status->MPI_SOURCE = (int) f_status[0]; c_status->MPI_TAG = (int) f_status[1]; c_status->MPI_ERROR = (int) f_status[2]; c_status->_count = (int) f_status[3]; c_status->_cancelled = (int) f_status[4]; */ return MPI_SUCCESS; }
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 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 ompi_file_read_ordered_f(MPI_Fint *fh, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *status, MPI_Fint *ierr) { int c_ierr; MPI_File c_fh = MPI_File_f2c(*fh); MPI_Datatype c_type = MPI_Type_f2c(*datatype); MPI_Status *c_status; #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT MPI_Status c_status2; #endif /* 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_File_read_ordered(c_fh, OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), c_type, c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT if (MPI_SUCCESS == c_ierr && MPI_STATUS_IGNORE != c_status) { MPI_Status_c2f(c_status, status); } #endif }
int MPI_Status_f2c(MPI_Fint *f_status, MPI_Status *c_status) { int i, *c_ints; OPAL_CR_NOOP_PROGRESS(); if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); /* MPI-2:4.12.5 says that if you pass in MPI_STATUS[ES]_IGNORE, it's erroneous */ if (NULL == f_status || #if OMPI_WANT_F77_BINDINGS || OMPI_WANT_F90_BINDINGS /* This section is #if'ed out if we are not building the fortran bindings because these macros check values against constants that only exist if the fortran bindings exist. */ OMPI_IS_FORTRAN_STATUS_IGNORE(f_status) || OMPI_IS_FORTRAN_STATUSES_IGNORE(f_status) || #endif NULL == c_status) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_IN_STATUS, FUNC_NAME); } } /* ***NOTE*** See huge comment in status_c2f.c (yes, I know there's a size_t member in the C MPI_Status -- go read that comment for an explanation why copying everything as a bunch of int's is ok). We can't use OMPI_FINT_2_INT here because of some complications with include files. :-( So just do the casting manually. */ c_ints = (int*)c_status; for( i = 0; i < (int)(sizeof(MPI_Status) / sizeof(int)); i++ ) c_ints[i] = (int)f_status[i]; return MPI_SUCCESS; }
void mpi_recv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr) { MPI_Status *c_status; #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT MPI_Status c_status2; #endif MPI_Comm c_comm = MPI_Comm_f2c(*comm); MPI_Datatype c_type = MPI_Type_f2c(*datatype); /* 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 } /* Call the C function */ *ierr = OMPI_INT_2_FINT(MPI_Recv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), c_type, OMPI_FINT_2_INT(*source), OMPI_FINT_2_INT(*tag), c_comm, c_status)); #if OMPI_SIZEOF_FORTRAN_INTEGER != SIZEOF_INT if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr) && MPI_STATUS_IGNORE != c_status) { MPI_Status_c2f(c_status, status); } #endif }
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); }