QUDA  0.9.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
quda::Transfer Class Reference

#include <transfer.h>

Collaboration diagram for quda::Transfer:
Collaboration graph
[legend]

Public Member Functions

 Transfer (const std::vector< ColorSpinorField *> &B, int Nvec, int *geo_bs, int spin_bs, bool enable_gpu, TimeProfile &profile)
 
virtual ~Transfer ()
 
void P (ColorSpinorField &out, const ColorSpinorField &in) const
 
void R (ColorSpinorField &out, const ColorSpinorField &in) const
 
const ColorSpinorFieldVectors (QudaFieldLocation location=QUDA_CPU_FIELD_LOCATION) const
 
int nvec () const
 
int Spin_bs () const
 
const intGeo_bs () const
 
void setTransferGPU (bool use_gpu) const
 
void setSiteSubset (QudaSiteSubset site_subset, QudaParity parity)
 Sets whether the transfer operator is to act on full fields or single parity fields, and if single-parity which parity. If site_subset is QUDA_FULL_SITE_SUBSET, the transfer operator can still be applied to single-parity fields, however, if site_subset is QUDA_PARITY_SITE_SUBSET, then the transfer operator cannot be applied to full fields, and setSiteSubset will need to be called first to reset to QUDA_FULL_SITE_SUBSET. This method exists to reduce GPU memory overhead - if only transfering single-parity fine fields then we only store a single-parity copy of the null space components on the device. More...
 
double flops () const
 

Private Member Functions

void fillV (ColorSpinorField &V)
 
void createGeoMap (int *geo_bs)
 
void createSpinMap (int spin_bs)
 

Private Attributes

const std::vector< ColorSpinorField * > & B
 
const int Nvec
 
ColorSpinorFieldV_h
 
ColorSpinorFieldV_d
 
ColorSpinorFieldfine_tmp_h
 
ColorSpinorFieldfine_tmp_d
 
ColorSpinorFieldcoarse_tmp_h
 
ColorSpinorFieldcoarse_tmp_d
 
intgeo_bs
 
intfine_to_coarse_h
 
intcoarse_to_fine_h
 
intfine_to_coarse_d
 
intcoarse_to_fine_d
 
int spin_bs
 
intspin_map
 
QudaSiteSubset site_subset
 
QudaParity parity
 
bool enable_gpu
 
bool use_gpu
 
double flops_
 
TimeProfileprofile
 

Detailed Description

The transfer class defines the inter-grid operators that connect fine and coarse grids. This implements both restriction and prologation methods. The transfer operator is fully defined at object creation time, and defined by the null-space vectors and the coarsening pattern that are passed to it.

At present only the restriction (R) and prolongation (P) methods have been offloaded to run on the GPU, with the block orthogonlization yet to be offloaded.

Definition at line 30 of file transfer.h.

Constructor & Destructor Documentation

◆ Transfer()

quda::Transfer::Transfer ( const std::vector< ColorSpinorField *> &  B,
int  Nvec,
int geo_bs,
int  spin_bs,
bool  enable_gpu,
TimeProfile profile 
)

The constructor for Transfer

Parameters
BArray of null-space vectors
NvecNumber of null-space vectors
dThe Dirac operator to which these null-space vectors correspond
geo_bsThe geometric block sizes to use
spin_bsThe spin block sizes to use
parityFor single-parity fields are these QUDA_EVEN_PARITY or QUDA_ODD_PARITY
enable_gpuWhether to enable this to run on GPU (as well as CPU)

Definition at line 21 of file transfer.cpp.

References B, quda::BlockOrthogonalize(), coarse_tmp_d, coarse_tmp_h, coarse_to_fine_d, coarse_to_fine_h, quda::ColorSpinorField::Create(), quda::ColorSpinorField::CreateCoarse(), createGeoMap(), createSpinMap(), d, device_malloc, enable_gpu, errorQuda, fillV(), fine_tmp_d, fine_tmp_h, fine_to_coarse_d, fine_to_coarse_h, geo_bs, getVerbosity(), QudaGaugeParam_s::location, ndim, Nspin, Nvec, param, printfQuda, QUDA_CUDA_FIELD_LOCATION, QUDA_FLOAT2_FIELD_ORDER, QUDA_FULL_SITE_SUBSET, QUDA_NULL_FIELD_CREATE, QUDA_PARITY_SITE_SUBSET, QUDA_VERBOSE, QUDA_ZERO_FIELD_CREATE, safe_malloc, spin_bs, spin_map, sprintf(), V_d, V_h, warningQuda, and X.

