1#ifndef _BACKEND_LATTICE_H_
2#define _BACKEND_LATTICE_H_
13#ifdef SPECIAL_BOUNDARY_CONDITIONS
15 unsigned *d_neighb_special[
NDIRS];
25#ifdef EVEN_SITES_FIRST
29#if defined(CUDA) || defined(HIP)
32 __host__ __device__
const CoordinateVector &coordinates(
unsigned idx)
const {
33 return d_coordinates[idx];
35 __host__ __device__
int coordinate(
unsigned idx,
Direction dir)
const {
36 return d_coordinates[idx][dir];
46 __device__
int coordinate(
unsigned idx,
Direction dir)
const;
61#define HILA_GPU_EXTERN
63#define HILA_GPU_EXTERN extern
70#ifndef EVEN_SITES_FIRST
78#pragma hila loop_function
79inline int loop_lattice_size(
Direction dir) {
80 return _d_size()[dir];
83#pragma hila loop_function
88#pragma hila loop_function
89inline int64_t loop_lattice_volume(
void) {
93#ifndef EVEN_SITES_FIRST
95inline __device__
const CoordinateVector backend_lattice_struct::coordinates(
unsigned idx)
const {
100 for (
int d = 0; d < NDIM - 1; ++d) {
101 ndiv = vdiv / _d_nodesize()[d];
102 c[d] = vdiv - ndiv * _d_nodesize()[d] + _d_nodemin()[d];
105 c[NDIM - 1] = vdiv + _d_nodemin()[NDIM - 1];
110inline __device__
int backend_lattice_struct::coordinate(
unsigned idx,
Direction dir)
const {
111 return (idx / _d_nodefactor()[dir]) % _d_nodesize()[dir] + _d_nodemin()[dir];
Global variable class within hila namespace.
This header file defines:
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