From 40f1c5248f621b1cc6b1a45fc6469094d5734322 Mon Sep 17 00:00:00 2001 From: Florian Schornbaum <florian.schornbaum@fau.de> Date: Wed, 11 Apr 2018 16:44:58 +0200 Subject: [PATCH] [BUGFIX] No more "gaps" in the SFC partitioning (#54) --- src/blockforest/loadbalancing/DynamicCurve.h | 5 +++-- src/blockforest/loadbalancing/StaticCurve.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/blockforest/loadbalancing/DynamicCurve.h b/src/blockforest/loadbalancing/DynamicCurve.h index d9767ecf0..d72b60726 100644 --- a/src/blockforest/loadbalancing/DynamicCurve.h +++ b/src/blockforest/loadbalancing/DynamicCurve.h @@ -792,8 +792,9 @@ void DynamicCurveBalance< PhantomData_T >::balanceWeighted( const std::vector< s long double weight( 0 ); int numBlocks( 0 ); while( c < blocks.size() && - std::abs( pWeight - weight - numeric_cast< long double >( allBlocks[ uint_c( blocks[c].first ) ][ blocks[c].second ].second ) ) <= - std::abs( pWeight - weight ) && + ( isIdentical(weight, 0.0l) || + std::abs( pWeight - weight - numeric_cast< long double >( allBlocks[ uint_c( blocks[c].first ) ][ blocks[c].second ].second ) ) <= + std::abs( pWeight - weight ) ) && numBlocks < maxBlocksPerProcess_ ) { targets[ uint_c( blocks[c].first ) ][ blocks[c].second ] = pid_c(p); diff --git a/src/blockforest/loadbalancing/StaticCurve.cpp b/src/blockforest/loadbalancing/StaticCurve.cpp index 9bb9c184d..e90ec3bc1 100644 --- a/src/blockforest/loadbalancing/StaticCurve.cpp +++ b/src/blockforest/loadbalancing/StaticCurve.cpp @@ -123,9 +123,9 @@ uint_t StaticLevelwiseCurveBalanceWeighted::operator()( SetupBlockForest & fores { const workload_t pWeight = totalWeight / workload_c( numberOfProcesses - p ); workload_t weight( 0 ); - while( c < blocksOnLevel.size() && + while( c < blocksOnLevel.size() && ( isIdentical(weight, workload_t(0)) || std::abs( pWeight - weight - blocksOnLevel[c]->getWorkload() ) <= - std::abs( pWeight - weight ) ) + std::abs( pWeight - weight ) ) ) { blocksOnLevel[c]->assignTargetProcess(p); -- GitLab