Load balancer API#

This section provides a reference for the load balancer in GauXC, including C++ class definitions, C bindings, and Fortran bindings for creating and managing load balancers used in GauXC computations.

C++ definitions#

class GauXC::LoadBalancer#

A class representing a load balancer for distributing computational work across multiple processes in GauXC.

class GauXC::LoadBalancerFactory#

A factory class for creating LoadBalancer objects based on the specified load balancing strategy.

LoadBalancerFactory(ExecutionSpace ex, std::string kernel_name)#

Construct a LoadBalancerFactory object with the specified execution space and kernel name.

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 basis functions are kept, the gaps are filled in. This gurantees contiguous memory access but leads to significantly more work. Not advised for general usage.

Currently accepted values for Device execution space:

“DEFAULT”:

Read as “REPLICATED”

“REPLICATED”:

Same as Host::REPLICATED-PETITE

Parameters:
  • ex – The execution space for which to create load balancers.

  • kernel_name – The name of the kernel for which to create load balancers.

LoadBalancer get_instance(const RuntimeEnvironment &rt, const Molecule &mol, const MolGrid &mg, const BasisSet<double> &bs)#

Get a LoadBalancer instance for the specified runtime environment, molecule, molecular grid, and basis set.

Parameters:
  • rt – The runtime environment for which to get the load balancer instance.

  • mol – The molecule for which to get the load balancer instance.

  • mg – The molecular grid for which to get the load balancer instance.

  • bs – The basis set for which to get the load balancer instance.

std::shared_ptr<LoadBalancer> get_shared_instance(RuntimeEnvironment &rt, const Molecule &mol, const MolGrid &mg, const BasisSet<double> &bs)#

Get a shared pointer to a LoadBalancer instance for the specified runtime environment, molecule, molecular grid, and basis set.

Parameters:
  • rt – The runtime environment for which to get the load balancer instance.

  • mol – The molecule for which to get the load balancer instance.

  • mg – The molecular grid for which to get the load balancer instance.

  • bs – The basis set for which to get the load balancer instance.

enum class GauXC::ExecutionSpace#

Enumeration of execution spaces for which load balancers can be created in GauXC.

The following execution spaces are available:

enumerator Host#

Load balancers for execution on the host CPU.

enumerator Device#

Load balancers for execution on a device (e.g., GPU).

C bindings#

struct GauXCLoadBalancer#

Opaque struct representing a load balancer in the GauXC C API.

void gauxc_load_balancer_delete(GauXCStatus *status, GauXCLoadBalancer *lb)#

Delete a load balancer instance. Part of the gauxc_delete() interface.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • lb – Pointer to the GauXCLoadBalancer instance to be deleted.

struct GauXCLoadBalancerFactory#

Opaque struct representing a load balancer factory in the GauXC C API.

GauXCLoadBalancerFactory *gauxc_load_balancer_factory_new(GauXCStatus *status, enum GauXC_ExecutionSpace ex, const char *kernel_name)#

Create a new load balancer factory with the specified execution space and kernel name.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • ex – The execution space for which to create load balancers.

  • kernel_name – The name of the kernel for which to create load balancers.

GauXCLoadBalancer gauxc_load_balancer_factory_get_instance(GauXCStatus *status, GauXCLoadBalancerFactory lbf, const GauXCRuntimeEnvironment rt, const GauXCMolecule mol, const GauXCMolGrid mg, const GauXCBasisSet bs)#

Get a load balancer instance for the specified runtime environment, molecule, molecular grid, and basis set. Part of the gauxc_get_instance() interface.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • lbf – GauXCLoadBalancerFactory struct from which to get the load balancer instance.

  • rt – Pointer to the runtime environment for which to get the load balancer instance.

  • mol – Pointer to the molecule for which to get the load balancer instance.

  • mg – Pointer to the molecular grid for which to get the load balancer instance.

  • bs – Pointer to the basis set for which to get the load balancer instance.

void gauxc_load_balancer_factory_delete(GauXCStatus *status, GauXCLoadBalancerFactory *lbf)#

Delete a load balancer factory instance. Part of the gauxc_delete() interface.

Parameters:
  • status – Pointer to a GauXCStatus struct where the status of the operation will be stored.

  • lbf – Pointer to the GauXCLoadBalancerFactory instance to be deleted.

enum GauXC_ExecutionSpace#

Enumeration of execution spaces for which load balancers can be created in the GauXC C API.

The following execution spaces are available:

enumerator GauXC_ExecutionSpace_Host#

Load balancers for execution on the host CPU.

enumerator GauXC_ExecutionSpace_Device#

Load balancers for execution on a device (e.g., GPU).

Fortran bindings#

type  gauxc_load_balancer_type#

Opaque type representing a load balancer in the GauXC Fortran API. Available in the module gauxc_load_balancer.

function  gauxc_load_balancer_delete(status, lb)#

Delete a load balancer instance.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • lb [type(gauxc_load_balancer_type)] :: The load balancer instance to be deleted.

type  gauxc_load_balancer_factory_type#

Opaque type representing a load balancer factory in the GauXC Fortran API. Available in the module gauxc_load_balancer.

function  gauxc_load_balancer_factory_new(status, ex, kernel_name)#

Create a new load balancer factory with the specified execution space and kernel name.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • ex [integer(c_int)] :: The execution space for which to create load balancers.

  • kernel_name [character(len=*)] :: The name of the kernel for which to create load balancers.

function  gauxc_load_balancer_factory_get_instance(status, lbf, rt, mol, mg, bs)#

Get a load balancer instance for the specified runtime environment, molecule, molecular grid, and basis set.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • lbf [type(gauxc_load_balancer_factory_type)] :: The load balancer factory from which to get the load balancer instance.

  • rt [type(gauxc_runtime_environment_type)] :: The runtime environment for which to get the load balancer instance.

  • mol [type(gauxc_molecule_type)] :: The molecule for which to get the load balancer instance.

  • mg [type(gauxc_mol_grid_type)] :: The molecular grid for which to get the load balancer instance.

  • bs [type(gauxc_basis_set_type)] :: The basis set for which to get the load balancer instance.

subroutine  gauxc_load_balancer_factory_delete(status, lbf)#

Delete a load balancer factory instance.

Parameters:
  • status [type(gauxc_status_type)] :: Pointer to a GauXCStatus variable to store the status of the operation.

  • lbf [type(gauxc_load_balancer_factory_type)] :: The load balancer factory instance to be deleted.

type  gauxc_execution_space#

Parameter instance of a derived type with members corresponding to the execution spaces for which load balancers can be created in the GauXC Fortran API.

Type fields:
  • % host [integer(c_int)] :: Load balancers for execution on the host CPU.

  • % device [integer(c_int)] :: Load balancers for execution on a device (e.g., GPU).