Skip to content

Commit da2c8fd

Browse files
authored
Merge pull request #12830 from jsquyres/pr/v5.0.x/update-portable-platform.h
v5.0.x: Update opal_portable_platform_real.h from upstream gasnet
2 parents 49ca7e6 + d5e2855 commit da2c8fd

File tree

4 files changed

+57
-42
lines changed

4 files changed

+57
-42
lines changed

ompi/include/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ include_HEADERS += \
4747
endif
4848

4949
# These files are always installed in $(includedir), but shouldn't be
50-
# shipped since they are generated by configure from their .in
51-
# counterparts (which AM automatically ships).
50+
# shipped since they are generated by configure from .in counterparts
51+
# (which AM automatically ships) or other sources (which are shipped
52+
# by other Makefile.am's).
5253
nodist_include_HEADERS = \
5354
mpi.h \
5455
mpi-ext.h \

ompi/include/mpi.h.in

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,22 +268,15 @@
268268
* hacks to eliminate warnings in the portable_platform.h file.
269269
*/
270270
# ifndef SIZEOF_VOID_P
271-
# define CLEANUP_SIZEOF_VOID_P 1
271+
# define OMPI_CLEANUP_SIZEOF_VOID_P 1
272272
# define SIZEOF_VOID_P OPAL_SIZEOF_VOID_P
273273
# else
274-
# define CLEANUP_SIZEOF_VOID_P 0
275-
# endif
276-
277-
# ifndef _PORTABLE_PLATFORM_H
278-
# define _PORTABLE_PLATFORM_H 0
279-
# endif
280-
# ifndef PLATFORM_HEADER_VERSION
281-
# define PLATFORM_HEADER_VERSION 0
274+
# define OMPI_CLEANUP_SIZEOF_VOID_P 0
282275
# endif
283276

284277
# include "mpi_portable_platform.h"
285278

286-
#if CLEANUP_SIZEOF_VOID_P
279+
#if OMPI_CLEANUP_SIZEOF_VOID_P
287280
#undef SIZEOF_VOID_P
288281
#endif
289282

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
/*
22
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
33
* reserved.
4+
* Copyright (c) 2024 Jeffrey M. Squyres. All rights reserved.
45
* $COPYRIGHT$
56
*
67
* Additional copyrights may follow
78
*
89
* $HEADER$
910
*
1011
* Wrapper around GASNet's gasnet_portable_platform.h to avoid
11-
* compiler warnings
12+
* compiler warnings. This wrapper used to be necessary to add some
13+
* additional #defines, but those issues have now been resolved
14+
* upstream at gasnet. However, we left this wrapper file just to be
15+
* able to handle any future workarounds, if necessary.
1216
*/
1317

1418
#ifndef OPAL_PORTABLE_PLATFORM_H
1519
#define OPAL_PORTABLE_PLATFORM_H 1
1620

17-
#ifndef _PORTABLE_PLATFORM_H
18-
#define _PORTABLE_PLATFORM_H 0
19-
#endif
20-
#ifndef PLATFORM_HEADER_VERSION
21-
#define PLATFORM_HEADER_VERSION 0
22-
#endif
23-
2421
#include "opal/opal_portable_platform_real.h"
2522

2623
#endif

opal/include/opal/opal_portable_platform_real.h

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
*/
2929
/* Publish and enforce version number for the public interface to this header */
3030
/* YOU ARE NOT PERMITTED TO CHANGE THIS SECTION WITHOUT DIRECT APPROVAL FROM DAN BONACHEA */
31-
#if _PORTABLE_PLATFORM_H != PLATFORM_HEADER_VERSION \
32-
|| PLATFORM_HEADER_VERSION < 16
31+
#if !defined(_PORTABLE_PLATFORM_H) || !defined(PLATFORM_HEADER_VERSION) \
32+
|| _PORTABLE_PLATFORM_H != PLATFORM_HEADER_VERSION \
33+
|| PLATFORM_HEADER_VERSION < 22
3334
#undef PLATFORM_HEADER_VERSION
34-
#define PLATFORM_HEADER_VERSION 16
35+
#define PLATFORM_HEADER_VERSION 22
3536
#undef _PORTABLE_PLATFORM_H
3637
#define _PORTABLE_PLATFORM_H PLATFORM_HEADER_VERSION
3738
/* End Header versioning handshake */
@@ -115,14 +116,17 @@
115116
#undef PLATFORM_COMPILER_UNKNOWN
116117

