Skip to content
Snippets Groups Projects
Commit 2878e688 authored by Florian Schornbaum's avatar Florian Schornbaum
Browse files

Improves weighted SFC partitioning

parent 579b6bbe
No related merge requests found
......@@ -32,6 +32,7 @@
#include "core/mpi/Gatherv.h"
#include "core/mpi/MPIManager.h"
#include <cmath>
#include <map>
#include <set>
#include <stack>
......@@ -751,9 +752,11 @@ void DynamicLevelwiseCurveBalance< PhantomData_T >::balanceWeighted( const std::
uint_t c( uint_t(0) );
for( uint_t p = uint_t(0); p != processes; ++p )
{
const long double minWeight = totalWeight / numeric_cast< long double >( processes - p );
const long double pWeight = totalWeight / numeric_cast< long double >( processes - p );
long double weight( 0 );
while( weight < minWeight && c < blocks.size() )
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 ) )
{
targets[ uint_c( blocks[c].first ) ][ blocks[c].second ] = pid_c(p);
sender[p].insert( blocks[c].first );
......
......@@ -21,6 +21,8 @@
#include "StaticCurve.h"
#include <cmath>
namespace walberla {
......@@ -119,9 +121,11 @@ uint_t StaticLevelwiseCurveBalanceWeighted::operator()( SetupBlockForest & fores
uint_t c( uint_t(0) );
for( uint_t p = uint_t(0); p != numberOfProcesses; ++p )
{
const workload_t minWeight = totalWeight / workload_c( numberOfProcesses - p );
const workload_t pWeight = totalWeight / workload_c( numberOfProcesses - p );
workload_t weight( 0 );
while( weight < minWeight && c < blocksOnLevel.size() )
while( c < blocksOnLevel.size() &&
std::abs( pWeight - weight - blocksOnLevel[c]->getWorkload() ) <=
std::abs( pWeight - weight ) )
{
blocksOnLevel[c]->assignTargetProcess(p);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment