vSMC  v3.0.0
Scalable Monte Carlo
config.h
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/internal/config.h
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2016, 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 VSMC_INTERNAL_CONFIG_H
33 #define VSMC_INTERNAL_CONFIG_H
34 
35 // Compiler dependent macros
36 
37 #include <vsmc/internal/compiler.h>
38 
39 // Assertion macros
40 
41 #ifndef VSMC_NO_RUNTIME_ASSERT
42 #ifndef NDEBUG
43 #define VSMC_NO_RUNTIME_ASSERT 0
44 #else
45 #define VSMC_NO_RUNTIME_ASSERT 1
46 #endif
47 #endif
48 
49 #ifndef VSMC_NO_RUNTIME_WARNING
50 #ifndef NDEBUG
51 #define VSMC_NO_RUNTIME_WARNING 0
52 #else
53 #define VSMC_NO_RUNTIME_WARNING 1
54 #endif
55 #endif
56 
59 #ifndef VSMC_RUNTIME_ASSERT_AS_EXCEPTION
60 #define VSMC_RUNTIME_ASSERT_AS_EXCEPTION 0
61 #endif
62 
65 #ifndef VSMC_RUNTIME_WARNING_AS_EXCEPTION
66 #define VSMC_RUNTIME_WARNING_AS_EXCEPTION 0
67 #endif
68 
69 // OS dependent macros
70 
71 #ifndef VSMC_OPENCL
72 #if defined(__APPLE__) || defined(__MACOSX)
73 #include <Availability.h>
74 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
75 #ifndef VSMC_HAS_POSIX
76 #define VSMC_HAS_POSIX 1
77 #endif
78 #ifndef VSMC_USE_ACCELERATE
79 #define VSMC_USE_ACCELERATE 1
80 #endif
81 #endif
82 #else // __APPLE__
83 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
84 #ifndef VSMC_HAS_POSIX
85 #define VSMC_HAS_POSIX 1
86 #endif
87 #endif // _POSIX_C_SOURCE >= 200112L
88 #if defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600
89 #ifndef VSMC_HAS_POSIX
90 #define VSMC_HAS_POSIX 1
91 #endif
92 #endif // _XOPEN_SOURCE >= 600
93 #endif // VSMC_MACOSX
94 #endif // VSMC_OPENCL
95 
96 #ifndef VSMC_HAS_POSIX
97 #define VSMC_HAS_POSIX 0
98 #endif
99 
100 // Optional libraries
101 
102 #ifndef VSMC_HAS_OMP
103 #ifdef _OPENMP
104 #define VSMC_HAS_OMP 1
105 #else
106 #define VSMC_HAS_OMP 0
107 #endif
108 #endif
109 
110 #ifndef VSMC_USE_OMP
111 #define VSMC_USE_OMP VSMC_HAS_OMP
112 #endif
113 
114 #ifndef VSMC_HAS_OPENCL
115 #define VSMC_HAS_OPENCL 0
116 #endif
117 
118 #ifndef VSMC_HAS_HDF5
119 #define VSMC_HAS_HDF5 0
120 #endif
121 
122 #ifndef VSMC_HAS_TBB
123 #define VSMC_HAS_TBB 0
124 #endif
125 
126 #ifndef VSMC_USE_TBB
127 #define VSMC_USE_TBB VSMC_HAS_TBB
128 #endif
129 
130 #ifndef VSMC_USE_TBB_MALLOC
131 #define VSMC_USE_TBB_MALLOC VSMC_HAS_TBB
132 #endif
133 
134 #ifndef VSMC_USE_TBB_TLS
135 #define VSMC_USE_TBB_TLS VSMC_HAS_TBB
136 #endif
137 
138 #ifndef VSMC_HAS_MKL
139 #define VSMC_HAS_MKL 0
140 #endif
141 
142 #ifndef VSMC_USE_MKL_CBLAS
143 #define VSMC_USE_MKL_CBLAS VSMC_HAS_MKL
144 #endif
145 
146 #ifndef VSMC_USE_MKL_VML
147 #define VSMC_USE_MKL_VML VSMC_HAS_MKL
148 #endif
149 
150 #ifndef VSMC_USE_MKL_VSL
151 #define VSMC_USE_MKL_VSL VSMC_HAS_MKL
152 #endif
153 
154 #ifndef VSMC_USE_ACCELERATE
155 #define VSMC_USE_ACCELERATE 0
156 #endif
157 
158 #ifndef VSMC_USE_CBLAS
159 #if VSMC_USE_MKL_CBLAS || VSMC_USE_ACCELERATE
160 #define VSMC_USE_CBLAS 1
161 #else
162 #define VSMC_USE_CBLAS 0
163 #endif
164 #endif
165 
166 #endif // VSMC_INTERNAL_CONFIG_H