1 #ifndef _LATTICE_FIELD_H 2 #define _LATTICE_FIELD_H 10 #include <cuda_runtime.h> 27 class ColorSpinorField;
28 class cudaColorSpinorField;
29 class cpuColorSpinorField;
32 class cudaEigValueSet;
44 class cudaCloverField;
92 for (
int i=0; i<
nDim; i++) {
108 : precision(precision), ghost_precision(precision), nDim(nDim), pad(pad),
110 ghostExchange(ghostExchange), scale(1.0)
113 for (
int i=0; i<
nDim; i++) {
126 : precision(param.
cpu_prec), ghost_precision(param.
cpu_prec), nDim(4), pad(0),
130 for (
int i=0; i<
nDim; i++) {
131 this->x[i] = param.
X[i];
202 static void *ghost_send_buffer_d[2];
207 static void *ghost_recv_buffer_d[2];
212 static void *ghost_pinned_send_buffer_h[2];
217 static void *ghost_pinned_recv_buffer_h[2];
222 static void *ghost_pinned_send_buffer_hd[2];
227 static void *ghost_pinned_recv_buffer_hd[2];
296 void *from_face_h[2];
301 void *from_face_hd[2];
306 void *from_face_d[2];
384 virtual void setTuningString();
397 errorQuda(
"Unknown precision %d\n", precision);
429 void allocateGhostBuffer(
size_t ghost_bytes)
const;
434 static void freeGhostBuffer(
void);
444 void createComms(
bool no_comms_fill=
false,
bool bidir=
true);
454 void createIPCComms();
459 static void destroyIPCComms();
464 inline bool ipcCopyComplete(
int dir,
int dim);
469 inline bool ipcRemoteCopyComplete(
int dir,
int dim);
474 const cudaEvent_t& getIPCCopyEvent(
int dir,
int dim)
const;
479 const cudaEvent_t& getIPCRemoteCopyEvent(
int dir,
int dim)
const;
499 const int*
X()
const {
return x; }
521 int SurfaceCB(
const int i)
const {
return surfaceCB[i]; }
536 const int*
R()
const {
return r; }
562 void Scale(
double scale_) { scale = scale_; }
588 size_t GBytes()
const {
return total_bytes / (1<<30); }
600 virtual void read(
char *filename);
606 virtual void write(
char *filename);
608 virtual void gather(
int nFace,
int dagger,
int dir, cudaStream_t *stream_p=NULL)
611 virtual void commsStart(
int nFace,
int dir,
int dagger=0, cudaStream_t *stream_p=NULL,
bool gdr_send=
false,
bool gdr_recv=
true)
614 virtual int commsQuery(
int nFace,
int dir,
int dagger=0, cudaStream_t *stream_p=NULL,
bool gdr_send=
false,
bool gdr_recv=
true)
615 {
errorQuda(
"Not implemented");
return 0; }
617 virtual void commsWait(
int nFace,
int dir,
int dagger=0, cudaStream_t *stream_p=NULL,
bool gdr_send=
false,
bool gdr_recv=
true)
624 inline const char *
VolString()
const {
return vol_string; }
627 inline const char *
AuxString()
const {
return aux_string; }
646 else errorQuda(
"Locations %d %d do not match (%s:%d in %s())\n",
658 template <
typename... Args>
664 #define checkLocation(...)Location_(__func__, __FILE__, __LINE__, __VA_ARGS__) 676 else errorQuda(
"Precisions %d %d do not match (%s:%d in %s())\n",
688 template <
typename... Args>
691 const Args &... args) {
695 #define checkPrecision(...) Precision_(__func__, __FILE__, __LINE__, __VA_ARGS__) 730 #endif // _LATTICE_FIELD_H QudaPrecision Precision_(const char *func, const char *file, int line, const LatticeField &a, const LatticeField &b)
Helper function for determining if the precision of the fields is the same.
QudaFieldLocation reorder_location()
Return whether data is reordered on the CPU or GPU. This can set at QUDA initialization using the env...
QudaGhostExchange ghostExchange
enum QudaPrecision_s QudaPrecision
const char * AuxString() const
virtual void commsWait(int nFace, int dir, int dagger=0, cudaStream_t *stream_p=NULL, bool gdr_send=false, bool gdr_recv=true)
QudaSiteSubset siteSubset
QudaPrecision GhostPrecision() const
virtual int commsQuery(int nFace, int dir, int dagger=0, cudaStream_t *stream_p=NULL, bool gdr_send=false, bool gdr_recv=true)
int SurfaceCB(const int i) const
QudaPrecision GhostPrecision() const
const char * VolString() const
const int * SurfaceCB() const
LatticeFieldParam(const QudaGaugeParam ¶m)
Constructor for creating a LatticeFieldParam from a QudaGaugeParam. Used for wrapping around a CPU re...
bool ghost_precision_reset
static bool initGhostFaceBuffer
const char * compile_type_str(const LatticeField &meta, QudaFieldLocation location_=QUDA_INVALID_FIELD_LOCATION)
Helper function for setting auxilary string.
QudaSiteSubset siteSubset
std::ostream & operator<<(std::ostream &output, const CloverFieldParam ¶m)
virtual QudaMemoryType MemType() const
static bool ghost_field_reset
enum QudaGhostExchange_s QudaGhostExchange
QudaGhostExchange ghostExchange
virtual void backup() const
Backs up the LatticeField.
enum QudaSiteSubset_s QudaSiteSubset
QudaFieldLocation Location() const
static QudaFieldLocation reorder_location_
static size_t ghostFaceBytes
enum QudaFieldLocation_s QudaFieldLocation
void Scale(double scale_)
Set the scale factor for a fixed-point field.
QudaPrecision ghost_precision
virtual void scatter(int nFace, int dagger, int dir)
Main header file for the QUDA library.
QudaPrecision Precision() const
virtual QudaSiteSubset SiteSubset() const
LatticeFieldParam()
Default constructor for LatticeFieldParam.
QudaPrecision ghost_precision
#define QUDA_MAX_DIM
Maximum number of dimensions supported by QUDA. In practice, no routines make use of more than 5...
QudaGhostExchange GhostExchange() const
virtual void commsStart(int nFace, int dir, int dagger=0, cudaStream_t *stream_p=NULL, bool gdr_send=false, bool gdr_recv=true)
static const int volume_n
LatticeFieldParam(int nDim, const int *x, int pad, QudaPrecision precision, QudaGhostExchange ghostExchange=QUDA_GHOST_EXCHANGE_PAD)
Constructor for creating a LatticeFieldParam from a set of parameters.
QudaPrecision Precision() const
void reorder_location_set(QudaFieldLocation reorder_location_)
Set whether data is reorderd on the CPU or GPU. This can set at QUDA initialization using the environ...
QudaFieldLocation Location_(const char *func, const char *file, int line, const LatticeField &a, const LatticeField &b)
Helper function for determining if the location of the fields is the same.
virtual void gather(int nFace, int dagger, int dir, cudaStream_t *stream_p=NULL)
virtual void restore() const
Restores the LatticeField.
enum QudaMemoryType_s QudaMemoryType