From d652933fe7b03aee2d3e6a6ad0b4ad0ba16ef8b8 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 30 Sep 2024 16:55:04 -0600 Subject: [PATCH] Update prte_portable_platform_real.h from upstream gasnet See open-mpi/ompi#12829 for an explanation Signed-off-by: Ralph Castain (cherry picked from commit bff20a87f64757337fec78639c049a4783158dee) --- src/include/prte_portable_platform.h | 9 +-- src/include/prte_portable_platform_real.h | 72 +++++++++++++++-------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/include/prte_portable_platform.h b/src/include/prte_portable_platform.h index babd7b518c..52e8c0aaac 100644 --- a/src/include/prte_portable_platform.h +++ b/src/include/prte_portable_platform.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights * reserved. - * Copyright (c) 2021 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2024 Nanook Consulting All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,13 +15,6 @@ #ifndef PRTE_PORTABLE_PLATFORM_H #define PRTE_PORTABLE_PLATFORM_H 1 -#ifndef _PORTABLE_PLATFORM_H -#define _PORTABLE_PLATFORM_H 0 -#endif -#ifndef PLATFORM_HEADER_VERSION -#define PLATFORM_HEADER_VERSION 0 -#endif - #include "src/include/prte_portable_platform_real.h" #endif diff --git a/src/include/prte_portable_platform_real.h b/src/include/prte_portable_platform_real.h index 3a9f0cccb0..6f21dbfa8d 100644 --- a/src/include/prte_portable_platform_real.h +++ b/src/include/prte_portable_platform_real.h @@ -28,10 +28,11 @@ */ /* Publish and enforce version number for the public interface to this header */ /* YOU ARE NOT PERMITTED TO CHANGE THIS SECTION WITHOUT DIRECT APPROVAL FROM DAN BONACHEA */ -#if _PORTABLE_PLATFORM_H != PLATFORM_HEADER_VERSION \ - || PLATFORM_HEADER_VERSION < 16 +#if !defined(_PORTABLE_PLATFORM_H) || !defined(PLATFORM_HEADER_VERSION) \ + || _PORTABLE_PLATFORM_H != PLATFORM_HEADER_VERSION \ + || PLATFORM_HEADER_VERSION < 22 #undef PLATFORM_HEADER_VERSION -#define PLATFORM_HEADER_VERSION 16 +#define PLATFORM_HEADER_VERSION 22 #undef _PORTABLE_PLATFORM_H #define _PORTABLE_PLATFORM_H PLATFORM_HEADER_VERSION /* End Header versioning handshake */ @@ -115,14 +116,17 @@ #undef PLATFORM_COMPILER_UNKNOWN #undef PLATFORM_OS_FAMILYNAME +#undef PLATFORM_OS_SUBFAMILYNAME #undef PLATFORM_OS_CATAMOUNT -#undef PLATFORM_OS_CNL #undef PLATFORM_OS_BGP #undef PLATFORM_OS_BGQ -#undef PLATFORM_OS_WSL #undef PLATFORM_OS_K42 #undef PLATFORM_OS_UCLINUX #undef PLATFORM_OS_LINUX +#undef PLATFORM_OS_CNL +#undef PLATFORM_OS_SUBFAMILY_CNL +#undef PLATFORM_OS_WSL +#undef PLATFORM_OS_SUBFAMILY_WSL #undef PLATFORM_OS_BLRTS #undef PLATFORM_OS_CYGWIN #undef PLATFORM_OS_MSWINDOWS @@ -167,6 +171,7 @@ #undef PLATFORM_ARCH_AARCH64 #undef PLATFORM_ARCH_TILE #undef PLATFORM_ARCH_S390 +#undef PLATFORM_ARCH_RISCV #undef PLATFORM_ARCH_UNKNOWN /* prevent known old/broken versions of this header from loading */ @@ -291,7 +296,7 @@ PLATFORM_COMPILER_VERSION_INT(__PATHCC__,__PATHCC_MINOR__,__PATHCC_PATCHLEVEL__+0) #define PLATFORM_COMPILER_VERSION_STR __PATHSCALE__ -#elif defined(__NVCOMPILER) // Must occur prior to PGI and CLANG +#elif defined(__NVCOMPILER) /* Must occur prior to PGI and CLANG */ #define PLATFORM_COMPILER_NVHPC 1 #define PLATFORM_COMPILER_FAMILYNAME NVHPC #define PLATFORM_COMPILER_FAMILYID 20 @@ -590,7 +595,7 @@ #define PLATFORM_COMPILER_VERSION_STR __clang_version__ #endif -// NOTE: PLATFORM_COMPILER_FAMILYID "20" is allocted to NVHPC, appearing earlier +/* NOTE: PLATFORM_COMPILER_FAMILYID "20" is allocted to NVHPC, appearing earlier */ #else /* unknown compiler */ #define PLATFORM_COMPILER_UNKNOWN 1 @@ -750,17 +755,17 @@ PLATFORM_OS_: defined to a positive value if OS belongs to a given family, undef otherwise PLATFORM_OS_FAMILYNAME: - unquoted token which provides the compiler family name + unquoted token which provides the OS family name + + Some systems also define a subfamily: + PLATFORM_OS_SUBFAMILY_: positive value or undef + PLATFORM_OS_SUBFAMILYNAME: unquoted token for subfamily name or undef */ #if defined(__LIBCATAMOUNT__) || defined(__QK_USER__) #define PLATFORM_OS_CATAMOUNT 1 #define PLATFORM_OS_FAMILYNAME CATAMOUNT -#elif defined(__CRAYXT_COMPUTE_LINUX_TARGET) - #define PLATFORM_OS_CNL 1 - #define PLATFORM_OS_FAMILYNAME CNL - #elif defined(GASNETI_ARCH_BGP) || defined(__bgp__) #define PLATFORM_OS_BGP 1 #define PLATFORM_OS_FAMILYNAME BGP @@ -769,10 +774,6 @@ #define PLATFORM_OS_BGQ 1 #define PLATFORM_OS_FAMILYNAME BGQ -#elif defined(GASNETI_ARCH_WSL) - #define PLATFORM_OS_WSL 1 - #define PLATFORM_OS_FAMILYNAME WSL - #elif defined(__K42) #define PLATFORM_OS_K42 1 #define PLATFORM_OS_FAMILYNAME K42 @@ -784,6 +785,14 @@ #elif defined(__linux) || defined(__linux__) || defined(__gnu_linux__) #define PLATFORM_OS_LINUX 1 #define PLATFORM_OS_FAMILYNAME LINUX + #if defined(GASNETI_ARCH_WSL) + #define PLATFORM_OS_SUBFAMILY_WSL 1 + #define PLATFORM_OS_SUBFAMILYNAME WSL + #elif defined(__CRAYXT_COMPUTE_LINUX_TARGET) + /* NOTE: As of 2022-07 this is ONLY defined for the Cray cc/CC wrappers, and not the raw PrgEnv compilers */ + #define PLATFORM_OS_SUBFAMILY_CNL 1 + #define PLATFORM_OS_SUBFAMILYNAME CNL + #endif #elif defined(__blrts) || defined(__blrts__) || defined(__gnu_blrts__) #define PLATFORM_OS_BLRTS 1 @@ -1031,6 +1040,16 @@ #define _PLATFORM_ARCH_32 1 #endif +#elif defined(__riscv) + #define PLATFORM_ARCH_RISCV 1 + #define PLATFORM_ARCH_FAMILYNAME RISCV + #define _PLATFORM_ARCH_LITTLE_ENDIAN 1 + #if __riscv_xlen == 32 + #define _PLATFORM_ARCH_32 1 + #else /* (__riscv_xlen == 64) || (__riscv_xlen == 128) */ + #define _PLATFORM_ARCH_64 1 + #endif + #else /* unknown CPU */ #define PLATFORM_ARCH_UNKNOWN 1 #define PLATFORM_ARCH_FAMILYNAME UNKNOWN @@ -1053,9 +1072,9 @@ #elif defined(__LITTLE_ENDIAN__) || defined(WORDS_LITTLEENDIAN) || \ ( __BYTE_ORDER__ > 0 && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ) #define PLATFORM_ARCH_LITTLE_ENDIAN 1 -#elif defined(_PLATFORM_ARCH_BIG_ENDIAN) && _PLATFORM_ARCH_BIG_ENDIAN +#elif defined(_PLATFORM_ARCH_BIG_ENDIAN) #define PLATFORM_ARCH_BIG_ENDIAN 1 -#elif defined(_PLATFORM_ARCH_LITTLE_ENDIAN) && _PLATFORM_ARCH_LITTLE_ENDIAN +#elif defined(_PLATFORM_ARCH_LITTLE_ENDIAN) #define PLATFORM_ARCH_LITTLE_ENDIAN 1 #endif #undef _PLATFORM_ARCH_BIG_ENDIAN @@ -1086,9 +1105,9 @@ defined(__arch32__) || defined(__32BIT__) || \ __INTPTR_MAX__ == 2147483647 #define PLATFORM_ARCH_32 1 -#elif defined(_PLATFORM_ARCH_64) && _PLATFORM_ARCH_64 +#elif defined(_PLATFORM_ARCH_64) #define PLATFORM_ARCH_64 1 -#elif defined(_PLATFORM_ARCH_32) && _PLATFORM_ARCH_32 +#elif defined(_PLATFORM_ARCH_32) #define PLATFORM_ARCH_32 1 #endif #undef _PLATFORM_ARCH_64 @@ -1128,16 +1147,21 @@ int main(void) { PLATFORM_DISPX(COMPILER_VERSION); PLATFORM_DISP(COMPILER_VERSION_STR); PLATFORM_DISP(COMPILER_IDSTR); - #if PLATFORM_COMPILER_C_LANGLVL + #ifdef PLATFORM_COMPILER_C_LANGLVL PLATFORM_DISPI(COMPILER_C_LANGLVL); - #elif PLATFORM_COMPILER_CXX_LANGLVL + #elif defined(PLATFORM_COMPILER_CXX_LANGLVL) PLATFORM_DISPI(COMPILER_CXX_LANGLVL); #else printf("WARNING: Missing PLATFORM_COMPILER_C(XX)_LANGLVL!"); #endif PLATFORM_DISP(OS_FAMILYNAME); + #ifdef PLATFORM_OS_SUBFAMILYNAME + { const char * OS_SUBFAMILYNAME = PLATFORM_STRINGIFY(PLATFORM_OS_SUBFAMILYNAME); + PLATFORM_DISP(OS_SUBFAMILYNAME); + } + #endif PLATFORM_DISP(ARCH_FAMILYNAME); - #if PLATFORM_ARCH_32 + #ifdef PLATFORM_ARCH_32 PLATFORM_DISPI(ARCH_32); assert(sizeof(void *) == 4); #else @@ -1146,7 +1170,7 @@ int main(void) { #endif { int x = 0x00FF; unsigned char *p = (unsigned char *)&x; - #if PLATFORM_ARCH_BIG_ENDIAN + #ifdef PLATFORM_ARCH_BIG_ENDIAN PLATFORM_DISPI(ARCH_BIG_ENDIAN); assert(*p == 0); #else