Skip to content

Commit 83375bc

Browse files
committed
fortran: optimize testall and waitall when MPI_STATUSES_IGNORE is used
1 parent a3327fe commit 83375bc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ompi/mpi/fortran/mpif-h/testall_f.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -107,11 +109,10 @@ void ompi_testall_f(MPI_Fint *count, MPI_Fint *array_of_requests, ompi_fortran_l
107109

108110
/* All Fortran Compilers have FALSE == 0, so just check for any
109111
nonzero value (because TRUE is not always == 1) */
110-
if (MPI_SUCCESS == c_ierr && *flag) {
112+
if (MPI_SUCCESS == c_ierr && !OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) && *flag) {
111113
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
112114
array_of_requests[i] = c_req[i]->req_f_to_c_index;
113-
if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
114-
!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
115+
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
115116
MPI_Status_c2f(&c_status[i], &array_of_statuses[i * (sizeof(MPI_Status) / sizeof(int))]);
116117
}
117118
}

ompi/mpi/fortran/mpif-h/waitall_f.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -102,11 +104,10 @@ void ompi_waitall_f(MPI_Fint *count, MPI_Fint *array_of_requests,
102104
c_ierr = MPI_Waitall(OMPI_FINT_2_INT(*count), c_req, c_status);
103105
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
104106

105-
if (MPI_SUCCESS == c_ierr) {
107+
if (MPI_SUCCESS == c_ierr && !OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses)) {
106108
for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
107109
array_of_requests[i] = c_req[i]->req_f_to_c_index;
108-
if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
109-
!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
110+
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
110111
MPI_Status_c2f( &c_status[i], &array_of_statuses[i * (sizeof(MPI_Status) / sizeof(int))]);
111112
}
112113
}

0 commit comments

Comments
 (0)