The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches
modes.h
1/** @file
2 * Compile-time checks that all expected
3 * preprocessor macros are defined and valid
4 *
5 * @author Tyson Jones
6 *
7 * @defgroup modes Modes
8 * @ingroup api
9 * @brief Macros for controlling QuEST compilation.
10 * @{
11 */
12
13#ifndef MODES_H
14#define MODES_H
15
16
17
18// ensure all mode flags are defined
19
20#ifndef COMPILE_MPI
21 #error "Compiler must define COMPILE_MPI"
22#endif
23
24#ifndef COMPILE_OPENMP
25 #error "Compiler must define COMPILE_OPENMP"
26#endif
27
28#ifndef COMPILE_CUDA
29 #error "Compiler must define COMPILE_CUDA"
30#endif
31
32#ifndef COMPILE_CUQUANTUM
33 #error "Compiler must define COMPILE_CUQUANTUM"
34#endif
35
36
37
38// ensure all mode flags are valid values
39
40#if ! (COMPILE_MPI == 0 || COMPILE_MPI == 1)
41 #error "Macro COMPILE_MPI must have value 0 or 1"
42#endif
43
44#if ! (COMPILE_OPENMP == 0 || COMPILE_OPENMP == 1)
45 #error "Macro COMPILE_OPENMP must have value 0 or 1"
46#endif
47
48#if ! (COMPILE_CUDA == 0 || COMPILE_CUDA == 1)
49 #error "Macro COMPILE_CUDA must have value 0 or 1"
50#endif
51
52#if ! (COMPILE_CUQUANTUM == 0 || COMPILE_CUQUANTUM == 1)
53 #error "Macro COMPILE_CUQUANTUM must have value 0 or 1"
54#endif
55
56
57
58// ensure mode flags are compatible
59
60#if COMPILE_CUQUANTUM && ! COMPILE_CUDA
61 #error "Cannot enable cuQuantum without simultaneously enabling GPU-acceleration"
62#endif
63
64
65
66// ensure C++ macro is valid (API headers use #ifdef, not #if)
67
68#ifdef __cplusplus
69#if !__cplusplus
70#error "Preprocessor __cplusplus was 0 and should instead be undefined"
71#endif
72#endif
73
74
75
76// define optional-macro defaults (mostly to list them)
77
78#ifndef PERMIT_NODES_TO_SHARE_GPU
79#define PERMIT_NODES_TO_SHARE_GPU 0
80#endif
81
82#ifndef INCLUDE_DEPRECATED_FUNCTIONS
83#define INCLUDE_DEPRECATED_FUNCTIONS 0
84#endif
85
86#ifndef DISABLE_DEPRECATION_WARNINGS
87#define DISABLE_DEPRECATION_WARNINGS 0
88#endif
89
90// further macros are defined in precision.h
91
92// spoofing above macro as consts to doc
93#if 0
94
95
96 /// @notdoced
97 /// @macrodoc
99
100
101 /// @notdoced
102 /// @macrodoc
104
105
106 /// @notdoced
107 /// @macrodoc
109
110
111#endif
112
113
114
115// user flags for choosing automatic deployment; only accessible by C++
116// backend and C++ users; C users must hardcode -1
117
118#ifdef __cplusplus
119
120namespace modeflag {
121
122 extern int USE_AUTO;
123}
124
125#endif // __cplusplus
126
127
128
129#endif // MODES_H
130
131/** @} */ // (end file-wide doxygen defgroup)
const int PERMIT_NODES_TO_SHARE_GPU
Definition modes.h:98
const int INCLUDE_DEPRECATED_FUNCTIONS
Definition modes.h:103
const int DISABLE_DEPRECATION_WARNINGS
Definition modes.h:108