From: pini Date: Mon, 6 Sep 2010 09:12:15 +0000 (+0000) Subject: Added missing MPI call. X-Git-Tag: v3_5~654 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/219621110c7f3906fa7e9bee2efe3ecab596f773 Added missing MPI call. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8168 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 5d5dfb5289..1bae75b13d 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -64,6 +64,7 @@ typedef struct { int MPI_SOURCE; int MPI_TAG; int MPI_ERROR; + int count; } MPI_Status; #define MPI_STATUS_IGNORE NULL @@ -184,6 +185,7 @@ XBT_PUBLIC(int) MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MP XBT_PUBLIC(int) MPI_Comm_rank(MPI_Comm comm, int* rank); XBT_PUBLIC(int) MPI_Comm_size(MPI_Comm comm, int* size); XBT_PUBLIC(int) MPI_Get_processor_name(char *name, int *resultlen); +XBT_PUBLIC(int) MPI_Get_count(MPI_Status* status, MPI_Datatype datatype, int* count); XBT_PUBLIC(int) MPI_Comm_group(MPI_Comm comm, MPI_Group* group); XBT_PUBLIC(int) MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int* result); diff --git a/src/smpi/private.h b/src/smpi/private.h index 244af7a119..a604da4463 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -94,6 +94,7 @@ void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int dst, int tag void smpi_mpi_sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status); int smpi_mpi_test(MPI_Request* request, MPI_Status* status); int smpi_mpi_testany(int count, MPI_Request requests[], int* index, MPI_Status* status); +int smpi_mpi_get_count(MPI_Status* status, MPI_Datatype datatype); void smpi_mpi_wait(MPI_Request* request, MPI_Status* status); int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status* status); void smpi_mpi_waitall(int count, MPI_Request requests[], MPI_Status status[]); diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index ed9620b716..e82e6d00c7 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -158,11 +158,16 @@ void smpi_mpi_sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int } } +int smpi_mpi_get_count(MPI_Status* status, MPI_Datatype datatype) { + return status->count / smpi_datatype_size(datatype); +} + static void finish_wait(MPI_Request* request, MPI_Status* status) { if(status != MPI_STATUS_IGNORE) { status->MPI_SOURCE = (*request)->src; status->MPI_TAG = (*request)->tag; status->MPI_ERROR = MPI_SUCCESS; + status->count = SIMIX_communication_get_dst_buf_size((*request)->pair); } print_request("finishing wait", *request); if((*request)->complete == 1) { diff --git a/src/smpi/smpi_mpi.c b/src/smpi/smpi_mpi.c index 4a5cd8d51d..05a6369186 100644 --- a/src/smpi/smpi_mpi.c +++ b/src/smpi/smpi_mpi.c @@ -1465,8 +1465,9 @@ int MPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype s } -int MPI_Get_processor_name( char *name, int *resultlen ) { +int MPI_Get_processor_name(char* name, int* resultlen) { int retval = MPI_SUCCESS; + smpi_bench_end(-1, NULL); strncpy( name , SIMIX_host_get_name(SIMIX_host_self()), MPI_MAX_PROCESSOR_NAME-1); *resultlen= strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name); @@ -1475,3 +1476,25 @@ int MPI_Get_processor_name( char *name, int *resultlen ) { return retval; } +int MPI_Get_count(MPI_Status* status, MPI_Datatype datatype, int* count) { + int retval = MPI_SUCCESS; + size_t size; + + smpi_bench_end(-1, NULL); + if (status == NULL || count == NULL) { + retval = MPI_ERR_ARG; + } else if (datatype == MPI_DATATYPE_NULL) { + retval = MPI_ERR_TYPE; + } else { + size = smpi_datatype_size(datatype); + if (size == 0) { + *count = 0; + } else if (status->count % size != 0) { + retval = MPI_UNDEFINED; + } else { + *count = smpi_mpi_get_count(status, datatype); + } + } + smpi_bench_begin(-1, NULL); + return retval; +}