diff --git a/src/mpi/f77/finalized_f.c b/src/mpi/f77/finalized_f.c index b3e8d48a72..cb2857133d 100644 --- a/src/mpi/f77/finalized_f.c +++ b/src/mpi/f77/finalized_f.c @@ -48,5 +48,5 @@ OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZED, void mpi_finalized_f(MPI_Fint *flag, MPI_Fint *ierr) { - + *ierr = MPI_Finalized(flag); } diff --git a/src/mpi/f77/get_version_f.c b/src/mpi/f77/get_version_f.c index c6af34db63..772347fa9e 100644 --- a/src/mpi/f77/get_version_f.c +++ b/src/mpi/f77/get_version_f.c @@ -48,5 +48,5 @@ OMPI_GENERATE_F77_BINDINGS (MPI_GET_VERSION, void mpi_get_version_f(MPI_Fint *version, MPI_Fint *subversion, MPI_Fint *ierr) { - + *ierr = MPI_Get_version(version, subversion); } diff --git a/src/mpi/f77/initialized_f.c b/src/mpi/f77/initialized_f.c index 2d55fc0e8c..37093fdb49 100644 --- a/src/mpi/f77/initialized_f.c +++ b/src/mpi/f77/initialized_f.c @@ -48,5 +48,5 @@ OMPI_GENERATE_F77_BINDINGS (MPI_INITIALIZED, void mpi_initialized_f(MPI_Fint *flag, MPI_Fint *ierr) { - + *ierr = MPI_Initialized(flag); } diff --git a/src/mpi/f77/request_free_f.c b/src/mpi/f77/request_free_f.c index ba87873c90..30a3ea71a7 100644 --- a/src/mpi/f77/request_free_f.c +++ b/src/mpi/f77/request_free_f.c @@ -48,5 +48,9 @@ OMPI_GENERATE_F77_BINDINGS (MPI_REQUEST_FREE, void mpi_request_free_f(MPI_Fint *request, MPI_Fint *ierr) { + MPI_Request c_req = MPI_Request_f2c( *request ); + *ierr = MPI_Request_free( &c_req ); + + *request = MPI_Request_f2c( &c_req ); } diff --git a/src/mpi/f77/request_get_status_f.c b/src/mpi/f77/request_get_status_f.c index 7b7f3eeaf6..ae0b94b5b0 100644 --- a/src/mpi/f77/request_get_status_f.c +++ b/src/mpi/f77/request_get_status_f.c @@ -48,5 +48,10 @@ OMPI_GENERATE_F77_BINDINGS (MPI_REQUEST_GET_STATUS, void mpi_request_get_status_f(MPI_Fint *request, MPI_Fint *flag, MPI_Fint *status, MPI_Fint *ierr) { + MPI_Status c_status; + MPI_Request c_req = MPI_Request_f2c( *request ); + *ierr = MPI_Request_get_status( c_req, flag, &c_status ); + + MPI_Status_c2f( &c_status, status ); } diff --git a/src/mpi/f77/status_set_elements_f.c b/src/mpi/f77/status_set_elements_f.c index 4d00b0b844..356435e219 100644 --- a/src/mpi/f77/status_set_elements_f.c +++ b/src/mpi/f77/status_set_elements_f.c @@ -48,5 +48,15 @@ OMPI_GENERATE_F77_BINDINGS (MPI_STATUS_SET_ELEMENTS, void mpi_status_set_elements_f(MPI_Fint *status, MPI_Fint *datatype, MPI_Fint *count, MPI_Fint *ierr) { + MPI_Datatype c_type; + MPI_Status c_status; + + MPI_Status_f2c( status, &c_status ); + + *ierr = MPI_Status_set_elements(&c_status, &c_type, *count); + + /* If datatype is really being set, then that needs to be converted.... */ + if (*ierr == MPI_SUCCESS) + MPI_Status_c2f(&c_status, status); } diff --git a/src/mpi/f77/type_create_keyval_f.c b/src/mpi/f77/type_create_keyval_f.c index 8a3a574319..7499bfc669 100644 --- a/src/mpi/f77/type_create_keyval_f.c +++ b/src/mpi/f77/type_create_keyval_f.c @@ -8,6 +8,7 @@ #include "mpi.h" #include "mpi/f77/bindings.h" +#include "attribute/attribute.h" #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #pragma weak PMPI_TYPE_CREATE_KEYVAL = mpi_type_create_keyval_f @@ -46,7 +47,34 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_CREATE_KEYVAL, #include "mpi/c/profile/defines.h" #endif +static char FUNC_NAME[] = "MPI_Type_create_keyval_f"; + void mpi_type_create_keyval_f(MPI_Fint *type_copy_attr_fn, MPI_Fint *type_delete_attr_fn, MPI_Fint *type_keyval, char *extra_state, MPI_Fint *ierr) { + int ret; + ompi_attribute_fn_ptr_union_t copy_fn; + ompi_attribute_fn_ptr_union_t del_fn; + if (MPI_PARAM_CHECK) { + if ((NULL == type_copy_attr_fn) || + (NULL == type_delete_attr_fn) || + (NULL == type_keyval) ) { + *ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_ARG, + FUNC_NAME); + } + } + + copy_fn.attr_F_copy_fn = (MPI_F_copy_function *)type_copy_attr_fn; + del_fn.attr_F_delete_fn = (MPI_F_delete_function *)type_delete_attr_fn; + + ret = ompi_attr_create_keyval(TYPE_ATTR, copy_fn, del_fn, + type_keyval, extra_state, OMPI_KEYVAL_F77); + + if (ret != OMPI_SUCCESS) { + *ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, + FUNC_NAME); + } else { + *ierr = MPI_SUCCESS; + } } diff --git a/src/mpi/f77/type_delete_attr_f.c b/src/mpi/f77/type_delete_attr_f.c index b1d74dc8ba..78f40845e8 100644 --- a/src/mpi/f77/type_delete_attr_f.c +++ b/src/mpi/f77/type_delete_attr_f.c @@ -48,5 +48,12 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_DELETE_ATTR, void mpi_type_delete_attr_f(MPI_Fint *type, MPI_Fint *type_keyval, MPI_Fint *ierr) { + MPI_Datatype c_type = MPI_Type_f2c(*type); + *ierr = MPI_Type_delete_attr( c_type, *type_keyval ); + + if (*ierr == MPI_SUCCESS) + *type = MPI_Type_c2f( c_type ); } + + diff --git a/src/mpi/f77/type_get_attr_f.c b/src/mpi/f77/type_get_attr_f.c index 6a629e9904..0e98dbc41c 100644 --- a/src/mpi/f77/type_get_attr_f.c +++ b/src/mpi/f77/type_get_attr_f.c @@ -48,5 +48,7 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_GET_ATTR, void mpi_type_get_attr_f(MPI_Fint *type, MPI_Fint *type_keyval, char *attribute_val, MPI_Fint *flag, MPI_Fint *ierr) { + MPI_Datatype c_type = MPI_Type_f2c( *type ); + *ierr = MPI_Type_get_attr( c_type, *type_keyval, attribute_val, flag ); } diff --git a/src/mpi/f77/type_set_attr_f.c b/src/mpi/f77/type_set_attr_f.c index 66e58d2361..24ff2951fc 100644 --- a/src/mpi/f77/type_set_attr_f.c +++ b/src/mpi/f77/type_set_attr_f.c @@ -48,5 +48,11 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_SET_ATTR, void mpi_type_set_attr_f(MPI_Fint *type, MPI_Fint *type_keyval, char *attr_val, MPI_Fint *ierr) { + MPI_Datatype c_type = MPI_Type_f2c( *type ); + + *ierr = MPI_Type_set_attr( c_type, *type_keyval, attr_val ); + + if (*ierr == MPI_SUCCESS) + *type = MPI_Type_c2f( c_type ); } diff --git a/src/mpi/f77/win_create_keyval_f.c b/src/mpi/f77/win_create_keyval_f.c index a3ca05b3a8..fb18ae94c7 100644 --- a/src/mpi/f77/win_create_keyval_f.c +++ b/src/mpi/f77/win_create_keyval_f.c @@ -8,6 +8,7 @@ #include "mpi.h" #include "mpi/f77/bindings.h" +#include "attribute/attribute.h" #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #pragma weak PMPI_WIN_CREATE_KEYVAL = mpi_win_create_keyval_f @@ -46,7 +47,33 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WIN_CREATE_KEYVAL, #include "mpi/c/profile/defines.h" #endif +static char FUNC_NAME[] = "MPI_Win_create_keyval"; + void mpi_win_create_keyval_f(MPI_Fint *win_copy_attr_fn, MPI_Fint *win_delete_attr_fn, MPI_Fint *win_keyval, char *extra_state, MPI_Fint *ierr) { + int ret; + ompi_attribute_fn_ptr_union_t copy_fn; + ompi_attribute_fn_ptr_union_t del_fn; + if (MPI_PARAM_CHECK) { + if ((NULL == win_copy_attr_fn) || + (NULL == win_delete_attr_fn) || + (NULL == win_keyval) ) { + *ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, + MPI_ERR_ARG, + FUNC_NAME); + } + } + copy_fn.attr_F_copy_fn = (MPI_F_copy_function *)win_copy_attr_fn; + del_fn.attr_F_delete_fn = (MPI_F_delete_function *)win_delete_attr_fn; + + ret = ompi_attr_create_keyval(WIN_ATTR, copy_fn, del_fn, + win_keyval, extra_state, OMPI_KEYVAL_F77); + + if (ret != OMPI_SUCCESS) { + OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, FUNC_NAME); + } else { + *ierr = MPI_SUCCESS; + } } + diff --git a/src/mpi/f77/win_get_attr_f.c b/src/mpi/f77/win_get_attr_f.c index eefa07064d..2345aaf495 100644 --- a/src/mpi/f77/win_get_attr_f.c +++ b/src/mpi/f77/win_get_attr_f.c @@ -48,5 +48,7 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WIN_GET_ATTR, void mpi_win_get_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, char *attribute_val, MPI_Fint *flag, MPI_Fint *ierr) { + MPI_Win c_win = MPI_Win_f2c( *win ); + *ierr = MPI_Win_get_attr( c_win, *win_keyval, attribute_val, flag ); } diff --git a/src/mpi/f77/win_set_attr_f.c b/src/mpi/f77/win_set_attr_f.c index 8c9cc79136..55d661e670 100644 --- a/src/mpi/f77/win_set_attr_f.c +++ b/src/mpi/f77/win_set_attr_f.c @@ -48,5 +48,7 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WIN_SET_ATTR, void mpi_win_set_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, char *attribute_val, MPI_Fint *ierr) { + MPI_Win c_win = MPI_Win_f2c( *win ); + *ierr = MPI_Win_set_attr( c_win, *win_keyval, attribute_val ); }