X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a521b79fb5f8fc07b3f9102cec6de074186fe5c1..b2852b7c61948f495d7437ffaa7fd9aced12849c:/src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp diff --git a/src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp b/src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp index e91c7680cc..d245ab4d2b 100644 --- a/src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp +++ b/src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2020. The SimGrid Team. +/* Copyright (c) 2013-2023. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -58,8 +58,7 @@ #include "../coll_tuned_topo.hpp" #include "../colls_private.hpp" #define MAXTREEFANOUT 32 -namespace simgrid { -namespace smpi { +namespace simgrid::smpi { int bcast__ompi_split_bintree( void* buffer, int count, @@ -112,23 +111,20 @@ int bcast__ompi_split_bintree( void* buffer, counts[0] = count/2; if (count % 2 != 0) counts[0]++; counts[1] = count - counts[0]; - if ( segsize > 0 ) { - /* Note that ompi_datatype_type_size() will never return a negative - value in typelng; it returns an int [vs. an unsigned type] - because of the MPI spec. */ - if (segsize < ((uint32_t)type_size)) { - segsize = type_size; /* push segsize up to hold one type */ - } - segcount[0] = segcount[1] = segsize / type_size; - num_segments[0] = counts[0]/segcount[0]; - if ((counts[0] % segcount[0]) != 0) num_segments[0]++; - num_segments[1] = counts[1]/segcount[1]; - if ((counts[1] % segcount[1]) != 0) num_segments[1]++; - } else { - segcount[0] = counts[0]; - segcount[1] = counts[1]; - num_segments[0] = num_segments[1] = 1; + + /* Note that ompi_datatype_type_size() will never return a negative + value in typelng; it returns an int [vs. an unsigned type] + because of the MPI spec. */ + if (segsize < ((uint32_t)type_size)) { + segsize = type_size; /* push segsize up to hold one type */ } + segcount[0] = segcount[1] = segsize / type_size; + num_segments[0] = counts[0] / segcount[0]; + if ((counts[0] % segcount[0]) != 0) + num_segments[0]++; + num_segments[1] = counts[1] / segcount[1]; + if ((counts[1] % segcount[1]) != 0) + num_segments[1]++; /* if the message is too small to be split into segments */ if( (counts[0] == 0 || counts[1] == 0) || @@ -295,6 +291,4 @@ int bcast__ompi_split_bintree( void* buffer, } -} -} - +} // namespace simgrid::smpi