Skip to content

Commit

Permalink
coll: warnings fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hzhou committed Jun 28, 2024
1 parent f717faf commit 23c8399
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
11 changes: 10 additions & 1 deletion src/mpi/coll/bcast/bcast_intra_pipelined_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand All @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions src/mpi/coll/bcast/bcast_intra_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/mpi/coll/iallgather/iallgather_tsp_recexch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 23c8399

Please sign in to comment.