Load balancing#
The GauXC::LoadBalancer distributes quadrature tasks across processes and provides access to local work units.
To create load balancers, the GauXC::LoadBalancerFactory is provided, which can generate different load balancing strategies based on user-defined settings.
For specifying the execution context, the GauXC::ExecutionSpace enum is available.
-
class LoadBalancer#
A class to distribute and manage local quadrature tasks for XCIntegraor operations.
Public Functions
-
LoadBalancer()#
Construct default LoadBalancer instance with null internal state.
-
LoadBalancer(std::unique_ptr<pimpl_type> &&pimpl)#
Construct LoadBalancer instance from preconstructed implementation.
-
LoadBalancer(const LoadBalancer&)#
Copy a LoadBalancer instance.
-
LoadBalancer(LoadBalancer&&) noexcept#
Move a LoadBalancer instance.
-
~LoadBalancer() noexcept#
Destruct LoadBalancer instance (defaulted)
-
const std::vector<XCTask> &get_tasks() const#
Get underlying (local) quadrature tasks for this process (cost)
-
std::vector<XCTask> &get_tasks()#
Get underlying (local) quadrature tasks for this process (non-cost)
-
void rebalance_weights()#
Rebalance quadrature batches according to weight-only cost.
-
void rebalance_exc_vxc()#
Rebalance quadrature batches according to exc-vxc cost.
-
void rebalance_exx()#
Rebalance quadrature batches according to exx cost.
-
const util::Timer &get_timings() const#
Return internal timing tracker.
-
size_t total_npts() const#
Return the total number of points for local tasks.
-
size_t max_npts() const#
Return the maximum number of points for local tasks.
-
size_t max_nbe() const#
Return the maximum effective basis dimention for local tasks.
-
size_t max_npts_x_nbe() const#
Return the maximum npts x nde product for local tasks.
-
const Molecule &molecule() const#
Return the underlying molecule instance used to generate this LoadBalancer.
-
const MolMeta &molmeta() const#
Return the underlying MolMeta instance used to generate this LoadBalancer.
-
const basis_type &basis() const#
Return the underlying BasisSet instance used to generate this LoadBalancer.
-
const basis_map_type &basis_map() const#
Return BasisSetMap instance corresponding to basis/molecule.
-
const shell_pair_type &shell_pairs() const#
Return the number of non-negligible local shell pairs for this LoadBalancer.
-
const RuntimeEnvironment &runtime() const#
Return the runtime handle used to construct this LoadBalancer.
-
LoadBalancerState &state()#
Return the load balancer state (non-const)
-
bool operator==(const LoadBalancer&) const#
Check equality of LoadBalancer instances.
-
LoadBalancer()#
-
class LoadBalancerFactory#
A factory to generate LoadBalancer instances.
Public Functions
-
LoadBalancerFactory(ExecutionSpace ex, std::string kernel_name)#
Construct a factory which generates a specific kind of LoadBalancer.
Currently accepted values for Device execution space:
”DEFAULT”: Read as “REPLICATED”
”REPLICATED”: Same as Host::REPLICATED-PETITE
- Parameters:
ex – [in] Execution space for the LoadBalancer phase. Acceptable values:
Host: Run LoadBalancer on CPU
Device: Run LoadBalancer on GPU (if enabled)
kernel_name – [in] Specification of the LoadBalancer kernel. Currently accepted values for Host execution space:
”DEFAULT”: Read as “REPLICATED-PETITE”
”REPLICATED”: Read as “REPLICATED-PETITE”
”REPLICATED-PETITE”: Replicate the load balancer function, only keep non negligible basis functions
”REPLICATED-FILLIN”: Same as “REPLICATED-PETITE” except if two non-adjacent bfns are kept, the gaps are filled in. This gurantees contiguous memory access but leads to significantly more work. Not advised for general usage
-
LoadBalancer get_instance(const RuntimeEnvironment &rt, const Molecule &mol, const MolGrid &mg, const BasisSet<double> &bs)#
Generate a LoadBalancer instance per kernel and execution space specfication.
- Parameters:
rt – [in] Runtime handle defining the execution space across which the quadrature tasks will be distributed.
mol – [in] Molecule on which the quadrature is defined.
mg – [in] The batched molecular quadrature
bs – [in] The basis set whcih will be used for numerical integration
- Returns:
A LoadBalancer instance constructed using the passed parameters.
Generate a shared pointer to a LoadBalancer instance per kernel and execution space specfication.
- Parameters:
rt – [in] Runtime handle defining the execution space across which the quadrature tasks will be distributed.
mol – [in] Molecule on which the quadrature is defined.
mg – [in] The batched molecular quadrature
bs – [in] The basis set whcih will be used for numerical integration
- Returns:
A shared pointer to a LoadBalancer instance constructed using the passed parameters.
-
LoadBalancerFactory(ExecutionSpace ex, std::string kernel_name)#