HILA
Loading...
Searching...
No Matches
backend_gpu/lattice.h
1#ifndef _BACKEND_LATTICE_H_
2#define _BACKEND_LATTICE_H_
3
4/// Lattice related data that needs to be communicated
5/// to kernels
7 /// Storage for the neighbour indexes. Stored on device
8 unsigned *d_neighb[NDIRS];
9
10#ifdef SPECIAL_BOUNDARY_CONDITIONS
11 /// Neighbour indexes with special boundaries. Stored on device
12 unsigned *d_neighb_special[NDIRS];
13#endif
14
15 /// The full number of elements in a field, including haloes.
16 /// This is necessary for structure-of-arrays -storage
18 /// beginning and end of this loop (using lattice to communicate,
19 /// which may not be the clearest choice.)
20 int loop_begin, loop_end;
21
22#ifdef EVEN_SITES_FIRST
23 /// Finally a pointer to the list of coordinates, stored on device
24 CoordinateVector *d_coordinates;
25
26//#if defined(__CUDACC__) || defined(__HIPCC__)
27#if defined(CUDA) || defined(HIP)
28
29 /// get the coordinates at a given site
30 __host__ __device__ const CoordinateVector &coordinates(unsigned idx) const {
31 return d_coordinates[idx];
32 }
33 __host__ __device__ int coordinate(unsigned idx, Direction dir) const {
34 return d_coordinates[idx][dir];
35 }
36
37#endif
38
39#else
40 // Now not EVEN_SITES_FIRST
41
42 // these defined in hila_gpu.cpp
43 __device__ const CoordinateVector coordinates(unsigned idx) const;
44 __device__ int coordinate(unsigned idx, Direction dir) const;
45
46#endif
47
48 /// setup the backend lattice data
49 void setup(lattice_struct &lattice);
50
51};
52
53//#if defined(__CUDACC__) || defined(__HIPCC__)
54#if defined(CUDA) || defined(HIP)
55
56// define also loop_lattice_size() and _volume() methods for cuda
57
58__host__ __device__ int loop_lattice_size(Direction d);
59__host__ __device__ CoordinateVector loop_lattice_size(void);
60__host__ __device__ int64_t loop_lattice_volume(void);
61
62#endif
63
64#endif
constexpr unsigned NDIRS
Number of directions.
Definition coordinates.h:57
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
Definition coordinates.h:34
Helper class for loading the vectorized lattice.
void setup(lattice_struct *lattice)
unsigned * d_neighb[NDIRS]
Storage for the neighbour indexes. Stored on device.