[Openmp-dev] OS definitions

"C. Bergström" cbergstrom at pathscale.com
Fri Aug 8 05:47:38 PDT 2014


On 08/ 8/14 07:02 PM, Cownie, James H wrote:
>
> Carlo,
>
> I’m integrating the BGQ stuff into the code we’re getting ready to 
> push, and I have a question…
>
> In kmp_os.h there’s this code
>
> /* ---------------------- Operating system recognition 
> ------------------- */
>
> #define KMP_OS_LINUX 0
>
> #define KMP_OS_FREEBSD 0
>
> #define KMP_OS_DARWIN 0
>
> #define KMP_OS_FREEBSD 0
>
> #define KMP_OS_WINDOWS 0
>
> #define KMP_OS_CNK 0
>
> #define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN 
> etc. */
>
> #define KMP_ARCH_X86 0
>
> #define KMP_ARCH_X86_64 0
>
> #define KMP_ARCH_PPC64 0
>
> #ifdef _WIN32
>
> # undef KMP_OS_WINDOWS
>
> # define KMP_OS_WINDOWS 1
>
> #endif
>
> #if ( defined __APPLE__ && defined __MACH__ )
>
> # undef KMP_OS_DARWIN
>
> # define KMP_OS_DARWIN 1
>
> #endif
>
> // in some ppc64 linux installations, only the second condition is met
>
> #if ( defined __linux )
>
> # undef KMP_OS_LINUX
>
> # define KMP_OS_LINUX 1
>
> #elif ( defined __linux__)
>
> # undef KMP_OS_LINUX
>
> # define KMP_OS_LINUX 1
>
> #else
>
> #endif
>
> #if ( defined __FreeBSD__ )
>
> # undef KMP_OS_FREEBSD
>
> # define KMP_OS_FREEBSD 1
>
> #endif
>
> #if ( defined __bgq__ )
>
> # undef KMP_OS_CNK
>
> # define KMP_OS_CNK 1
>
> #endif
>
> #if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)
>
> # error Unknown OS
>
> #endif
>
> Shouldn’t that last test also include KMP_OS_CNK? Or does CNK pretend 
> to be one of the other OSes as well?
>
Technically it's linux, but for consistency it may make sense to add the 
additional case. In the comment above you'll see
// in some ppc64 linux installations, only the second condition is met





More information about the Openmp-dev mailing list