Skip to content

Commit 369754d

Browse files
committed
Define the object class for the isendrecv request once.
This patch works, but the code is ugly, each file using a static structure and function which ends up being defined twice (for MPI and PMPI API). There is no better solution at the MPI API level that would not require adding additional files to move the structure declaration, callback implementations and the class implementation into. Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
1 parent 64b84e6 commit 369754d

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

ompi/mpi/c/isendrecv.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2021 The University of Tennessee and The University
6+
* Copyright (c) 2004-2022 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -53,7 +53,11 @@ struct ompi_isendrecv_context_t {
5353
};
5454

5555
typedef struct ompi_isendrecv_context_t ompi_isendrecv_context_t;
56+
#if OMPI_BUILD_MPI_PROFILING
5657
OBJ_CLASS_INSTANCE(ompi_isendrecv_context_t, opal_object_t, NULL, NULL);
58+
#else
59+
OBJ_CLASS_DECLARATION(ompi_isendrecv_context_t);
60+
#endif /* OMPI_BUILD_MPI_PROFILING */
5761

5862
static int ompi_isendrecv_complete_func (ompi_comm_request_t *request)
5963
{
@@ -66,7 +70,7 @@ static int ompi_isendrecv_complete_func (ompi_comm_request_t *request)
6670
*
6771
* Probably need to bring up in the MPI forum.
6872
*/
69-
73+
7074
if (MPI_PROC_NULL != context->source) {
7175
OMPI_COPY_STATUS(&request->super.req_status,
7276
context->subreq[0]->req_status, false);
@@ -129,21 +133,21 @@ int MPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
129133

130134
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
131135
}
132-
136+
133137
crequest = ompi_comm_request_get ();
134138
if (NULL == crequest) {
135139
return OMPI_ERR_OUT_OF_RESOURCE;
136140
}
137-
141+
138142
context = OBJ_NEW(ompi_isendrecv_context_t);
139143
if (NULL == context) {
140144
ompi_comm_request_return (crequest);
141145
return OMPI_ERR_OUT_OF_RESOURCE;
142146
}
143147

144148
crequest->context = &context->super;
145-
context->subreq[0] = NULL;
146-
context->subreq[1] = NULL;
149+
context->subreq[0] = MPI_REQUEST_NULL;
150+
context->subreq[1] = MPI_REQUEST_NULL;
147151
context->source = source;
148152

149153
if (source != MPI_PROC_NULL) { /* post recv */
@@ -158,7 +162,7 @@ int MPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
158162

159163
if (dest != MPI_PROC_NULL) { /* send */
160164
rc = MCA_PML_CALL(isend(sendbuf, sendcount, sendtype, dest,
161-
sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++]));
165+
sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++]));
162166
if (MPI_SUCCESS != rc) {
163167
OBJ_RELEASE(context);
164168
ompi_comm_request_return (crequest);

ompi/mpi/c/isendrecv_replace.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2020 The University of Tennessee and The University
5+
* Copyright (c) 2004-2022 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
@@ -57,6 +57,7 @@ struct ompi_isendrecv_replace_context_t {
5757

5858
typedef struct ompi_isendrecv_replace_context_t ompi_isendrecv_replace_context_t;
5959

60+
#if OMPI_BUILD_MPI_PROFILING
6061
static void ompi_isendrecv_context_constructor(ompi_isendrecv_replace_context_t *context)
6162
{
6263
context->packed_size = 0;
@@ -75,6 +76,9 @@ OBJ_CLASS_INSTANCE(ompi_isendrecv_replace_context_t,
7576
opal_object_t,
7677
ompi_isendrecv_context_constructor,
7778
ompi_isendrecv_context_destructor);
79+
#else
80+
OBJ_CLASS_DECLARATION(ompi_isendrecv_replace_context_t);
81+
#endif /* OMPI_BUILD_MPI_PROFILING */
7882

7983
static int ompi_isendrecv_replace_complete_func (ompi_comm_request_t *request)
8084
{
@@ -87,7 +91,7 @@ static int ompi_isendrecv_replace_complete_func (ompi_comm_request_t *request)
8791
*
8892
* Probably need to bring up in the MPI forum.
8993
*/
90-
94+
9195
if (MPI_PROC_NULL != context->source) {
9296
OMPI_COPY_STATUS(&request->super.req_status,
9397
context->subreq[0]->req_status, false);
@@ -165,7 +169,7 @@ int MPI_Isendrecv_replace(void * buf, int count, MPI_Datatype datatype,
165169
if (NULL == crequest) {
166170
return OMPI_ERR_OUT_OF_RESOURCE;
167171
}
168-
172+
169173
context = OBJ_NEW(ompi_isendrecv_replace_context_t);
170174
if (NULL == context) {
171175
ompi_comm_request_return (crequest);
@@ -205,7 +209,7 @@ int MPI_Isendrecv_replace(void * buf, int count, MPI_Datatype datatype,
205209
rc = MPI_ERR_UNKNOWN;
206210
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
207211
}
208-
212+
209213
if (source != MPI_PROC_NULL) { /* post recv */
210214
rc = MCA_PML_CALL(irecv(buf, count, datatype,
211215
source, recvtag, comm, &context->subreq[nreqs++]));

0 commit comments

Comments
 (0)