QUDA
1.0.0
|
#include <transfer.h>
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 ColorSpinorField & | Vectors (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 |
ColorSpinorField * | V_h |
ColorSpinorField * | V_d |
ColorSpinorField * | fine_tmp_h |
ColorSpinorField * | fine_tmp_d |
ColorSpinorField * | coarse_tmp_h |
ColorSpinorField * | coarse_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_ |
TimeProfile & | profile |
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.
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
B | Array of null-space vectors |
Nvec | Number of null-space vectors |
NblockOrtho | Number of times to Gram-Schmidt within block ortho |
d | The Dirac operator to which these null-space vectors correspond |
geo_bs | The geometric block sizes to use |
spin_bs | The spin block sizes to use |
parity | For single-parity fields are these QUDA_EVEN_PARITY or QUDA_ODD_PARITY |
null_precision | The precision to store the null-space basis vectors in |
enable_gpu | Whether 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.
|
virtual |
The destructor for Transfer
Definition at line 205 of file transfer.cpp.
References coarse_tmp_d, coarse_tmp_h, coarse_to_fine_d, coarse_to_fine_h, fine_tmp_d, fine_tmp_h, fine_to_coarse_d, fine_to_coarse_h, geo_bs, host_free, nspin_fine, pool_device_free, pool_pinned_free, quda::s, spin_map, V_d, and V_h.
|
inline |
Definition at line 241 of file transfer.h.
References coarse_to_fine_d, coarse_to_fine_h, and QUDA_CPU_FIELD_LOCATION.
|
private |
Creates the map between fine and coarse grids.
geo_bs | An 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().
|
private |
Creates the map between fine spin and parity to coarse spin dimensions.
spin_bs | The spin block size |
Definition at line 289 of file transfer.cpp.
References B, quda::s, spin_bs, and spin_map.
Referenced by Transfer().
|
private |
Allocate temporaries used when applying transfer operators.
[in] | location | Where to allocate the temporaries |
Definition at line 134 of file transfer.cpp.
References B, coarse_tmp_d, coarse_tmp_h, quda::ColorSpinorParam::create, quda::ColorSpinorField::Create(), quda::ColorSpinorField::CreateCoarse(), quda::ColorSpinorParam::fieldOrder, fine_tmp_d, fine_tmp_h, geo_bs, quda::ColorSpinorParam::location, Nvec, param, postTrace, quda::LatticeFieldParam::Precision(), QUDA_CUDA_FIELD_LOCATION, QUDA_FLOAT2_FIELD_ORDER, QUDA_NULL_FIELD_CREATE, QUDA_SINGLE_PRECISION, QUDA_SPACE_SPIN_COLOR_FIELD_ORDER, quda::ColorSpinorParam::setPrecision(), and spin_bs.
Referenced by initializeLazy(), and Transfer().
|
private |
Allocate V field.
[in] | location | Where to allocate the V field |
Definition at line 101 of file transfer.cpp.
References B, quda::ColorSpinorParam::create, quda::ColorSpinorField::Create(), enable_cpu, enable_gpu, quda::ColorSpinorParam::fieldOrder, quda::ColorSpinorParam::location, quda::ColorSpinorParam::nColor, quda::ColorSpinorParam::nSpin, null_precision, Nvec, quda::ColorSpinorParam::nVec, param, postTrace, QUDA_CUDA_FIELD_LOCATION, QUDA_FLOAT2_FIELD_ORDER, QUDA_FULL_SITE_SUBSET, QUDA_NULL_FIELD_CREATE, QUDA_PARITY_SITE_SUBSET, QUDA_SPACE_SPIN_COLOR_FIELD_ORDER, quda::ColorSpinorParam::setPrecision(), quda::LatticeFieldParam::siteSubset, V_d, V_h, and quda::LatticeFieldParam::x.
Referenced by initializeLazy(), and Transfer().
|
inline |
Definition at line 235 of file transfer.h.
References fine_to_coarse_d, fine_to_coarse_h, and QUDA_CPU_FIELD_LOCATION.
double quda::Transfer::flops | ( | ) | const |
Return flops
Definition at line 387 of file transfer.cpp.
References flops_.
Referenced by quda::MG::flops(), and setTransferGPU().
|
inline |
Returns the geometrical coarse grid blocking
Definition at line 230 of file transfer.h.
References geo_bs.
Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().
|
private |
Lazy allocation of the transfer operator in a given location.
[in] | location | Where 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.
|
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().
|
inline |
Returns the number of near nullvectors
Definition at line 218 of file transfer.h.
References Nvec.
Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().
void quda::Transfer::P | ( | ColorSpinorField & | out, |
const ColorSpinorField & | in | ||
) | const |
Apply the prolongator
out | The resulting field on the fine lattice |
in | The input field on the coarse lattice |
Definition at line 305 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, initializeLazy(), quda::LatticeField::Location(), quda::ColorSpinorField::Ncolor(), quda::ColorSpinorField::Nspin(), 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, quda::ColorSpinorField::SiteSubset(), spin_map, use_gpu, V, V_d, V_h, and quda::ColorSpinorField::VolumeCB().
Referenced by quda::MG::operator()(), and quda::MG::verify().
void quda::Transfer::R | ( | ColorSpinorField & | out, |
const ColorSpinorField & | in | ||
) | const |
Apply the restrictor
out | The resulting field on the coarse lattice |
in | The input field on the fine lattice |
Definition at line 344 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, initializeLazy(), quda::LatticeField::Location(), quda::ColorSpinorField::Ncolor(), quda::ColorSpinorField::Nspin(), Nvec, out, parity, profile, QUDA_CPU_FIELD_LOCATION, QUDA_CUDA_FIELD_LOCATION, QUDA_FULL_SITE_SUBSET, QUDA_PARITY_SITE_SUBSET, quda::QUDA_PROFILE_COMPUTE, qudaDeviceSynchronize, quda::Restrict(), quda::ColorSpinorField::SiteSubset(), spin_map, use_gpu, V, V_d, V_h, and quda::ColorSpinorField::VolumeCB().
Referenced by quda::MG::generateNullVectors(), quda::MG::operator()(), quda::MG::reset(), and quda::MG::verify().
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().
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.
[in] | site_subset | The site_subset of the fine-grid fields |
[in] | parity | The 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().
|
inline |
Sets where the prolongator / restrictor should take place
location | Location 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.
|
inline |
Returns the amount of spin blocking. Defined as zero when coarsening staggered.
Definition at line 224 of file transfer.h.
References spin_bs.
Referenced by quda::DiracCoarse::createY(), and quda::DiracCoarse::createYhat().
|
inline |
Returns a const reference to the V field
location | Which memory space are we requesting |
Definition at line 205 of file transfer.h.
References QUDA_CUDA_FIELD_LOCATION, QUDA_INVALID_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::createY(), quda::DiracCoarse::createYhat(), and quda::MG::verify().
|
private |
The raw null space components
Definition at line 34 of file transfer.h.
Referenced by createGeoMap(), createSpinMap(), createTmp(), createV(), initializeLazy(), reset(), and setTransferGPU().
|
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().
|
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().
|
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().
|
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().
|
mutableprivate |
Whether the CPU transfer operator has been constructed
Definition at line 107 of file transfer.h.
Referenced by createV(), initializeLazy(), and reset().
|
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().
|
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().
|
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().
|
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().
|
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().
|
mutableprivate |
Internal flops accumulator
Definition at line 146 of file transfer.h.
|
private |
The geometrical coase grid blocking
Definition at line 64 of file transfer.h.
Referenced by createTmp(), Geo_bs(), reset(), setTransferGPU(), and ~Transfer().
|
private |
The number of times to Gram-Schmidt within block ortho
Definition at line 40 of file transfer.h.
Referenced by reset().
|
private |
Nspin for the fine level. Required for deallocating spin_map.
Definition at line 95 of file transfer.h.
Referenced by Transfer(), and ~Transfer().
|
private |
Precision to use for the GPU null-space components
Definition at line 43 of file transfer.h.
Referenced by createV(), and NullPrecision().
|
private |
The number of null space components
Definition at line 37 of file transfer.h.
Referenced by createTmp(), createV(), nvec(), P(), R(), and setTransferGPU().
|
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().
|
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.
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().