From: Augustin Degomme Date: Wed, 17 Jul 2013 15:56:59 +0000 (+0200) Subject: fix behavior of MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE with fortran X-Git-Tag: v3_9_90~128^2~58 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a8789d26b134d65148058b8ec759127e97055b67 fix behavior of MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE with fortran --- diff --git a/include/smpi/mpif.h b/include/smpi/mpif.h index f8f31e01f9..b8424469a1 100644 --- a/include/smpi/mpif.h +++ b/include/smpi/mpif.h @@ -111,10 +111,10 @@ ! This should be equal to the number of int fields in MPI_Status integer MPI_STATUS_SIZE, MPI_STATUSES_IGNORE parameter(MPI_STATUS_SIZE=4) - common/smpi/ MPI_STATUSES_IGNORE + parameter(MPI_STATUSES_IGNORE=-1) - integer MPI_STATUS_IGNORE(MPI_STATUS_SIZE) - common/smpi/ MPI_STATUS_IGNORE + integer MPI_STATUS_IGNORE + parameter(MPI_STATUS_IGNORE=-1) integer MPI_REQUEST_NULL parameter(MPI_REQUEST_NULL=-1) diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 2aec62ae26..47ffd5f35f 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -167,6 +167,8 @@ typedef struct { #define MPI_STATUS_IGNORE NULL #define MPI_STATUSES_IGNORE NULL +#define MPI_FORTRAN_STATUS_IGNORE -1 +#define MPI_FORTRAN_STATUSES_IGNORE -1 #define MPI_DATATYPE_NULL NULL XBT_PUBLIC_DATA( MPI_Datatype ) MPI_CHAR; diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index 61d4b4639c..a74500b8d6 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -25,6 +25,8 @@ static int running_processes = 0; /* Convert between Fortran and C MPI_BOTTOM */ #define F2C_BOTTOM(addr) ((addr!=MPI_IN_PLACE && *(int*)addr == MPI_FORTRAN_BOTTOM) ? MPI_BOTTOM : (addr)) #define F2C_IN_PLACE(addr) ((addr!=MPI_BOTTOM &&*(int*)addr == MPI_FORTRAN_IN_PLACE) ? MPI_IN_PLACE : (addr)) +#define F2C_STATUS_IGNORE(addr) ((*(int*)addr == MPI_FORTRAN_STATUS_IGNORE) ? MPI_STATUS_IGNORE : (addr)) +#define F2C_STATUSES_IGNORE(addr) ((*(int*)addr == MPI_FORTRAN_STATUSES_IGNORE) ? MPI_STATUSES_IGNORE : (addr)) #define KEY_SIZE (sizeof(int) * 2 + 1) @@ -353,7 +355,7 @@ void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst, int* comm, MPI_Status* status, int* ierr) { *ierr = MPI_Sendrecv(sendbuf, *sendcount, get_datatype(*sendtype), *dst, *sendtag, recvbuf, *recvcount,get_datatype(*recvtype), *src, *recvtag, - get_comm(*comm), status); + get_comm(*comm), F2C_STATUS_IGNORE(status)); } void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag, @@ -405,7 +407,7 @@ void mpi_startall_(int* count, int* requests, int* ierr) { void mpi_wait_(int* request, MPI_Status* status, int* ierr) { MPI_Request req = find_request(*request); - *ierr = MPI_Wait(&req, status); + *ierr = MPI_Wait(&req, F2C_STATUS_IGNORE(status)); if(req==MPI_REQUEST_NULL){ free_request(*request); *request=MPI_FORTRAN_REQUEST_NULL; @@ -436,7 +438,7 @@ void mpi_waitall_(int* count, int* requests, MPI_Status* status, int* ierr) { for(i = 0; i < *count; i++) { reqs[i] = find_request(requests[i]); } - *ierr = MPI_Waitall(*count, reqs, status); + *ierr = MPI_Waitall(*count, reqs, F2C_STATUSES_IGNORE(status)); for(i = 0; i < *count; i++) { if(reqs[i]==MPI_REQUEST_NULL){ free_request(requests[i]); @@ -551,7 +553,7 @@ void mpi_alltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendtyp void mpi_test_ (int * request, int *flag, MPI_Status * status, int* ierr){ MPI_Request req = find_request(*request); - *ierr= MPI_Test(&req, flag, status); + *ierr= MPI_Test(&req, flag, F2C_STATUS_IGNORE(status)); if(req==MPI_REQUEST_NULL){ free_request(*request); *request=MPI_FORTRAN_REQUEST_NULL; @@ -566,7 +568,7 @@ void mpi_testall_ (int* count, int * requests, int *flag, MPI_Status * statuses for(i = 0; i < *count; i++) { reqs[i] = find_request(requests[i]); } - *ierr= MPI_Testall(*count, reqs, flag, statuses); + *ierr= MPI_Testall(*count, reqs, flag, F2C_STATUSES_IGNORE(statuses)); for(i = 0; i < *count; i++) { if(reqs[i]==MPI_REQUEST_NULL){ free_request(requests[i]); @@ -581,7 +583,7 @@ void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){ } void mpi_get_count_(MPI_Status * status, int* datatype, int *count, int* ierr){ - *ierr = MPI_Get_count(status, get_datatype(*datatype), count); + *ierr = MPI_Get_count(F2C_STATUS_IGNORE(status), get_datatype(*datatype), count); } void mpi_attr_get_(int* comm, int* keyval, void* attr_value, int* flag, int* ierr ){ @@ -966,7 +968,7 @@ void mpi_sendrecv_replace_ (void *buf, int* count, int* datatype, int* dst, int* { *ierr = MPI_Sendrecv_replace(buf, *count, get_datatype(*datatype), *dst, *sendtag, *src, - *recvtag, get_comm(*comm), status); + *recvtag, get_comm(*comm), F2C_STATUS_IGNORE(status)); } void mpi_testany_ (int* count, int* requests, int *index, int *flag, MPI_Status* status, int* ierr) @@ -978,7 +980,7 @@ void mpi_testany_ (int* count, int* requests, int *index, int *flag, MPI_Status* for(i = 0; i < *count; i++) { reqs[i] = find_request(requests[i]); } - *ierr = MPI_Testany(*count, reqs, index, flag, status); + *ierr = MPI_Testany(*count, reqs, index, flag, F2C_STATUS_IGNORE(status)); if(*index!=MPI_UNDEFINED) if(reqs[*index]==MPI_REQUEST_NULL){ free_request(requests[*index]); @@ -1154,7 +1156,7 @@ void mpi_testsome_ (int* incount, int* requests, int* outcount, int* indices, M reqs[i] = find_request(requests[i]); indices[i]=0; } - *ierr = MPI_Testsome(*incount, reqs, outcount, indices, statuses); + *ierr = MPI_Testsome(*incount, reqs, outcount, indices, F2C_STATUSES_IGNORE(statuses)); for(i=0;i<*incount;i++){ if(indices[i]){ if(reqs[indices[i]]==MPI_REQUEST_NULL){ @@ -1311,7 +1313,7 @@ void mpi_issend_ (void* buf, int* count, int* datatype, int *dest, int* tag, int } void mpi_probe_ (int* source, int* tag, int* comm, MPI_Status* status, int* ierr) { - *ierr = MPI_Probe(*source, *tag, get_comm(*comm), status); + *ierr = MPI_Probe(*source, *tag, get_comm(*comm), F2C_STATUS_IGNORE(status)); } void mpi_attr_delete_ (int* comm, int* keyval, int* ierr) {