Here is the call graph for this function:

◆ ~Transfer()

quda::Transfer::~Transfer ( )
virtual

Member Function Documentation

◆ createGeoMap()

void quda::Transfer::createGeoMap ( int geo_bs)
private

Creates the map between fine and coarse grids

Parameters
geo_bsAn array storing the block size in each geometric dimension

Definition at line 212 of file transfer.cpp.

References B, checkCudaError, coarse_tmp_h, coarse_to_fine_d, coarse_to_fine_h, d, enable_gpu, fine_tmp_h, fine_to_coarse_d, fine_to_coarse_h, geo_bs, fused_exterior_ndeg_tm_dslash_cuda_gen::i, quda::ColorSpinorField::LatticeIndex(), quda::ColorSpinorField::Ndim(), quda::ColorSpinorField::OffsetIndex(), QUDA_MAX_DIM, qudaMemcpy, quda::ColorSpinorField::Volume(), x, and y.

Referenced by Transfer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createSpinMap()

void quda::Transfer::createSpinMap ( int  spin_bs)
private

Creates a block-ordered version of the color-spinor field V N.B. in must be the accessor to the color-spinor field V

Parameters
outA Complex array storing the block-ordered fields
inAccessor for the color-spinor field V Copies elements from the block-ordered field in back to the color-spinor field V N.B. out must be the accessor to the color-spinor field V
outThe full lattice color spinor field, not block-ordered
inA Complex array storing the block-ordered fields Does Gram-Schmidt orthogonalization.
vThe block-ordered vectors
nBlocks
Nc
blockSizeCreates the map between fine and coarse spin dimensions
spin_bsThe spin block size

Definition at line 253 of file transfer.cpp.

References B, s, spin_bs, and spin_map.

Referenced by Transfer().

Here is the caller graph for this function:

◆ fillV()

void quda::Transfer::fillV ( ColorSpinorField V)
private

Copies the null-space vector components into the V-field

Definition at line 197 of file transfer.cpp.

References B, quda::FillV(), Nvec, and V.

Referenced by Transfer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flops()

double quda::Transfer::flops ( ) const

Return flops

Returns
flops expended by this operator

Definition at line 342 of file transfer.cpp.

References flops_.

Referenced by quda::MG::flops().

Here is the caller graph for this function:

◆ Geo_bs()

const int* quda::Transfer::Geo_bs ( ) const
inline

Returns the geometrical coarse grid blocking

Returns
geo_bs

Definition at line 215 of file transfer.h.

References geo_bs.

Referenced by quda::DiracCoarse::initializeCoarse().

Here is the caller graph for this function:

◆ nvec()

int quda::Transfer::nvec ( ) const
inline

Returns the number of near nullvectors

Returns
Nvec

Definition at line 203 of file transfer.h.

References Nvec.

Referenced by quda::DiracCoarse::initializeCoarse().

Here is the caller graph for this function:

◆ P()

void quda::Transfer::P ( ColorSpinorField out,
const ColorSpinorField in 
) const

Apply the prolongator

Parameters
outThe resulting field on the fine lattice
inThe input field on the coarse lattice

Definition at line 262 of file transfer.cpp.

References coarse_tmp_d, enable_gpu, errorQuda, quda::ColorSpinorField::Even(), fine_tmp_d, fine_tmp_h, fine_to_coarse_d, fine_to_coarse_h, flops_, quda::ColorSpinorField::GammaBasis(), in, Nvec, out, parity, profile, quda::Prolongate(), QUDA_CPU_FIELD_LOCATION, QUDA_CUDA_FIELD_LOCATION, QUDA_FULL_SITE_SUBSET, QUDA_PARITY_SITE_SUBSET, quda::QUDA_PROFILE_COMPUTE, spin_map, use_gpu, V, V_d, and V_h.

Referenced by quda::MG::operator()(), and quda::MG::verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ R()

void quda::Transfer::R ( ColorSpinorField out,
const ColorSpinorField in 
) const

Apply the restrictor

Parameters
outThe resulting field on the coarse lattice
inThe input field on the fine lattice

Definition at line 300 of file transfer.cpp.

References coarse_tmp_d, coarse_to_fine_d, coarse_to_fine_h, enable_gpu, errorQuda, quda::ColorSpinorField::Even(), fine_tmp_d, fine_tmp_h, fine_to_coarse_d, fine_to_coarse_h, flops_, quda::ColorSpinorField::GammaBasis(), in, Nvec, out, parity, profile, QUDA_CPU_FIELD_LOCATION, QUDA_CUDA_FIELD_LOCATION, QUDA_FULL_SITE_SUBSET, QUDA_PARITY_SITE_SUBSET, quda::QUDA_PROFILE_COMPUTE, quda::qudaDeviceSynchronize(), quda::Restrict(), spin_map, use_gpu, V, V_d, and V_h.

