Skip to content

Define the object class for the isendrecv request once. #9990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions ompi/mpi/c/isendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2021 The University of Tennessee and The University
* Copyright (c) 2004-2022 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
Expand Down Expand Up @@ -53,7 +53,11 @@ struct ompi_isendrecv_context_t {
};

typedef struct ompi_isendrecv_context_t ompi_isendrecv_context_t;
#if OMPI_BUILD_MPI_PROFILING
OBJ_CLASS_INSTANCE(ompi_isendrecv_context_t, opal_object_t, NULL, NULL);
#else
OBJ_CLASS_DECLARATION(ompi_isendrecv_context_t);
#endif /* OMPI_BUILD_MPI_PROFILING */

static int ompi_isendrecv_complete_func (ompi_comm_request_t *request)
{
Expand All @@ -66,7 +70,7 @@ static int ompi_isendrecv_complete_func (ompi_comm_request_t *request)
*
* Probably need to bring up in the MPI forum.
*/

if (MPI_PROC_NULL != context->source) {
OMPI_COPY_STATUS(&request->super.req_status,
context->subreq[0]->req_status, false);
Expand Down Expand Up @@ -129,21 +133,21 @@ int MPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,

OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
}

crequest = ompi_comm_request_get ();
if (NULL == crequest) {
return OMPI_ERR_OUT_OF_RESOURCE;
}

context = OBJ_NEW(ompi_isendrecv_context_t);
if (NULL == context) {
ompi_comm_request_return (crequest);
return OMPI_ERR_OUT_OF_RESOURCE;
}

crequest->context = &context->super;
context->subreq[0] = NULL;
context->subreq[1] = NULL;
context->subreq[0] = MPI_REQUEST_NULL;
context->subreq[1] = MPI_REQUEST_NULL;
context->source = source;

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

if (dest != MPI_PROC_NULL) { /* send */
rc = MCA_PML_CALL(isend(sendbuf, sendcount, sendtype, dest,
sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++]));
sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++]));
if (MPI_SUCCESS != rc) {
OBJ_RELEASE(context);
ompi_comm_request_return (crequest);
Expand Down
12 changes: 8 additions & 4 deletions ompi/mpi/c/isendrecv_replace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2020 The University of Tennessee and The University
* Copyright (c) 2004-2022 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
Expand Down Expand Up @@ -57,6 +57,7 @@ struct ompi_isendrecv_replace_context_t {

typedef struct ompi_isendrecv_replace_context_t ompi_isendrecv_replace_context_t;

#if OMPI_BUILD_MPI_PROFILING
static void ompi_isendrecv_context_constructor(ompi_isendrecv_replace_context_t *context)
{
context->packed_size = 0;
Expand All @@ -75,6 +76,9 @@ OBJ_CLASS_INSTANCE(ompi_isendrecv_replace_context_t,
opal_object_t,
ompi_isendrecv_context_constructor,
ompi_isendrecv_context_destructor);
#else
OBJ_CLASS_DECLARATION(ompi_isendrecv_replace_context_t);
#endif /* OMPI_BUILD_MPI_PROFILING */

static int ompi_isendrecv_replace_complete_func (ompi_comm_request_t *request)
{
Expand All @@ -87,7 +91,7 @@ static int ompi_isendrecv_replace_complete_func (ompi_comm_request_t *request)
*
* Probably need to bring up in the MPI forum.
*/

if (MPI_PROC_NULL != context->source) {
OMPI_COPY_STATUS(&request->super.req_status,
context->subreq[0]->req_status, false);
Expand Down Expand Up @@ -165,7 +169,7 @@ int MPI_Isendrecv_replace(void * buf, int count, MPI_Datatype datatype,
if (NULL == crequest) {
return OMPI_ERR_OUT_OF_RESOURCE;
}

context = OBJ_NEW(ompi_isendrecv_replace_context_t);
if (NULL == context) {
ompi_comm_request_return (crequest);
Expand Down Expand Up @@ -205,7 +209,7 @@ int MPI_Isendrecv_replace(void * buf, int count, MPI_Datatype datatype,
rc = MPI_ERR_UNKNOWN;
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
}

if (source != MPI_PROC_NULL) { /* post recv */
rc = MCA_PML_CALL(irecv(buf, count, datatype,
source, recvtag, comm, &context->subreq[nreqs++]));
Expand Down