MCKL
Monte Carlo Kernel Library
config.h
Go to the documentation of this file.
1 //============================================================================
2 // MCKL/include/mckl/internal/config.h
3 //----------------------------------------------------------------------------
4 // MCKL: Monte Carlo Kernel Library
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2018, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef MCKL_INTERNAL_CONFIG_H
33 #define MCKL_INTERNAL_CONFIG_H
34 
35 // Version number
36 #define MCKL_VERSION_MAJOR 1
37 #define MCKL_VERSION_MINOR 0
38 #define MCKL_VERSION_PATCH 0
39 #define MCKL_VERSION \
40  (MCKL_VERSION_MAJOR * 10000 + MCKL_VERSION_MINOR * 100 + \
41  MCKL_VERSION_PATCH)
42 
43 // Compiler dependent macros
44 
45 #include <mckl/internal/compiler.h>
46 
47 // ASM library header file
48 #include <mckl/mckl.h>
49 
50 // Assertion macros
51 
52 #ifndef MCKL_NO_RUNTIME_ASSERT
53 #ifndef NDEBUG
54 #define MCKL_NO_RUNTIME_ASSERT 0
55 #else
56 #define MCKL_NO_RUNTIME_ASSERT 1
57 #endif
58 #endif
59 
62 #ifndef MCKL_RUNTIME_ASSERT_AS_EXCEPTION
63 #define MCKL_RUNTIME_ASSERT_AS_EXCEPTION 0
64 #endif
65 
68 #ifndef MCKL_REQUIRE_ENDIANNESS_NEUTURAL
69 #define MCKL_REQUIRE_ENDIANNESS_NEUTURAL 0
70 #endif
71 
72 // OS dependent macros
73 
74 #ifndef MCKL_OPENCL
75 #ifdef __APPLE__
76 #include <Availability.h>
77 #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && defined(__MAC_10_5)
78 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
79 #ifndef MCKL_HAS_POSIX
80 #define MCKL_HAS_POSIX 1
81 #endif
82 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
83 #endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && defined(__MAC_10_5)
84 #elif defined(__POSIX_C_SOURCE)
85 #if _POSIX_C_SOURCE >= 200112L
86 #ifndef MCKL_HAS_POSIX
87 #define MCKL_HAS_POSIX 1
88 #endif
89 #endif // _POSIX_C_SOURCE >= 200112L
90 #elif defined(_XOPEN_SOURCE)
91 #if _XOPEN_SOURCE >= 600
92 #ifndef MCKL_HAS_POSIX
93 #define MCKL_HAS_POSIX 1
94 #endif
95 #endif // _XOPEN_SOURCE >= 600
96 #endif // __APPLE__
97 #endif // MCKL_OPENCL
98 
99 #ifndef MCKL_HAS_POSIX
100 #define MCKL_HAS_POSIX 0
101 #endif
102 
103 // Optional libraries
104 
105 #ifndef MCKL_USE_ASM_LIBRARY
106 #define MCKL_USE_ASM_LIBRARY 0
107 #endif
108 
109 #ifndef MCKL_USE_ASM_FMA
110 #define MCKL_USE_ASM_FMA MCKL_USE_FMA
111 #endif
112 
113 #ifndef MCKL_USE_ASM_VMF
114 #define MCKL_USE_ASM_VMF 0
115 #endif
116 
117 #ifndef MCKL_HAS_OMP
118 #ifdef _OPENMP
119 #define MCKL_HAS_OMP 1
120 #else
121 #define MCKL_HAS_OMP 0
122 #endif
123 #endif
124 
125 #ifndef MCKL_USE_OMP
126 #define MCKL_USE_OMP MCKL_HAS_OMP
127 #endif
128 
129 #ifndef MCKL_HAS_TBB
130 #define MCKL_HAS_TBB 0
131 #endif
132 
133 #ifndef MCKL_HAS_JEMALLOC
134 #define MCKL_HAS_JEMALLOC 0
135 #endif
136 
137 #ifndef MCKL_USE_JEMALLOC
138 #define MCKL_USE_JEMALLOC MCKL_HAS_JEMALLOC
139 #endif
140 
141 #ifndef MCKL_USE_TBB
142 #define MCKL_USE_TBB MCKL_HAS_TBB
143 #endif
144 
145 #ifndef MCKL_USE_TBB_MALLOC
146 #define MCKL_USE_TBB_MALLOC MCKL_HAS_TBB
147 #endif
148 
149 #ifndef MCKL_USE_TBB_TLS
150 #define MCKL_USE_TBB_TLS MCKL_HAS_TBB
151 #endif
152 
153 #ifndef MCKL_HAS_MKL
154 #define MCKL_HAS_MKL 0
155 #endif
156 
157 #ifndef MCKL_USE_MKL_CBLAS
158 #define MCKL_USE_MKL_CBLAS MCKL_HAS_MKL
159 #endif
160 
161 #ifndef MCKL_USE_MKL_VML
162 #define MCKL_USE_MKL_VML MCKL_HAS_MKL
163 #endif
164 
165 #ifndef MCKL_USE_MKL_VSL
166 #define MCKL_USE_MKL_VSL MCKL_HAS_MKL
167 #endif
168 
169 #ifndef MCKL_USE_CBLAS
170 #define MCKL_USE_CBLAS MCKL_USE_MKL_CBLAS
171 #endif
172 
173 #ifndef MCKL_HAS_HDF5
174 #define MCKL_HAS_HDF5 0
175 #endif
176 
177 #ifndef MCKL_HAS_TESTU01
178 #define MCKL_HAS_TESTU01 0
179 #endif
180 
183 #ifndef MCKL_ALIGNMENT
184 #if MCKL_USE_AVX512
185 #define MCKL_ALIGNMENT 64
186 #elif MCKL_USE_AVX2
187 #define MCKL_ALIGNMENT 32
188 #else
189 #define MCKL_ALIGNMENT 16
190 #endif
191 #endif
192 
195 #ifndef MCKL_MINIMUM_ALIGNMENT
196 #define MCKL_MINIMUM_ALIGNMENT 16
197 #endif
198 
199 #if MCKL_ALIGNMENT < MCKL_MINIMUM_ALIGNMENT
200 #undef MCKL_ALIGNEMNT
201 #define MCKL_ALIGNMENT MCKL_MINIMUM_ALIGNMENT
202 #endif
203 
204 #endif // MCKL_INTERNAL_CONFIG_H