13 errorQuda(
"CPU fields do not support half precision");
16 errorQuda(
"CPU fields do not support quarter precision");
19 errorQuda(
"CPU fields do not support non-zero padding");
25 errorQuda(
"10-reconstruction only supported with momentum links");
45 gauge = (
void**)
safe_malloc(siteDim *
sizeof(
void*));
47 for (
int d=0; d<siteDim; d++) {
53 gauge[d] = ((
void **)
param.gauge)[d];
64 errorQuda(
"MILC site gauge order only supported for reference fields");
71 gauge = (
void**)
param.gauge;
83 for (
int i=0; i<
nDim; i++) {
113 for (
int d=0; d<siteDim; d++) {
127 for (
int i=0; i<
nDim; i++) {
141 errorQuda(
"Cannot request exchange of forward links on non-coarse geometry");
144 for (
int d=0; d<
nDim; d++) {
174 errorQuda(
"link_direction = %d not supported", link_direction);
194 for (
int d=0; d<
nDim; d++) {
201 for (
int d=0; d<
nDim; d++) {
233 memcpy(
static_cast<char*
>(recv[d])+
bytes[d], send[d],
bytes[d]);
234 memcpy(recv[d],
static_cast<char*
>(send[d])+
bytes[d],
bytes[d]);
241 for (
int d=0; d<
nDim; d++) {
262 if (
this == &src)
return;
281 src.
Bytes(), cudaMemcpyDeviceToHost);
335 errorQuda(
"Setting gauge pointer is only allowed when create="
336 "QUDA_REFERENCE_FIELD_CREATE type\n");
345 char **buffer =
new char*[
geometry];
350 backup_h =
reinterpret_cast<char*
>(buffer);
364 char **buffer =
reinterpret_cast<char**
>(
backup_h);
390 void *
const *p =
static_cast<void *
const *
>(
Gauge_p());
391 int dbytes =
Bytes() / 4;
392 static_assert(
sizeof(
char) == 1,
"Assuming sizeof(char) == 1");
393 char *dst_buffer =
reinterpret_cast<char *
>(buffer);
394 for (
int d = 0; d < 4; d++) { std::memcpy(&dst_buffer[d * dbytes], p[d], dbytes); }
400 std::memcpy(buffer, p,
bytes);
410 void **p =
static_cast<void **
>(
Gauge_p());
411 size_t dbytes =
Bytes() / 4;
412 static_assert(
sizeof(
char) == 1,
"Assuming sizeof(char) == 1");
413 const char *dst_buffer =
reinterpret_cast<const char *
>(buffer);
414 for (
int d = 0; d < 4; d++) { std::memcpy(p[d], &dst_buffer[d * dbytes], dbytes); }
420 std::memcpy(p, buffer,
bytes);
void * ghost[2 *QUDA_MAX_DIM]
QudaGaugeFieldOrder order
QudaGaugeFieldOrder Order() const
const double & LinkMax() const
void exchange(void **recv, void **send, QudaDirection dir) const
Exchange the buffers across all dimensions in a given direction.
double abs_max(int dim=-1, bool fixed=false) const
Compute the absolute maximum of the field (Linfinity norm)
void checkField(const LatticeField &) const
QudaFieldGeometry geometry
QudaReconstructType reconstruct
const void ** Ghost() const
QudaGhostExchange ghostExchange
MsgHandle * mh_send_fwd[2][QUDA_MAX_DIM]
int surface[QUDA_MAX_DIM]
MsgHandle * mh_send_back[2][QUDA_MAX_DIM]
QudaGhostExchange GhostExchange() const
MsgHandle * mh_recv_fwd[2][QUDA_MAX_DIM]
MsgHandle * mh_recv_back[2][QUDA_MAX_DIM]
void copy(const GaugeField &src)
virtual void copy_from_buffer(void *buffer)
Copy all contents of the field from a host buffer to this field.
void setGauge(void **_gauge)
void backup() const
Backs up the cpuGaugeField.
void injectGhost(QudaLinkDirection link_direction=QUDA_LINK_BACKWARDS)
The opposite of exchangeGhost: take the ghost zone on x, send to node x-1, and inject back into the f...
void exchangeExtendedGhost(const int *R, bool no_comms_fill=false)
This does routine will populate the border / halo region of a gauge field that has been created using...
void exchangeGhost(QudaLinkDirection link_direction=QUDA_LINK_BACKWARDS)
Exchange the ghost and store store in the padded region.
void restore() const
Restores the cpuGaugeField.
cpuGaugeField(const GaugeFieldParam ¶m)
Constructor for cpuGaugeField from a GaugeFieldParam.
virtual void copy_to_buffer(void *buffer) const
Copy all contents of the field to a host buffer.
void comm_start(MsgHandle *mh)
int comm_dim_partitioned(int dim)
#define comm_declare_receive_relative(buffer, dim, dir, nbytes)
void comm_wait(MsgHandle *mh)
void comm_free(MsgHandle *&mh)
#define comm_declare_send_relative(buffer, dim, dir, nbytes)
void * memset(void *s, int c, size_t n)
enum QudaLinkDirection_s QudaLinkDirection
@ QUDA_CUDA_FIELD_LOCATION
@ QUDA_CPU_FIELD_LOCATION
@ QUDA_LINK_BIDIRECTIONAL
enum QudaGaugeFieldOrder_s QudaGaugeFieldOrder
enum QudaFieldGeometry_s QudaFieldGeometry
@ QUDA_GHOST_EXCHANGE_EXTENDED
@ QUDA_GHOST_EXCHANGE_PAD
@ QUDA_MILC_SITE_GAUGE_ORDER
@ QUDA_CPS_WILSON_GAUGE_ORDER
@ QUDA_TIFR_PADDED_GAUGE_ORDER
@ QUDA_QDPJIT_GAUGE_ORDER
@ QUDA_REFERENCE_FIELD_CREATE
#define pool_pinned_malloc(size)
#define safe_malloc(size)
#define pool_pinned_free(ptr)
void * create_gauge_buffer(size_t bytes, QudaGaugeFieldOrder order, QudaFieldGeometry geometry)
void ** create_ghost_buffer(size_t bytes[], QudaGaugeFieldOrder order, QudaFieldGeometry geometry)
void copyGenericGauge(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out=0, void *In=0, void **ghostOut=0, void **ghostIn=0, int type=0)
void extractGaugeGhost(const GaugeField &u, void **ghost, bool extract=true, int offset=0)
void extractExtendedGaugeGhost(const GaugeField &u, int dim, const int *R, void **ghost, bool extract)
void free_gauge_buffer(void *buffer, QudaGaugeFieldOrder order, QudaFieldGeometry geometry)
void free_ghost_buffer(void **buffer, QudaGaugeFieldOrder order, QudaFieldGeometry geometry)
QudaFieldLocation reorder_location()
Return whether data is reordered on the CPU or GPU. This can set at QUDA initialization using the env...
void copyExtendedGauge(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out=0, void *In=0)
#define qudaMemcpy(dst, src, count, kind)
#define QUDA_MAX_DIM
Maximum number of dimensions supported by QUDA. In practice, no routines make use of more than 5.