OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

mpi_portable_platform.h
1 /*
2 * Header file with preprocessor magic to figure out, which compiler the user has been calling!
3 *
4 * This code is adapted from the file other/portable_platform.h of GASnet-1.14.0:
5 * - Ripping out the required parts.
6 * - Get rid of brackets as it messes up autoconf
7 * - Delete version tests for older PGI versions (#include "omp.h" not acceptabe)
8 * - Indent ('#' should be in column 0)
9 *
10 * External packages (vt, romio) depend on top_build_dir/ompi/include, therefore
11 * although this is not changed in the configure process, this has to be set as
12 * a .in file...
13 * ---------------------------------------------------------------------------
14 */
15 #ifndef MPI_PORTABLE_PLATFORM_H
16 #define MPI_PORTABLE_PLATFORM_H
17
18 /* All files in this directory and all sub-directories (except where otherwise noted)
19 * are subject to the following licensing terms:
20 *
21 * ---------------------------------------------------------------------------
22 * "Copyright (c) 2000-2003 The Regents of the University of California.
23 * All rights reserved.
24 *
25 * Permission to use, copy, modify, and distribute this software and its
26 * documentation for any purpose, without fee, and without written agreement is
27 * hereby granted, provided that the above copyright notice and the following
28 * two paragraphs appear in all copies of this software.
29 *
30 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
31 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
32 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
33 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
36 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
37 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
38 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
39 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
40 * ---------------------------------------------------------------------------
41 *
42 * Please see the license.txt files within the gm-conduit, lapi-conduit and
43 * vapi-conduit directories for the licensing terms governing those
44 * contributed components.
45 *
46 * The authors/contributors of GASNet include:
47 *
48 * Dan Bonachea <bonachea@cs.berkeley.edu>:
49 * General infrastructure & documentation
50 * mpi-conduit
51 * elan-conduit
52 * smp-conduit
53 * udp-conduit
54 * extended-ref
55 * template-conduit
56 * Christian Bell <csbell@cs.berkeley.edu>: gm-conduit, shmem-conduit
57 * Mike Welcome <mlwelcome@lbl.gov>: lapi-conduit, portals-conduit
58 * Paul H. Hargrove <phhargrove@lbl.gov>: vapi-conduit, ibv-conduit
59 * Rajesh Nishtala <rajeshn@cs.berkeley.edu>: collectives, dcmf-conduit
60 * Parry Husbands (PJRHusbands@lbl.gov): lapi-conduit
61 *
62 * For more information about GASNet, visit our home page at:
63 * http://gasnet.cs.berkeley.edu/
64 * Or send email to:
65 * <upc@lbl.gov>
66 *
67 * Source code contributions (fixes, patches, extensions etc.) should be
68 * sent to <upc@lbl.gov> to be reviewed for acceptance into the primary
69 * distribution. Contributions are most likely to be accepted if they
70 * are provided as public domain, or under a BSD-style license such as
71 * the one above.
72 *
73 */
74 #ifndef _STRINGIFY
75 #define _STRINGIFY_HELPER(x) #x
76 #define _STRINGIFY(x) _STRINGIFY_HELPER(x)
77 #endif
78
79 #if defined(__INTEL_COMPILER)
80 # define PLATFORM_COMPILER_FAMILYNAME INTEL
81 # define PLATFORM_COMPILER_FAMILYID 2
82 # ifdef __cplusplus
83 # define PLATFORM_COMPILER_INTEL_CXX 1
84 # else
85 # define PLATFORM_COMPILER_INTEL_C 1
86 # endif
87 # define _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE 19700000 /* year 1970: predates most intel products :) */
88 # ifdef __INTEL_COMPILER_BUILD_DATE
89 # define _PLATFORM_INTEL_COMPILER_BUILD_DATE __INTEL_COMPILER_BUILD_DATE
90 # else
91 # define _PLATFORM_INTEL_COMPILER_BUILD_DATE _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE
92 # endif
93 /* patch number is a decimal build date: YYYYMMDD */
94 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
95 (((((maj) * 10) | (min)) << 20) | \
96 ((pat) < _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE ? \
97 _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE : ((pat)-_PLATFORM_COMPILER_INTEL_MIN_BUILDDATE)))
98 # define PLATFORM_COMPILER_VERSION \
99 PLATFORM_COMPILER_VERSION_INT(__INTEL_COMPILER/10, __INTEL_COMPILER/100, _PLATFORM_INTEL_COMPILER_BUILD_DATE)
100 # define PLATFORM_COMPILER_VERSION_STR \
101 _STRINGIFY(__INTEL_COMPILER)"."_STRINGIFY(_PLATFORM_INTEL_COMPILER_BUILD_DATE)
102
103 #elif defined(__PATHSCALE__)
104 # define PLATFORM_COMPILER_PATHSCALE 1
105 # define PLATFORM_COMPILER_FAMILYNAME PATHSCALE
106 # define PLATFORM_COMPILER_FAMILYID 3
107 # ifdef __cplusplus
108 # define PLATFORM_COMPILER_PATHSCALE_CXX 1
109 # else
110 # define PLATFORM_COMPILER_PATHSCALE_C 1
111 # endif
112 # define PLATFORM_COMPILER_VERSION \
113 PLATFORM_COMPILER_VERSION_INT(__PATHCC__,__PATHCC_MINOR__,__PATHCC_PATCHLEVEL__)
114 # define PLATFORM_COMPILER_VERSION_STR __PATHSCALE__
115
116 #elif defined(__PGI)
117 # define PLATFORM_COMPILER_PGI 1
118 # define PLATFORM_COMPILER_FAMILYNAME PGI
119 # define PLATFORM_COMPILER_FAMILYID 4
120 # ifdef __cplusplus
121 # define PLATFORM_COMPILER_PGI_CXX 1
122 # else
123 # define PLATFORM_COMPILER_PGI_C 1
124 # endif
125 # if __PGIC__ == 99
126 /* bug 2230: PGI versioning was broken for some platforms in 7.0
127 no way to know exact version, but provide something slightly more accurate */
128 # define PLATFORM_COMPILER_VERSION 0x070000
129 # define PLATFORM_COMPILER_VERSION_STR "7.?-?"
130 # elif defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
131 # define PLATFORM_COMPILER_VERSION \
132 PLATFORM_COMPILER_VERSION_INT(__PGIC__,__PGIC_MINOR__,__PGIC_PATCHLEVEL__)
133 # define PLATFORM_COMPILER_VERSION_STR \
134 _STRINGIFY(__PGIC__)"."_STRINGIFY(__PGIC_MINOR__)"-"_STRINGIFY(__PGIC_PATCHLEVEL__)
135 # else
136 /* PGI before 6.1-4 lacks any version ID preprocessor macros - so use this filthy hack */
137 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
138 * We cannot do these within mpi.h.in, as we should not include ompi.h
139 * Hopefully, compilers with integrated preprocessors will not analyse code within the #if 0-block
140 * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
141 */
142 #if 0
143 # ifdef PLATFORM_PGI_IS_ANCIENT
144 /* Include below might fail for ancient versions lacking this header, but testing shows it
145 works back to at least 5.1-3 (Nov 2003), and based on docs probably back to 3.2 (Sep 2000) */
146 # define PLATFORM_COMPILER_VERSION 0
147 # elif defined(__x86_64__) /* bug 1753 - 64-bit omp.h upgrade happenned in <6.0-8,6.1-1) */
148 # include "omp.h"
149 # if defined(_PGOMP_H)
150 /* 6.1.1 or newer */
151 # define PLATFORM_COMPILER_VERSION 0x060101
152 # define PLATFORM_COMPILER_VERSION_STR ">=6.1-1"
153 # else
154 /* 6.0.8 or older */
155 # define PLATFORM_COMPILER_VERSION 0
156 # define PLATFORM_COMPILER_VERSION_STR "<=6.0-8"
157 # endif
158 # else /* 32-bit omp.h upgrade happenned in <5.2-4,6.0-8 */
159 # include "omp.h"
160 # if defined(_PGOMP_H)
161 /* 6.0-8 or newer */
162 # define PLATFORM_COMPILER_VERSION 0x060008
163 # define PLATFORM_COMPILER_VERSION_STR ">=6.0-8"
164 # else
165 /* 5.2-4 or older */
166 # define PLATFORM_COMPILER_VERSION 0
167 # define PLATFORM_COMPILER_VERSION_STR "<=5.2-4"
168 # endif
169 # endif
170 #endif /* 0 */
171 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
172 # endif
173
174 #elif defined(__xlC__)
175 # define PLATFORM_COMPILER_XLC 1
176 # define PLATFORM_COMPILER_FAMILYNAME XLC
177 # define PLATFORM_COMPILER_FAMILYID 5
178 # ifdef __cplusplus
179 # define PLATFORM_COMPILER_XLC_CXX 1
180 # else
181 # define PLATFORM_COMPILER_XLC_C 1
182 # endif
183 # define PLATFORM_COMPILER_VERSION __xlC__
184 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
185 ( ((maj) << 8) | ((min) << 4) | (pat) )
186
187 #elif defined(__DECC) || defined(__DECCXX)
188 # define PLATFORM_COMPILER_COMPAQ 1
189 # define PLATFORM_COMPILER_FAMILYNAME COMPAQ
190 # define PLATFORM_COMPILER_FAMILYID 6
191 # ifdef __cplusplus
192 # define PLATFORM_COMPILER_COMPAQ_CXX 1
193 # else
194 # define PLATFORM_COMPILER_COMPAQ_C 1
195 # endif
196 # if defined(__DECC_VER)
197 # define PLATFORM_COMPILER_VERSION __DECC_VER
198 # elif defined(__DECCXX_VER)
199 # define PLATFORM_COMPILER_VERSION __DECCXX_VER
200 # endif
201
202 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
203 ( ((maj) * 10000000) + ((min) * 100000) + (90000) + (pat) )
204 /* 90000 = official ver, 80000 = customer special ver, 60000 = field test ver */
205
206 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
207 # define PLATFORM_COMPILER_SUN 1
208 # define PLATFORM_COMPILER_FAMILYNAME SUN
209 # define PLATFORM_COMPILER_FAMILYID 7
210 # ifdef __cplusplus
211 # define PLATFORM_COMPILER_SUN_CXX 1
212 # else
213 # define PLATFORM_COMPILER_SUN_C 1
214 # endif
215 # if defined(__SUNPRO_C) && __SUNPRO_C > 0
216 # define PLATFORM_COMPILER_VERSION __SUNPRO_C
217 # elif defined(__SUNPRO_CC) && __SUNPRO_CC > 0
218 # define PLATFORM_COMPILER_VERSION __SUNPRO_CC
219 # endif
220 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
221 ( ((maj) << 8) | ((min) << 4) | (pat) )
222
223 #elif defined(__HP_cc) || defined(__HP_aCC)
224 # define PLATFORM_COMPILER_HP 1
225 # define PLATFORM_COMPILER_FAMILYNAME HP
226 # define PLATFORM_COMPILER_FAMILYID 8
227 # ifdef __cplusplus
228 # define PLATFORM_COMPILER_HP_CXX 1
229 # else
230 # define PLATFORM_COMPILER_HP_C 1
231 # endif
232 # if defined(__HP_cc) && __HP_cc > 0
233 # define PLATFORM_COMPILER_VERSION __HP_cc
234 # elif defined(__HP_aCC) && __HP_aCC > 0
235 # define PLATFORM_COMPILER_VERSION __HP_aCC
236 # endif
237 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
238 ( ((maj) << 16) | ((min) << 8) | (pat) )
239
240 #elif defined(_SGI_COMPILER_VERSION) || \
241 (defined(_COMPILER_VERSION) && defined(__sgi) && !defined(__GNUC__)) /* 7.3.0 and earlier lack _SGI_COMPILER_VERSION */
242 # define PLATFORM_COMPILER_SGI 1
243 # define PLATFORM_COMPILER_FAMILYNAME SGI
244 # define PLATFORM_COMPILER_FAMILYID 9
245 # ifdef __cplusplus
246 # define PLATFORM_COMPILER_SGI_CXX 1
247 # else
248 # define PLATFORM_COMPILER_SGI_C 1
249 # endif
250 # if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION > 0
251 # define PLATFORM_COMPILER_VERSION _SGI_COMPILER_VERSION
252 # elif defined(_COMPILER_VERSION) && _COMPILER_VERSION > 0
253 # define PLATFORM_COMPILER_VERSION _COMPILER_VERSION
254 # endif
255 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
256 ( ((maj) << 8) | ((min) << 4) | (pat) )
257
258 #elif defined(_CRAYC)
259 # define PLATFORM_COMPILER_CRAY 1
260 # define PLATFORM_COMPILER_FAMILYNAME CRAY
261 # define PLATFORM_COMPILER_FAMILYID 10
262 # ifdef __cplusplus
263 # define PLATFORM_COMPILER_CRAY_CXX 1
264 # else
265 # define PLATFORM_COMPILER_CRAY_C 1
266 # endif
267 # if defined(_RELEASE) && defined(_RELEASE_MINOR) /* X1 and XT */
268 # define PLATFORM_COMPILER_VERSION \
269 PLATFORM_COMPILER_VERSION_INT(_RELEASE,_RELEASE_MINOR,0)
270 # elif defined(_RELEASE) /* T3E */
271 # define PLATFORM_COMPILER_VERSION \
272 PLATFORM_COMPILER_VERSION_INT(_RELEASE,0,0)
273 # endif
274 # ifdef _RELEASE_STRING /* X1 and XT */
275 # define PLATFORM_COMPILER_VERSION_STR _RELEASE_STRING
276 # endif
277
278 #elif defined(__KCC)
279 # define PLATFORM_COMPILER_KAI 1
280 # define PLATFORM_COMPILER_FAMILYNAME KAI
281 # define PLATFORM_COMPILER_FAMILYID 11
282 # ifdef __cplusplus
283 # define PLATFORM_COMPILER_KAI_CXX 1
284 # else
285 # define PLATFORM_COMPILER_KAI_C 1
286 # endif
287
288 #elif defined(__MTA__)
289 # define PLATFORM_COMPILER_MTA 1
290 # define PLATFORM_COMPILER_FAMILYNAME MTA
291 # define PLATFORM_COMPILER_FAMILYID 12
292 # ifdef __cplusplus
293 # define PLATFORM_COMPILER_MTA_CXX 1
294 # else
295 # define PLATFORM_COMPILER_MTA_C 1
296 # endif
297
298 #elif defined(_SX)
299 # define PLATFORM_COMPILER_NECSX 1
300 # define PLATFORM_COMPILER_FAMILYNAME NECSX
301 # define PLATFORM_COMPILER_FAMILYID 13
302 # ifdef __cplusplus
303 # define PLATFORM_COMPILER_NECSX_CXX 1
304 # else
305 # define PLATFORM_COMPILER_NECSX_C 1
306 # endif
307
308 #elif defined(_MSC_VER)
309 # define PLATFORM_COMPILER_MICROSOFT 1
310 # define PLATFORM_COMPILER_FAMILYNAME MICROSOFT
311 # define PLATFORM_COMPILER_FAMILYID 14
312 # ifdef __cplusplus
313 # define PLATFORM_COMPILER_MICROSOFT_CXX 1
314 # else
315 # define PLATFORM_COMPILER_MICROSOFT_C 1
316 # endif
317 # define PLATFORM_COMPILER_VERSION _MSC_VER
318
319 #elif defined(__TINYC__)
320 # define PLATFORM_COMPILER_TINY 1
321 # define PLATFORM_COMPILER_FAMILYNAME TINY
322 # define PLATFORM_COMPILER_FAMILYID 15
323 # ifdef __cplusplus
324 # define PLATFORM_COMPILER_TINY_CXX 1
325 # else
326 # define PLATFORM_COMPILER_TINY_C 1
327 # endif
328
329 #elif defined(__LCC__)
330 # define PLATFORM_COMPILER_LCC 1
331 # define PLATFORM_COMPILER_FAMILYNAME LCC
332 # define PLATFORM_COMPILER_FAMILYID 16
333 # ifdef __cplusplus
334 # define PLATFORM_COMPILER_LCC_CXX 1
335 # else
336 # define PLATFORM_COMPILER_LCC_C 1
337 # endif
338
339 #else /* unknown compiler */
340 # define PLATFORM_COMPILER_UNKNOWN 1
341 #endif
342
343 /* this stanza comes last, because many vendor compilers lie and claim
344 to be GNU C for compatibility reasons and/or because they share a frontend */
345 #if defined(__GNUC__)
346 # undef PLATFORM_COMPILER_UNKNOWN
347 # ifndef PLATFORM_COMPILER_FAMILYID
348 # define PLATFORM_COMPILER_GNU 1
349 # define PLATFORM_COMPILER_FAMILYNAME GNU
350 # define PLATFORM_COMPILER_FAMILYID 1
351 # ifdef __cplusplus
352 # define PLATFORM_COMPILER_GNU_CXX 1
353 # else
354 # define PLATFORM_COMPILER_GNU_C 1
355 # endif
356 # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
357 # define PLATFORM_COMPILER_VERSION \
358 PLATFORM_COMPILER_VERSION_INT(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
359 # elif defined(__GNUC_MINOR__) /* older versions of egcs lack __GNUC_PATCHLEVEL__ */
360 # define PLATFORM_COMPILER_VERSION \
361 PLATFORM_COMPILER_VERSION_INT(__GNUC__,__GNUC_MINOR__,0)
362 # else
363 # define PLATFORM_COMPILER_VERSION \
364 PLATFORM_COMPILER_VERSION_INT(__GNUC__,0,0)
365 # endif
366 # define PLATFORM_COMPILER_VERSION_STR __PLATFORM_COMPILER_GNU_VERSION_STR
367 # else
368 # define _PLATFORM_COMPILER_GNU_VERSION_STR __PLATFORM_COMPILER_GNU_VERSION_STR
369 # endif
370 /* gather any advertised GNU version number info, even for non-gcc compilers */
371 # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
372 # define __PLATFORM_COMPILER_GNU_VERSION_STR \
373 _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)"."_STRINGIFY(__GNUC_PATCHLEVEL__)
374 # elif defined(__GNUC_MINOR__)
375 # define __PLATFORM_COMPILER_GNU_VERSION_STR \
376 _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)".?"
377 # else
378 # define __PLATFORM_COMPILER_GNU_VERSION_STR \
379 _STRINGIFY(__GNUC__)".?.?"
380 # endif
381 #elif defined(PLATFORM_COMPILER_UNKNOWN) /* unknown compiler */
382 # define PLATFORM_COMPILER_FAMILYNAME UNKNOWN
383 # define PLATFORM_COMPILER_FAMILYID 0
384 #endif
385
386 /* Default Values */
387 #ifndef PLATFORM_COMPILER_VERSION
388 # define PLATFORM_COMPILER_VERSION 0 /* don't know */
389 #endif
390
391 #ifndef PLATFORM_COMPILER_VERSION_STR
392 # define PLATFORM_COMPILER_VERSION_STR _STRINGIFY(PLATFORM_COMPILER_VERSION)
393 #endif
394
395 #ifndef PLATFORM_COMPILER_VERSION_INT
396 # define PLATFORM_COMPILER_VERSION_INT(maj,min,pat) \
397 (((maj) << 16) | ((min) << 8) | (pat))
398 #endif
399
400
401 #endif /* MPI_PORTABLE_PLATFORM_H */