Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 8d58e58

Browse files
committed
fortran: optimize testall and waitall when MPI_STATUSES_IGNORE is used
(back-ported from commit open-mpi/ompi@83375bc)
1 parent 3f4fd58 commit 8d58e58

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
* Copyright (c) 2004-2005 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
8-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
99
* University of Stuttgart. All rights reserved.
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$
14-
*
16+
*
1517
* Additional copyrights may follow
16-
*
18+
*
1719
* $HEADER$
1820
*/
1921

@@ -102,12 +104,11 @@ 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-
MPI_Status_c2f( &c_status[i], &array_of_statuses[i * (sizeof(MPI_Status) / sizeof(int))]);
110+
if (!OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
111+
MPI_Status_c2f( &c_status[i], &array_of_statuses[i * (sizeof(MPI_Status) / sizeof(int))]);
111112
}
112113
}
113114
}

0 commit comments

Comments
 (0)