Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
LoadBalanceStrategy.hpp File Reference

implementation of the hilbert curve load balancing More...

#include "shambase/aliases_int.hpp"
#include "shambackends/sycl.hpp"
#include "shambackends/vec.hpp"
#include "shamcomm/logs.hpp"
#include "shamcomm/worldInfo.hpp"
#include <vector>
+ Include dependency graph for LoadBalanceStrategy.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  shamrock::scheduler::TileWithLoad< Torder, Tweight >
 
struct  shamrock::scheduler::details::LoadBalancedTile< Torder, Tweight >
 
struct  shamrock::scheduler::details::LBMetric
 

Namespaces

namespace  shamrock
 namespace for the main framework
 

Functions

template<class Torder , class Tweight >
void shamrock::scheduler::details::apply_ordering (std::vector< LoadBalancedTile< Torder, Tweight > > &lb_vec)
 Sort tiles by their ordering value.
 
template<class Torder , class Tweight >
std::vector< i32shamrock::scheduler::details::lb_startegy_parallel_sweep (const std::vector< TileWithLoad< Torder, Tweight > > &lb_vector, i32 wsize)
 Load balance using parallel sweep strategy based on accumulated load.
 
template<class Torder , class Tweight >
std::vector< i32shamrock::scheduler::details::lb_startegy_roundrobin (const std::vector< TileWithLoad< Torder, Tweight > > &lb_vector, i32 wsize)
 Load balance using round-robin strategy ignoring actual load values.
 
template<class Torder , class Tweight >
LBMetric shamrock::scheduler::details::compute_LB_metric (const std::vector< TileWithLoad< Torder, Tweight > > &lb_vector, const std::vector< i32 > &new_owners, i32 world_size, f64 strategy_weight)
 Compute load balance quality metrics.
 
template<class Torder , class Tweight >
std::vector< i32shamrock::scheduler::load_balance (std::vector< TileWithLoad< Torder, Tweight > > &&lb_vector, i32 world_size=shamcomm::world_size())
 load balance the input vector
 

Detailed Description

implementation of the hilbert curve load balancing

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file LoadBalanceStrategy.hpp.

Function Documentation

◆ apply_ordering()

template<class Torder , class Tweight >
void shamrock::scheduler::details::apply_ordering ( std::vector< LoadBalancedTile< Torder, Tweight > > &  lb_vec)
inline

Sort tiles by their ordering value.

Template Parameters
TorderOrdering value type
TweightLoad weight type
Parameters
lb_vecVector of load-balanced tiles to sort

Definition at line 58 of file LoadBalanceStrategy.hpp.

+ Here is the call graph for this function:

◆ compute_LB_metric()

template<class Torder , class Tweight >
LBMetric shamrock::scheduler::details::compute_LB_metric ( const std::vector< TileWithLoad< Torder, Tweight > > &  lb_vector,
const std::vector< i32 > &  new_owners,
i32  world_size,
f64  strategy_weight 
)
inline

Compute load balance quality metrics.

Template Parameters
TorderOrdering value type
TweightLoad weight type
Parameters
lb_vectorTiles with load information
new_ownersOwner assignments to evaluate
world_sizeNumber of workers
Returns
LBMetric Statistics about load distribution (min, max, mean, stddev)

Definition at line 222 of file LoadBalanceStrategy.hpp.

+ Here is the call graph for this function:

◆ lb_startegy_parallel_sweep()

template<class Torder , class Tweight >
std::vector< i32 > shamrock::scheduler::details::lb_startegy_parallel_sweep ( const std::vector< TileWithLoad< Torder, Tweight > > &  lb_vector,
i32  wsize 
)
inline

Load balance using parallel sweep strategy based on accumulated load.

Template Parameters
TorderOrdering value type
TweightLoad weight type
Parameters
lb_vectorTiles with load information
wsizeNumber of workers
Returns
std::vector<i32> New owner assignments for each tile

Definition at line 75 of file LoadBalanceStrategy.hpp.

+ Here is the call graph for this function:

◆ lb_startegy_roundrobin()

template<class Torder , class Tweight >
std::vector< i32 > shamrock::scheduler::details::lb_startegy_roundrobin ( const std::vector< TileWithLoad< Torder, Tweight > > &  lb_vector,
i32  wsize 
)
inline

Load balance using round-robin strategy ignoring actual load values.

Template Parameters
TorderOrdering value type
TweightLoad weight type
Parameters
lb_vectorTiles with load information
wsizeNumber of workers
Returns
std::vector<i32> New owner assignments for each tile

Definition at line 144 of file LoadBalanceStrategy.hpp.

+ Here is the call graph for this function:

◆ load_balance()

template<class Torder , class Tweight >
std::vector< i32 > shamrock::scheduler::load_balance ( std::vector< TileWithLoad< Torder, Tweight > > &&  lb_vector,
i32  world_size = shamcomm::world_size() 
)
inline

load balance the input vector

Template Parameters
Torderordering value (hilbert, morton, ...)
Tweightweight type
Parameters
lb_vector
Returns
std::vector<i32> The new owner list

Definition at line 274 of file LoadBalanceStrategy.hpp.

+ Here is the call graph for this function: