From 23c839993672e0ed3bb0843528b1421fa6fd0d18 Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Fri, 28 Jun 2024 16:26:37 -0500 Subject: [PATCH] coll: warnings fix --- src/mpi/coll/bcast/bcast_intra_pipelined_tree.c | 11 ++++++++++- src/mpi/coll/bcast/bcast_intra_tree.c | 10 +++++++--- src/mpi/coll/iallgather/iallgather_tsp_recexch.c | 3 +-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c b/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c index e1b05cb1543..d09ef6aae41 100644 --- a/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c +++ b/src/mpi/coll/bcast/bcast_intra_pipelined_tree.c @@ -23,7 +23,7 @@ int MPIR_Bcast_intra_pipelined_tree(void *buffer, int mpi_errno = MPI_SUCCESS; MPI_Status status; MPI_Aint type_size, num_chunks, chunk_size_floor, chunk_size_ceil; - MPI_Aint true_lb, true_extent, recvd_size, actual_packed_unpacked_bytes, nbytes = 0; + MPI_Aint true_lb, true_extent, actual_packed_unpacked_bytes, nbytes = 0; void *sendbuf = NULL; int parent = -1, num_children = 0, lrank = 0, num_req = 0; MPIR_Request **reqs = NULL; @@ -148,16 +148,22 @@ int MPIR_Bcast_intra_pipelined_tree(void *buffer, if (src != -1) { mpi_errno = MPIC_Wait(reqs[i]); MPIR_ERR_CHECK(mpi_errno); +#ifdef HAVE_ERROR_CHECKING + int recvd_size; MPIR_Get_count_impl(&reqs[i]->status, MPI_BYTE, &recvd_size); MPIR_ERR_COLL_CHECK_SIZE(recvd_size, msgsize, mpi_errno); +#endif } } else if (num_chunks > 3 && is_nb && i < 3 && !recv_pre_posted) { /* Wait to receive the chunk before it can be sent to the children */ if (src != -1) { mpi_errno = MPIC_Wait(reqs[i]); MPIR_ERR_CHECK(mpi_errno); +#ifdef HAVE_ERROR_CHECKING + int recvd_size; MPIR_Get_count_impl(&reqs[i]->status, MPI_BYTE, &recvd_size); MPIR_ERR_COLL_CHECK_SIZE(recvd_size, msgsize, mpi_errno); +#endif } } else { /* Receive message from parent */ @@ -166,8 +172,11 @@ int MPIR_Bcast_intra_pipelined_tree(void *buffer, MPIC_Recv((char *) sendbuf + offset, msgsize, MPI_BYTE, src, MPIR_BCAST_TAG, comm_ptr, &status); MPIR_ERR_CHECK(mpi_errno); +#ifdef HAVE_ERROR_CHECKING + int recvd_size; MPIR_Get_count_impl(&status, MPI_BYTE, &recvd_size); MPIR_ERR_COLL_CHECK_SIZE(recvd_size, msgsize, mpi_errno); +#endif } } if (tree_type == MPIR_TREE_TYPE_KARY) { diff --git a/src/mpi/coll/bcast/bcast_intra_tree.c b/src/mpi/coll/bcast/bcast_intra_tree.c index e1fadcc1957..50b7a10d5f3 100644 --- a/src/mpi/coll/bcast/bcast_intra_tree.c +++ b/src/mpi/coll/bcast/bcast_intra_tree.c @@ -15,10 +15,10 @@ int MPIR_Bcast_intra_tree(void *buffer, int root, MPIR_Comm * comm_ptr, int tree_type, int branching_factor, int is_nb) { - int rank, comm_size, src, dst, *p, j, k, lrank, is_contig; + int rank, comm_size, src, dst, *p, j, k, is_contig; int parent = -1, num_children = 0, num_req = 0, is_root = 0; int mpi_errno = MPI_SUCCESS; - MPI_Aint nbytes = 0, type_size, actual_packed_unpacked_bytes, recvd_size; + MPI_Aint nbytes = 0, type_size, actual_packed_unpacked_bytes; MPI_Aint saved_count = count; MPI_Status status; void *send_buf = NULL; @@ -67,7 +67,7 @@ int MPIR_Bcast_intra_tree(void *buffer, if (tree_type == MPIR_TREE_TYPE_KARY) { if (rank == root) is_root = 1; - lrank = (rank + (comm_size - root)) % comm_size; + int lrank = (rank + (comm_size - root)) % comm_size; parent = (lrank == 0) ? -1 : (((lrank - 1) / branching_factor) + root) % comm_size; num_children = branching_factor; } else { @@ -131,11 +131,15 @@ int MPIR_Bcast_intra_tree(void *buffer, src = parent; mpi_errno = MPIC_Recv(send_buf, count, dtype, src, MPIR_BCAST_TAG, comm_ptr, &status); MPIR_ERR_CHECK(mpi_errno); +#ifdef HAVE_ERROR_CHECKING /* check that we received as much as we expected */ + int recvd_size; MPIR_Get_count_impl(&status, MPI_BYTE, &recvd_size); MPIR_ERR_COLL_CHECK_SIZE(recvd_size, nbytes, mpi_errno); +#endif } if (tree_type == MPIR_TREE_TYPE_KARY) { + int lrank = (rank + (comm_size - root)) % comm_size; for (k = 1; k <= branching_factor; k++) { /* Send to children */ dst = lrank * branching_factor + k; if (dst >= comm_size) diff --git a/src/mpi/coll/iallgather/iallgather_tsp_recexch.c b/src/mpi/coll/iallgather/iallgather_tsp_recexch.c index 9d998d3eaf7..20ae5114b95 100644 --- a/src/mpi/coll/iallgather/iallgather_tsp_recexch.c +++ b/src/mpi/coll/iallgather/iallgather_tsp_recexch.c @@ -172,9 +172,8 @@ static int MPIR_TSP_Iallgather_sched_intra_recexch_step2(int step1_sendto, int s phase++; } - *nrecvs_ = nrecvs; - fn_exit: + *nrecvs_ = nrecvs; MPIR_FUNC_EXIT; return mpi_errno; fn_fail: