Loading...
Searching...
No Matches
q3::execution::gpu::GPUExecutionPolicy Class Reference

#include <init.hpp>

+ Inheritance diagram for q3::execution::gpu::GPUExecutionPolicy:

Public Member Functions

 GPUExecutionPolicy (std::shared_ptr< device::GPUDeviceBackend > device_backend)
 
void add_scaled_vector (int number_of_elements, ComplexValue scaling_factor, const ComplexValue *vector_x, ComplexValue *vector_y) const override
 
void allgather_within_group (const Real *local_data, int local_count, Real *full_data, int) const override
 
const device::GPUDeviceBackend & device_backend () const
 
ComplexValue dot_product (int number_of_elements, const ComplexValue *vector_x, const ComplexValue *vector_y) const override
 
int global_number_of_elements (int local_number_of_elements) const override
 
int group_rank_index () const override
 
int group_size () const override
 
bool is_root () const override
 
Real norm (int number_of_elements, const ComplexValue *vector_x) const override
 
int number_of_processes () const override
 
void reduce_within_group (ComplexValue *, int) const override
 
void reduce_within_group (Real *, int) const override
 
- Public Member Functions inherited from q3::execution::ExecutionPolicy
virtual ~ExecutionPolicy ()=default
 
virtual void allgather_across_bands (ComplexValue *, const int *, const int *) const
 
virtual int band_distribution_rank_index () const
 
virtual int band_distribution_size () const
 
virtual void broadcast_across_bands (ComplexValue *, int) const
 
virtual void broadcast_across_bands (int *, int) const
 Integer overload, for the counts that decide collective sizes.
 
virtual void broadcast_across_bands (Real *, int) const
 Real overload, for eigenvalues – the numbers convergence decisions are made from.
 
virtual void broadcast_from_group_root (ComplexValue *, int) const
 
virtual void broadcast_from_group_root (Real *, int) const
 
virtual void reduce_across_bands (Real *, int) const
 
virtual void reduce_group_distributed_result (ComplexValue *, int) const
 

Protected Attributes

std::shared_ptr< device::GPUDeviceBackend > device_backend_
 

Additional Inherited Members

- Public Types inherited from q3::execution::ExecutionPolicy
using ComplexValue = Complex
 

Detailed Description

Definition at line 35 of file init.hpp.

Constructor & Destructor Documentation

◆ GPUExecutionPolicy()

q3::execution::gpu::GPUExecutionPolicy::GPUExecutionPolicy ( std::shared_ptr< device::GPUDeviceBackend >  device_backend)
inlineexplicit

Construct a GPU execution policy.

Parameters
device_backendShared pointer to the GPU device backend. Must not be null.

Definition at line 43 of file init.hpp.

References device_backend_.

Member Function Documentation

◆ add_scaled_vector()

void q3::execution::gpu::GPUExecutionPolicy::add_scaled_vector ( int  number_of_elements,
ComplexValue  scaling_factor,
const ComplexValue *  vector_x,
ComplexValue *  vector_y 
) const
inlineoverridevirtual

Scaled vector addition on GPU-resident data: vector_y += scaling_factor * vector_x.

Intentionally unwired: the GPU compute paths call GPUBLAS directly on device buffers instead of going through this generic policy interface. Throws if reached.

Implements q3::execution::ExecutionPolicy.

Reimplemented in q3::execution::PlanewaveGPUExecutionPolicy.

Definition at line 74 of file init.hpp.

◆ allgather_within_group()

void q3::execution::gpu::GPUExecutionPolicy::allgather_within_group ( const Real *  local_data,
int  local_count,
Real *  full_data,
int  total_count 
) const
inlineoverridevirtual

Allgather rank-local slab data into a full-size buffer on every rank.

Gathers each group rank's contiguous local slice into a contiguous full array on every rank (concatenated in rank order). No-op when group_size == 1.

Parameters
local_dataRank-local slab data.
local_countNumber of real elements in the local slab.
full_dataOutput: full-grid data (all slabs concatenated).
total_countTotal number of real elements across all ranks.

Implements q3::execution::ExecutionPolicy.

Definition at line 127 of file init.hpp.

◆ device_backend()

const device::GPUDeviceBackend & q3::execution::gpu::GPUExecutionPolicy::device_backend ( ) const
inline

Access the underlying GPU device backend.

Definition at line 137 of file init.hpp.

References device_backend_.

◆ dot_product()

