-
Notifications
You must be signed in to change notification settings - Fork 907
add support for request_get_status_any/all/some #13279
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
Open
edgargabriel
wants to merge
7
commits into
open-mpi:main
Choose a base branch
from
edgargabriel:topic/request-status-mult
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
37d0a54
mpi: add request_get_status_all/any/some
edgargabriel f636bc5
docs: add man-pages for new functions
edgargabriel 81e3492
c-bindings: add support for const request args
hppritcha 31a0d60
request_get_status variants: add f08 interfaces
hppritcha fb2e098
use-mpi-ignore: start using binding infrastructure
hppritcha a391063
request_get_status_mult: add f77 functions
hppritcha 360c797
fortran: PR feedback
hppritcha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* | ||
* 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 | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, | ||
* University of Stuttgart. All rights reserved. | ||
* Copyright (c) 2004-2005 The Regents of the University of California. | ||
* All rights reserved. | ||
* Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. | ||
* Copyright (c) 2015 Research Organization for Information Science | ||
* and Technology (RIST). All rights reserved. | ||
* Copyright (c) 2024 Triad National Security, LLC. All rights | ||
* reserved. | ||
* Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved | ||
* | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
#include "ompi_config.h" | ||
#include <stdio.h> | ||
|
||
#include "ompi/mpi/c/bindings.h" | ||
#include "ompi/runtime/params.h" | ||
#include "ompi/communicator/communicator.h" | ||
#include "ompi/errhandler/errhandler.h" | ||
#include "ompi/request/request.h" | ||
#include "ompi/request/grequest.h" | ||
#include "ompi/memchecker.h" | ||
|
||
/* Non blocking test for the request status. Upon completion, the request will | ||
* not be freed (unlike the test function). A subsequent call to test, wait | ||
* or free should be executed on the request. | ||
*/ | ||
PROTOTYPE ERROR_CLASS request_get_status_all(INT count, REQUEST_INOUT requests:count, INT_OUT flag, | ||
STATUS_OUT statuses:count) | ||
{ | ||
MEMCHECKER( | ||
int j; | ||
for (j = 0; j< count; j++) { | ||
memchecker_request(&requests[j]); | ||
} | ||
); | ||
|
||
if( MPI_PARAM_CHECK ) { | ||
int rc = MPI_SUCCESS; | ||
|
||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME); | ||
if (NULL == requests) { | ||
rc = MPI_ERR_REQUEST; | ||
} else { | ||
if(!ompi_request_check_same_instance(requests, count) ) { | ||
rc = MPI_ERR_REQUEST; | ||
} | ||
} | ||
if ((NULL == flag) || (count < 0)) { | ||
rc = MPI_ERR_ARG; | ||
} | ||
OMPI_ERRHANDLER_NOHANDLE_CHECK(rc, rc, FUNC_NAME); | ||
} | ||
|
||
if (OPAL_UNLIKELY(0 == count)) { | ||
*flag = true; | ||
return MPI_SUCCESS; | ||
} | ||
|
||
bool all_done; | ||
bool one_done; | ||
|
||
#if OPAL_ENABLE_PROGRESS_THREADS == 0 | ||
int do_it_once = 0; | ||
recheck_request_status: | ||
#endif | ||
|
||
opal_atomic_mb(); | ||
int i; | ||
all_done = true; | ||
for (i = 0; i < count; i++) { | ||
one_done = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is |
||
if( (requests[i] == MPI_REQUEST_NULL) || (requests[i]->req_state == OMPI_REQUEST_INACTIVE) || | ||
(requests[i]->req_complete) ) { | ||
continue; | ||
} | ||
if (!one_done) { | ||
all_done = false; | ||
break; | ||
} | ||
} | ||
|
||
if (!all_done) { | ||
#if OPAL_ENABLE_PROGRESS_THREADS == 0 | ||
if( 0 == do_it_once ) { | ||
/* If we run the opal_progress then check the status of the | ||
request before leaving. We will call the opal_progress only | ||
once per call. */ | ||
opal_progress(); | ||
do_it_once++; | ||
goto recheck_request_status; | ||
} | ||
#endif | ||
*flag = false; | ||
return MPI_SUCCESS; | ||
} | ||
|
||
for (i = 0; i < count; i++) { | ||
if( (requests[i] == MPI_REQUEST_NULL) || (requests[i]->req_state == OMPI_REQUEST_INACTIVE) ) { | ||
if (MPI_STATUS_IGNORE != statuses) { | ||
OMPI_COPY_STATUS(&statuses[i], ompi_status_empty, false); | ||
} | ||
} | ||
if (requests[i]->req_complete ) { | ||
/* If this is a generalized request, we *always* have to call | ||
the query function to get the status (MPI-2:8.2), even if | ||
the user passed STATUS_IGNORE. */ | ||
if (OMPI_REQUEST_GEN == requests[i]->req_type) { | ||
ompi_grequest_invoke_query(requests[i], &requests[i]->req_status); | ||
} | ||
if (MPI_STATUS_IGNORE != statuses) { | ||
OMPI_COPY_STATUS(&statuses[i], requests[i]->req_status, false); | ||
} | ||
} | ||
} | ||
|
||
*flag = true; | ||
return MPI_SUCCESS; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* 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 | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, | ||
* University of Stuttgart. All rights reserved. | ||
* Copyright (c) 2004-2005 The Regents of the University of California. | ||
* All rights reserved. | ||
* Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. | ||
* Copyright (c) 2015 Research Organization for Information Science | ||
* and Technology (RIST). All rights reserved. | ||
* Copyright (c) 2024 Triad National Security, LLC. All rights | ||
* reserved. | ||
* Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved | ||
* | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
#include "ompi_config.h" | ||
#include <stdio.h> | ||
|
||
#include "ompi/mpi/c/bindings.h" | ||
#include "ompi/runtime/params.h" | ||
#include "ompi/communicator/communicator.h" | ||
#include "ompi/errhandler/errhandler.h" | ||
#include "ompi/request/request.h" | ||
#include "ompi/request/grequest.h" | ||
#include "ompi/memchecker.h" | ||
|
||
/* Non blocking test for the request status. Upon completion, the request will | ||
* not be freed (unlike the test function). A subsequent call to test, wait | ||
* or free should be executed on the request. | ||
*/ | ||
PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_INOUT requests:count, INT_OUT indx, | ||
INT_OUT flag, STATUS_OUT status) | ||
{ | ||
|
||
MEMCHECKER( | ||
int j; | ||
for (j = 0; j< count; j++) { | ||
memchecker_request(&requests[j]); | ||
} | ||
); | ||
|
||
if( MPI_PARAM_CHECK ) { | ||
int rc = MPI_SUCCESS; | ||
|
||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME); | ||
if (NULL == requests) { | ||
rc = MPI_ERR_REQUEST; | ||
} else { | ||
if(!ompi_request_check_same_instance(requests, count) ) { | ||
rc = MPI_ERR_REQUEST; | ||
} | ||
} | ||
if ((NULL == flag) || (count < 0) || (NULL == indx) ) { | ||
rc = MPI_ERR_ARG; | ||
} | ||
OMPI_ERRHANDLER_NOHANDLE_CHECK(rc, rc, FUNC_NAME); | ||
} | ||
|
||
if (OPAL_UNLIKELY(0 == count)) { | ||
*flag = true; | ||
*indx = MPI_UNDEFINED; | ||
if (MPI_STATUS_IGNORE != status) { | ||
OMPI_COPY_STATUS(status, ompi_status_empty, false); | ||
} | ||
return MPI_SUCCESS; | ||
} | ||
|
||
bool all_inactive; | ||
|
||
#if OPAL_ENABLE_PROGRESS_THREADS == 0 | ||
int do_it_once = 0; | ||
recheck_request_status: | ||
#endif | ||
|
||
opal_atomic_mb(); | ||
all_inactive = true; | ||
int i; | ||
for (i = 0; i < count; i++) { | ||
if ( (requests[i] == MPI_REQUEST_NULL) || (requests[i]->req_state == OMPI_REQUEST_INACTIVE) ) { | ||
continue; | ||
} | ||
if (requests[i]->req_complete ) { | ||
*flag = true; | ||
*indx = i; | ||
/* If this is a generalized request, we *always* have to call | ||
the query function to get the status (MPI-2:8.2), even if | ||
the user passed STATUS_IGNORE. */ | ||
if (OMPI_REQUEST_GEN == requests[i]->req_type) { | ||
ompi_grequest_invoke_query(requests[i], &requests[i]->req_status); | ||
} | ||
if (MPI_STATUS_IGNORE != status) { | ||
OMPI_COPY_STATUS(status, requests[i]->req_status, false); | ||
} | ||
return MPI_SUCCESS; | ||
} else { | ||
/* regular request but not complete */ | ||
all_inactive = false; | ||
} | ||
} | ||
|
||
if (all_inactive) { | ||
*flag = true; | ||
*indx = MPI_UNDEFINED; | ||
if (MPI_STATUS_IGNORE != status) { | ||
OMPI_COPY_STATUS(status, ompi_status_empty, false); | ||
} | ||
return MPI_SUCCESS; | ||
} | ||
|
||
#if OPAL_ENABLE_PROGRESS_THREADS == 0 | ||
if( 0 == do_it_once ) { | ||
/* If we run the opal_progress then check the status of the | ||
request before leaving. We will call the opal_progress only | ||
once per call. */ | ||
opal_progress(); | ||
do_it_once++; | ||
goto recheck_request_status; | ||
} | ||
#endif | ||
*flag = false; | ||
*indx = MPI_UNDEFINED; | ||
return MPI_SUCCESS; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to make this an
int
instead ofbool
?