QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 NblockOrtho, int *geo_bs, int spin_bs, QudaPrecision null_precision, TimeProfile &profile)
 
virtual ~Transfer ()
 
void reset ()
 for resetting the Transfer when the null vectors have changed More...
 
void P (ColorSpinorField &out, const ColorSpinorField &in) const
 
void R (ColorSpinorField &out, const ColorSpinorField &in) const
 
QudaPrecision NullPrecision (QudaFieldLocation location) const
 The precision of the packed null-space vectors. More...
 
const ColorSpinorFieldVectors (QudaFieldLocation location=QUDA_INVALID_FIELD_LOCATION) const
 
int nvec () const
 
int Spin_bs () const
 
const int * Geo_bs () const
 
const int * fineToCoarse (QudaFieldLocation location=QUDA_CPU_FIELD_LOCATION) const
 
const int * coarseToFine (QudaFieldLocation location=QUDA_CPU_FIELD_LOCATION) 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. More...
 
double flops () const
 

Private Member Functions

void createV (QudaFieldLocation location) const
 Allocate V field. More...
 
void createTmp (QudaFieldLocation location) const
 Allocate temporaries used when applying transfer operators. More...
 
void createGeoMap (int *geo_bs)
 Creates the map between fine and coarse grids. More...
 
void createSpinMap (int spin_bs)
 Creates the map between fine spin and parity to coarse spin dimensions. More...
 
void initializeLazy (QudaFieldLocation location) const
 Lazy allocation of the transfer operator in a given location. More...
 

Private Attributes

const std::vector< ColorSpinorField * > & B
 
const int Nvec
 
const int NblockOrtho
 
const QudaPrecision null_precision
 
ColorSpinorFieldV_h
 
ColorSpinorFieldV_d
 
ColorSpinorFieldfine_tmp_h
 
ColorSpinorFieldfine_tmp_d
 
ColorSpinorFieldcoarse_tmp_h
 
ColorSpinorFieldcoarse_tmp_d
 
int * geo_bs
 
int * fine_to_coarse_h
 
int * coarse_to_fine_h
 
int * fine_to_coarse_d
 
int * coarse_to_fine_d
 
int spin_bs
 
int ** spin_map
 
const int nspin_fine
 
QudaSiteSubset site_subset
 
QudaParity parity
 
bool enable_gpu
 
bool enable_cpu
 
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 29 of file transfer.h.

Constructor & Destructor Documentation

◆ Transfer()

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

The constructor for Transfer

Parameters
BArray of null-space vectors
NvecNumber of null-space vectors
NblockOrthoNumber of times to Gram-Schmidt within block ortho
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
null_precisionThe precision to store the null-space basis vectors in
enable_gpuWhether to enable this to run on GPU (as well as CPU)

Definition at line 19 of file transfer.cpp.

References coarse_to_fine_d, coarse_to_fine_h, createGeoMap(), createSpinMap(), createTmp(), createV(), enable_gpu, errorQuda, fine_to_coarse_d, fine_to_coarse_h, getVerbosity(), ndim, nspin_fine, pool_device_malloc, pool_pinned_malloc, postTrace, printfQuda, QUDA_CPU_FIELD_LOCATION, QUDA_VERBOSE, reset(), quda::s, safe_malloc, spin_map, warningQuda, and X.

Here is the call graph for this function:

◆ ~Transfer()

quda::Transfer::~Transfer ( )
virtual

Member Function Documentation

◆ coarseToFine()

const int* quda::Transfer::coarseToFine ( QudaFieldLocation  location = QUDA_CPU_FIELD_LOCATION) const
inline
Returns
Pointer to the lookup table to the coarse-to-fine map

Definition at line 241 of file transfer.h.

References coarse_to_fine_d, coarse_to_fine_h, and QUDA_CPU_FIELD_LOCATION.

◆ 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 248 of file transfer.cpp.

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

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 the map between fine spin and parity to coarse spin dimensions.

Parameters
spin_bsThe spin block size

Definition at line 289 of file transfer.cpp.

References B, quda::s, spin_bs, and spin_map.

