Skip to content

Commit ade590b

Browse files
committed
Revert "Check that requests belong to similar sessions"
bot:notacherrypick This reverts commit c3498bc. Signed-off-by: Wenduo Wang <[email protected]>
1 parent 7a702e8 commit ade590b

File tree

9 files changed

+131
-65
lines changed

9 files changed

+131
-65
lines changed

ompi/communicator/communicator.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
* Copyright (c) 2018-2024 Triad National Security, LLC. All rights
2626
* reserved.
2727
* Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
28-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2928
* $COPYRIGHT$
3029
*
3130
* Additional copyrights may follow
@@ -610,6 +609,11 @@ static inline struct ompi_proc_t* ompi_comm_peer_lookup (const ompi_communicator
610609
return ompi_group_peer_lookup(comm->c_remote_group,peer_id);
611610
}
612611

612+
static inline bool ompi_comm_instances_same(const ompi_communicator_t *comm1, const ompi_communicator_t *comm2)
613+
{
614+
return comm1->instance == comm2->instance;
615+
}
616+
613617
#if OPAL_ENABLE_FT_MPI
614618
/*
615619
* Support for MPI_ANY_SOURCE point-to-point operations

ompi/mpi/c/testall.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Triad National Security, LLC. All rights
1919
* reserved.
20-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2120
* $COPYRIGHT$
2221
*
2322
* Additional copyrights may follow
@@ -58,13 +57,31 @@ int MPI_Testall(int count, MPI_Request requests[], int *flag,
5857
);
5958

6059
if ( MPI_PARAM_CHECK ) {
61-
int rc = MPI_SUCCESS;
60+
int i, rc = MPI_SUCCESS;
61+
MPI_Request check_req = NULL;
6262
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6363
if( (NULL == requests) && (0 != count) ) {
6464
rc = MPI_ERR_REQUEST;
6565
} else {
66-
if(!ompi_request_check_same_instance(requests, count) ) {
67-
rc = MPI_ERR_REQUEST;
66+
for (i = 0; i < count; i++) {
67+
if (NULL == requests[i]) {
68+
rc = MPI_ERR_REQUEST;
69+
break;
70+
}
71+
if (&ompi_request_empty == requests[i]) {
72+
continue;
73+
} else if (NULL == requests[i]->req_mpi_object.comm) {
74+
continue;
75+
} else if (NULL == check_req) {
76+
check_req = requests[i];
77+
}
78+
else {
79+
if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm,
80+
check_req->req_mpi_object.comm)) {
81+
rc = MPI_ERR_REQUEST;
82+
break;
83+
}
84+
}
6885
}
6986
}
7087
if ((NULL == flag) || (count < 0)) {

ompi/mpi/c/testany.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Triad National Security, LLC. All rights
1919
* reserved.
20-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2120
* $COPYRIGHT$
2221
*
2322
* Additional copyrights may follow
@@ -57,13 +56,31 @@ int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MP
5756
);
5857

5958
if ( MPI_PARAM_CHECK ) {
60-
int rc = MPI_SUCCESS;
59+
int i, rc = MPI_SUCCESS;
60+
MPI_Request check_req = NULL;
6161
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6262
if ((NULL == requests) && (0 != count)) {
6363
rc = MPI_ERR_REQUEST;
6464
} else {
65-
if(!ompi_request_check_same_instance(requests, count) ) {
66-
rc = MPI_ERR_REQUEST;
65+
for (i = 0; i < count; i++) {
66+
if (NULL == requests[i]) {
67+
rc = MPI_ERR_REQUEST;
68+
break;
69+
}
70+
if (&ompi_request_empty == requests[i]) {
71+
continue;
72+
} else if (NULL == requests[i]->req_mpi_object.comm) {
73+
continue;
74+
} else if (NULL == check_req) {
75+
check_req = requests[i];
76+
}
77+
else {
78+
if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm,
79+
check_req->req_mpi_object.comm)) {
80+
rc = MPI_ERR_REQUEST;
81+
break;
82+
}
83+
}
6784
}
6885
}
6986
if (((NULL == indx || NULL == completed) && count > 0) ||

ompi/mpi/c/testsome.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Triad National Security, LLC. All rights
1919
* reserved.
20-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2120
* $COPYRIGHT$
2221
*
2322
* Additional copyrights may follow
@@ -59,13 +58,31 @@ int MPI_Testsome(int incount, MPI_Request requests[],
5958
);
6059

6160
if ( MPI_PARAM_CHECK ) {
62-
int rc = MPI_SUCCESS;
61+
int indx, rc = MPI_SUCCESS;
62+
MPI_Request check_req = NULL;
6363
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6464
if ((NULL == requests) && (0 != incount)) {
6565
rc = MPI_ERR_REQUEST;
6666
} else {
67-
if(!ompi_request_check_same_instance(requests, incount) ) {
68-
rc = MPI_ERR_REQUEST;
67+
for (indx = 0; indx < incount; ++indx) {
68+
if (NULL == requests[indx]) {
69+
rc = MPI_ERR_REQUEST;
70+
break;
71+
}
72+
if (&ompi_request_empty == requests[indx]) {
73+
continue;
74+
} else if (NULL == requests[indx]->req_mpi_object.comm) {
75+
continue;
76+
} else if (NULL == check_req) {
77+
check_req = requests[indx];
78+
}
79+
else {
80+
if (!ompi_comm_instances_same(requests[indx]->req_mpi_object.comm,
81+
check_req->req_mpi_object.comm)) {
82+
rc = MPI_ERR_REQUEST;
83+
break;
84+
}
85+
}
6986
}
7087
}
7188
if (((NULL == outcount || NULL == indices) && incount > 0) ||

ompi/mpi/c/waitall.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2021 Triad National Security, LLC. All rights
1818
* reserved.
19-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2019
* $COPYRIGHT$
2120
*
2221
* Additional copyrights may follow
@@ -56,13 +55,31 @@ int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[])
5655
);
5756

5857
if ( MPI_PARAM_CHECK ) {
59-
int rc = MPI_SUCCESS;
58+
int i, rc = MPI_SUCCESS;
59+
MPI_Request check_req = NULL;
6060
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6161
if( (NULL == requests) && (0 != count) ) {
6262
rc = MPI_ERR_REQUEST;
6363
} else {
64-
if(!ompi_request_check_same_instance(requests, count) ) {
65-
rc = MPI_ERR_REQUEST;
64+
for (i = 0; i < count; i++) {
65+
if (NULL == requests[i]) {
66+
rc = MPI_ERR_REQUEST;
67+
break;
68+
}
69+
if (&ompi_request_empty == requests[i]) {
70+
continue;
71+
} else if (NULL == requests[i]->req_mpi_object.comm) {
72+
continue;
73+
} else if (NULL == check_req) {
74+
check_req = requests[i];
75+
}
76+
else {
77+
if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm,
78+
check_req->req_mpi_object.comm)) {
79+
rc = MPI_ERR_REQUEST;
80+
break;
81+
}
82+
}
6683
}
6784
}
6885
if (count < 0) {

ompi/mpi/c/waitany.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Triad National Security, LLC. All rights
1919
* reserved.
20-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2120
* $COPYRIGHT$
2221
*
2322
* Additional copyrights may follow
@@ -57,13 +56,31 @@ int MPI_Waitany(int count, MPI_Request requests[], int *indx, MPI_Status *status
5756
);
5857

5958
if ( MPI_PARAM_CHECK ) {
60-
int rc = MPI_SUCCESS;
59+
int i, rc = MPI_SUCCESS;
60+
MPI_Request check_req = NULL;
6161
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6262
if ((NULL == requests) && (0 != count)) {
6363
rc = MPI_ERR_REQUEST;
6464
} else {
65-
if(!ompi_request_check_same_instance(requests, count) ) {
66-
rc = MPI_ERR_REQUEST;
65+
for (i = 0; i < count; i++) {
66+
if (NULL == requests[i]) {
67+
rc = MPI_ERR_REQUEST;
68+
break;
69+
}
70+
if (requests[i] == &ompi_request_empty) {
71+
continue;
72+
} else if (NULL == requests[i]->req_mpi_object.comm) {
73+
continue;
74+
} else if (NULL == check_req) {
75+
check_req = requests[i];
76+
}
77+
else {
78+
if (!ompi_comm_instances_same(requests[i]->req_mpi_object.comm,
79+
check_req->req_mpi_object.comm)) {
80+
rc = MPI_ERR_REQUEST;
81+
break;
82+
}
83+
}
6784
}
6885
}
6986
if ((NULL == indx && count > 0) ||

ompi/mpi/c/waitsome.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Triad National Security, LLC. All rights
1919
* reserved.
20-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2120
* $COPYRIGHT$
2221
*
2322
* Additional copyrights may follow
@@ -59,13 +58,31 @@ int MPI_Waitsome(int incount, MPI_Request requests[],
5958
);
6059

6160
if ( MPI_PARAM_CHECK ) {
62-
int rc = MPI_SUCCESS;
61+
int indx, rc = MPI_SUCCESS;
62+
MPI_Request check_req = NULL;
6363
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
6464
if ((NULL == requests) && (0 != incount)) {
6565
rc = MPI_ERR_REQUEST;
6666
} else {
67-
if(!ompi_request_check_same_instance(requests, incount) ) {
68-
rc = MPI_ERR_REQUEST;
67+
for (indx = 0; indx < incount; ++indx) {
68+
if (NULL == requests[indx]) {
69+
rc = MPI_ERR_REQUEST;
70+
break;
71+
}
72+
if (&ompi_request_empty == requests[indx]) {
73+
continue;
74+
} else if (NULL == requests[indx]->req_mpi_object.comm) {
75+
continue;
76+
} else if (NULL == check_req) {
77+
check_req = requests[indx];
78+
}
79+
else {
80+
if (!ompi_comm_instances_same(requests[indx]->req_mpi_object.comm,
81+
check_req->req_mpi_object.comm)) {
82+
rc = MPI_ERR_REQUEST;
83+
break;
84+
}
85+
}
6986
}
7087
}
7188
if (((NULL == outcount || NULL == indices) && incount > 0) ||

ompi/request/request.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* Copyright (c) 2018 Triad National Security, LLC. All rights
2222
* reserved.
2323
* Copyright (c) 2022 IBM Corporation. All rights reserved.
24-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2524
* $COPYRIGHT$
2625
*
2726
* Additional copyrights may follow
@@ -249,25 +248,3 @@ int ompi_request_persistent_noop_create(ompi_request_t** request)
249248
*request = req;
250249
return OMPI_SUCCESS;
251250
}
252-
253-
bool ompi_request_check_same_instance(ompi_request_t** requests,
254-
int count)
255-
{
256-
ompi_request_t *req, *base = NULL;
257-
258-
for(int idx = 0; idx < count; idx++ ) {
259-
req = requests[idx];
260-
if(OMPI_REQUEST_NULL == req->req_type) /* predefined requests are generic */
261-
continue;
262-
/* Only PML requests have support for MPI sessions */
263-
if(OMPI_REQUEST_PML != req->req_type)
264-
continue;
265-
if(NULL == base) {
266-
base = req;
267-
continue;
268-
}
269-
if(base->req_mpi_object.comm != req->req_mpi_object.comm)
270-
return false;
271-
}
272-
return true;
273-
}

ompi/request/request.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
* Copyright (c) 2018 Triad National Security, LLC. All rights
2020
* reserved.
2121
* Copyright (c) 2022 IBM Corporation. All rights reserved.
22-
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2322
* $COPYRIGHT$
2423
*
2524
* Additional copyrights may follow
@@ -557,22 +556,6 @@ static inline int ompi_request_set_callback(ompi_request_t* request,
557556
return OMPI_SUCCESS;
558557
}
559558

560-
/**
561-
* Check if an array of requests contains only requests that belong to the same
562-
* instance or MPI Session. Exclude predefined requests, that are generic and part
563-
* of all instances.
564-
* Right now, only tests for PML requests as they are the only requests that have
565-
* support for MPI Sessions.
566-
*
567-
* @param requests (IN) Array of requests
568-
* @param count (IN) Number of requests
569-
* @return true if all requests are part of the same instance
570-
* or MPI Session, false otherwise.
571-
*
572-
*/
573-
bool ompi_request_check_same_instance(ompi_request_t** requests,
574-
int count);
575-
576559
END_C_DECLS
577560

578561
#endif

0 commit comments

Comments
 (0)