Skip to content

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
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions ompi/include/mpi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2227,13 +2227,13 @@ OMPI_DECLSPEC int MPI_Request_free(MPI_Request *request);
OMPI_DECLSPEC int MPI_Request_get_status(MPI_Request request, int *flag,
MPI_Status *status);
/* should be 'const MPI_Request array_of_requests[]' */
OMPI_DECLSPEC int MPI_Request_get_status_all(int count, MPI_Request array_of_requests[], int *flag,
OMPI_DECLSPEC int MPI_Request_get_status_all(int count, const MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[]);
/* should be 'const MPI_Request array_of_requests[]' */
OMPI_DECLSPEC int MPI_Request_get_status_any(int count, MPI_Request array_of_requests[], int *index,
OMPI_DECLSPEC int MPI_Request_get_status_any(int count, const MPI_Request array_of_requests[], int *index,
int *flag, MPI_Status *status);
/* should be 'const MPI_Request array_of_requests[]' */
OMPI_DECLSPEC int MPI_Request_get_status_some(int incount, MPI_Request array_of_requests[], int *outcount,
OMPI_DECLSPEC int MPI_Request_get_status_some(int incount, const MPI_Request array_of_requests[], int *outcount,
int array_of_indices[], MPI_Status array_of_statuses[]);
OMPI_DECLSPEC int MPI_Rget(void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype,
Expand Down Expand Up @@ -3395,13 +3395,13 @@ OMPI_DECLSPEC int PMPI_Request_free(MPI_Request *request);
OMPI_DECLSPEC int PMPI_Request_get_status(MPI_Request request, int *flag,
MPI_Status *status);
/* should be 'const MPI_Request array_of_requests[]' */
OMPI_DECLSPEC int PMPI_Request_get_status_all(int count, MPI_Request array_of_requests[], int *flag,
OMPI_DECLSPEC int PMPI_Request_get_status_all(int count, const MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[]);
/* should be 'const MPI_Request array_of_requests[]' */
OMPI_DECLSPEC int PMPI_Request_get_status_any(int count, MPI_Request array_of_requests[], int *index,
OMPI_DECLSPEC int PMPI_Request_get_status_any(int count, const MPI_Request array_of_requests[], int *index,
int *flag, MPI_Status *status);
/* should be 'const MPI_Request array_of_requests[]' */
OMPI_DECLSPEC int PMPI_Request_get_status_some(int incount, MPI_Request array_of_requests[], int *outcount,
OMPI_DECLSPEC int PMPI_Request_get_status_some(int incount, const MPI_Request array_of_requests[], int *outcount,
int array_of_indices[], MPI_Status array_of_statuses[]);
OMPI_DECLSPEC int PMPI_Rget(void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype,
Expand Down
27 changes: 25 additions & 2 deletions ompi/mpi/bindings/ompi_bindings/c_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,38 @@ def type_text(self, enable_count=False):
def argument(self):
return f'(MPI_Request) {self.name}'

@Type.add_type('REQUEST_CONST', abi_type=['ompi'])
class TypeConstRequest(TypeRequest):

def type_text(self, enable_count=False):
return f'const MPI_Request *'

def parameter(self, enable_count=False, **kwargs):
if self.count_param is None:
return f'const MPI_Request {self.name}'
else:
return f'const MPI_Request {self.name}[]'

#
# TODO ABI NEEDS WORK
#
@Type.add_type('REQUEST_CONST', abi_type=['standard'])
class TypeConstRequestStandard(TypeRequestStandard):

def type_text(self, enable_count=False):
name = self.mangle_name('MPI_Request')
return f'const {name}'

@property
def argument(self):
return f'(MPI_Request) {self.name}'

@Type.add_type('REQUEST_INOUT', abi_type=['ompi'])
class TypeRequestInOut(Type):

def type_text(self, enable_count=False):
return 'MPI_Request *'


@Type.add_type('REQUEST_INOUT', abi_type=['standard'])
class TypeRequestInOutStandard(Type):

Expand Down Expand Up @@ -593,7 +617,6 @@ def parameter(self, enable_count=False, **kwargs):
else:
return f'{type_name} {self.name}[]'


@Type.add_type('STATUS', abi_type=['ompi'])
class TypeStatus(Type):

Expand Down
4 changes: 2 additions & 2 deletions ompi/mpi/c/request_get_status_all.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* 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,
PROTOTYPE ERROR_CLASS request_get_status_all(INT count, REQUEST_CONST requests:count, INT_OUT flag,
STATUS_OUT statuses:count)
{
MEMCHECKER(
Expand All @@ -54,7 +54,7 @@ PROTOTYPE ERROR_CLASS request_get_status_all(INT count, REQUEST_INOUT requests:c
if (NULL == requests) {
rc = MPI_ERR_REQUEST;
} else {
if(!ompi_request_check_same_instance(requests, count) ) {
if(!ompi_request_check_same_instance((MPI_Request *)requests, count) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why cast? Is there a reason the 1st arg to ompi_request_check_same_instance isn't const?

rc = MPI_ERR_REQUEST;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ompi/mpi/c/request_get_status_any.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* 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,
PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_CONST requests:count, INT_OUT indx,
INT_OUT flag, STATUS_OUT status)
{

Expand All @@ -55,7 +55,7 @@ PROTOTYPE ERROR_CLASS request_get_status_any(INT count, REQUEST_INOUT requests:c
if (NULL == requests) {
rc = MPI_ERR_REQUEST;
} else {
if(!ompi_request_check_same_instance(requests, count) ) {
if(!ompi_request_check_same_instance((MPI_Request *)requests, count) ) {
rc = MPI_ERR_REQUEST;
}
}
Expand Down
4 changes: 2 additions & 2 deletions ompi/mpi/c/request_get_status_some.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* 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_some(INT incount, REQUEST_INOUT requests:count, INT_OUT outcount,
PROTOTYPE ERROR_CLASS request_get_status_some(INT incount, REQUEST_CONST requests:count, INT_OUT outcount,
INT_OUT indices, STATUS_OUT statuses:count)
{

Expand All @@ -55,7 +55,7 @@ PROTOTYPE ERROR_CLASS request_get_status_some(INT incount, REQUEST_INOUT request
if (NULL == requests) {
rc = MPI_ERR_REQUEST;
} else {
if(!ompi_request_check_same_instance(requests, incount) ) {
if(!ompi_request_check_same_instance((MPI_Request *)requests, incount) ) {
rc = MPI_ERR_REQUEST;
}
}
Expand Down