2020 * Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
2121 * Copyright (c) Amazon.com, Inc. or its affiliates.
2222 * All rights reserved.
23+ * Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
2324 * $COPYRIGHT$
2425 *
2526 * Additional copyrights may follow
@@ -983,14 +984,7 @@ int ompi_coll_base_allreduce_intra_redscat_allgather(
983984 "coll:base:allreduce_intra_redscat_allgather: rank %d/%d" ,
984985 rank , comm_size ));
985986
986- /* Find nearest power-of-two less than or equal to comm_size */
987- int nsteps = opal_hibit (comm_size , comm -> c_cube_dim + 1 ); /* ilog2(comm_size) */
988- if (-1 == nsteps ) {
989- return MPI_ERR_ARG ;
990- }
991- int nprocs_pof2 = 1 << nsteps ; /* flp2(comm_size) */
992-
993- if (count < (size_t ) nprocs_pof2 || !ompi_op_is_commute (op )) {
987+ if (!ompi_op_is_commute (op )) {
994988 OPAL_OUTPUT ((ompi_coll_base_framework .framework_output ,
995989 "coll:base:allreduce_intra_redscat_allgather: rank %d/%d "
996990 "count %zu switching to basic linear allreduce" ,
@@ -999,6 +993,12 @@ int ompi_coll_base_allreduce_intra_redscat_allgather(
999993 op , comm , module );
1000994 }
1001995
996+ /* Find nearest power-of-two less than or equal to comm_size */
997+ int nsteps = opal_hibit (comm_size , comm -> c_cube_dim + 1 ); /* ilog2(comm_size) */
998+ if (-1 == nsteps ) {
999+ return MPI_ERR_ARG ;
1000+ }
1001+ int nprocs_pof2 = 1 << nsteps ; /* flp2(comm_size) */
10021002 int err = MPI_SUCCESS ;
10031003 ptrdiff_t lb , extent , dsize , gap = 0 ;
10041004 ompi_datatype_get_extent (dtype , & lb , & extent );
0 commit comments