|
2 | 2 | * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana |
3 | 3 | * University Research and Technology |
4 | 4 | * Corporation. All rights reserved. |
5 | | - * Copyright (c) 2004-2005 The University of Tennessee and The University |
| 5 | + * Copyright (c) 2004-2021 The University of Tennessee and The University |
6 | 6 | * of Tennessee Research Foundation. All rights |
7 | 7 | * reserved. |
8 | 8 | * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
|
23 | 23 |
|
24 | 24 | #include "ompi/mpi/fortran/mpif-h/bindings.h" |
25 | 25 | #include "ompi/mpi/fortran/base/constants.h" |
26 | | -#include "ompi/communicator/communicator.h" |
| 26 | +#include "ompi/mca/coll/base/coll_base_util.h" |
27 | 27 |
|
28 | 28 | #if OMPI_BUILD_MPI_PROFILING |
29 | 29 | #if OPAL_HAVE_WEAK_SYMBOLS |
@@ -78,7 +78,7 @@ void ompi_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts, |
78 | 78 | MPI_Datatype *c_sendtypes = NULL, *c_recvtypes; |
79 | 79 | MPI_Info c_info; |
80 | 80 | MPI_Request c_request; |
81 | | - int size, c_ierr; |
| 81 | + int size, idx = 0, c_ierr; |
82 | 82 | OMPI_ARRAY_NAME_DECL(sendcounts); |
83 | 83 | OMPI_ARRAY_NAME_DECL(sdispls); |
84 | 84 | OMPI_ARRAY_NAME_DECL(recvcounts); |
@@ -117,14 +117,30 @@ void ompi_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts, |
117 | 117 | OMPI_ARRAY_NAME_CONVERT(rdispls), |
118 | 118 | c_recvtypes, c_comm, c_info, &c_request); |
119 | 119 | if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); |
120 | | - if (MPI_SUCCESS == c_ierr) *request = PMPI_Request_c2f(c_request); |
121 | | - |
122 | | - OMPI_ARRAY_FINT_2_INT_CLEANUP(sendcounts); |
123 | | - OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls); |
124 | | - OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts); |
125 | | - OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls); |
126 | | - if (NULL != c_sendtypes) { |
127 | | - free(c_sendtypes); |
| 120 | + if (MPI_SUCCESS == c_ierr) { |
| 121 | + *request = PMPI_Request_c2f(c_request); |
| 122 | + ompi_coll_base_nbc_request_t* nb_request = (ompi_coll_base_nbc_request_t*)c_request; |
| 123 | + nb_request->data.release_arrays[idx++] = c_recvtypes; |
| 124 | + if (recvcounts != OMPI_ARRAY_NAME_CONVERT(recvcounts)) { |
| 125 | + nb_request->data.release_arrays[idx++] = OMPI_ARRAY_NAME_CONVERT(recvcounts); |
| 126 | + nb_request->data.release_arrays[idx++] = OMPI_ARRAY_NAME_CONVERT(rdispls); |
| 127 | + } |
| 128 | + if (NULL != c_sendtypes) { |
| 129 | + nb_request->data.release_arrays[idx++] = c_sendtypes; |
| 130 | + if (sendcounts != OMPI_ARRAY_NAME_CONVERT(sendcounts)) { |
| 131 | + nb_request->data.release_arrays[idx++] = OMPI_ARRAY_NAME_CONVERT(sendcounts); |
| 132 | + nb_request->data.release_arrays[idx++] = OMPI_ARRAY_NAME_CONVERT(sdispls); |
| 133 | + } |
| 134 | + } |
| 135 | + nb_request->data.release_arrays[idx] = NULL; |
| 136 | + } else { |
| 137 | + OMPI_ARRAY_FINT_2_INT_CLEANUP(sendcounts); |
| 138 | + OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls); |
| 139 | + OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts); |
| 140 | + OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls); |
| 141 | + if (NULL != c_sendtypes) { |
| 142 | + free(c_sendtypes); |
| 143 | + } |
| 144 | + free(c_recvtypes); |
128 | 145 | } |
129 | | - free(c_recvtypes); |
130 | 146 | } |
0 commit comments