117118
#undef PLATFORM_OS_FAMILYNAME
119+
#undef PLATFORM_OS_SUBFAMILYNAME
118120
#undef PLATFORM_OS_CATAMOUNT
119-
#undef PLATFORM_OS_CNL
120121
#undef PLATFORM_OS_BGP
121122
#undef PLATFORM_OS_BGQ
122-
#undef PLATFORM_OS_WSL
123123
#undef PLATFORM_OS_K42
124124
#undef PLATFORM_OS_UCLINUX
125125
#undef PLATFORM_OS_LINUX
126+
#undef PLATFORM_OS_CNL
127+
#undef PLATFORM_OS_SUBFAMILY_CNL
128+
#undef PLATFORM_OS_WSL
129+
#undef PLATFORM_OS_SUBFAMILY_WSL
126130
#undef PLATFORM_OS_BLRTS
127131
#undef PLATFORM_OS_CYGWIN
128132
#undef PLATFORM_OS_MSWINDOWS
@@ -167,6 +171,7 @@
167171
#undef PLATFORM_ARCH_AARCH64
168172
#undef PLATFORM_ARCH_TILE
169173
#undef PLATFORM_ARCH_S390
174+
#undef PLATFORM_ARCH_RISCV
170175
#undef PLATFORM_ARCH_UNKNOWN
171176

172177
/* prevent known old/broken versions of this header from loading */
@@ -291,7 +296,7 @@
291296
PLATFORM_COMPILER_VERSION_INT(__PATHCC__,__PATHCC_MINOR__,__PATHCC_PATCHLEVEL__+0)
292297
#define PLATFORM_COMPILER_VERSION_STR __PATHSCALE__
293298

294-
#elif defined(__NVCOMPILER) // Must occur prior to PGI and CLANG
299+
#elif defined(__NVCOMPILER) /* Must occur prior to PGI and CLANG */
295300
#define PLATFORM_COMPILER_NVHPC 1
296301
#define PLATFORM_COMPILER_FAMILYNAME NVHPC
297302
#define PLATFORM_COMPILER_FAMILYID 20
@@ -330,7 +335,7 @@
330335
/* Include below might fail for ancient versions lacking this header, but testing shows it
331336
works back to at least 5.1-3 (Nov 2003), and based on docs probably back to 3.2 (Sep 2000) */
332337
#define PLATFORM_COMPILER_VERSION 0
333-
#elif defined(__x86_64__) /* bug 1753 - 64-bit omp.h upgrade happened in <6.0-8,6.1-1] */
338+
#elif defined(__x86_64__) /* bug 1753 - 64-bit omp.h upgrade happenned in <6.0-8,6.1-1] */
334339
#include "omp.h"
335340
#if defined(_PGOMP_H)
336341
/* 6.1.1 or newer */
@@ -341,7 +346,7 @@
341346
#define PLATFORM_COMPILER_VERSION 0
342347
#define PLATFORM_COMPILER_VERSION_STR "<=6.0-8"
343348
#endif
344-
#else /* 32-bit omp.h upgrade happened in <5.2-4,6.0-8] */
349+
#else /* 32-bit omp.h upgrade happenned in <5.2-4,6.0-8] */
345350
#include "omp.h"
346351
#if defined(_PGOMP_H)
347352
/* 6.0-8 or newer */
@@ -590,7 +595,7 @@
590595
#define PLATFORM_COMPILER_VERSION_STR __clang_version__
591596
#endif
592597

593-
// NOTE: PLATFORM_COMPILER_FAMILYID "20" is allocated to NVHPC, appearing earlier
598+
/* NOTE: PLATFORM_COMPILER_FAMILYID "20" is allocted to NVHPC, appearing earlier */
594599

595600
#else /* unknown compiler */
596601
#define PLATFORM_COMPILER_UNKNOWN 1
@@ -750,17 +755,17 @@
750755
PLATFORM_OS_<family>:
751756
defined to a positive value if OS belongs to a given family, undef otherwise
752757
PLATFORM_OS_FAMILYNAME:
753-
unquoted token which provides the compiler family name
758+
unquoted token which provides the OS family name
759+
760+
Some systems also define a subfamily:
761+
PLATFORM_OS_SUBFAMILY_<subfamily>: positive value or undef
762+
PLATFORM_OS_SUBFAMILYNAME: unquoted token for subfamily name or undef
754763
*/
755764

756765
#if defined(__LIBCATAMOUNT__) || defined(__QK_USER__)
757766
#define PLATFORM_OS_CATAMOUNT 1
758767
#define PLATFORM_OS_FAMILYNAME CATAMOUNT
759768

