|
9 | 9 | * University of Stuttgart. All rights reserved. |
10 | 10 | * Copyright (c) 2004-2005 The Regents of the University of California. |
11 | 11 | * All rights reserved. |
12 | | - * Copyright (c) 2015-2016 Research Organization for Information Science |
| 12 | + * Copyright (c) 2015-2017 Research Organization for Information Science |
13 | 13 | * and Technology (RIST). All rights reserved. |
14 | 14 | * $COPYRIGHT$ |
15 | 15 | * |
|
27 | 27 | #include "ompi/op/op.h" |
28 | 28 | #include "ompi/mca/coll/coll.h" |
29 | 29 | #include "ompi/mca/coll/base/coll_tags.h" |
| 30 | +#include "ompi/mca/coll/base/coll_base_util.h" |
30 | 31 | #include "coll_basic.h" |
31 | 32 | #include "ompi/mca/pml/pml.h" |
32 | 33 |
|
@@ -83,7 +84,6 @@ mca_coll_basic_allreduce_inter(const void *sbuf, void *rbuf, int count, |
83 | 84 | int err, i, rank, root = 0, rsize, line; |
84 | 85 | ptrdiff_t extent, dsize, gap; |
85 | 86 | char *tmpbuf = NULL, *pml_buffer = NULL; |
86 | | - ompi_request_t *req[2]; |
87 | 87 | ompi_request_t **reqs = NULL; |
88 | 88 |
|
89 | 89 | rank = ompi_comm_rank(comm); |
@@ -114,18 +114,11 @@ mca_coll_basic_allreduce_inter(const void *sbuf, void *rbuf, int count, |
114 | 114 | } |
115 | 115 |
|
116 | 116 | /* Do a send-recv between the two root procs. to avoid deadlock */ |
117 | | - err = MCA_PML_CALL(irecv(rbuf, count, dtype, 0, |
118 | | - MCA_COLL_BASE_TAG_ALLREDUCE, comm, |
119 | | - &(req[0]))); |
120 | | - if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; } |
121 | | - |
122 | | - err = MCA_PML_CALL(isend(sbuf, count, dtype, 0, |
123 | | - MCA_COLL_BASE_TAG_ALLREDUCE, |
124 | | - MCA_PML_BASE_SEND_STANDARD, |
125 | | - comm, &(req[1]))); |
126 | | - if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; } |
127 | | - |
128 | | - err = ompi_request_wait_all(2, req, MPI_STATUSES_IGNORE); |
| 117 | + err = ompi_coll_base_sendrecv_actual(sbuf, count, dtype, 0, |
| 118 | + MCA_COLL_BASE_TAG_ALLREDUCE, |
| 119 | + rbuf, count, dtype, 0, |
| 120 | + MCA_COLL_BASE_TAG_ALLREDUCE, |
| 121 | + comm, MPI_STATUS_IGNORE); |
129 | 122 | if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; } |
130 | 123 |
|
131 | 124 | /* Loop receiving and calling reduction function (C or Fortran). */ |
@@ -154,18 +147,11 @@ mca_coll_basic_allreduce_inter(const void *sbuf, void *rbuf, int count, |
154 | 147 | /***************************************************************************/ |
155 | 148 | if (rank == root) { |
156 | 149 | /* sendrecv between the two roots */ |
157 | | - err = MCA_PML_CALL(irecv(pml_buffer, count, dtype, 0, |
158 | | - MCA_COLL_BASE_TAG_ALLREDUCE, |
159 | | - comm, &(req[1]))); |
160 | | - if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; } |
161 | | - |
162 | | - err = MCA_PML_CALL(isend(rbuf, count, dtype, 0, |
163 | | - MCA_COLL_BASE_TAG_ALLREDUCE, |
164 | | - MCA_PML_BASE_SEND_STANDARD, comm, |
165 | | - &(req[0]))); |
166 | | - if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; } |
167 | | - |
168 | | - err = ompi_request_wait_all(2, req, MPI_STATUSES_IGNORE); |
| 150 | + err = ompi_coll_base_sendrecv_actual(rbuf, count, dtype, 0, |
| 151 | + MCA_COLL_BASE_TAG_ALLREDUCE, |
| 152 | + pml_buffer, count, dtype, 0, |
| 153 | + MCA_COLL_BASE_TAG_ALLREDUCE, |
| 154 | + comm, MPI_STATUS_IGNORE); |
169 | 155 | if (OMPI_SUCCESS != err) { line = __LINE__; goto exit; } |
170 | 156 |
|
171 | 157 | /* distribute the data to other processes in remote group. |
|
0 commit comments