From b5e26196fa0ed9984c00c0d3f2bd7dc0bcbbce74 Mon Sep 17 00:00:00 2001 From: Vishal Sahay Date: Wed, 15 Sep 2004 07:40:58 +0000 Subject: [PATCH] More bindings with macros This commit was SVN r2676. --- src/mpi/f77/pack_size_f.c | 2 +- src/mpi/f77/type_dup_f.c | 2 +- src/mpi/f77/type_indexed_f.c | 10 ++++++++-- src/mpi/f77/type_lb_f.c | 2 +- src/mpi/f77/type_match_size_f.c | 4 +++- src/mpi/f77/type_set_attr_f.c | 4 +++- src/mpi/f77/type_size_f.c | 6 +++++- src/mpi/f77/type_struct_f.c | 22 +++++++++++++++++----- src/mpi/f77/type_ub_f.c | 2 +- src/mpi/f77/type_vector_f.c | 10 +++++++--- src/mpi/f77/unpack_external_f.c | 13 ++++++++++--- src/mpi/f77/wait_f.c | 2 +- src/mpi/f77/waitall_f.c | 6 ++++-- src/mpi/f77/waitany_f.c | 16 ++++++++++++---- src/mpi/f77/waitsome_f.c | 15 ++++++++++++--- src/mpi/f77/win_create_keyval_f.c | 2 +- src/mpi/f77/win_delete_attr_f.c | 8 ++++---- src/mpi/f77/win_get_attr_f.c | 11 +++++++++-- src/mpi/f77/win_set_attr_f.c | 7 +++++-- 19 files changed, 105 insertions(+), 39 deletions(-) diff --git a/src/mpi/f77/pack_size_f.c b/src/mpi/f77/pack_size_f.c index da054915f7..6a2b5f1808 100644 --- a/src/mpi/f77/pack_size_f.c +++ b/src/mpi/f77/pack_size_f.c @@ -56,7 +56,7 @@ void mpi_pack_size_f(MPI_Fint *incount, MPI_Fint *datatype, c_comm = MPI_Comm_f2c(*comm); c_type = MPI_Type_f2c(*datatype); - *ierr = OMPI_FINT_2_INT(MPI_Pack_size(OMPI_FINT_2_INT(*incount), + *ierr = OMPI_INT_2_FINT(MPI_Pack_size(OMPI_FINT_2_INT(*incount), c_type, c_comm, OMPI_SINGLE_NAME_CONVERT(size))); diff --git a/src/mpi/f77/type_dup_f.c b/src/mpi/f77/type_dup_f.c index 53d9d84511..bff2eaaabc 100644 --- a/src/mpi/f77/type_dup_f.c +++ b/src/mpi/f77/type_dup_f.c @@ -51,7 +51,7 @@ void mpi_type_dup_f(MPI_Fint *type, MPI_Fint *newtype, MPI_Fint *ierr) MPI_Datatype c_type = MPI_Type_f2c(*type); MPI_Datatype c_new; - *ierr = OMPI_FINT_2_INT(MPI_Type_dup(c_type, &c_new)); + *ierr = OMPI_INT_2_FINT(MPI_Type_dup(c_type, &c_new)); if (MPI_SUCCESS == *ierr) { *newtype = MPI_Type_c2f(c_new); diff --git a/src/mpi/f77/type_indexed_f.c b/src/mpi/f77/type_indexed_f.c index eecbf60a82..c19903f945 100644 --- a/src/mpi/f77/type_indexed_f.c +++ b/src/mpi/f77/type_indexed_f.c @@ -52,9 +52,15 @@ void mpi_type_indexed_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, { MPI_Datatype c_old = MPI_Type_f2c(*oldtype); MPI_Datatype c_new; + OMPI_ARRAY_NAME_DECL(array_of_blocklengths); - *ierr = MPI_Type_indexed(*count, array_of_blocklengths, - array_of_displacements, c_old, &c_new); + OMPI_ARRAY_FINT_2_INT(array_of_blocklengths, *count); + + *ierr = OMPI_INT_2_FINT(MPI_Type_indexed(OMPI_FINT_2_INT(*count), + OMPI_ARRAY_NAME_CONVERT(array_of_blocklengths), + array_of_displacements, c_old, &c_new)); + + OMPI_ARRAY_FINT_2_INT_CLEANUP(array_of_blocklengths); if (MPI_SUCCESS == *ierr) { *newtype = MPI_Type_c2f(c_new); diff --git a/src/mpi/f77/type_lb_f.c b/src/mpi/f77/type_lb_f.c index cc4d159e2e..f0a9ac88a0 100644 --- a/src/mpi/f77/type_lb_f.c +++ b/src/mpi/f77/type_lb_f.c @@ -51,7 +51,7 @@ void mpi_type_lb_f(MPI_Fint *type, MPI_Fint *lb, MPI_Fint *ierr) MPI_Datatype c_type = MPI_Type_f2c(*type); MPI_Aint c_lb; - *ierr = MPI_Type_lb(c_type, &c_lb); + *ierr = OMPI_INT_2_FINT(MPI_Type_lb(c_type, &c_lb)); if (MPI_SUCCESS == *ierr) { *lb = (MPI_Fint)c_lb; diff --git a/src/mpi/f77/type_match_size_f.c b/src/mpi/f77/type_match_size_f.c index 1f2338fa7d..106b8a69ea 100644 --- a/src/mpi/f77/type_match_size_f.c +++ b/src/mpi/f77/type_match_size_f.c @@ -50,7 +50,9 @@ void mpi_type_match_size_f(MPI_Fint *typeclass, MPI_Fint *size, MPI_Fint *type, { MPI_Datatype c_type; - *ierr = MPI_Type_match_size(*typeclass, *size, &c_type); + *ierr = OMPI_INT_2_FINT(MPI_Type_match_size(OMPI_FINT_2_INT(*typeclass), + OMPI_FINT_2_INT(*size), + &c_type)); if (MPI_SUCCESS == *ierr) { *type = MPI_Type_c2f(c_type); diff --git a/src/mpi/f77/type_set_attr_f.c b/src/mpi/f77/type_set_attr_f.c index 93184b151a..2cf7828645 100644 --- a/src/mpi/f77/type_set_attr_f.c +++ b/src/mpi/f77/type_set_attr_f.c @@ -50,7 +50,9 @@ void mpi_type_set_attr_f(MPI_Fint *type, MPI_Fint *type_keyval, char *attr_val, { MPI_Datatype c_type = MPI_Type_f2c( *type ); - *ierr = MPI_Type_set_attr( c_type, *type_keyval, attr_val ); + *ierr = OMPI_INT_2_FINT(MPI_Type_set_attr( c_type, + OMPI_FINT_2_INT(*type_keyval), + attr_val )); if (MPI_SUCCESS == *ierr) { *type = MPI_Type_c2f( c_type ); diff --git a/src/mpi/f77/type_size_f.c b/src/mpi/f77/type_size_f.c index 154957e217..ab624c8bb8 100644 --- a/src/mpi/f77/type_size_f.c +++ b/src/mpi/f77/type_size_f.c @@ -49,6 +49,10 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_SIZE, void mpi_type_size_f(MPI_Fint *type, MPI_Fint *size, MPI_Fint *ierr) { MPI_Datatype c_type = MPI_Type_f2c(*type); + OMPI_SINGLE_NAME_DECL(size); - *ierr = MPI_Type_size(c_type, size); + *ierr = OMPI_INT_2_FINT(MPI_Type_size(c_type, + OMPI_SINGLE_NAME_CONVERT(size))); + + OMPI_SINGLE_INT_2_FINT(size); } diff --git a/src/mpi/f77/type_struct_f.c b/src/mpi/f77/type_struct_f.c index b3a2ea65c2..15c19dae74 100644 --- a/src/mpi/f77/type_struct_f.c +++ b/src/mpi/f77/type_struct_f.c @@ -52,18 +52,23 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_STRUCT, static const char FUNC_NAME[] = "MPI_TYPE_STRUCT"; -void mpi_type_struct_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, MPI_Fint *array_of_displacements, MPI_Fint *array_of_types, MPI_Fint *newtype, MPI_Fint *ierr) +void mpi_type_struct_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, + MPI_Fint *array_of_displacements, + MPI_Fint *array_of_types, MPI_Fint *newtype, + MPI_Fint *ierr) { MPI_Aint *c_disp_array; MPI_Datatype *c_type_old_array; MPI_Datatype c_new; - int i; + int i, c_err; + OMPI_ARRAY_NAME_DECL(array_of_blocklengths); c_type_old_array = malloc(*count * (sizeof(MPI_Datatype) + sizeof(MPI_Aint))); if (NULL == c_type_old_array) { - *ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, + c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); + *ierr = OMPI_INT_2_FINT(c_err); return; } c_disp_array = (MPI_Aint*) c_type_old_array + *count; @@ -73,8 +78,14 @@ void mpi_type_struct_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, MPI_Fin c_type_old_array[i] = MPI_Type_f2c(array_of_types[i]); } - *ierr = MPI_Type_struct(*count, array_of_blocklengths, c_disp_array, - c_type_old_array, &c_new); + OMPI_ARRAY_FINT_2_INT(array_of_blocklengths, *count); + + *ierr = OMPI_INT_2_FINT(MPI_Type_struct(OMPI_FINT_2_INT(*count), + OMPI_ARRAY_NAME_CONVERT(array_of_blocklengths), + c_disp_array, + c_type_old_array, &c_new)); + + OMPI_ARRAY_FINT_2_INT_CLEANUP(array_of_blocklengths); if (MPI_SUCCESS == *ierr) { *newtype = MPI_Type_c2f(c_new); @@ -82,3 +93,4 @@ void mpi_type_struct_f(MPI_Fint *count, MPI_Fint *array_of_blocklengths, MPI_Fin free(c_type_old_array); } + diff --git a/src/mpi/f77/type_ub_f.c b/src/mpi/f77/type_ub_f.c index 8d4793ed26..9f87dcf78d 100644 --- a/src/mpi/f77/type_ub_f.c +++ b/src/mpi/f77/type_ub_f.c @@ -51,7 +51,7 @@ void mpi_type_ub_f(MPI_Fint *mtype, MPI_Fint *ub, MPI_Fint *ierr) MPI_Datatype c_mtype = MPI_Type_f2c(*mtype); MPI_Aint c_ub; - *ierr = MPI_Type_ub(c_mtype, &c_ub); + *ierr = OMPI_INT_2_FINT(MPI_Type_ub(c_mtype, &c_ub)); if (MPI_SUCCESS == *ierr) { *ub = (MPI_Fint)c_ub; diff --git a/src/mpi/f77/type_vector_f.c b/src/mpi/f77/type_vector_f.c index ffac6fe636..13862a6bd1 100644 --- a/src/mpi/f77/type_vector_f.c +++ b/src/mpi/f77/type_vector_f.c @@ -46,15 +46,19 @@ OMPI_GENERATE_F77_BINDINGS (MPI_TYPE_VECTOR, #include "mpi/f77/profile/defines.h" #endif -void mpi_type_vector_f(MPI_Fint *count, MPI_Fint *blocklength, MPI_Fint *stride, MPI_Fint *oldtype, MPI_Fint *newtype, MPI_Fint *ierr) +void mpi_type_vector_f(MPI_Fint *count, MPI_Fint *blocklength, + MPI_Fint *stride, MPI_Fint *oldtype, + MPI_Fint *newtype, MPI_Fint *ierr) { MPI_Datatype c_old; MPI_Datatype c_new; c_old = MPI_Type_f2c(*oldtype); - *ierr = MPI_Type_vector(*count, *blocklength, *stride, - c_old, &c_new); + *ierr = OMPI_INT_2_FINT(MPI_Type_vector(OMPI_FINT_2_INT(*count), + OMPI_FINT_2_INT(*blocklength), + OMPI_FINT_2_INT(*stride), + c_old, &c_new)); if (MPI_SUCCESS == *ierr) { *newtype = MPI_Type_c2f(c_new); diff --git a/src/mpi/f77/unpack_external_f.c b/src/mpi/f77/unpack_external_f.c index e4129189ee..faffcef114 100644 --- a/src/mpi/f77/unpack_external_f.c +++ b/src/mpi/f77/unpack_external_f.c @@ -46,11 +46,18 @@ OMPI_GENERATE_F77_BINDINGS (MPI_UNPACK_EXTERNAL, #include "mpi/f77/profile/defines.h" #endif -void mpi_unpack_external_f (char *datarep, char *inbuf, MPI_Fint *insize, MPI_Fint *position, char *outbuf, MPI_Fint *outcount, MPI_Fint *datatype, MPI_Fint *ierr) +void mpi_unpack_external_f (char *datarep, char *inbuf, MPI_Fint *insize, + MPI_Fint *position, char *outbuf, + MPI_Fint *outcount, MPI_Fint *datatype, + MPI_Fint *ierr) { MPI_Datatype c_type; c_type = MPI_Type_f2c(*datatype); - *ierr = MPI_Unpack_external(datarep, inbuf, *insize, (MPI_Aint *)position, - outbuf, *outcount, c_type); + *ierr = OMPI_INT_2_FINT(MPI_Unpack_external(datarep, inbuf, + (MPI_Aint)*insize, + (MPI_Aint *)position, + outbuf, + OMPI_FINT_2_INT(*outcount), + c_type)); } diff --git a/src/mpi/f77/wait_f.c b/src/mpi/f77/wait_f.c index 4e77ddcbdd..83bf11e72d 100644 --- a/src/mpi/f77/wait_f.c +++ b/src/mpi/f77/wait_f.c @@ -51,7 +51,7 @@ void mpi_wait_f(MPI_Fint *request, MPI_Fint *status, MPI_Fint *ierr) MPI_Request c_req = MPI_Request_f2c(*request); MPI_Status c_status; - *ierr = MPI_Wait(&c_req, &c_status); + *ierr = OMPI_INT_2_FINT(MPI_Wait(&c_req, &c_status)); if (MPI_SUCCESS == *ierr) { /* reset request handle to MPI_REQUEST_NULL */ diff --git a/src/mpi/f77/waitall_f.c b/src/mpi/f77/waitall_f.c index 77bdf5a4e9..13e7bf2ba4 100644 --- a/src/mpi/f77/waitall_f.c +++ b/src/mpi/f77/waitall_f.c @@ -52,7 +52,8 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WAITALL, static const char FUNC_NAME[] = "MPI_WAITALL"; -void mpi_waitall_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *array_of_statuses, MPI_Fint *ierr) +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; @@ -70,7 +71,8 @@ void mpi_waitall_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *array c_req[i] = MPI_Request_f2c(array_of_requests[i]); } - *ierr = MPI_Waitall(*count, c_req, c_status); + *ierr = OMPI_INT_2_FINT(MPI_Waitall(OMPI_FINT_2_INT(*count), + c_req, c_status)); if (MPI_SUCCESS == *ierr) { for (i = 0; i < *count; i++) { diff --git a/src/mpi/f77/waitany_f.c b/src/mpi/f77/waitany_f.c index c3597e7e80..0552480a04 100644 --- a/src/mpi/f77/waitany_f.c +++ b/src/mpi/f77/waitany_f.c @@ -52,16 +52,19 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WAITANY, static const char FUNC_NAME[] = "MPI_WAITANY"; -void mpi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *index, MPI_Fint *status, MPI_Fint *ierr) +void mpi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests, + MPI_Fint *index, MPI_Fint *status, MPI_Fint *ierr) { MPI_Request *c_req; MPI_Status c_status; - int i; + int i, c_err; + OMPI_SINGLE_NAME_DECL(index); c_req = malloc(*count * sizeof(MPI_Request)); if (NULL == c_req) { - *ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, + c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME); + *ierr = OMPI_INT_2_FINT(c_err); return; } @@ -69,9 +72,13 @@ void mpi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *index c_req[i] = MPI_Request_f2c(array_of_requests[i]); } - *ierr = MPI_Waitany(*count, c_req, index, &c_status); + *ierr = OMPI_INT_2_FINT(MPI_Waitany(OMPI_FINT_2_INT(*count), c_req, + OMPI_SINGLE_NAME_CONVERT(index), + &c_status)); if (MPI_SUCCESS == *ierr) { + + OMPI_SINGLE_INT_2_FINT(index); /* * Increment index by one for fortran conventions */ @@ -79,6 +86,7 @@ void mpi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *index *index += 1; } MPI_Status_c2f( &c_status, status); + } free(c_req); } diff --git a/src/mpi/f77/waitsome_f.c b/src/mpi/f77/waitsome_f.c index a4d6b684b4..a45ca09750 100644 --- a/src/mpi/f77/waitsome_f.c +++ b/src/mpi/f77/waitsome_f.c @@ -52,11 +52,15 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WAITSOME, static const char FUNC_NAME[] = "MPI_WAITSOME"; -void mpi_waitsome_f(MPI_Fint *incount, MPI_Fint *array_of_requests, MPI_Fint *outcount, MPI_Fint *array_of_indices, MPI_Fint *array_of_statuses, MPI_Fint *ierr) +void mpi_waitsome_f(MPI_Fint *incount, MPI_Fint *array_of_requests, + MPI_Fint *outcount, MPI_Fint *array_of_indices, + MPI_Fint *array_of_statuses, MPI_Fint *ierr) { MPI_Request *c_req; MPI_Status *c_status; int i; + OMPI_SINGLE_NAME_DECL(outcount); + OMPI_ARRAY_NAME_DECL(array_of_indices); c_req = malloc(*incount * (sizeof(MPI_Request) + sizeof(MPI_Status))); if (NULL == c_req) { @@ -70,10 +74,15 @@ void mpi_waitsome_f(MPI_Fint *incount, MPI_Fint *array_of_requests, MPI_Fint *ou c_req[i] = MPI_Request_f2c(array_of_requests[i]); } - *ierr = MPI_Waitsome(*incount, c_req, outcount, array_of_indices, - c_status); + OMPI_ARRAY_FINT_2_INT_ALLOC(array_of_indices, *incount); + *ierr = OMPI_INT_2_FINT(MPI_Waitsome(OMPI_FINT_2_INT(*incount), c_req, + OMPI_SINGLE_NAME_CONVERT(outcount), + OMPI_ARRAY_NAME_CONVERT(array_of_indices), + c_status)); if (MPI_SUCCESS == *ierr) { + OMPI_SINGLE_INT_2_FINT(outcount); + OMPI_ARRAY_INT_2_FINT(array_of_indices, *incount); /* * Increment indexes by one for fortran conventions */ diff --git a/src/mpi/f77/win_create_keyval_f.c b/src/mpi/f77/win_create_keyval_f.c index 98d40f27e2..c2ca455a50 100644 --- a/src/mpi/f77/win_create_keyval_f.c +++ b/src/mpi/f77/win_create_keyval_f.c @@ -69,7 +69,7 @@ void mpi_win_create_keyval_f(MPI_Fint *win_copy_attr_fn, MPI_Fint *win_delete_at 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); + win_keyval, extra_state, OMPI_KEYVAL_F77); if (MPI_SUCCESS != ret) { c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER, diff --git a/src/mpi/f77/win_delete_attr_f.c b/src/mpi/f77/win_delete_attr_f.c index c7cb120c17..71bcfda807 100644 --- a/src/mpi/f77/win_delete_attr_f.c +++ b/src/mpi/f77/win_delete_attr_f.c @@ -51,12 +51,13 @@ static const char FUNC_NAME[] = "MPI_Win_delete_attr_f"; void mpi_win_delete_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, MPI_Fint *ierr) { MPI_Win c_win = MPI_Win_f2c( *win ); - int ret; + int ret, c_err; if (MPI_PARAM_CHECK) { if (MPI_WIN_NULL == c_win) { - *ierr = OMPI_ERRHANDLER_INVOKE(c_win, MPI_ERR_WIN, - FUNC_NAME); + c_err = OMPI_ERRHANDLER_INVOKE(c_win, MPI_ERR_WIN, + FUNC_NAME); + *ierr = OMPI_INT_2_FINT(c_err); } } @@ -68,5 +69,4 @@ void mpi_win_delete_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, MPI_Fint *ierr) } 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 13cc623eba..b6542733e4 100644 --- a/src/mpi/f77/win_get_attr_f.c +++ b/src/mpi/f77/win_get_attr_f.c @@ -46,9 +46,16 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WIN_GET_ATTR, #include "mpi/f77/profile/defines.h" #endif -void mpi_win_get_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, char *attribute_val, MPI_Fint *flag, MPI_Fint *ierr) +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 ); + OMPI_SINGLE_NAME_DECL(flag); - *ierr = MPI_Win_get_attr( c_win, *win_keyval, attribute_val, flag ); + *ierr = OMPI_INT_2_FINT(MPI_Win_get_attr( c_win, + OMPI_FINT_2_INT(*win_keyval), + attribute_val, + OMPI_SINGLE_NAME_CONVERT(flag) )); + + OMPI_SINGLE_INT_2_FINT(flag); } diff --git a/src/mpi/f77/win_set_attr_f.c b/src/mpi/f77/win_set_attr_f.c index 38e31d276d..ef86c209d6 100644 --- a/src/mpi/f77/win_set_attr_f.c +++ b/src/mpi/f77/win_set_attr_f.c @@ -46,9 +46,12 @@ OMPI_GENERATE_F77_BINDINGS (MPI_WIN_SET_ATTR, #include "mpi/f77/profile/defines.h" #endif -void mpi_win_set_attr_f(MPI_Fint *win, MPI_Fint *win_keyval, char *attribute_val, MPI_Fint *ierr) +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 ); + *ierr = OMPI_INT_2_FINT(MPI_Win_set_attr( c_win, + OMPI_FINT_2_INT(*win_keyval), + attribute_val )); }