From 3298143d154ffad1e3935770d53b15b34caea69a Mon Sep 17 00:00:00 2001 From: degomme Date: Mon, 17 Jul 2017 20:10:08 +0200 Subject: [PATCH] Add some missing SMPI fortran bindings (recently supported functions) --- src/smpi/bindings/smpi_f77.cpp | 165 ++++++++++++++++++++++++++++ src/smpi/bindings/smpi_f77_comm.cpp | 8 ++ src/smpi/bindings/smpi_f77_type.cpp | 16 +-- src/smpi/include/private.h | 39 ++++++- 4 files changed, 219 insertions(+), 9 deletions(-) diff --git a/src/smpi/bindings/smpi_f77.cpp b/src/smpi/bindings/smpi_f77.cpp index c917e2a124..ad40a6b49e 100644 --- a/src/smpi/bindings/smpi_f77.cpp +++ b/src/smpi/bindings/smpi_f77.cpp @@ -182,6 +182,102 @@ void mpi_win_get_name_ (int* win, char * name, int* len, int* ierr){ name[*len]=' ';//blank padding, not \0 } +void mpi_win_allocate_( MPI_Aint* size, int* disp_unit, int* info, int* comm, void* base, int* win, int* ierr){ + MPI_Win tmp; + *ierr = MPI_Win_allocate( *size, *disp_unit, simgrid::smpi::Info::f2c(*info), simgrid::smpi::Comm::f2c(*comm),static_cast(base),&tmp); + if(*ierr == MPI_SUCCESS) { + *win = tmp->add_f(); + } +} + +void mpi_win_attach_(int* win, int* base, MPI_Aint* size, int* ierr){ + *ierr = MPI_Win_attach(simgrid::smpi::Win::f2c(*win), static_cast(base), *size); +} + +void mpi_win_create_dynamic_( int* info, int* comm, int *win, int* ierr){ + MPI_Win tmp; + *ierr = MPI_Win_create_dynamic( simgrid::smpi::Info::f2c(*info), simgrid::smpi::Comm::f2c(*comm),&tmp); + if(*ierr == MPI_SUCCESS) { + *win = tmp->add_f(); + } +} + +void mpi_win_detach_(int* win, int* base, int* ierr){ + *ierr = MPI_Win_detach(simgrid::smpi::Win::f2c(*win), static_cast(base)); +} + +void mpi_win_set_info_(int* win, int* info, int* ierr){ + *ierr = MPI_Win_set_info(simgrid::smpi::Win::f2c(*win), simgrid::smpi::Info::f2c(*info)); +} + +void mpi_win_get_info_(int* win, int* info, int* ierr){ + MPI_Info tmp; + *ierr = MPI_Win_get_info(simgrid::smpi::Win::f2c(*win), &tmp); + if(*ierr == MPI_SUCCESS) { + *info = tmp->add_f(); + } +} + +void mpi_win_get_group_(int* win, int* group, int* ierr){ + MPI_Group tmp; + *ierr = MPI_Win_get_group(simgrid::smpi::Win::f2c(*win), &tmp); + if(*ierr == MPI_SUCCESS) { + *group = tmp->add_f(); + } +} + +void mpi_win_get_attr_(int* win, int* type_keyval, void* attribute_val, int* flag, int* ierr){ + *ierr = MPI_Win_get_attr(simgrid::smpi::Win::f2c(*win), *type_keyval, attribute_val, flag); +} + +void mpi_win_set_attr_(int* win, int* type_keyval, void* att, int* ierr){ + *ierr = MPI_Win_set_attr(simgrid::smpi::Win::f2c(*win), *type_keyval, att); +} + +void mpi_win_delete_attr_(int* win, int* comm_keyval, int* ierr){ + *ierr = MPI_Win_delete_attr (simgrid::smpi::Win::f2c(*win), *comm_keyval); +} + +void mpi_win_create_keyval_(void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr){ + *ierr = MPI_Win_create_keyval(reinterpret_cast(copy_fn), reinterpret_cast(delete_fn), + keyval, extra_state) ; +} + +void mpi_win_free_keyval_(int* keyval, int* ierr){ + *ierr = MPI_Win_free_keyval( keyval); +} + +void mpi_win_lock_(int* lock_type, int* rank, int* assert, int* win, int* ierr){ + *ierr = MPI_Win_lock(*lock_type, *rank, *assert, simgrid::smpi::Win::f2c(*win)); +} + +void mpi_win_lock_all_(int* assert, int* win, int* ierr){ + *ierr = MPI_Win_lock_all(*assert, simgrid::smpi::Win::f2c(*win)); +} + +void mpi_win_unlock_(int* rank, int* win, int* ierr){ + *ierr = MPI_Win_unlock(*rank, simgrid::smpi::Win::f2c(*win)); +} + +void mpi_win_unlock_all_(int* win, int* ierr){ + *ierr = MPI_Win_unlock_all(simgrid::smpi::Win::f2c(*win)); +} + +void mpi_win_flush_(int* rank, int* win, int* ierr){ + *ierr = MPI_Win_flush(*rank, simgrid::smpi::Win::f2c(*win)); +} + +void mpi_win_flush_local_(int* rank, int* win, int* ierr){ + *ierr = MPI_Win_flush_local(*rank, simgrid::smpi::Win::f2c(*win)); +} +void mpi_win_flush_all_(int* win, int* ierr){ + *ierr = MPI_Win_flush_all(simgrid::smpi::Win::f2c(*win)); +} + +void mpi_win_flush_local_all_(int* win, int* ierr){ + *ierr = MPI_Win_flush_local_all(simgrid::smpi::Win::f2c(*win)); +} + void mpi_info_create_( int *info, int* ierr){ MPI_Info tmp; *ierr = MPI_Info_create(&tmp); @@ -255,18 +351,83 @@ void mpi_get_( int *origin_addr, int* origin_count, int* origin_datatype, int *t *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*tarsmpi_type_f2c), simgrid::smpi::Win::f2c(*win)); } +void mpi_rget_( int *origin_addr, int* origin_count, int* origin_datatype, int *target_rank, + MPI_Aint* target_disp, int *target_count, int* tarsmpi_type_f2c, int* win, int* request, int* ierr){ + MPI_Request req; + *ierr = MPI_Rget( static_cast(origin_addr),*origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),*target_rank, + *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*tarsmpi_type_f2c), simgrid::smpi::Win::f2c(*win), &req); + if(*ierr == MPI_SUCCESS) { + *request = req->add_f(); + } +} + void mpi_accumulate_( int *origin_addr, int* origin_count, int* origin_datatype, int *target_rank, MPI_Aint* target_disp, int *target_count, int* tarsmpi_type_f2c, int* op, int* win, int* ierr){ *ierr = MPI_Accumulate( static_cast(origin_addr),*origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),*target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*tarsmpi_type_f2c), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win)); } +void mpi_raccumulate_( int *origin_addr, int* origin_count, int* origin_datatype, int *target_rank, + MPI_Aint* target_disp, int *target_count, int* tarsmpi_type_f2c, int* op, int* win, int* request, int* ierr){ + MPI_Request req; + *ierr = MPI_Raccumulate( static_cast(origin_addr),*origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),*target_rank, + *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*tarsmpi_type_f2c), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win),&req); + if(*ierr == MPI_SUCCESS) { + *request = req->add_f(); + } +} + void mpi_put_( int *origin_addr, int* origin_count, int* origin_datatype, int *target_rank, MPI_Aint* target_disp, int *target_count, int* tarsmpi_type_f2c, int* win, int* ierr){ *ierr = MPI_Put( static_cast(origin_addr),*origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),*target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*tarsmpi_type_f2c), simgrid::smpi::Win::f2c(*win)); } +void mpi_rput_( int *origin_addr, int* origin_count, int* origin_datatype, int *target_rank, + MPI_Aint* target_disp, int *target_count, int* tarsmpi_type_f2c, int* win, int* request, int* ierr){ + MPI_Request req; + *ierr = MPI_Rput( static_cast(origin_addr),*origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),*target_rank, + *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*tarsmpi_type_f2c), simgrid::smpi::Win::f2c(*win),&req); + if(*ierr == MPI_SUCCESS) { + *request = req->add_f(); + } +} + +void mpi_fetch_and_op_( int *origin_addr, int* result_addr, int* datatype, int* target_rank, MPI_Aint* target_disp, int* op, int* win, int* ierr){ + *ierr = MPI_Fetch_and_op( static_cast(origin_addr), + static_cast(result_addr), simgrid::smpi::Datatype::f2c(*datatype),*target_rank, + *target_disp, simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win)); +} + +void mpi_compare_and_swap_( int *origin_addr, int* compare_addr, int* result_addr, + int* datatype, int* target_rank, MPI_Aint* target_disp, int* win, int* ierr){ + *ierr = MPI_Compare_and_swap( static_cast(origin_addr),static_cast(compare_addr), + static_cast(result_addr), simgrid::smpi::Datatype::f2c(*datatype),*target_rank, + *target_disp, simgrid::smpi::Win::f2c(*win)); +} + +void mpi_get_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr, + int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, + int* target_datatype, int* op, int* win, int* ierr){ + *ierr = MPI_Get_accumulate( static_cast(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype), + static_cast(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype), + *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype), + simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win)); +} + +void mpi_rget_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr, + int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, + int* target_datatype, int* op, int* win, int* request, int* ierr){ + MPI_Request req; + *ierr = MPI_Rget_accumulate( static_cast(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype), + static_cast(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype), + *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype), + simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win), &req); + if(*ierr == MPI_SUCCESS) { + *request = req->add_f(); + } +} + //following are automatically generated, and have to be checked void mpi_finalized_ (int * flag, int* ierr){ @@ -320,6 +481,10 @@ void mpi_op_free_ (int* op, int* ierr){ } } +void mpi_op_commutative_ (int* op, int* commute, int* ierr){ + *ierr = MPI_Op_commutative(simgrid::smpi::Op::f2c(*op), commute); +} + void mpi_group_free_ (int* group, int* ierr){ MPI_Group tmp = simgrid::smpi::Group::f2c(*group); *ierr = MPI_Group_free(&tmp); diff --git a/src/smpi/bindings/smpi_f77_comm.cpp b/src/smpi/bindings/smpi_f77_comm.cpp index d4dca014c0..f0f56d0d2a 100644 --- a/src/smpi/bindings/smpi_f77_comm.cpp +++ b/src/smpi/bindings/smpi_f77_comm.cpp @@ -63,6 +63,14 @@ void mpi_comm_group_(int* comm, int* group_out, int* ierr) { } } +void mpi_comm_create_group_ (int* comm, int* group, int i, int* comm_out, int* ierr){ + MPI_Comm tmp; + *ierr = MPI_Comm_create_group(simgrid::smpi::Comm::f2c(*comm),simgrid::smpi::Group::f2c(*group), i, &tmp); + if(*ierr == MPI_SUCCESS) { + *comm_out = tmp->c2f(); + } +} + void mpi_comm_get_attr_ (int* comm, int* comm_keyval, void *attribute_val, int *flag, int* ierr){ *ierr = MPI_Comm_get_attr (simgrid::smpi::Comm::f2c(*comm), *comm_keyval, attribute_val, flag); diff --git a/src/smpi/bindings/smpi_f77_type.cpp b/src/smpi/bindings/smpi_f77_type.cpp index e07102562f..1da72486c8 100644 --- a/src/smpi/bindings/smpi_f77_type.cpp +++ b/src/smpi/bindings/smpi_f77_type.cpp @@ -112,14 +112,6 @@ void mpi_type_vector_(int* count, int* blocklen, int* stride, int* old_type, int } } -void mpi_type_create_vector_(int* count, int* blocklen, int* stride, int* old_type, int* newtype, int* ierr){ - MPI_Datatype tmp; - *ierr= MPI_Type_vector(*count, *blocklen, *stride, simgrid::smpi::Datatype::f2c(*old_type), &tmp); - if(*ierr == MPI_SUCCESS) { - *newtype = tmp->add_f(); - } -} - void mpi_type_hvector_(int* count, int* blocklen, MPI_Aint* stride, int* old_type, int* newtype, int* ierr){ MPI_Datatype tmp; *ierr= MPI_Type_hvector (*count, *blocklen, *stride, simgrid::smpi::Datatype::f2c(*old_type), &tmp); @@ -169,6 +161,14 @@ void mpi_type_indexed_ (int* count, int* blocklens, int* indices, int* old_type, } } +void mpi_type_create_indexed_(int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr){ + MPI_Datatype tmp; + *ierr = MPI_Type_create_indexed(*count, blocklens, indices, simgrid::smpi::Datatype::f2c(*old_type), &tmp); + if(*ierr == MPI_SUCCESS) { + *newtype = tmp->add_f(); + } +} + void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, int* old_type, int*newtype, int* ierr){ MPI_Datatype tmp; diff --git a/src/smpi/include/private.h b/src/smpi/include/private.h index 41eb445793..0b713bee8f 100644 --- a/src/smpi/include/private.h +++ b/src/smpi/include/private.h @@ -121,6 +121,7 @@ void mpi_comm_free_(int* comm, int* ierr); void mpi_comm_split_(int* comm, int* color, int* key, int* comm_out, int* ierr); void mpi_group_incl_(int* group, int* n, int* key, int* group_out, int* ierr) ; void mpi_comm_group_(int* comm, int* group_out, int* ierr); +void mpi_comm_create_group_ (int* comm, int* group, int, int* comm_out, int* ierr); void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr); void mpi_isend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr); void mpi_irsend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr); @@ -167,7 +168,6 @@ void mpi_type_extent_(int* datatype, MPI_Aint * extent, int* ierr); void mpi_attr_get_(int* comm, int* keyval, void* attr_value, int* flag, int* ierr ); void mpi_type_commit_(int* datatype, int* ierr); void mpi_type_vector_(int* count, int* blocklen, int* stride, int* old_type, int* newtype, int* ierr); -void mpi_type_create_vector_(int* count, int* blocklen, int* stride, int* old_type, int* newtype, int* ierr); void mpi_type_hvector_(int* count, int* blocklen, MPI_Aint* stride, int* old_type, int* newtype, int* ierr); void mpi_type_create_hvector_(int* count, int* blocklen, MPI_Aint* stride, int* old_type, int* newtype, int* ierr); void mpi_type_free_(int* datatype, int* ierr); @@ -182,6 +182,26 @@ void mpi_win_post_(int* group, int assert, int* win, int* ierr); void mpi_win_start_(int* group, int assert, int* win, int* ierr); void mpi_win_complete_(int* win, int* ierr); void mpi_win_wait_(int* win, int* ierr); +void mpi_win_allocate_( MPI_Aint* size, int* disp_unit, int* info, int* comm, void* base, int* win, int* ierr); +void mpi_win_attach_(int* win, int* base, MPI_Aint* size, int* ierr); +void mpi_win_create_dynamic_( int* info, int* comm, int *win, int* ierr); +void mpi_win_detach_(int* win, int* base, int* ierr); +void mpi_win_set_info_(int* win, int* info, int* ierr); +void mpi_win_get_info_(int* win, int* info, int* ierr); +void mpi_win_get_group_(int* win, int* group, int* ierr); +void mpi_win_get_attr_(int* win, int* type_keyval, void* attribute_val, int* flag, int* ierr); +void mpi_win_set_attr_(int* win, int* type_keyval, void* att, int* ierr); +void mpi_win_delete_attr_(int* win, int* comm_keyval, int* ierr); +void mpi_win_create_keyval_(void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr); +void mpi_win_free_keyval_(int* keyval, int* ierr); +void mpi_win_lock_(int* lock_type, int* rank, int* assert, int* win, int* ierr); +void mpi_win_lock_all_(int* assert, int* win, int* ierr); +void mpi_win_unlock_(int* rank, int* win, int* ierr); +void mpi_win_unlock_all_(int* win, int* ierr); +void mpi_win_flush_(int* rank, int* win, int* ierr); +void mpi_win_flush_local_(int* rank, int* win, int* ierr); +void mpi_win_flush_all_(int* win, int* ierr); +void mpi_win_flush_local_all_(int* win, int* ierr); void mpi_info_create_( int *info, int* ierr); void mpi_info_set_( int *info, char *key, char *value, int* ierr, unsigned int keylen, unsigned int valuelen); void mpi_info_free_(int* info, int* ierr); @@ -189,8 +209,23 @@ void mpi_get_( int *origin_addr, int* origin_count, int* origin_datatype, int* t MPI_Aint* target_disp, int* target_count, int* target_datatype, int* win, int* ierr); void mpi_put_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, int* target_datatype, int* win, int* ierr); +void mpi_rget_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank, + MPI_Aint* target_disp, int* target_count, int* target_datatype, int* win, int* request, int* ierr); +void mpi_rput_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank, + MPI_Aint* target_disp, int* target_count, int* target_datatype, int* win, int* request, int* ierr); +void mpi_fetch_and_op_( int *origin_addr, int* result_addr, int* datatype, int* target_rank, MPI_Aint* target_disp, int* op, int* win, int* ierr); +void mpi_compare_and_swap_( int *origin_addr, int* compare_addr, int* result_addr, + int* datatype, int* target_rank, MPI_Aint* target_disp, int* win, int* ierr); +void mpi_get_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr, + int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, + int* target_datatype, int* op, int* win, int* ierr); +void mpi_rget_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr, + int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, + int* target_datatype, int* op, int* win, int* request, int* ierr); void mpi_accumulate_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, int* target_datatype, int* op, int* win, int* ierr); +void mpi_raccumulate_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank, + MPI_Aint* target_disp, int* target_count, int* target_datatype, int* op, int* win, int* request, int* ierr); void mpi_error_string_(int* errorcode, char* string, int* resultlen, int* ierr); void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst, int* sendtag, void *recvbuf, int* recvcount, int* recvtype, int* src, int* recvtag, int* comm, MPI_Status* status, int* ierr); @@ -214,6 +249,7 @@ void mpi_type_get_extent_ (int* datatype, MPI_Aint * lb, MPI_Aint * extent, int* void mpi_type_get_true_extent_ (int* datatype, MPI_Aint * lb, MPI_Aint * extent, int* ierr); void mpi_op_create_ (void * function, int* commute, int* op, int* ierr); void mpi_op_free_ (int* op, int* ierr); +void mpi_op_commutative_ (int* op, int* commute, int* ierr); void mpi_group_free_ (int* group, int* ierr); void mpi_group_size_ (int* group, int *size, int* ierr); void mpi_group_rank_ (int* group, int *rank, int* ierr); @@ -282,6 +318,7 @@ void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, i void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype, int* ierr) ; void mpi_type_indexed_ (int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr) ; +void mpi_type_create_indexed_ (int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr) ; void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, int* old_type, int*newtype, int* ierr); void mpi_type_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr) ; -- 2.20.1