ComplexValue q3::execution::gpu::GPUExecutionPolicy::dot_product ( int  number_of_elements,
const ComplexValue *  vector_x,
const ComplexValue *  vector_y 
) const
inlineoverridevirtual

Compute the inner product x† · y on GPU-resident data.

Intentionally unwired: the GPU compute paths (hamiltonian applicator, subspace manager) call GPUBLAS directly on device buffers instead of going through this generic policy interface. Throws if reached.

Implements q3::execution::ExecutionPolicy.

Reimplemented in q3::execution::PlanewaveGPUExecutionPolicy.

Definition at line 57 of file init.hpp.

◆ global_number_of_elements()

int q3::execution::gpu::GPUExecutionPolicy::global_number_of_elements ( int  local_number_of_elements) const
inlineoverridevirtual

Sum a rank-local element count across the process group.

Distributed vector algorithms use this to distinguish the local slab length from the dimension of the complete vector space.

Implements q3::execution::ExecutionPolicy.

Definition at line 119 of file init.hpp.

◆ group_rank_index()

int q3::execution::gpu::GPUExecutionPolicy::group_rank_index ( ) const
inlineoverridevirtual

Index of this process within its process group.

0 in serial mode. NOT necessarily 0 when group_size() == 1: a group whose data distribution was disabled at run time (see MPIExecutionPolicy::disable_group_distribution) reports group_size() == 1 while keeping its pool-local rank index, because the pool identity is still needed. Use group_size() <= 1 to ask "is my data replicated"; use group_rank_index() == 0 only to pick one representative per pool.

Implements q3::execution::ExecutionPolicy.

Definition at line 107 of file init.hpp.

◆ group_size()

int q3::execution::gpu::GPUExecutionPolicy::group_size ( ) const
inlineoverridevirtual

Number of processes in this process group. Always 1 in serial mode or when each group contains a single process.

Implements q3::execution::ExecutionPolicy.

Definition at line 111 of file init.hpp.

◆ is_root()

bool q3::execution::gpu::GPUExecutionPolicy::is_root ( ) const
inlineoverridevirtual

GPU execution is always single-process (no MPI in this policy).

Implements q3::execution::ExecutionPolicy.

Definition at line 103 of file init.hpp.

◆ norm()

Real q3::execution::gpu::GPUExecutionPolicy::norm ( int  number_of_elements,
const ComplexValue *  vector_x 
) const
inlineoverridevirtual

Euclidean norm on GPU-resident data.

Intentionally unwired: the GPU compute paths call GPUBLAS directly on device buffers instead of going through this generic policy interface. Throws if reached.

Implements q3::execution::ExecutionPolicy.

Reimplemented in q3::execution::PlanewaveGPUExecutionPolicy.

Definition at line 93 of file init.hpp.

◆ number_of_processes()

int q3::execution::gpu::GPUExecutionPolicy::number_of_processes ( ) const
inlineoverridevirtual

Number of processes in the complete execution topology.

Implements q3::execution::ExecutionPolicy.

Definition at line 115 of file init.hpp.

◆ reduce_within_group() [1/2]

void q3::execution::gpu::GPUExecutionPolicy::reduce_within_group ( ComplexValue *  data,
int  number_of_elements 
) const
inlineoverridevirtual

Allreduce an array of complex values within the process group.

Used after ZGEMM-based inner products over the distributed vector dimension (e.g., subspace matrices, orthogonalization overlaps) when coefficient vectors are distributed across group ranks. No-op when group_size == 1.

Parameters
dataIn-out array of complex values.
number_of_elementsNumber of complex elements to reduce.

Implements q3::execution::ExecutionPolicy.

Definition at line 123 of file init.hpp.

◆ reduce_within_group() [2/2]

void q3::execution::gpu::GPUExecutionPolicy::reduce_within_group ( Real *  data,
int  number_of_elements 
) const
inlineoverridevirtual

Allreduce an array of real values within the process group.

Same as the complex variant but for real-valued arrays.

Parameters
dataIn-out array of real values.
number_of_elementsNumber of real elements to reduce.

Implements q3::execution::ExecutionPolicy.

Definition at line 125 of file init.hpp.

Member Data Documentation

◆ device_backend_

std::shared_ptr<device::GPUDeviceBackend> q3::execution::gpu::GPUExecutionPolicy::device_backend_
protected

Definition at line 142 of file init.hpp.

Referenced by GPUExecutionPolicy(), and device_backend().


The documentation for this class was generated from the following file: