1#ifndef HILA_BACKEND_LATTICE_GPU_H_
2#define HILA_BACKEND_LATTICE_GPU_H_
10#define HILA_GPU_EXTERN
12#define HILA_GPU_EXTERN extern
22#ifdef SPECIAL_BOUNDARY_CONDITIONS
24 unsigned *d_neighb_special[
NDIRS];
34#ifdef EVEN_SITES_FIRST
51 __device__
int coordinate(
unsigned idx,
Direction dir)
const;
64HILA_GPU_EXTERN __constant__
unsigned _dev_field_alloc_size;
65#ifdef EVEN_SITES_FIRST
71 return _dev_coordinates[idx];
74template <
typename T,
typename D>
75inline __device__
int get_dev_coordinate(T idx, D dir) {
76 return _dev_coordinates[idx][dir];
81#ifdef EVEN_SITES_FIRST
83inline __device__
Parity get_dev_site_parity(T idx) {
84 auto cv = get_dev_coordinates(idx);
98#ifndef EVEN_SITES_FIRST
106#pragma hila loop_function
107inline int loop_lattice_size(
Direction dir) {
108 return _d_size()[dir];
111#pragma hila loop_function
116#pragma hila loop_function
117inline int64_t loop_lattice_volume(
void) {
121#ifndef EVEN_SITES_FIRST
123#pragma hila loop_function
124inline const CoordinateVector backend_lattice_struct::coordinates(
unsigned idx)
const {
129 for (
int d = 0; d < NDIM - 1; ++d) {
130 ndiv = vdiv / _d_nodesize()[d];
131 c[d] = vdiv - ndiv * _d_nodesize()[d] + _d_nodemin()[d];
134 c[NDIM - 1] = vdiv + _d_nodemin()[NDIM - 1];
139#pragma hila loop_function
140inline int backend_lattice_struct::coordinate(
unsigned idx,
Direction dir)
const {
141 return (idx / _d_nodefactor()[dir]) % _d_nodesize()[dir] + _d_nodemin()[dir];
Global variable class within hila namespace.
This header file defines:
Parity
Parity enum with values EVEN, ODD, ALL; refers to parity of the site. Parity of site (x,...
#define foralldir(d)
Macro to loop over (all) Direction(s)
constexpr unsigned NDIRS
Number of directions.
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
Definition of global variable class.
Helper class for loading the vectorized lattice.
void setup(lattice_struct *lattice)
unsigned * d_neighb[NDIRS]
Storage for the neighbour indexes. Stored on device.
unsigned field_alloc_size