760-
#elif defined(__CRAYXT_COMPUTE_LINUX_TARGET)
761-
#define PLATFORM_OS_CNL 1
762-
#define PLATFORM_OS_FAMILYNAME CNL
763-
764769
#elif defined(GASNETI_ARCH_BGP) || defined(__bgp__)
765770
#define PLATFORM_OS_BGP 1
766771
#define PLATFORM_OS_FAMILYNAME BGP
@@ -769,10 +774,6 @@
769774
#define PLATFORM_OS_BGQ 1
770775
#define PLATFORM_OS_FAMILYNAME BGQ
771776

772-
#elif defined(GASNETI_ARCH_WSL)
773-
#define PLATFORM_OS_WSL 1
774-
#define PLATFORM_OS_FAMILYNAME WSL
775-
776777
#elif defined(__K42)
777778
#define PLATFORM_OS_K42 1
778779
#define PLATFORM_OS_FAMILYNAME K42
@@ -784,6 +785,14 @@
784785
#elif defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
785786
#define PLATFORM_OS_LINUX 1
786787
#define PLATFORM_OS_FAMILYNAME LINUX
788+
#if defined(GASNETI_ARCH_WSL)
789+
#define PLATFORM_OS_SUBFAMILY_WSL 1
790+
#define PLATFORM_OS_SUBFAMILYNAME WSL
791+
#elif defined(__CRAYXT_COMPUTE_LINUX_TARGET)
792+
/* NOTE: As of 2022-07 this is ONLY defined for the Cray cc/CC wrappers, and not the raw PrgEnv compilers */
793+
#define PLATFORM_OS_SUBFAMILY_CNL 1
794+
#define PLATFORM_OS_SUBFAMILYNAME CNL
795+
#endif
787796

788797
#elif defined(__blrts) || defined(__blrts__) || defined(__gnu_blrts__)
789798
#define PLATFORM_OS_BLRTS 1
@@ -1031,6 +1040,16 @@
10311040
#define _PLATFORM_ARCH_32 1
10321041
#endif
10331042

1043+
#elif defined(__riscv)
1044+
#define PLATFORM_ARCH_RISCV 1
1045+
#define PLATFORM_ARCH_FAMILYNAME RISCV
1046+
#define _PLATFORM_ARCH_LITTLE_ENDIAN 1
1047+
#if __riscv_xlen == 32
1048+
#define _PLATFORM_ARCH_32 1
1049+
#else /* (__riscv_xlen == 64) || (__riscv_xlen == 128) */
1050+
#define _PLATFORM_ARCH_64 1
1051+
#endif
1052+
10341053
#else /* unknown CPU */
10351054
#define PLATFORM_ARCH_UNKNOWN 1
10361055
#define PLATFORM_ARCH_FAMILYNAME UNKNOWN
@@ -1128,16 +1147,21 @@ int main(void) {
11281147
PLATFORM_DISPX(COMPILER_VERSION);
11291148
PLATFORM_DISP(COMPILER_VERSION_STR);
11301149
PLATFORM_DISP(COMPILER_IDSTR);
1131-
#if PLATFORM_COMPILER_C_LANGLVL
1150+
#ifdef PLATFORM_COMPILER_C_LANGLVL
11321151
PLATFORM_DISPI(COMPILER_C_LANGLVL);
1133-
#elif PLATFORM_COMPILER_CXX_LANGLVL
1152+
#elif defined(PLATFORM_COMPILER_CXX_LANGLVL)
11341153
PLATFORM_DISPI(COMPILER_CXX_LANGLVL);
11351154
#else
11361155
printf("WARNING: Missing PLATFORM_COMPILER_C(XX)_LANGLVL!");
11371156
#endif
11381157
PLATFORM_DISP(OS_FAMILYNAME);
1158+
#ifdef PLATFORM_OS_SUBFAMILYNAME
1159+
{ const char * OS_SUBFAMILYNAME = PLATFORM_STRINGIFY(PLATFORM_OS_SUBFAMILYNAME);
1160+
PLATFORM_DISP(OS_SUBFAMILYNAME);
1161+
}
1162+
#endif
11391163
PLATFORM_DISP(ARCH_FAMILYNAME);
1140-
#if PLATFORM_ARCH_32
1164+
#ifdef PLATFORM_ARCH_32
11411165
PLATFORM_DISPI(ARCH_32);
11421166
assert(sizeof(void *) == 4);
11431167
#else
@@ -1146,7 +1170,7 @@ int main(void) {
11461170
#endif
11471171
{ int x = 0x00FF;
11481172
unsigned char *p = (unsigned char *)&x;
1149-
#if PLATFORM_ARCH_BIG_ENDIAN
1173+
#ifdef PLATFORM_ARCH_BIG_ENDIAN
11501174
PLATFORM_DISPI(ARCH_BIG_ENDIAN);
11511175
assert(*p == 0);
11521176
#else

0 commit comments

Comments
 (0)