Skip to content
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

Fix divide by zero error in calculate_num_nodes_up_to_level using MPI_Bcast with 2 tasks #11120

Merged
merged 1 commit into from
Nov 29, 2022
Merged

Fix divide by zero error in calculate_num_nodes_up_to_level using MPI_Bcast with 2 tasks #11120

merged 1 commit into from
Nov 29, 2022

Conversation

drwootton
Copy link
Contributor

Clang static analysis reported a possible zerodivide exception at ompi/mca/coll/base/coll_base_topo.c:62 (calculate_num_nodes_up_to_level)

I was able to get this exception with the program

#include <mpi.h>
char buff[4096];
int main(int argc, char *argv[]) {
MPI_Init(&argc, &argv);
MPI_Bcast(buff, sizeof buff, MPI_CHAR, 0, MPI_COMM_WORLD);
MPI_Finalize();
}

Using the command

mpirun -n 2 --mca coll_adapt_bcast_algorithm 6 --mca coll_adapt_priority 99 bcast

The calculate_num_nodes_up_to_level function is called from ompi_coll_base_topo_build_tree. The exception occurs because fanout is set to one in this case.

This is a cherry pick of #11103 from the main branch

Signed-off-by: David Wootton [email protected]
(cherry picked from commit a74927f)

with MPI_Bcast in 2 tasks using --mca coll_adapt_bcast_algorithm 6
and --mca coll_adapt_priority 99

Resolve review comments

Signed-off-by: David Wootton <[email protected]>
(cherry picked from commit a74927f)
@drwootton drwootton requested a review from jjhursey November 28, 2022 19:17
@drwootton drwootton self-assigned this Nov 28, 2022
@jjhursey jjhursey requested a review from bosilca November 28, 2022 19:36
@awlauria awlauria merged commit 55503bb into open-mpi:v5.0.x Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants