QUDA
v1.1.0
A library for QCD on GPUs
|
#include <lattice_field.h>
Public Member Functions | |
LatticeField (const LatticeFieldParam ¶m) | |
LatticeField (const LatticeField &field) | |
virtual | ~LatticeField () |
void | allocateGhostBuffer (size_t ghost_bytes) const |
Allocate the static ghost buffers. More... | |
void | createComms (bool no_comms_fill=false, bool bidir=true) |
void | destroyComms () |
void | createIPCComms () |
bool | ipcCopyComplete (int dir, int dim) |
bool | ipcRemoteCopyComplete (int dir, int dim) |
const cudaEvent_t & | getIPCCopyEvent (int dir, int dim) const |
const cudaEvent_t & | getIPCRemoteCopyEvent (int dir, int dim) const |
int | Ndim () const |
const int * | X () const |
virtual int | full_dim (int d) const =0 |
size_t | Volume () const |
size_t | VolumeCB () const |
size_t | LocalVolume () const |
size_t | LocalVolumeCB () const |
const int * | SurfaceCB () const |
int | SurfaceCB (const int i) const |
size_t | Stride () const |
int | Pad () const |
const int * | R () const |
QudaGhostExchange | GhostExchange () const |
QudaPrecision | Precision () const |
QudaPrecision | GhostPrecision () const |
double | Scale () const |
void | Scale (double scale_) |
Set the scale factor for a fixed-point field. More... | |
virtual QudaSiteSubset | SiteSubset () const |
virtual QudaMemoryType | MemType () const |
int | Nvec () const |
QudaFieldLocation | Location () const |
size_t | GBytes () const |
void | checkField (const LatticeField &a) const |
virtual void | read (char *filename) |
virtual void | write (char *filename) |
void * | myFace_h (int dir, int dim) const |
Return pointer to the local pinned my_face buffer in a given direction and dimension. More... | |
void * | myFace_hd (int dir, int dim) const |
Return pointer to the local mapped my_face buffer in a given direction and dimension. More... | |
void * | myFace_d (int dir, int dim) const |
Return pointer to the device send buffer in a given direction and dimension. More... | |
void * | remoteFace_d (int dir, int dim) const |
Return base pointer to a remote device buffer for direct sending in a given direction and dimension. Since this is a base pointer, one still needs to take care of offsetting to the correct point for each direction/dimension. More... | |
void * | remoteFace_r () const |
Return base pointer to the ghost recv buffer. Since this is a base pointer, one still needs to take care of offsetting to the correct point for each direction/dimension. More... | |
virtual void | gather (int nFace, int dagger, int dir, qudaStream_t *stream_p=NULL) |
virtual void | commsStart (int nFace, int dir, int dagger=0, qudaStream_t *stream_p=NULL, bool gdr_send=false, bool gdr_recv=true) |
virtual int | commsQuery (int nFace, int dir, int dagger=0, qudaStream_t *stream_p=NULL, bool gdr_send=false, bool gdr_recv=true) |
virtual void | commsWait (int nFace, int dir, int dagger=0, qudaStream_t *stream_p=NULL, bool gdr_send=false, bool gdr_recv=true) |
virtual void | scatter (int nFace, int dagger, int dir) |
const char * | VolString () const |
const char * | AuxString () const |
virtual void | backup () const |
Backs up the LatticeField. More... | |
virtual void | restore () const |
Restores the LatticeField. More... | |
virtual void | prefetch (QudaFieldLocation mem_space, qudaStream_t stream=0) const |
If managed memory and prefetch is enabled, prefetch all relevant memory fields to the current device or to the CPU. More... | |
virtual bool | isNative () const =0 |
virtual void | copy_to_buffer (void *buffer) const =0 |
Copy all contents of the field to a host buffer. More... | |
virtual void | copy_from_buffer (void *buffer)=0 |
Copy all contents of the field from a host buffer to this field. More... | |
Public Member Functions inherited from quda::Object | |
Object () | |
virtual | ~Object () |
Static Public Member Functions | |
static void | freeGhostBuffer (void) |
Free statically allocated ghost buffers. More... | |
static void | destroyIPCComms () |
Static Public Member Functions inherited from quda::Object | |
static void * | operator new (std::size_t size) |
static void | operator delete (void *p) |
static void * | operator new[] (std::size_t size) |
static void | operator delete[] (void *p) |
Static Public Attributes | |
static int | bufferIndex = 0 |
static bool | ghost_field_reset = false |
Protected Member Functions | |
virtual void | setTuningString () |
void | precisionCheck () |
Static Protected Attributes | |
static void * | ghost_send_buffer_d [2] = {nullptr, nullptr} |
static void * | ghost_recv_buffer_d [2] = {nullptr, nullptr} |
static void * | ghost_pinned_send_buffer_h [2] = {nullptr, nullptr} |
static void * | ghost_pinned_recv_buffer_h [2] = {nullptr, nullptr} |
static void * | ghost_pinned_send_buffer_hd [2] = {nullptr, nullptr} |
static void * | ghost_pinned_recv_buffer_hd [2] = {nullptr, nullptr} |
static void * | ghost_remote_send_buffer_d [2][QUDA_MAX_DIM][2] |
static size_t | ghostFaceBytes = 0 |
static bool | initGhostFaceBuffer = false |
static MsgHandle * | mh_send_p2p_fwd [2][QUDA_MAX_DIM] { } |
static MsgHandle * | mh_send_p2p_back [2][QUDA_MAX_DIM] { } |
static MsgHandle * | mh_recv_p2p_fwd [2][QUDA_MAX_DIM] { } |
static MsgHandle * | mh_recv_p2p_back [2][QUDA_MAX_DIM] { } |
static int | buffer_send_p2p_fwd [2][QUDA_MAX_DIM] { } |
static int | buffer_recv_p2p_fwd [2][QUDA_MAX_DIM] { } |
static int | buffer_send_p2p_back [2][QUDA_MAX_DIM] { } |
static int | buffer_recv_p2p_back [2][QUDA_MAX_DIM] { } |
static cudaEvent_t | ipcCopyEvent [2][2][QUDA_MAX_DIM] |
static cudaEvent_t | ipcRemoteCopyEvent [2][2][QUDA_MAX_DIM] |
static bool | initIPCComms = false |
Definition at line 145 of file lattice_field.h.
quda::LatticeField::LatticeField | ( | const LatticeFieldParam & | param | ) |
Constructor for creating a LatticeField from a LatticeFieldParam
param | Contains the metadata for creating the LatticeField |
Definition at line 61 of file lattice_field.cpp.
quda::LatticeField::LatticeField | ( | const LatticeField & | field | ) |
Constructor for creating a LatticeField from another LatticeField
field | Instance of LatticeField from which we are inheriting metadata |
Definition at line 154 of file lattice_field.cpp.
|
virtual |
Destructor for LatticeField
Definition at line 226 of file lattice_field.cpp.
void quda::LatticeField::allocateGhostBuffer | ( | size_t | ghost_bytes | ) | const |
Allocate the static ghost buffers.
[in] | ghost_bytes | Size of the ghost buffer to allocate |
Definition at line 228 of file lattice_field.cpp.
|
inline |
Return the aux string used by the autotuner
Definition at line 696 of file lattice_field.h.
|
inlinevirtual |
Backs up the LatticeField.
Reimplemented in quda::cpuGaugeField, quda::cudaGaugeField, quda::cpuColorSpinorField, and quda::cudaColorSpinorField.
Definition at line 699 of file lattice_field.h.
void quda::LatticeField::checkField | ( | const LatticeField & | a | ) | const |
Check that the metadata of *this and a are compatible
a | The LatticeField to which we are comparing |
Definition at line 653 of file lattice_field.cpp.
|
inlinevirtual |
Reimplemented in quda::cudaColorSpinorField.
Definition at line 681 of file lattice_field.h.
|
inlinevirtual |
Reimplemented in quda::cudaColorSpinorField.
Definition at line 677 of file lattice_field.h.
|
inlinevirtual |
Reimplemented in quda::cudaColorSpinorField.
Definition at line 685 of file lattice_field.h.
|
pure virtual |
Copy all contents of the field from a host buffer to this field.
[in] | the | host buffer to copy from. Currently `buffer` has to be a host pointer: passing in UVM or device pointer leads to undefined behavior. *** |
Implemented in quda::cpuGaugeField, quda::cudaGaugeField, quda::cpuColorSpinorField, quda::cudaColorSpinorField, quda::cpuCloverField, and quda::cudaCloverField.
|
pure virtual |
Copy all contents of the field to a host buffer.
[in] | the | host buffer to copy to. Currently `buffer` has to be a host pointer: passing in UVM or device pointer leads to undefined behavior. *** |
Implemented in quda::cpuGaugeField, quda::cudaGaugeField, quda::cpuColorSpinorField, quda::cudaColorSpinorField, quda::cpuCloverField, and quda::cudaCloverField.
void quda::LatticeField::createComms | ( | bool | no_comms_fill = false , |
bool | bidir = true |
||
) |
Create the communication handlers (both host and device)
[in] | no_comms_fill | Whether to allocate halo buffers for dimensions that are not partitioned |
[in] | bidir | Whether to allocate communication buffers to allow for simultaneous bi-directional exchange. If false, then the forwards and backwards buffers will alias (saving memory). |
Definition at line 312 of file lattice_field.cpp.
void quda::LatticeField::createIPCComms | ( | ) |
Create the inter-process communication handlers
Definition at line 418 of file lattice_field.cpp.
void quda::LatticeField::destroyComms | ( | ) |
Destroy the communication handlers
Definition at line 386 of file lattice_field.cpp.
|
static |
Destroy the statically allocated inter-process communication handlers
Definition at line 572 of file lattice_field.cpp.
|
static |
Free statically allocated ghost buffers.
Definition at line 283 of file lattice_field.cpp.
|
pure virtual |
Implemented in quda::GaugeField, quda::ColorSpinorField, and quda::CloverField.
|
inlinevirtual |
Reimplemented in quda::cudaColorSpinorField.
Definition at line 675 of file lattice_field.h.
|
inline |
Definition at line 609 of file lattice_field.h.
const cudaEvent_t & quda::LatticeField::getIPCCopyEvent | ( | int | dir, |
int | dim | ||
) | const |
Handle to local copy event used for peer-to-peer synchronization
Definition at line 634 of file lattice_field.cpp.
const cudaEvent_t & quda::LatticeField::getIPCRemoteCopyEvent | ( | int | dir, |
int | dim | ||
) | const |
Handle to remote copy event used for peer-to-peer synchronization
Definition at line 638 of file lattice_field.cpp.
|
inline |
Definition at line 562 of file lattice_field.h.
|
inline |
Definition at line 572 of file lattice_field.h.
|
inline |
Helper function to determine if local-to-remote (send) peer-to-peer copy is complete
Definition at line 624 of file lattice_field.cpp.
|
inline |
Helper function to determine if local-to-remote (receive) peer-to-peer copy is complete
Definition at line 629 of file lattice_field.cpp.
|
pure virtual |
Implemented in quda::GaugeField, quda::ColorSpinorField, and quda::CloverField.
|
inline |
Definition at line 525 of file lattice_field.h.
|
inline |
Definition at line 530 of file lattice_field.h.
QudaFieldLocation quda::LatticeField::Location | ( | ) | const |
Definition at line 683 of file lattice_field.cpp.
|
inlinevirtual |
Definition at line 593 of file lattice_field.h.
|
inline |
Return pointer to the device send buffer in a given direction and dimension.
[in] | dir | Direction we are requesting |
[in] | dim | Dimension we are requesting |
Definition at line 654 of file lattice_field.h.
|
inline |
Return pointer to the local pinned my_face buffer in a given direction and dimension.
[in] | dir | Direction we are requesting |
[in] | dim | Dimension we are requesting |
Definition at line 636 of file lattice_field.h.
|
inline |
Return pointer to the local mapped my_face buffer in a given direction and dimension.
[in] | dir | Direction we are requesting |
[in] | dim | Dimension we are requesting |
Definition at line 645 of file lattice_field.h.
|
inline |
Definition at line 500 of file lattice_field.h.
int quda::LatticeField::Nvec | ( | ) | const |
Definition at line 707 of file lattice_field.cpp.
|
inline |
Definition at line 552 of file lattice_field.h.
|
inline |
Definition at line 567 of file lattice_field.h.
|
inlineprotected |
Definition at line 396 of file lattice_field.h.
|
inlinevirtual |
If managed memory and prefetch is enabled, prefetch all relevant memory fields to the current device or to the CPU.
[in] | mem_space | Memory space we are prefetching to |
Reimplemented in quda::cudaGaugeField, quda::cudaColorSpinorField, and quda::cudaCloverField.
Definition at line 709 of file lattice_field.h.
|
inline |
Definition at line 557 of file lattice_field.h.
|
virtual |
Read in the field specified by filenemae
filename | The name of the file to read |
Definition at line 699 of file lattice_field.cpp.
|
inline |
Return base pointer to a remote device buffer for direct sending in a given direction and dimension. Since this is a base pointer, one still needs to take care of offsetting to the correct point for each direction/dimension.
[in] | dir | Direction we are requesting |
[in] | dim | Dimension we are requesting |
Definition at line 665 of file lattice_field.h.
|
inline |
Return base pointer to the ghost recv buffer. Since this is a base pointer, one still needs to take care of offsetting to the correct point for each direction/dimension.
Definition at line 673 of file lattice_field.h.
|
inlinevirtual |
Restores the LatticeField.
Reimplemented in quda::cpuGaugeField, quda::cudaGaugeField, quda::cpuColorSpinorField, and quda::cudaColorSpinorField.
Definition at line 702 of file lattice_field.h.
|
inline |
Definition at line 577 of file lattice_field.h.
|
inline |
Set the scale factor for a fixed-point field.
[in] | scale_ | The new scale factor |
Definition at line 583 of file lattice_field.h.
|
inlinevirtual |
Reimplemented in quda::cudaColorSpinorField.
Definition at line 689 of file lattice_field.h.
|
protectedvirtual |
Sets the vol_string for use in tuning
Reimplemented in quda::GaugeField, and quda::ColorSpinorField.
Definition at line 642 of file lattice_field.cpp.
|
inlinevirtual |
Reimplemented in quda::ColorSpinorField.
Definition at line 588 of file lattice_field.h.
|
inline |
Definition at line 547 of file lattice_field.h.
|
inline |
i | The dimension of the requested surface |
Definition at line 536 of file lattice_field.h.
|
inline |
i | The dimension of the requested surface |
Definition at line 542 of file lattice_field.h.
|
inline |
Return the volume string used by the autotuner
Definition at line 693 of file lattice_field.h.
|
inline |
Definition at line 515 of file lattice_field.h.
|
inline |
Definition at line 520 of file lattice_field.h.
|
virtual |
Write the field in the file specified by filename
filename | The name of the file to write |
Definition at line 703 of file lattice_field.cpp.
|
inline |
Definition at line 505 of file lattice_field.h.
|
protected |
used as a label in the autotuner
Definition at line 388 of file lattice_field.h.
|
mutableprotected |
Definition at line 409 of file lattice_field.h.
|
mutableprotected |
Definition at line 407 of file lattice_field.h.
|
mutableprotected |
Definition at line 408 of file lattice_field.h.
|
staticprotected |
Buffer used by peer-to-peer message handler
Definition at line 370 of file lattice_field.h.
|
staticprotected |
Buffer used by peer-to-peer message handler
Definition at line 364 of file lattice_field.h.
|
staticprotected |
Buffer used by peer-to-peer message handler
Definition at line 367 of file lattice_field.h.
|
staticprotected |
Buffer used by peer-to-peer message handler
Definition at line 361 of file lattice_field.h.
|
static |
Static variable that is determined which ghost buffer we are using
Definition at line 490 of file lattice_field.h.
|
protected |
Device memory buffer for receiving messages
Definition at line 313 of file lattice_field.h.
|
protected |
Local pointers to the device ghost_recv buffer
Definition at line 322 of file lattice_field.h.
|
protected |
Local pointers to the pinned from_face buffer
Definition at line 316 of file lattice_field.h.
|
protected |
Local pointers to the mapped from_face buffer
Definition at line 319 of file lattice_field.h.
|
protected |
Memory buffer used for receiving all messages
Definition at line 303 of file lattice_field.h.
|
protected |
Mapped version of from_face_h
Definition at line 308 of file lattice_field.h.
|
mutableprotected |
Size in bytes of this ghost field
Definition at line 254 of file lattice_field.h.
|
mutableprotected |
Size in bytes of prior ghost allocation
Definition at line 259 of file lattice_field.h.
|
mutableprotected |
Size in bytes of the ghost in each dimension
Definition at line 264 of file lattice_field.h.
|
mutableprotected |
Actual allocated size in bytes of the ghost in each dimension
Definition at line 269 of file lattice_field.h.
|
static |
Bool which is triggered if the ghost field is reset
Definition at line 495 of file lattice_field.h.
|
mutableprotected |
Byte offsets to each ghost zone
Definition at line 274 of file lattice_field.h.
|
staticprotected |
Double buffered static pinned recv buffers
Definition at line 224 of file lattice_field.h.
|
staticprotected |
Mapped version of pinned recv buffers
Definition at line 234 of file lattice_field.h.
|
staticprotected |
Double buffered static pinned send buffers
Definition at line 219 of file lattice_field.h.
|
staticprotected |
Mapped version of pinned send buffers
Definition at line 229 of file lattice_field.h.
|
mutableprotected |
Precision of the ghost
Definition at line 181 of file lattice_field.h.
|
mutableprotected |
Bool which is triggered if the ghost precision is reset
Definition at line 184 of file lattice_field.h.
|
staticprotected |
Double buffered static GPU halo receive buffer
Definition at line 214 of file lattice_field.h.
|
staticprotected |
Remove ghost pointer for sending to
Definition at line 239 of file lattice_field.h.
|
staticprotected |
Double buffered static GPU halo send buffer
Definition at line 209 of file lattice_field.h.
|
protected |
Type of ghost exchange to perform
Definition at line 193 of file lattice_field.h.
|
staticprotected |
The current size of the static ghost allocation
Definition at line 244 of file lattice_field.h.
|
protected |
Whether we have initialized communication for this field
Definition at line 379 of file lattice_field.h.
|
staticprotected |
Whether the ghost buffers have been initialized
Definition at line 249 of file lattice_field.h.
|
staticprotected |
Whether we have initialized peer-to-peer communication
Definition at line 382 of file lattice_field.h.
|
staticprotected |
Local copy of event used for peer-to-peer synchronization
Definition at line 373 of file lattice_field.h.
|
staticprotected |
Remote copy of event used for peer-to-peer synchronization
Definition at line 376 of file lattice_field.h.
|
protected |
Local lattice volume
Definition at line 155 of file lattice_field.h.
|
protected |
Checkerboarded local volume
Definition at line 158 of file lattice_field.h.
|
protected |
The type of allocation we are going to do for this field
Definition at line 394 of file lattice_field.h.
|
protected |
Message handles for receiving from backwards
Definition at line 328 of file lattice_field.h.
|
protected |
Message handles for receiving from forwards
Definition at line 325 of file lattice_field.h.
|
staticprotected |
Peer-to-peer message handler for signaling event posting
Definition at line 358 of file lattice_field.h.
|
staticprotected |
Peer-to-peer message handler for signaling event posting
Definition at line 355 of file lattice_field.h.
|
protected |
Message handles for rdma receiving from backwards
Definition at line 340 of file lattice_field.h.
|
protected |
Message handles for rdma receiving from forwards
Definition at line 337 of file lattice_field.h.
|
protected |
Message handles for sending backwards
Definition at line 334 of file lattice_field.h.
|
protected |
Message handles for sending forwards
Definition at line 331 of file lattice_field.h.
|
staticprotected |
Peer-to-peer message handler for signaling event posting
Definition at line 352 of file lattice_field.h.
|
staticprotected |
Peer-to-peer message handler for signaling event posting
Definition at line 349 of file lattice_field.h.
|
protected |
Message handles for rdma sending to backwards
Definition at line 346 of file lattice_field.h.
|
protected |
Message handles for rdma sending to forwards
Definition at line 343 of file lattice_field.h.
|
protected |
Device memory buffer for sending messages
Definition at line 289 of file lattice_field.h.
|
protected |
Local pointers to the device ghost_send buffer
Definition at line 298 of file lattice_field.h.
|
protected |
Local pointers to the pinned my_face buffer
Definition at line 292 of file lattice_field.h.
|
protected |
Local pointers to the mapped my_face buffer
Definition at line 295 of file lattice_field.h.
|
protected |
Pinned memory buffer used for sending messages
Definition at line 279 of file lattice_field.h.
|
protected |
Mapped version of my_face_h
Definition at line 284 of file lattice_field.h.
|
protected |
Number of field dimensions
Definition at line 166 of file lattice_field.h.
|
protected |
The number of dimensions we partition for communication
Definition at line 198 of file lattice_field.h.
|
protected |
Definition at line 161 of file lattice_field.h.
|
protected |
Precision of the field
Definition at line 178 of file lattice_field.h.
|
protected |
The extended lattice radius (if applicable)
Definition at line 175 of file lattice_field.h.
|
protected |
For fixed-point fields that need a global scaling factor
Definition at line 187 of file lattice_field.h.
|
protected |
Whether the field is full or single parity
Definition at line 190 of file lattice_field.h.
|
protected |
Definition at line 160 of file lattice_field.h.
|
protected |
Definition at line 171 of file lattice_field.h.
|
protected |
Definition at line 172 of file lattice_field.h.
|
protected |
Definition at line 163 of file lattice_field.h.
|
protected |
Used as a label in the autotuner
Definition at line 385 of file lattice_field.h.
|
protected |
Lattice volume
Definition at line 149 of file lattice_field.h.
|
protected |
Checkerboarded volume
Definition at line 152 of file lattice_field.h.
|
protected |
Array storing the length of dimension
Definition at line 169 of file lattice_field.h.