From 4f377cfbcae89e70585c675eb978c7c8a33dd773 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Wed, 6 Mar 2013 17:30:05 +0100 Subject: [PATCH] add a bunch of bindings/new definitions of unimplemented MPI-2 functions, to make bigdft happy again --- include/smpi/mpif.h | 7 ++++ include/smpi/smpi.h | 10 ++++++ src/smpi/private.h | 14 ++++++++ src/smpi/smpi_f77.c | 79 ++++++++++++++++++++++++++++++++++++++++++++ src/smpi/smpi_mpi.c | 30 +++++++++++++++++ src/smpi/smpi_pmpi.c | 28 ++++++++++++++++ 6 files changed, 168 insertions(+) diff --git a/include/smpi/mpif.h b/include/smpi/mpif.h index 7c900d83cc..632e77d418 100644 --- a/include/smpi/mpif.h +++ b/include/smpi/mpif.h @@ -127,6 +127,13 @@ parameter(MPI_BAND=9) parameter(MPI_BOR=10) parameter(MPI_BXOR=11) + + INTEGER MPI_ADDRESS_KIND, MPI_OFFSET_KIND + PARAMETER (MPI_ADDRESS_KIND=8) + PARAMETER (MPI_OFFSET_KIND=8) + + INTEGER MPI_MODE_NOPRECEDE + PARAMETER (MPI_MODE_NOPRECEDE=8192) external MPI_INIT, MPI_FINALIZE, MPI_ABORT external MPI_COMM_RANK, MPI_COMM_SIZE, MPI_COMM_DUP, MPI_COMM_SPLIT diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index aa601ecddf..e3b4b1c3d3 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -401,6 +401,8 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Probe, //FIXME: these are not yet implemented typedef void MPI_Handler_function(MPI_Comm*, int*, ...); +typedef int MPI_Win; +typedef int MPI_Info; typedef void* MPI_Errhandler; typedef int MPI_Copy_function(MPI_Comm oldcomm, int keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, int* flag); @@ -464,6 +466,14 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Get_elements, (MPI_Status* status, MPI_Datatype da MPI_CALL(XBT_PUBLIC(int), MPI_Dims_create, (int nnodes, int ndims, int* dims)); MPI_CALL(XBT_PUBLIC(int), MPI_Initialized, (int* flag)); MPI_CALL(XBT_PUBLIC(int), MPI_Pcontrol, (const int level )); +MPI_CALL(XBT_PUBLIC(int), MPI_Win_fence,( int assert, MPI_Win win)); +MPI_CALL(XBT_PUBLIC(int), MPI_Win_free,( MPI_Win* win)); +MPI_CALL(XBT_PUBLIC(int), MPI_Win_create,( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win)); +MPI_CALL(XBT_PUBLIC(int), MPI_Info_create,( MPI_Info *info)); +MPI_CALL(XBT_PUBLIC(int), MPI_Info_set,( MPI_Info *info, char *key, char *value)); +MPI_CALL(XBT_PUBLIC(int), MPI_Info_free,( MPI_Info *info)); +MPI_CALL(XBT_PUBLIC(int), MPI_Get,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, + MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win)); //FIXME: End of all the not yet implemented stuff diff --git a/src/smpi/private.h b/src/smpi/private.h index 43f8c36b3a..f36e86890a 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -346,8 +346,22 @@ void mpi_testall__ (int* count, int * requests, int *flag, MPI_Status * statuse void mpi_get_count__(MPI_Status * status, int* datatype, int *count, int* ierr); 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); void mpi_type_lb__(int* datatype, MPI_Aint * extent, int* ierr); void mpi_type_ub__(int* datatype, MPI_Aint * extent, int* ierr); +void mpi_win_fence__( int* assert, int* win, int* ierr); +void mpi_win_free__( int* win, int* ierr); +void mpi_win_create__( int *base, MPI_Aint* size, int* disp_unit, int* info, int* comm, int *win, int* ierr); +void mpi_info_create__( int *info, int* ierr); +void mpi_info_set__( int *info, char *key, char *value, int* ierr); +void mpi_info_free__(int* info, int* ierr); +void mpi_get__( 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_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, diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index e9336754ad..5aaf1dca45 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -83,6 +83,10 @@ static MPI_Datatype get_datatype(int datatype) { : MPI_DATATYPE_NULL; } +static void free_datatype(int datatype) { + xbt_dynar_remove_at(datatype_lookup, datatype, NULL); +} + static int new_op(MPI_Op op) { xbt_dynar_push(op_lookup, &op); return (int)xbt_dynar_length(op_lookup) - 1; @@ -486,6 +490,51 @@ void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr){ *ierr= MPI_Type_extent(get_datatype(*datatype), extent); } +void mpi_type_commit__(int* datatype, int* ierr){ + MPI_Datatype tmp= get_datatype(*datatype); + *ierr= MPI_Type_commit(&tmp); +} + +void mpi_type_vector__(int* count, int* blocklen, int* stride, int* old_type, int* newtype, int* ierr){ + MPI_Datatype tmp; + *ierr= MPI_Type_vector(*count, *blocklen, *stride, get_datatype(*old_type), &tmp); + if(*ierr == MPI_SUCCESS) { + *newtype = new_datatype(tmp); + } +} + +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, get_datatype(*old_type), &tmp); + if(*ierr == MPI_SUCCESS) { + *newtype = new_datatype(tmp); + } +} + +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, get_datatype(*old_type), &tmp); + if(*ierr == MPI_SUCCESS) { + *newtype = new_datatype(tmp); + } +} + +void mpi_type_create_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, get_datatype(*old_type), &tmp); + if(*ierr == MPI_SUCCESS) { + *newtype = new_datatype(tmp); + } +} + +void mpi_type_free__(int* datatype, int* ierr){ + MPI_Datatype tmp= get_datatype(*datatype); + *ierr= MPI_Type_free (&tmp); + if(*ierr == MPI_SUCCESS) { + free_datatype(*datatype); + } +} + void mpi_type_ub__(int* datatype, MPI_Aint * disp, int* ierr){ *ierr= MPI_Type_ub(get_datatype(*datatype), disp); } @@ -502,3 +551,33 @@ void mpi_type_size__(int* datatype, int *size, int* ierr) void mpi_error_string__(int* errorcode, char* string, int* resultlen, int* ierr){ *ierr = MPI_Error_string(*errorcode, string, resultlen); } + +void mpi_win_fence__( int* assert, int* win, int* ierr){ + *ierr = MPI_Win_fence(* assert, *(MPI_Win*)win); +} + +void mpi_win_free__( int* win, int* ierr){ + *ierr = MPI_Win_free( (MPI_Win*)win); +} + +void mpi_win_create__( int *base, MPI_Aint* size, int* disp_unit, int* info, int* comm, int *win, int* ierr){ + *ierr = MPI_Win_create( (void*)base, *size, *disp_unit, *(MPI_Info*)info, get_comm(*comm),(MPI_Win*)win); +} + +void mpi_info_create__( int *info, int* ierr){ + *ierr = MPI_Info_create( (MPI_Info *)info); +} + +void mpi_info_set__( int *info, char *key, char *value, int* ierr){ + *ierr = MPI_Info_set( (MPI_Info *)info, key, value); +} + +void mpi_info_free__(int* info, int* ierr){ + *ierr = MPI_Info_free((MPI_Info *) info); +} + +void mpi_get__( 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){ + *ierr = MPI_Get( (void*)origin_addr,*origin_count, get_datatype(*origin_datatype),*target_rank, + *target_disp, *target_count,get_datatype(*target_datatype), *(MPI_Win *)win); +} diff --git a/src/smpi/smpi_mpi.c b/src/smpi/smpi_mpi.c index 518e265039..7778277dc2 100644 --- a/src/smpi/smpi_mpi.c +++ b/src/smpi/smpi_mpi.c @@ -711,3 +711,33 @@ int MPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status int MPI_Initialized(int* flag) { return PMPI_Initialized(flag); } + +int MPI_Win_fence( int assert, MPI_Win win){ + return PMPI_Win_fence( assert, win); +} + +int MPI_Win_free( MPI_Win* win){ + return PMPI_Win_free( win); +} + +int MPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){ + return PMPI_Win_create( base, size, disp_unit, info, comm,win); +} + +int MPI_Info_create( MPI_Info *info){ + return PMPI_Info_create( info); +} + +int MPI_Info_set( MPI_Info *info, char *key, char *value){ + return PMPI_Info_set( info, key, value); +} + +int MPI_Info_free( MPI_Info *info){ + return PMPI_Info_free( info); +} + +int MPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, + MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){ + return PMPI_Get( origin_addr,origin_count, origin_datatype,target_rank, + target_disp, target_count,target_datatype, win); +} diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 58cfb15661..d6938f5f7f 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -2334,4 +2334,32 @@ int PMPI_Dims_create(int nnodes, int ndims, int* dims) { return not_yet_implemented(); } +int PMPI_Win_fence( int assert, MPI_Win win){ + return not_yet_implemented(); +} + +int PMPI_Win_free( MPI_Win* win){ + return not_yet_implemented(); +} + +int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){ + return not_yet_implemented(); +} + +int PMPI_Info_create( MPI_Info *info){ + return not_yet_implemented(); +} + +int PMPI_Info_set( MPI_Info *info, char *key, char *value){ + return not_yet_implemented(); +} + +int PMPI_Info_free( MPI_Info *info){ + return not_yet_implemented(); +} + +int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, + MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){ + return not_yet_implemented(); +} -- 2.20.1