Intel® OpenMP* Runtime Library
Main Page
Modules
Classes
All
Classes
Functions
Variables
Typedefs
Enumerations
Enumerator
Modules
Pages
src
kmp_platform.h
1
/*
2
* kmp_platform.h -- header for determining operating system and architecture
3
*/
4
5
/* <copyright>
6
Copyright (c) 1997-2015 Intel Corporation. All Rights Reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions
10
are met:
11
12
* Redistributions of source code must retain the above copyright
13
notice, this list of conditions and the following disclaimer.
14
* Redistributions in binary form must reproduce the above copyright
15
notice, this list of conditions and the following disclaimer in the
16
documentation and/or other materials provided with the distribution.
17
* Neither the name of Intel Corporation nor the names of its
18
contributors may be used to endorse or promote products derived
19
from this software without specific prior written permission.
20
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
</copyright> */
34
35
#ifndef KMP_PLATFORM_H
36
#define KMP_PLATFORM_H
37
38
/* ---------------------- Operating system recognition ------------------- */
39
40
#define KMP_OS_LINUX 0
41
#define KMP_OS_FREEBSD 0
42
#define KMP_OS_DARWIN 0
43
#define KMP_OS_WINDOWS 0
44
#define KMP_OS_CNK 0
45
#define KMP_OS_UNIX 0
/* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
46
47
48
#ifdef _WIN32
49
# undef KMP_OS_WINDOWS
50
# define KMP_OS_WINDOWS 1
51
#endif
52
53
#if ( defined __APPLE__ && defined __MACH__ )
54
# undef KMP_OS_DARWIN
55
# define KMP_OS_DARWIN 1
56
#endif
57
58
// in some ppc64 linux installations, only the second condition is met
59
#if ( defined __linux )
60
# undef KMP_OS_LINUX
61
# define KMP_OS_LINUX 1
62
#elif ( defined __linux__)
63
# undef KMP_OS_LINUX
64
# define KMP_OS_LINUX 1
65
#else
66
#endif
67
68
#if ( defined __FreeBSD__ )
69
# undef KMP_OS_FREEBSD
70
# define KMP_OS_FREEBSD 1
71
#endif
72
73
#if ( defined __bgq__ )
74
# undef KMP_OS_CNK
75
# define KMP_OS_CNK 1
76
#endif
77
78
#if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
79
# error Unknown OS
80
#endif
81
82
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_DARWIN
83
# undef KMP_OS_UNIX
84
# define KMP_OS_UNIX 1
85
#endif
86
87
/* ---------------------- Architecture recognition ------------------- */
88
89
#define KMP_ARCH_X86 0
90
#define KMP_ARCH_X86_64 0
91
#define KMP_ARCH_AARCH64 0
92
#define KMP_ARCH_PPC64_BE 0
93
#define KMP_ARCH_PPC64_LE 0
94
#define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)
95
96
#if KMP_OS_WINDOWS
97
# if defined _M_AMD64
98
# undef KMP_ARCH_X86_64
99
# define KMP_ARCH_X86_64 1
100
# else
101
# undef KMP_ARCH_X86
102
# define KMP_ARCH_X86 1
103
# endif
104
#endif
105
106
#if KMP_OS_UNIX
107
# if defined __x86_64
108
# undef KMP_ARCH_X86_64
109
# define KMP_ARCH_X86_64 1
110
# elif defined __i386
111
# undef KMP_ARCH_X86
112
# define KMP_ARCH_X86 1
113
# elif defined __powerpc64__
114
# if defined __LITTLE_ENDIAN__
115
# undef KMP_ARCH_PPC64_LE
116
# define KMP_ARCH_PPC64_LE 1
117
# else
118
# undef KMP_ARCH_PPC64_BE
119
# define KMP_ARCH_PPC64_BE 1
120
# endif
121
# elif defined __aarch64__
122
# undef KMP_ARCH_AARCH64
123
# define KMP_ARCH_AARCH64 1
124
# endif
125
#endif
126
127
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \
128
defined(__ARM_ARCH_7A__)
129
# define KMP_ARCH_ARMV7 1
130
#endif
131
132
#if defined(KMP_ARCH_ARMV7) || defined(__ARM_ARCH_6__) || \
133
defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \
134
defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6T2__) || \
135
defined(__ARM_ARCH_6ZK__)
136
# define KMP_ARCH_ARMV6 1
137
#endif
138
139
#if defined(KMP_ARCH_ARMV6) || defined(__ARM_ARCH_5T__) || \
140
defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
141
defined(__ARM_ARCH_5TEJ__)
142
# define KMP_ARCH_ARMV5 1
143
#endif
144
145
#if defined(KMP_ARCH_ARMV5) || defined(__ARM_ARCH_4__) || \
146
defined(__ARM_ARCH_4T__)
147
# define KMP_ARCH_ARMV4 1
148
#endif
149
150
#if defined(KMP_ARCH_ARMV4) || defined(__ARM_ARCH_3__) || \
151
defined(__ARM_ARCH_3M__)
152
# define KMP_ARCH_ARMV3 1
153
#endif
154
155
#if defined(KMP_ARCH_ARMV3) || defined(__ARM_ARCH_2__)
156
# define KMP_ARCH_ARMV2 1
157
#endif
158
159
#if defined(KMP_ARCH_ARMV2)
160
# define KMP_ARCH_ARM 1
161
#endif
162
163
// Intel(R) Many Integrated Core Architecture detection
164
#if defined(__MIC__) || defined(__MIC2__)
165
# define KMP_MIC 1
166
// Intel(R) Composer XE (13.0) defines both __MIC__ and __MIC2__ !
167
# if __MIC2__ || __KNC__
168
# define KMP_MIC1 0
169
# define KMP_MIC2 1
170
# else
171
# define KMP_MIC1 1
172
# define KMP_MIC2 0
173
# endif
174
#else
175
# define KMP_MIC 0
176
# define KMP_MIC1 0
177
# define KMP_MIC2 0
178
#endif
179
180
// TODO: Fixme - This is clever, but really fugly
181
#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + KMP_ARCH_AARCH64)
182
# error Unknown or unsupported architecture
183
#endif
184
185
#endif // KMP_PLATFORM_H
Generated by
1.8.8