Astaroth  3.1
Scalable Multi-GPU Stencil Computations
Loading...
Searching...
No Matches
extern_arrays_decl.h
Go to the documentation of this file.
1#pragma once
2
3// TP: We do this ugly macro because I want to keep the generated headers the
4// same if we are compiling CPU analysis and the actual GPU code.
5// OM: After trying to make it possible to compile kernels across multiple CUs
6// the variables need to be referenced using 'extern' and then linked using
7// device linking.
8#define DECLARE_GMEM_ARRAY(DATATYPE, DEFINE_NAME, ARR_NAME) \
9 extern __device__ __constant__ DATATYPE* \
10 AC_INTERNAL_gmem_##DEFINE_NAME##_arrays_##ARR_NAME
11#define DECLARE_CONST_DIMS_GMEM_ARRAY(DATATYPE, DEFINE_NAME, ARR_NAME, LEN) \
12 extern __device__ DATATYPE \
13 AC_INTERNAL_gmem_##DEFINE_NAME##_arrays_##ARR_NAME[LEN]
14#define DECLARE_DCONST_ARRAY(DATATYPE, DEFINE_NAME, ARR_NAME, LEN) \
15 extern UNUSED __device__ __constant__ DATATYPE \
16 AC_INTERNAL_d_##DEFINE_NAME##_arrays_##ARR_NAME[LEN];
17#include "dconst_arrays_decl.h"
18#include "gmem_arrays_decl.h"
19#undef DECLARE_GMEM_ARRAY
20#undef DECLARE_CONST_DIMS_GMEM_ARRAY
21#undef DECLARE_DCONST_ARRAY