Referenced by quda::MG::MG(), quda::MG::operator()(), and quda::MG::verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSiteSubset()

void quda::Transfer::setSiteSubset ( QudaSiteSubset  site_subset,
QudaParity  parity 
)

Sets whether the transfer operator is to act on full fields or single parity fields, and if single-parity which parity. If site_subset is QUDA_FULL_SITE_SUBSET, the transfer operator can still be applied to single-parity fields, however, if site_subset is QUDA_PARITY_SITE_SUBSET, then the transfer operator cannot be applied to full fields, and setSiteSubset will need to be called first to reset to QUDA_FULL_SITE_SUBSET. This method exists to reduce GPU memory overhead - if only transfering single-parity fine fields then we only store a single-parity copy of the null space components on the device.

Parameters
[in]site_subsetThe site_subset of the fine-grid fields
[in]parityThe parity of the single-parity fields (if applicable)

Definition at line 155 of file transfer.cpp.

References quda::ColorSpinorField::Create(), enable_gpu, errorQuda, quda::ColorSpinorField::Even(), QudaGaugeParam_s::location, quda::ColorSpinorField::Odd(), param, parity, QUDA_CUDA_FIELD_LOCATION, QUDA_EVEN_PARITY, QUDA_FLOAT2_FIELD_ORDER, QUDA_FULL_SITE_SUBSET, QUDA_ODD_PARITY, QUDA_PARITY_SITE_SUBSET, site_subset, V_d, and V_h.

Referenced by quda::MG::reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTransferGPU()

void quda::Transfer::setTransferGPU ( bool  use_gpu) const
inline

Sets where the prolongator / restrictor should take place

Parameters
locationLocation where the transfer operator should be computed

Definition at line 221 of file transfer.h.

References use_gpu.

◆ Spin_bs()

int quda::Transfer::Spin_bs ( ) const
inline

Returns the amount of spin blocking

Returns
spin_bs

Definition at line 209 of file transfer.h.

References spin_bs.

Referenced by quda::DiracCoarse::initializeCoarse().

Here is the caller graph for this function:

◆ Vectors()

const ColorSpinorField& quda::Transfer::Vectors ( QudaFieldLocation  location = QUDA_CPU_FIELD_LOCATION) const
inline

Returns a const reference to the V field

Parameters
locationWhich memory space are we requesting
Returns
The V field const reference

Definition at line 195 of file transfer.h.

References QUDA_CUDA_FIELD_LOCATION, V_d, and V_h.

Referenced by quda::CoarseCoarseOp(), quda::CoarseOp(), quda::DiracWilson::createCoarseOp(), quda::DiracClover::createCoarseOp(), quda::DiracCloverPC::createCoarseOp(), quda::DiracTwistedClover::createCoarseOp(), quda::DiracTwistedCloverPC::createCoarseOp(), quda::DiracCoarse::createCoarseOp(), quda::DiracCoarsePC::createCoarseOp(), quda::DiracCoarse::initializeCoarse(), and quda::MG::verify().

Here is the caller graph for this function:

Member Data Documentation

◆ B

const std::vector<ColorSpinorField*>& quda::Transfer::B
private

The raw null space components

Definition at line 35 of file transfer.h.

Referenced by createGeoMap(), createSpinMap(), fillV(), and Transfer().

◆ coarse_tmp_d

ColorSpinorField* quda::Transfer::coarse_tmp_d
private

A GPU temporary field with coarse geometry and coarse color we use for CPU input / output

Definition at line 56 of file transfer.h.

Referenced by P(), R(), Transfer(), and ~Transfer().

◆ coarse_tmp_h

ColorSpinorField* quda::Transfer::coarse_tmp_h
private

A CPU temporary field with coarse geometry and coarse color

Definition at line 53 of file transfer.h.

Referenced by createGeoMap(), Transfer(), and ~Transfer().

◆ coarse_to_fine_d

int* quda::Transfer::coarse_to_fine_d
private

The mapping onto fine sites from coarse sites. This has length equal to the fine-grid volume, and is sorted into lexicographical block order, with each value corresponding to a fine-grid offset. (GPU)

Definition at line 81 of file transfer.h.

Referenced by createGeoMap(), R(), Transfer(), and ~Transfer().

◆ coarse_to_fine_h

