diff --git a/src/core/timing/TimingNode.h b/src/core/timing/TimingNode.h index 8ec0b3338a810f8618ff790e550329698096fd60..2f0597f7a591b12907932942e76f107b4f90015d 100644 --- a/src/core/timing/TimingNode.h +++ b/src/core/timing/TimingNode.h @@ -26,6 +26,7 @@ #include "core/debug/Debug.h" #include "core/logging/Logging.h" +#include "core/mpi/Gatherv.h" #include "core/mpi/MPIManager.h" #include "core/mpi/Reduce.h" #include "core/mpi/SetReduction.h" @@ -253,6 +254,20 @@ void reduceInplace( TimingNode<TP>& tn, ReduceType rt = REDUCE_TOTAL, int target break; } + WALBERLA_ASSERT_EQUAL(vals.size(), valsSq.size()); + WALBERLA_ASSERT_EQUAL(vals.size(), min.size()); + WALBERLA_ASSERT_EQUAL(vals.size(), max.size()); + WALBERLA_ASSERT_EQUAL(vals.size(), count.size()); + + WALBERLA_DEBUG_SECTION() + { + //checking if all timing trees contain the same number of elements + std::vector<uint32_t> lens; + lens.push_back(uint32_c(vals.size())); + lens = mpi::allGatherv(lens); + std::for_each(lens.begin(), lens.end(), [&](const uint32_t& v){WALBERLA_UNUSED(v); WALBERLA_ASSERT_EQUAL( v, vals.size(), "Different number of TimingTree nodes detected! All TimingTrees need to have the same timers for reduction!");}); + } + // Target vectors where reduced values are stored std::vector<double> minRed; std::vector<double> maxRed;