|
16 | 16 |
|
17 | 17 | // Check the user-defined macro for parallel policies
|
18 | 18 | #if defined(PSTL_USE_PARALLEL_POLICIES)
|
19 |
| -#undef __PSTL_USE_PAR_POLICIES |
20 |
| -#define __PSTL_USE_PAR_POLICIES PSTL_USE_PARALLEL_POLICIES |
| 19 | +# undef __PSTL_USE_PAR_POLICIES |
| 20 | +# define __PSTL_USE_PAR_POLICIES PSTL_USE_PARALLEL_POLICIES |
21 | 21 | // Check the internal macro for parallel policies
|
22 | 22 | #elif !defined(__PSTL_USE_PAR_POLICIES)
|
23 |
| -#define __PSTL_USE_PAR_POLICIES 1 |
| 23 | +# define __PSTL_USE_PAR_POLICIES 1 |
24 | 24 | #endif
|
25 | 25 |
|
26 | 26 | #if __PSTL_USE_PAR_POLICIES
|
27 |
| -#if !defined(__PSTL_PAR_BACKEND_TBB) |
28 |
| -#define __PSTL_PAR_BACKEND_TBB 1 |
29 |
| -#endif |
| 27 | +# if !defined(__PSTL_PAR_BACKEND_TBB) |
| 28 | +# define __PSTL_PAR_BACKEND_TBB 1 |
| 29 | +# endif |
30 | 30 | #else
|
31 |
| -#undef __PSTL_PAR_BACKEND_TBB |
| 31 | +# undef __PSTL_PAR_BACKEND_TBB |
32 | 32 | #endif
|
33 | 33 |
|
34 | 34 | // Check the user-defined macro for warnings
|
35 | 35 | #if defined(PSTL_USAGE_WARNINGS)
|
36 |
| -#undef __PSTL_USAGE_WARNINGS |
37 |
| -#define __PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS |
| 36 | +# undef __PSTL_USAGE_WARNINGS |
| 37 | +# define __PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS |
38 | 38 | // Check the internal macro for warnings
|
39 | 39 | #elif !defined(__PSTL_USAGE_WARNINGS)
|
40 |
| -#define __PSTL_USAGE_WARNINGS 0 |
| 40 | +# define __PSTL_USAGE_WARNINGS 0 |
41 | 41 | #endif
|
42 | 42 |
|
43 | 43 | // Portability "#pragma" definition
|
44 | 44 | #ifdef _MSC_VER
|
45 |
| -#define __PSTL_PRAGMA(x) __pragma(x) |
| 45 | +# define __PSTL_PRAGMA(x) __pragma(x) |
46 | 46 | #else
|
47 |
| -#define __PSTL_PRAGMA(x) _Pragma(#x) |
| 47 | +# define __PSTL_PRAGMA(x) _Pragma(# x) |
48 | 48 | #endif
|
49 | 49 |
|
50 | 50 | #define __PSTL_STRING_AUX(x) #x
|
|
57 | 57 |
|
58 | 58 | #if __clang__
|
59 | 59 | // according to clang documentation, version can be vendor specific
|
60 |
| -#define __PSTL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) |
| 60 | +# define __PSTL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) |
61 | 61 | #endif
|
62 | 62 |
|
63 | 63 | // Enable SIMD for compilers that support OpenMP 4.0
|
64 | 64 | #if (_OPENMP >= 201307) || (__INTEL_COMPILER >= 1600) || (!defined(__INTEL_COMPILER) && __PSTL_GCC_VERSION >= 40900)
|
65 |
| -#define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(omp simd) |
66 |
| -#define __PSTL_PRAGMA_DECLARE_SIMD __PSTL_PRAGMA(omp declare simd) |
67 |
| -#define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(omp simd reduction(PRM)) |
| 65 | +# define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(omp simd) |
| 66 | +# define __PSTL_PRAGMA_DECLARE_SIMD __PSTL_PRAGMA(omp declare simd) |
| 67 | +# define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(omp simd reduction(PRM)) |
68 | 68 | #elif !defined(_MSC_VER) //#pragma simd
|
69 |
| -#define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(simd) |
70 |
| -#define __PSTL_PRAGMA_DECLARE_SIMD |
71 |
| -#define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(simd reduction(PRM)) |
| 69 | +# define __PSTL_PRAGMA_SIMD __PSTL_PRAGMA(simd) |
| 70 | +# define __PSTL_PRAGMA_DECLARE_SIMD |
| 71 | +# define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) __PSTL_PRAGMA(simd reduction(PRM)) |
72 | 72 | #else //no simd
|
73 |
| -#define __PSTL_PRAGMA_SIMD |
74 |
| -#define __PSTL_PRAGMA_DECLARE_SIMD |
75 |
| -#define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) |
| 73 | +# define __PSTL_PRAGMA_SIMD |
| 74 | +# define __PSTL_PRAGMA_DECLARE_SIMD |
| 75 | +# define __PSTL_PRAGMA_SIMD_REDUCTION(PRM) |
76 | 76 | #endif //Enable SIMD
|
77 | 77 |
|
78 | 78 | #if (__INTEL_COMPILER)
|
79 |
| -#define __PSTL_PRAGMA_FORCEINLINE __PSTL_PRAGMA(forceinline) |
| 79 | +# define __PSTL_PRAGMA_FORCEINLINE __PSTL_PRAGMA(forceinline) |
80 | 80 | #else
|
81 |
| -#define __PSTL_PRAGMA_FORCEINLINE |
| 81 | +# define __PSTL_PRAGMA_FORCEINLINE |
82 | 82 | #endif
|
83 | 83 |
|
84 | 84 | #if (__INTEL_COMPILER >= 1900)
|
85 |
| -#define __PSTL_PRAGMA_SIMD_SCAN(PRM) __PSTL_PRAGMA(omp simd reduction(inscan, PRM)) |
86 |
| -#define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan inclusive(PRM)) |
87 |
| -#define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan exclusive(PRM)) |
| 85 | +# define __PSTL_PRAGMA_SIMD_SCAN(PRM) __PSTL_PRAGMA(omp simd reduction(inscan, PRM)) |
| 86 | +# define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan inclusive(PRM)) |
| 87 | +# define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) __PSTL_PRAGMA(omp scan exclusive(PRM)) |
88 | 88 | #else
|
89 |
| -#define __PSTL_PRAGMA_SIMD_SCAN(PRM) |
90 |
| -#define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) |
91 |
| -#define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) |
| 89 | +# define __PSTL_PRAGMA_SIMD_SCAN(PRM) |
| 90 | +# define __PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) |
| 91 | +# define __PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) |
92 | 92 | #endif
|
93 | 93 |
|
94 | 94 | // Should be defined to 1 for environments with a vendor implementation of C++17 execution policies
|
|
106 | 106 | #define __PSTL_MONOTONIC_PRESENT (__INTEL_COMPILER >= 1800)
|
107 | 107 |
|
108 | 108 | #if (__INTEL_COMPILER >= 1900 || !defined(__INTEL_COMPILER) && __PSTL_GCC_VERSION >= 40900 || _OPENMP >= 201307)
|
109 |
| -#define __PSTL_UDR_PRESENT 1 |
| 109 | +# define __PSTL_UDR_PRESENT 1 |
110 | 110 | #else
|
111 |
| -#define __PSTL_UDR_PRESENT 0 |
| 111 | +# define __PSTL_UDR_PRESENT 0 |
112 | 112 | #endif
|
113 | 113 |
|
114 | 114 | #define __PSTL_UDS_PRESENT (__INTEL_COMPILER >= 1900 && __INTEL_COMPILER_BUILD_DATE >= 20180626)
|
115 | 115 |
|
116 | 116 | #if __PSTL_EARLYEXIT_PRESENT
|
117 |
| -#define __PSTL_PRAGMA_SIMD_EARLYEXIT __PSTL_PRAGMA(omp simd early_exit) |
| 117 | +# define __PSTL_PRAGMA_SIMD_EARLYEXIT __PSTL_PRAGMA(omp simd early_exit) |
118 | 118 | #else
|
119 |
| -#define __PSTL_PRAGMA_SIMD_EARLYEXIT |
| 119 | +# define __PSTL_PRAGMA_SIMD_EARLYEXIT |
120 | 120 | #endif
|
121 | 121 |
|
122 | 122 | #if __PSTL_MONOTONIC_PRESENT
|
123 |
| -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) __PSTL_PRAGMA(omp ordered simd monotonic(PRM)) |
124 |
| -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) __PSTL_PRAGMA(omp ordered simd monotonic(PRM1, PRM2)) |
| 123 | +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) __PSTL_PRAGMA(omp ordered simd monotonic(PRM)) |
| 124 | +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) __PSTL_PRAGMA(omp ordered simd monotonic(PRM1, PRM2)) |
125 | 125 | #else
|
126 |
| -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) |
127 |
| -#define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) |
| 126 | +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) |
| 127 | +# define __PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) |
128 | 128 | #endif
|
129 | 129 |
|
130 | 130 | // Declaration of reduction functor, where
|
|
135 | 135 | // omp_priv - refers to the private copy of the initial value
|
136 | 136 | // omp_orig - refers to the original variable to be reduced
|
137 | 137 | #define __PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
|
138 |
| - __PSTL_PRAGMA(omp declare reduction(NAME : OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) |
| 138 | + __PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) |
139 | 139 |
|
140 | 140 | #if (__INTEL_COMPILER >= 1600)
|
141 |
| -#define __PSTL_PRAGMA_VECTOR_UNALIGNED __PSTL_PRAGMA(vector unaligned) |
| 141 | +# define __PSTL_PRAGMA_VECTOR_UNALIGNED __PSTL_PRAGMA(vector unaligned) |
142 | 142 | #else
|
143 |
| -#define __PSTL_PRAGMA_VECTOR_UNALIGNED |
| 143 | +# define __PSTL_PRAGMA_VECTOR_UNALIGNED |
144 | 144 | #endif
|
145 | 145 |
|
146 | 146 | // Check the user-defined macro to use non-temporal stores
|
147 | 147 | #if defined(PSTL_USE_NONTEMPORAL_STORES) && (__INTEL_COMPILER >= 1600)
|
148 |
| -#define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA(vector nontemporal) |
| 148 | +# define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED __PSTL_PRAGMA(vector nontemporal) |
149 | 149 | #else
|
150 |
| -#define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED |
| 150 | +# define __PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED |
151 | 151 | #endif
|
152 | 152 |
|
153 | 153 | #if _MSC_VER || __INTEL_COMPILER //the preprocessors don't type a message location
|
154 |
| -#define __PSTL_PRAGMA_LOCATION __FILE__ ":" __PSTL_STRING(__LINE__) ": [Parallel STL message]: " |
| 154 | +# define __PSTL_PRAGMA_LOCATION __FILE__ ":" __PSTL_STRING(__LINE__) ": [Parallel STL message]: " |
155 | 155 | #else
|
156 |
| -#define __PSTL_PRAGMA_LOCATION " [Parallel STL message]: " |
| 156 | +# define __PSTL_PRAGMA_LOCATION " [Parallel STL message]: " |
157 | 157 | #endif
|
158 | 158 |
|
159 | 159 | #define __PSTL_PRAGMA_MESSAGE_IMPL(x) __PSTL_PRAGMA(message(__PSTL_STRING_CONCAT(__PSTL_PRAGMA_LOCATION, x)))
|
160 | 160 |
|
161 | 161 | #if __PSTL_USAGE_WARNINGS
|
162 |
| -#define __PSTL_PRAGMA_MESSAGE(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) |
163 |
| -#define __PSTL_PRAGMA_MESSAGE_POLICIES(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) |
| 162 | +# define __PSTL_PRAGMA_MESSAGE(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) |
| 163 | +# define __PSTL_PRAGMA_MESSAGE_POLICIES(x) __PSTL_PRAGMA_MESSAGE_IMPL(x) |
164 | 164 | #else
|
165 |
| -#define __PSTL_PRAGMA_MESSAGE(x) |
166 |
| -#define __PSTL_PRAGMA_MESSAGE_POLICIES(x) |
| 165 | +# define __PSTL_PRAGMA_MESSAGE(x) |
| 166 | +# define __PSTL_PRAGMA_MESSAGE_POLICIES(x) |
167 | 167 | #endif
|
168 | 168 |
|
169 | 169 | // broken macros
|
|
0 commit comments