23 NblockOrtho(n_block_ortho),
24 null_precision(null_precision),
29 coarse_tmp_h(nullptr),
30 coarse_tmp_d(nullptr),
32 fine_to_coarse_h(nullptr),
33 coarse_to_fine_h(nullptr),
34 fine_to_coarse_d(nullptr),
35 coarse_to_fine_d(nullptr),
38 nspin_fine(B[0]->
Nspin()),
48 int ndim = B[0]->Ndim();
50 for (
int d = 0; d <
ndim; d++) {
51 while (geo_bs[d] > 0) {
52 if (d==0 && B[0]->
X(0) == geo_bs[0])
53 warningQuda(
"X-dimension length %d cannot block length %d", B[0]->
X(0), geo_bs[0]);
54 else if ( (B[0]->
X(d)/geo_bs[d]+1)%2 == 0)
55 warningQuda(
"Indexing does not (yet) support odd coarse dimensions: X(%d) = %d", d, B[0]->
X(d)/geo_bs[d]);
56 else if ( (B[0]->
X(d)/geo_bs[d]) * geo_bs[d] != B[0]->
X(d) )
57 warningQuda(
"cannot block dim[%d]=%d with block size = %d", d, B[0]->
X(d), geo_bs[d]);
62 if (geo_bs[d] == 0)
errorQuda(
"Unable to block dimension %d", d);
65 this->geo_bs =
new int[
ndim];
66 int total_block_size = 1;
67 for (
int d = 0; d <
ndim; d++) {
68 this->geo_bs[d] = geo_bs[d];
69 total_block_size *= geo_bs[d];
72 if (total_block_size == 1)
errorQuda(
"Total geometric block size is 1");
74 std::string block_str = std::to_string(geo_bs[0]);
75 for (
int d=1; d<
ndim; d++) block_str +=
" x " + std::to_string(geo_bs[1]);
110 param.
nSpin =
B[0]->Nspin();
178 errorQuda(
"Unknown location %d", location);
230 errorQuda(
"Undefined parity %d", parity_);
240 Int2(
int x,
int y) : x(x), y(y) { }
243 return (x < a.
x) ? true : (x==a.
x && y<a.
y) ?
true :
false;
256 for (
int i=0; i<fine.
Volume(); i++) {
263 for (
int d=0; d<fine.
Ndim(); d++) x[d] /= geo_bs[d];
275 std::vector<Int2> geo_sort(
B[0]->Volume());
277 std::sort(geo_sort.begin(), geo_sort.end());
278 for (
unsigned int i=0; i<geo_sort.size(); i++)
coarse_to_fine_h[i] = geo_sort[i].y;
297 for (
int s=0;
s<
B[0]->Nspin();
s++) {
327 errorQuda(
"Cannot prolongate to a full field since only have single parity null-space components");
330 errorQuda(
"Cannot apply prolongator using fields in a different basis from the null space (%d,%d) != %d",
368 errorQuda(
"Cannot restrict a full field since only have single parity null-space components");
371 errorQuda(
"Cannot apply restrictor using fields in a different basis from the null space (%d,%d) != %d",
#define qudaMemcpy(dst, src, count, kind)
void OffsetIndex(int &i, int *y) const
void setPrecision(QudaPrecision precision, QudaPrecision ghost_precision=QUDA_INVALID_PRECISION, bool force_native=false)
void createTmp(QudaFieldLocation location) const
Allocate temporaries used when applying transfer operators.
#define pool_pinned_free(ptr)
Transfer(const std::vector< ColorSpinorField *> &B, int Nvec, int NblockOrtho, int *geo_bs, int spin_bs, QudaPrecision null_precision, TimeProfile &profile)
enum QudaPrecision_s QudaPrecision
QudaVerbosity getVerbosity()
void initializeLazy(QudaFieldLocation location) const
Lazy allocation of the transfer operator in a given location.
const QudaPrecision null_precision
void R(ColorSpinorField &out, const ColorSpinorField &in) const
const ColorSpinorField & Even() const
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
QudaGammaBasis GammaBasis() const
void P(ColorSpinorField &out, const ColorSpinorField &in) const
ColorSpinorField * fine_tmp_h
void createV(QudaFieldLocation location) const
Allocate V field.
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.
QudaSiteSubset siteSubset
ColorSpinorField * coarse_tmp_d
#define qudaDeviceSynchronize()
QudaFieldLocation location
QudaSiteSubset site_subset
QudaFieldOrder fieldOrder
ColorSpinorField * CreateCoarse(const int *geoBlockSize, int spinBlockSize, int Nvec, QudaPrecision precision=QUDA_INVALID_PRECISION, QudaFieldLocation location=QUDA_INVALID_FIELD_LOCATION, QudaMemoryType mem_Type=QUDA_MEMORY_INVALID)
Create a coarse color-spinor field, using this field to set the meta data.
void createGeoMap(int *geo_bs)
Creates the map between fine and coarse grids.
ColorSpinorField * coarse_tmp_h
QudaSiteSubset SiteSubset() const
#define pool_device_malloc(size)
enum QudaParity_s QudaParity
#define safe_malloc(size)
enum QudaSiteSubset_s QudaSiteSubset
QudaFieldLocation Location() const
#define pool_pinned_malloc(size)
enum QudaFieldLocation_s QudaFieldLocation
cpuColorSpinorField * out
QudaPrecision Precision() const
void LatticeIndex(int *y, int i) const
#define pool_device_free(ptr)
bool operator<(const Int2 &a) const
#define QUDA_MAX_DIM
Maximum number of dimensions supported by QUDA. In practice, no routines make use of more than 5...
ColorSpinorField * fine_tmp_d
void createSpinMap(int spin_bs)
Creates the map between fine spin and parity to coarse spin dimensions.
const std::vector< ColorSpinorField * > & B
int n_block_ortho[QUDA_MAX_MG_LEVEL]
void Prolongate(ColorSpinorField &out, const ColorSpinorField &in, const ColorSpinorField &v, int Nvec, const int *fine_to_coarse, const int *const *spin_map, int parity=QUDA_INVALID_PARITY)
Apply the prolongation operator.
void BlockOrthogonalize(ColorSpinorField &V, const std::vector< ColorSpinorField *> &B, const int *fine_to_coarse, const int *coarse_to_fine, const int *geo_bs, const int spin_bs, const int n_block_ortho)
Block orthogonnalize the matrix field, where the blocks are defined by lookup tables that map the fin...
void reset()
for resetting the Transfer when the null vectors have changed