Referenced by Transfer().

Here is the caller graph for this function:

◆ createTmp()

void quda::Transfer::createTmp ( QudaFieldLocation  location) const
private

◆ createV()

void quda::Transfer::createV ( QudaFieldLocation  location) const
private

◆ fineToCoarse()

const int* quda::Transfer::fineToCoarse ( QudaFieldLocation  location = QUDA_CPU_FIELD_LOCATION) const
inline
Returns
Pointer to the lookup table to the fine-to-coarse map

Definition at line 235 of file transfer.h.

References fine_to_coarse_d, fine_to_coarse_h, and QUDA_CPU_FIELD_LOCATION.

◆ flops()

double quda::Transfer::flops ( ) const

Return flops

Returns
flops expended by this operator

Definition at line 387 of file transfer.cpp.

References flops_.

Referenced by quda::MG::flops(), and setTransferGPU().

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 230 of file transfer.h.

References geo_bs.

Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().

Here is the caller graph for this function:

◆ initializeLazy()

void quda::Transfer::initializeLazy ( QudaFieldLocation  location) const
private

Lazy allocation of the transfer operator in a given location.

Parameters
[in]locationWhere to allocate the temporaries

Definition at line 154 of file transfer.cpp.

References B, coarse_to_fine_d, coarse_to_fine_h, createTmp(), createV(), enable_cpu, enable_gpu, errorQuda, fine_to_coarse_d, fine_to_coarse_h, pool_device_malloc, QUDA_CPU_FIELD_LOCATION, QUDA_CUDA_FIELD_LOCATION, qudaMemcpy, V_d, and V_h.

Referenced by P(), and R().

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

◆ NullPrecision()

QudaPrecision quda::Transfer::NullPrecision ( QudaFieldLocation  location) const
inline

The precision of the packed null-space vectors.

Definition at line 195 of file transfer.h.

References null_precision, QUDA_CUDA_FIELD_LOCATION, and QUDA_SINGLE_PRECISION.

Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().

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 218 of file transfer.h.

References Nvec.

Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().

Here is the caller graph for this function:

◆ P()

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

◆ R()

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

◆ reset()

void quda::Transfer::reset ( )

for resetting the Transfer when the null vectors have changed

Definition at line 182 of file transfer.cpp.

References B, quda::BlockOrthogonalize(), coarse_to_fine_d, coarse_to_fine_h, enable_cpu, enable_gpu, errorQuda, fine_to_coarse_d, fine_to_coarse_h, geo_bs, getVerbosity(), NblockOrtho, postTrace, printfQuda, QUDA_CUDA_FIELD_LOCATION, QUDA_VERBOSE, spin_bs, V_d, and V_h.

Referenced by quda::MG::reset(), and Transfer().

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.

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

Definition at line 227 of file transfer.cpp.

References errorQuda, parity, QUDA_EVEN_PARITY, QUDA_ODD_PARITY, QUDA_PARITY_SITE_SUBSET, and site_subset.

Referenced by quda::MG::operator()(), quda::MG::reset(), and setTransferGPU().

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 248 of file transfer.h.

References B, quda::BlockOrthogonalize(), flops(), geo_bs, in, n_block_ortho, Nvec, out, parity, quda::Prolongate(), QUDA_INVALID_PARITY, quda::Restrict(), setSiteSubset(), spin_bs, spin_map, use_gpu, and V.

Here is the call graph for this function:

◆ Spin_bs()

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

Returns the amount of spin blocking. Defined as zero when coarsening staggered.

Returns
spin_bs

Definition at line 224 of file transfer.h.

References spin_bs.

Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().

Here is the caller graph for this function:

◆ Vectors()

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

Member Data Documentation

◆ B

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

The raw null space components

Definition at line 34 of file transfer.h.

Referenced by createGeoMap(), createSpinMap(), createTmp(), createV(), initializeLazy(), reset(), and setTransferGPU().

◆ coarse_tmp_d

ColorSpinorField* quda::Transfer::coarse_tmp_d
mutableprivate

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

Definition at line 61 of file transfer.h.

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

◆ coarse_tmp_h

