|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
GPU portability layer: host/device decoration macros and backend detection. More...

Go to the source code of this file.
GPU portability layer: host/device decoration macros and backend detection.
This header is the single home for the thin backend-abstraction macros used by the EBGeometry GPU port. It performs no allocation and pulls in no backend runtime headers; it only detects which offload compiler (if any) is translating the current translation unit and expands the decoration macros accordingly. On an ordinary host C++17 compiler every decoration macro expands to nothing, so annotated code is byte-for-byte identical to unannotated code.
It also defines the inlining and launch macros: EBGEOMETRY_DEVICE_NOINLINE (out of line in a device pass), EBGEOMETRY_HOST_ALWAYS_INLINE and EBGEOMETRY_HOST_NOINLINE (GCC/Clang attributes in a host pass, so these two are not empty on a host compiler), and EBGEOMETRY_GRID_CONSTANT (a kernel parameter read in place, CUDA only).
__CUDACC__): decorations expand to __host__ / __device__ / __global__.__HIPCC__): same expansions as CUDA (HIP uses the identical attributes).Any other compiler, including a SYCL or OpenACC compiler, sees host code: the macros expand to nothing, and nothing in EBGeometry is callable inside a SYCL kernel or an OpenACC compute region.