From: Augustin Degomme Date: Thu, 25 Oct 2012 15:54:31 +0000 (+0200) Subject: add a few fortran bindings and types to have better support for mpich tests X-Git-Tag: v3_9_rc1~91^2~211 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fce65f194ca0bb025602ff52929597c76a99bbfb add a few fortran bindings and types to have better support for mpich tests --- diff --git a/include/smpi/mpif.h b/include/smpi/mpif.h index 5222b5c2c1..6c71f116e7 100644 --- a/include/smpi/mpif.h +++ b/include/smpi/mpif.h @@ -77,7 +77,7 @@ > MPI_INTEGER8, MPI_REAL, MPI_REAL4, MPI_REAL8, > MPI_DOUBLE_PRECISION, MPI_COMPLEX, MPI_DOUBLE_COMPLEX, > MPI_2INTEGER, MPI_LOGICAL1, MPI_LOGICAL2, MPI_LOGICAL4, - > MPI_LOGICAL8 + > MPI_LOGICAL8, MPI_2REAL, MPI_2DOUBLE_PRECISION parameter(MPI_DATATYPE_NULL=-1) parameter(MPI_BYTE=0) parameter(MPI_CHARACTER=1) @@ -98,6 +98,8 @@ parameter(MPI_LOGICAL2=16) parameter(MPI_LOGICAL4=17) parameter(MPI_LOGICAL8=18) + parameter(MPI_2REAL=19) + parameter(MPI_2DOUBLE_PRECISION=19) ! These should be ordered as in smpi_f77.c integer MPI_OP_NULL,MPI_MAX, MPI_MIN, MPI_MAXLOC, MPI_MINLOC, @@ -128,4 +130,7 @@ > MPI_ALLTOALL external MPI_WTIME + external MPI_WTICK + double precision MPI_WTIME + double precision MPI_WTICK diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index d032ac38a8..7a2ea0d770 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -129,12 +129,14 @@ XBT_PUBLIC( MPI_Datatype ) MPI_OFFSET; XBT_PUBLIC( MPI_Datatype ) MPI_LB; XBT_PUBLIC( MPI_Datatype ) MPI_UB; //The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC. -XBT_PUBLIC( MPI_Datatype ) MPI_FLOAT_INT; -XBT_PUBLIC( MPI_Datatype ) MPI_LONG_INT; -XBT_PUBLIC( MPI_Datatype ) MPI_DOUBLE_INT; -XBT_PUBLIC( MPI_Datatype ) MPI_SHORT_INT; -XBT_PUBLIC( MPI_Datatype ) MPI_2INT; -XBT_PUBLIC( MPI_Datatype ) MPI_LONG_DOUBLE_INT; +extern MPI_Datatype MPI_FLOAT_INT; +extern MPI_Datatype MPI_LONG_INT; +extern MPI_Datatype MPI_DOUBLE_INT; +extern MPI_Datatype MPI_SHORT_INT; +extern MPI_Datatype MPI_2INT; +extern MPI_Datatype MPI_LONG_DOUBLE_INT; +XBT_PUBLIC(MPI_Datatype) MPI_2FLOAT; +XBT_PUBLIC(MPI_Datatype) MPI_2DOUBLE; typedef void MPI_User_function(void *invec, void *inoutvec, int *len, MPI_Datatype * datatype); diff --git a/src/smpi/private.h b/src/smpi/private.h index 770d816858..fe03a57c09 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -250,6 +250,7 @@ void mpi_abort__(int* comm, int* errorcode, int* ierr); void mpi_comm_rank__(int* comm, int* rank, int* ierr); void mpi_comm_size__(int* comm, int* size, int* ierr); double mpi_wtime__(void); +double mpi_wtick__(void); void mpi_comm_dup__(int* comm, int* newcomm, int* ierr); void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr); @@ -287,9 +288,20 @@ void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype, void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr); +void mpi_allgatherv__(void* sendbuf, int* sendcount, int* sendtype, + void* recvbuf, int* recvcount,int* displs, int* recvtype, + int* comm, int* ierr) ; +void mpi_type_size__(int* datatype, int *size, int* ierr); + void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr); void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr); +void mpi_get_processor_name__(char *name, int *resultlen, int* ierr); +void mpi_test__ (int * request, int *flag, MPI_Status * status, int* ierr); +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_type_lb__(int* datatype, MPI_Aint * extent, int* ierr); +void mpi_type_ub__(int* datatype, MPI_Aint * extent, int* ierr); #endif diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index c467cc84f0..ffe8916651 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -101,6 +101,9 @@ void mpi_init__(int* ierr) { new_datatype(MPI_UINT16_T); new_datatype(MPI_UINT32_T); new_datatype(MPI_UINT64_T); + new_datatype(MPI_2FLOAT); + new_datatype(MPI_2DOUBLE); + op_lookup = xbt_dynar_new(sizeof(MPI_Op), NULL); new_op(MPI_MAX); @@ -148,6 +151,10 @@ double mpi_wtime__(void) { return MPI_Wtime(); } +double mpi_wtick__(void) { + return MPI_Wtick(); +} + void mpi_comm_dup__(int* comm, int* newcomm, int* ierr) { MPI_Comm tmp; @@ -311,6 +318,13 @@ void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype, recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*comm)); } +void mpi_allgatherv__(void* sendbuf, int* sendcount, int* sendtype, + void* recvbuf, int* recvcount,int* displs, int* recvtype, + int* comm, int* ierr) { + *ierr = MPI_Allgatherv(sendbuf, *sendcount, get_datatype(*sendtype), + recvbuf, recvcount, displs, get_datatype(*recvtype), get_comm(*comm)); +} + void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) { *ierr = MPI_Scan(sendbuf, recvbuf, *count, get_datatype(*datatype), @@ -322,3 +336,32 @@ void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype, *ierr = MPI_Alltoall(sendbuf, *sendcount, get_datatype(*sendtype), recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*comm)); } + +void mpi_test__ (int * request, int *flag, MPI_Status * status, int* ierr){ + MPI_Request req = find_request(*request); + *ierr= MPI_Test(&req, flag, status); +} +void mpi_get_processor_name__(char *name, int *resultlen, int* ierr){ + *ierr = MPI_Get_processor_name(name, resultlen); +} + +void mpi_get_count__(MPI_Status * status, int* datatype, int *count, int* ierr){ + *ierr = MPI_Get_count(status, get_datatype(*datatype), count); +} + +void mpi_type_extent__(int* datatype, MPI_Aint * extent, int* ierr){ + *ierr= MPI_Type_extent(get_datatype(*datatype), extent); +} + +void mpi_type_ub__(int* datatype, MPI_Aint * disp, int* ierr){ + *ierr= MPI_Type_ub(get_datatype(*datatype), disp); +} + +void mpi_type_lb__(int* datatype, MPI_Aint * extent, int* ierr){ + *ierr= MPI_Type_extent(get_datatype(*datatype), extent); +} + +void mpi_type_size__(int* datatype, int *size, int* ierr) +{ + *ierr = MPI_Type_size(get_datatype(*datatype), size); +} diff --git a/src/smpi/smpi_mpi_dt.c b/src/smpi/smpi_mpi_dt.c index efc7f6b1b6..1477cec75c 100644 --- a/src/smpi/smpi_mpi_dt.c +++ b/src/smpi/smpi_mpi_dt.c @@ -44,6 +44,14 @@ typedef struct { float value; int index; } float_int; +typedef struct { + float value; + float index; +} float_float; +typedef struct { + double value; + double index; +} double_double; typedef struct { long value; int index; @@ -101,6 +109,9 @@ CREATE_MPI_DATATYPE(MPI_LONG_INT, long_int); CREATE_MPI_DATATYPE(MPI_DOUBLE_INT, double_int); CREATE_MPI_DATATYPE(MPI_SHORT_INT, short_int); CREATE_MPI_DATATYPE(MPI_2INT, int_int); +CREATE_MPI_DATATYPE(MPI_2FLOAT, float_float); +CREATE_MPI_DATATYPE(MPI_2DOUBLE, double_double); + CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE_INT, long_double_int); CREATE_MPI_DATATYPE_NULL(MPI_UB); @@ -1148,6 +1159,10 @@ static void minloc_func(void *a, void *b, int *length, APPLY_FUNC(a, b, length, int_int, MINLOC_OP); } else if (*datatype == MPI_LONG_DOUBLE_INT) { APPLY_FUNC(a, b, length, long_double_int, MINLOC_OP); + } else if (*datatype == MPI_2FLOAT) { + APPLY_FUNC(a, b, length, float_float, MINLOC_OP); + } else if (*datatype == MPI_2DOUBLE) { + APPLY_FUNC(a, b, length, double_double, MINLOC_OP); } } @@ -1166,6 +1181,10 @@ static void maxloc_func(void *a, void *b, int *length, APPLY_FUNC(a, b, length, int_int, MAXLOC_OP); } else if (*datatype == MPI_LONG_DOUBLE_INT) { APPLY_FUNC(a, b, length, long_double_int, MAXLOC_OP); + } else if (*datatype == MPI_2FLOAT) { + APPLY_FUNC(a, b, length, float_float, MAXLOC_OP); + } else if (*datatype == MPI_2DOUBLE) { + APPLY_FUNC(a, b, length, double_double, MAXLOC_OP); } }