ColorSpinorField* quda::Transfer::coarse_tmp_h
mutableprivate

A CPU temporary field with coarse geometry and coarse color

Definition at line 58 of file transfer.h.

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

◆ coarse_to_fine_d

int* quda::Transfer::coarse_to_fine_d
mutableprivate

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 86 of file transfer.h.

Referenced by coarseToFine(), createGeoMap(), initializeLazy(), R(), reset(), Transfer(), and ~Transfer().

◆ coarse_to_fine_h

int* quda::Transfer::coarse_to_fine_h
mutableprivate

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 75 of file transfer.h.

Referenced by coarseToFine(), createGeoMap(), initializeLazy(), R(), reset(), Transfer(), and ~Transfer().

◆ enable_cpu

bool quda::Transfer::enable_cpu
mutableprivate

Whether the CPU transfer operator has been constructed

Definition at line 107 of file transfer.h.

Referenced by createV(), initializeLazy(), and reset().

◆ enable_gpu

bool quda::Transfer::enable_gpu
mutableprivate

Whether the GPU transfer operator has been constructed

Definition at line 104 of file transfer.h.

Referenced by createGeoMap(), createV(), initializeLazy(), P(), R(), reset(), and Transfer().

◆ fine_tmp_d

ColorSpinorField* quda::Transfer::fine_tmp_d
mutableprivate

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

Definition at line 55 of file transfer.h.

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

◆ fine_tmp_h

ColorSpinorField* quda::Transfer::fine_tmp_h
mutableprivate

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

Definition at line 52 of file transfer.h.

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

◆ fine_to_coarse_d

int* quda::Transfer::fine_to_coarse_d
mutableprivate

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 81 of file transfer.h.

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

◆ fine_to_coarse_h

int* quda::Transfer::fine_to_coarse_h
mutableprivate

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 70 of file transfer.h.

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

◆ flops_

double quda::Transfer::flops_
mutableprivate

Internal flops accumulator

Definition at line 146 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 64 of file transfer.h.

Referenced by createTmp(), Geo_bs(), reset(), setTransferGPU(), and ~Transfer().

◆ NblockOrtho

const int quda::Transfer::NblockOrtho
private

The number of times to Gram-Schmidt within block ortho

Definition at line 40 of file transfer.h.

Referenced by reset().

◆ nspin_fine

const int quda::Transfer::nspin_fine
private

Nspin for the fine level. Required for deallocating spin_map.

Definition at line 95 of file transfer.h.

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

◆ null_precision

const QudaPrecision quda::Transfer::null_precision
private

Precision to use for the GPU null-space components

Definition at line 43 of file transfer.h.

Referenced by createV(), and NullPrecision().

◆ Nvec

const int quda::Transfer::Nvec
private

The number of null space components

Definition at line 37 of file transfer.h.

Referenced by createTmp(), createV(), nvec(), P(), R(), and setTransferGPU().

◆ 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 101 of file transfer.h.

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

◆ 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 152 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 98 of file transfer.h.

Referenced by setSiteSubset().

◆ spin_bs

int quda::Transfer::spin_bs
private

The spin blocking. Defined as zero when the fine operator is staggered.

Definition at line 89 of file transfer.h.

Referenced by createSpinMap(), createTmp(), reset(), setTransferGPU(), and Spin_bs().

◆ spin_map

int** quda::Transfer::spin_map
private

The mapping onto coarse spin from fine spin (inner) and fine parity (outer), for staggered

Definition at line 92 of file transfer.h.

Referenced by createSpinMap(), P(), R(), setTransferGPU(), 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 111 of file transfer.h.

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

◆ V_d

ColorSpinorField* quda::Transfer::V_d
mutableprivate

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

Definition at line 49 of file transfer.h.

Referenced by createV(), initializeLazy(), P(), R(), reset(), Vectors(), and ~Transfer().

◆ V_h

ColorSpinorField* quda::Transfer::V_h
mutableprivate

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

Definition at line 46 of file transfer.h.

Referenced by createV(), initializeLazy(), P(), R(), reset(), Vectors(), and ~Transfer().


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