int* quda::Transfer::coarse_to_fine_h
private

The mapping onto fine sites from coarse sites. This has length equal to the fine-grid volume, and is sorted into lexicographical block order, with each value corresponding to a fine-grid offset. (CPU)

Definition at line 70 of file transfer.h.

Referenced by createGeoMap(), R(), Transfer(), and ~Transfer().

◆ enable_gpu

bool quda::Transfer::enable_gpu
private

Whether to enable transfer operator on the GPU

Definition at line 96 of file transfer.h.

Referenced by createGeoMap(), P(), R(), setSiteSubset(), and Transfer().

◆ fine_tmp_d

ColorSpinorField* quda::Transfer::fine_tmp_d
private

A GPU temporary field with fine geometry and fine color we use for changing gamma basis

Definition at line 50 of file transfer.h.

Referenced by P(), R(), Transfer(), and ~Transfer().

◆ fine_tmp_h

ColorSpinorField* quda::Transfer::fine_tmp_h
private

A CPU temporary field with fine geometry and fine color we use for changing gamma basis

Definition at line 47 of file transfer.h.

Referenced by createGeoMap(), P(), R(), Transfer(), and ~Transfer().

◆ fine_to_coarse_d

int* quda::Transfer::fine_to_coarse_d
private

The mapping onto coarse sites from fine sites. This has length equal to the fine-grid volume, and is sorted into lexicographical fine-grid order, with each value corresponding to a coarse-grid offset. (GPU)

Definition at line 76 of file transfer.h.

Referenced by createGeoMap(), P(), R(), Transfer(), and ~Transfer().

◆ fine_to_coarse_h

int* quda::Transfer::fine_to_coarse_h
private

The mapping onto coarse sites from fine sites. This has length equal to the fine-grid volume, and is sorted into lexicographical fine-grid order, with each value corresponding to a coarse-grid offset. (CPU)

Definition at line 65 of file transfer.h.

Referenced by createGeoMap(), P(), R(), Transfer(), and ~Transfer().

◆ flops_

double quda::Transfer::flops_
mutableprivate

Internal flops accumulator

Definition at line 150 of file transfer.h.

Referenced by flops(), P(), and R().

◆ geo_bs

int* quda::Transfer::geo_bs
private

The geometrical coase grid blocking

Definition at line 59 of file transfer.h.

Referenced by createGeoMap(), Geo_bs(), Transfer(), and ~Transfer().

◆ Nvec

const int quda::Transfer::Nvec
private

The number of null space components

Definition at line 38 of file transfer.h.

Referenced by fillV(), nvec(), P(), R(), and Transfer().

◆ parity

QudaParity quda::Transfer::parity
private

The parity of any single-parity fine-grid fields that are passed into the transfer operator

Definition at line 93 of file transfer.h.

Referenced by P(), R(), and setSiteSubset().

◆ profile

TimeProfile& quda::Transfer::profile
private

Reference to profile kept in the corresponding MG instance. Use this to record restriction and prolongation overhead.

Definition at line 156 of file transfer.h.

Referenced by P(), and R().

◆ site_subset

QudaSiteSubset quda::Transfer::site_subset
private

Whether the transfer operator is to be applied to full fields or single parity fields

Definition at line 90 of file transfer.h.

Referenced by setSiteSubset().

◆ spin_bs

int quda::Transfer::spin_bs
private

The spin blocking

Definition at line 84 of file transfer.h.

Referenced by createSpinMap(), Spin_bs(), and Transfer().

◆ spin_map

int* quda::Transfer::spin_map
private

The mapping onto coarse spin from fine spin

Definition at line 87 of file transfer.h.

Referenced by createSpinMap(), P(), R(), Transfer(), and ~Transfer().

◆ use_gpu

bool quda::Transfer::use_gpu
mutableprivate

Whether to apply the transfer operaton the GPU (requires enable_gpu=true in the constructor)

Definition at line 100 of file transfer.h.

Referenced by P(), R(), and setTransferGPU().

◆ V_d

ColorSpinorField* quda::Transfer::V_d
private

GPU copy of the block-normalized null-space components that define the prolongator

Definition at line 44 of file transfer.h.

Referenced by P(), R(), setSiteSubset(), Transfer(), Vectors(), and ~Transfer().

◆ V_h

ColorSpinorField* quda::Transfer::V_h
private

CPU copy of the block-normalized null-space components that define the prolongator

Definition at line 41 of file transfer.h.

Referenced by P(), R(), setSiteSubset(), Transfer(), Vectors(), and ~Transfer().


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