Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
CompilerPortability.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11// ---------------------------------------------------------------------------
12// GPU / Compiler Execution Qualifiers
13// ---------------------------------------------------------------------------
14#ifndef CORRELATION_DEVICE
15#if defined(__CUDACC__) || defined(__HIPCC__)
16#define CORRELATION_DEVICE __device__
17#define CORRELATION_HOST __host__
18#define CORRELATION_GLOBAL __global__
19#define CORRELATION_FORCEINLINE __forceinline__
20#else
21#define CORRELATION_DEVICE
22#define CORRELATION_HOST
23#define CORRELATION_GLOBAL
24#define CORRELATION_FORCEINLINE inline
25#endif
26#endif
27
28// ---------------------------------------------------------------------------
29// Portable restrict keyword macro
30// ---------------------------------------------------------------------------
31#ifndef CORRELATION_RESTRICT
32#if defined(__CUDACC__) || defined(__HIPCC__)
33#define CORRELATION_RESTRICT __restrict__
34#elif defined(_MSC_VER)
35#define CORRELATION_RESTRICT __restrict
36#elif defined(__GNUC__) || defined(__clang__)
37#define CORRELATION_RESTRICT __restrict__
38#else
39#define CORRELATION_RESTRICT
40#endif
41#endif
42
43// ---------------------------------------------------------------------------
44// Memory Alignment Macro
45// ---------------------------------------------------------------------------
46#ifndef CORRELATION_ALIGN
47#ifdef _MSC_VER
48#define CORRELATION_ALIGN(n) __declspec(align(n))
49#else
50#define CORRELATION_ALIGN(n) __attribute__((aligned(n)))
51#endif
52#endif