18 ghost( ), ghostNorm( ), ghostFace( ),
19 bytes(0), norm_bytes(0), even(0), odd(0),
48 int num_faces = ((
nSpin == 4 && spin_project) ? 1 : 2) * nFace;
49 int num_norm_faces = 2*nFace;
54 int x5 =
nDim == 5 ?
x[4] : 1;
55 for (
int i=0; i<
dims; i++) {
59 for (
int j=0; j<
dims; j++) {
99 int ghostNormVolume = num_norm_faces * ghostVolume;
100 ghostVolume *= num_faces;
111 for (
int dim=0; dim<
nDim; dim++)
X[dim] =
x[dim];
122 for (
int dim=0; dim<4; dim++) {
123 for (
int j=0; j<4; j++) face[j] =
X[j];
181 errorQuda(
"Number of dimensions nDim = %d too great", Ndim);
193 for (
int d=0; d<
nDim; d++) {
200 errorQuda(
"Must be two flavors for non-degenerate twisted mass spinor (while provided with %d number of components)\n",
x[4]);
267 for (
int d=1; d<
nDim; d++) {
276 char aux_tmp[aux_string_n];
277 int check = snprintf(
aux_string, aux_string_n,
"vol=%d,stride=%d,precision=%d,Ns=%d,Nc=%d",
279 if (check < 0 || check >= aux_string_n)
errorQuda(
"Error writing aux string");
283 if (check < 0 || check >= aux_string_n)
errorQuda(
"Error writing aux string");
333 for (
int d=0; d<
nDim; d++) {
334 if (param.
x[d] != 0)
x[d] = param.
x[d];
340 errorQuda(
"Must be two flavors for non-degenerate twisted mass spinor (provided with %d)\n",
x[4]);
397 if (!
init)
errorQuda(
"Shouldn't be resetting a non-inited field\n");
443 void *total_send =
nullptr;
444 void *total_recv =
nullptr;
451 bool no_comms_fill =
false;
457 bool fine_grained_memcpy =
false;
462 send_back[i] = sendbuf[2*i + 0];
463 send_fwd[i] = sendbuf[2*i + 1];
464 recv_fwd[i] = ghost[2*i + 1];
465 recv_back[i] = ghost[2*i + 0];
466 }
else if (no_comms_fill) {
467 memcpy(ghost[2*i+1], sendbuf[2*i+0], bytes[i]);
468 memcpy(ghost[2*i+0], sendbuf[2*i+1], bytes[i]);
479 send_back[i] =
static_cast<char*
>(total_send) + offset;
480 recv_back[i] =
static_cast<char*
>(total_recv) + offset;
482 send_fwd[i] =
static_cast<char*
>(total_send) + offset;
483 recv_fwd[i] =
static_cast<char*
>(total_recv) + offset;
485 if (fine_grained_memcpy) {
486 qudaMemcpy(send_back[i], sendbuf[2*i + 0], bytes[i], cudaMemcpyDeviceToHost);
487 qudaMemcpy(send_fwd[i], sendbuf[2*i + 1], bytes[i], cudaMemcpyDeviceToHost);
489 }
else if (no_comms_fill) {
490 qudaMemcpy(ghost[2*i+1], sendbuf[2*i+0], bytes[i], cudaMemcpyDeviceToDevice);
491 qudaMemcpy(ghost[2*i+0], sendbuf[2*i+1], bytes[i], cudaMemcpyDeviceToDevice);
494 if (!fine_grained_memcpy && total_bytes) {
496 void *send_ptr =
nullptr;
499 send_ptr = sendbuf[2*i];
503 qudaMemcpy(total_send, send_ptr, total_bytes, cudaMemcpyDeviceToHost);
535 if (fine_grained_memcpy) {
536 qudaMemcpy(ghost[2*i+0], recv_back[i], bytes[i], cudaMemcpyHostToDevice);
537 qudaMemcpy(ghost[2*i+1], recv_fwd[i], bytes[i], cudaMemcpyHostToDevice);
541 if (!fine_grained_memcpy && total_bytes) {
543 void *ghost_ptr =
nullptr;
546 ghost_ptr = ghost[2*i];
550 qudaMemcpy(ghost_ptr, total_recv, total_bytes, cudaMemcpyHostToDevice);
576 }
else if (
nSpin == 2) {
578 }
else if (
nSpin == 1) {
612 errorQuda(
"Cannot return even subset of QDPJIT field");
620 errorQuda(
"Cannot return even subset of QDPJIT field");
628 errorQuda(
"Cannot return even subset of QDPJIT field");
636 errorQuda(
"Cannot return even subset of QDPJIT field");
646 errorQuda(
"Incorrect component index...");
649 errorQuda(
"Cannot get requested component");
659 errorQuda(
"Incorrect component index...");
662 errorQuda(
"Cannot get requested component");
706 for (
int d=0; d<
nDim; d++) {
716 for (
int d=1; d<
nDim; d++) oddBit += y[d];
719 y[0] = 2*y[0] + oddBit;
735 for (
int d=0; d<
nDim; d++) parity += y[d];
742 for (
int d=
nDim-1; d>=0; d--) {
784 for (
int d=0; d<
nDim; d++) coarseParam.
x[d] =
x[d]/geoBlockSize[d];
787 coarseParam.
nColor = Nvec;
813 errorQuda(
"Invalid field location %d", new_location);
823 for (
int d=0; d<
nDim; d++) fineParam.
x[d] =
x[d] * geoBlockSize[d];
855 errorQuda(
"Invalid field location %d", new_location);
861 out <<
"typedid = " <<
typeid(a).name() << std::endl;
862 out <<
"nColor = " << a.
nColor << std::endl;
863 out <<
"nSpin = " << a.
nSpin << std::endl;
864 out <<
"twistFlavor = " << a.
twistFlavor << std::endl;
865 out <<
"nDim = " << a.
nDim << std::endl;
866 for (
int d=0; d<a.
nDim; d++) out <<
"x[" << d <<
"] = " << a.
x[d] << std::endl;
867 out <<
"volume = " << a.
volume << std::endl;
868 out <<
"precision = " << a.
precision << std::endl;
870 out <<
"pad = " << a.
pad << std::endl;
871 out <<
"stride = " << a.
stride << std::endl;
872 out <<
"real_length = " << a.
real_length << std::endl;
873 out <<
"length = " << a.
length << std::endl;
874 out <<
"bytes = " << a.
bytes << std::endl;
875 out <<
"norm_bytes = " << a.
norm_bytes << std::endl;
876 out <<
"siteSubset = " << a.
siteSubset << std::endl;
877 out <<
"siteOrder = " << a.
siteOrder << std::endl;
878 out <<
"fieldOrder = " << a.
fieldOrder << std::endl;
879 out <<
"gammaBasis = " << a.
gammaBasis << std::endl;
890 out <<
"pc_type = " << a.
pc_type << std::endl;
#define qudaMemcpy(dst, src, count, kind)
CompositeColorSpinorField components
void create(int nDim, const int *x, int Nc, int Ns, int Nvec, QudaTwistFlavorType Twistflavor, QudaPrecision precision, int pad, QudaSiteSubset subset, QudaSiteOrder siteOrder, QudaFieldOrder fieldOrder, QudaGammaBasis gammaBasis, QudaPCType pc_type)
void OffsetIndex(int &i, int *y) const
void setPrecision(QudaPrecision precision, QudaPrecision ghost_precision=QUDA_INVALID_PRECISION, bool force_native=false)
QudaFieldOrder fieldOrder
#define pool_pinned_free(ptr)
friend std::ostream & operator<<(std::ostream &out, const ColorSpinorField &)
int ghostNormOffset[QUDA_MAX_DIM][2]
enum QudaPrecision_s QudaPrecision
void * ghostNorm[2][QUDA_MAX_DIM]
int ghostFace[QUDA_MAX_DIM]
enum QudaPCType_s QudaPCType
enum QudaFieldOrder_s QudaFieldOrder
CompositeColorSpinorFieldDescriptor composite_descr
used for deflation eigenvector sets etc.:
virtual ~ColorSpinorField()
const ColorSpinorField & Even() const
enum QudaSiteOrder_s QudaSiteOrder
const ColorSpinorField & Odd() const
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
QudaGammaBasis gammaBasis
QudaPrecision GhostPrecision() const
DslashConstant dslash_constant
ColorSpinorField * CreateFine(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 fine color-spinor field, using this field to set the meta data.
ColorSpinorField & Component(const int idx) const
QudaSiteSubset siteSubset
ColorSpinorField(const ColorSpinorField &)
int_fastdiv Xh[QUDA_MAX_DIM]
bool is_composite
for deflation solvers:
int ghostFaceCB[QUDA_MAX_DIM]
QudaFieldLocation location
int_fastdiv X[QUDA_MAX_DIM]
#define comm_declare_send_relative(buffer, dim, dir, nbytes)
static void checkField(const ColorSpinorField &, const ColorSpinorField &)
#define comm_declare_receive_relative(buffer, dim, dir, nbytes)
void exchange(void **ghost, void **sendbuf, int nFace=1) const
void reset(const ColorSpinorParam &)
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.
char aux_string[TuneKey::aux_n]
#define ALIGNMENT_ADJUST(n)
void * GhostNorm(const int i)
void setTuningString()
Set the vol_string and aux_string for use in tuning.
QudaGammaBasis gammaBasis
void comm_start(MsgHandle *mh)
void * ghost[2][QUDA_MAX_DIM]
void comm_free(MsgHandle *&mh)
char vol_string[TuneKey::volume_n]
void init()
Create the CUBLAS context.
size_t ghost_face_bytes[QUDA_MAX_DIM]
QudaTwistFlavorType twistFlavor
MsgHandle * mh_send_fwd[2][QUDA_MAX_DIM]
int ghostFaceCB[QUDA_MAX_DIM+1]
int GhostOffset(const int i) const
virtual ColorSpinorField & operator=(const ColorSpinorField &)
enum QudaSiteSubset_s QudaSiteSubset
QudaFieldLocation Location() const
QudaPrecision ghost_precision_allocated
#define pool_pinned_malloc(size)
enum QudaFieldLocation_s QudaFieldLocation
cpuColorSpinorField * out
int ghostOffset[QUDA_MAX_DIM][2]
void createGhostZone(int nFace, bool spin_project=true) const
QudaPrecision ghost_precision
enum QudaGammaBasis_s QudaGammaBasis
void fill(ColorSpinorParam &) const
QudaPrecision Precision() const
int ghostFace[QUDA_MAX_DIM+1]
QudaTwistFlavorType twistFlavor
QudaTwistFlavorType TwistFlavor() const
void LatticeIndex(int *y, int i) const
int surfaceCB[QUDA_MAX_DIM]
void *const * Ghost() const
#define QUDA_MAX_DIM
Maximum number of dimensions supported by QUDA. In practice, no routines make use of more than 5...
void comm_wait(MsgHandle *mh)
static const int volume_n
void * ghost_buf[2 *QUDA_MAX_DIM]
QudaPrecision Precision() const
QudaSiteSubset siteSubset
MsgHandle * mh_send_back[2][QUDA_MAX_DIM]
QudaFieldOrder FieldOrder() const
enum QudaMemoryType_s QudaMemoryType
int comm_dim_partitioned(int dim)
enum QudaTwistFlavorType_s QudaTwistFlavorType