OS definitions

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?

– Jim

James Cownie james.h.cownie@intel.com
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)

Tel: +44 117 9071438

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

Technically it's linux, but for consistency it may make sense to add the additional case.

Well, that depends; if it is also setting KMP_OS_LINUX, then if I add + KMP_OS_CNK then the test will fail (since
1 (from KMP_OS_LINUX) + 1 (from KMP_OS_CNK) == 2, not the one that we're checking for.

In the comment above you'll see // in some ppc64 linux installations, only the second condition is met

Yes, I saw that, but it didn't add much light to this aspect of the discussion :slight_smile:

It seems a bit odd to me to claim to be two different OSes at the same time.
Wouldn't it be cleaner to have something like KMP_OS_DIALECT_CNK and set that and KMP_OS_LINUX?

-- Jim

James Cownie <james.h.cownie@intel.com>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)
Tel: +44 117 9071438

Hi Jim,

Yes you are right - it should be included. I forgot to add it.

Thanks

– Carlo

graycol.gif"Cownie, James H" —08/08/2014 08:03:19 AM—Carlo, I’m integrating the BGQ stuff into the code we’re getting ready to push, and I have a questio

From: "Carlo Bertolli" <cbertol@us.ibm.com>
To: "James H Cownie" <james.h.cownie@intel.com>
Cc: openmp-dev@dcs-maillist2.engr.illinois.edu
Sent: Friday, August 8, 2014 8:47:36 AM
Subject: Re: [Openmp-dev] OS definitions

Hi Jim,

Yes you are right - it should be included. I forgot to add it.

Did you test that? As I recall, CNK pretends to be Linux, so KMP_OS_LINUX is already defined on CNK.

-Hal

I didn’t. My patch only covers PPC64 building on your CNK/BGQ one.

I have no strong opinion about this - if it works having it look like linux then it’s all right by me.

Thanks

– Carlo

graycol.gif

As I recall, CNK pretends to be Linux, so KMP_OS_LINUX is already defined on CNK.

That would seem to be the case since there are other places that have stuff like

#if (KMP_OS_LINUX && !KMP_OS_CNK)

Which is why I was proposing KMP_OS_DIALECT_CNK. (Or maybe KMP_LINUX_DIALECT_CNK would be even better).

-- Jim

James Cownie <james.h.cownie@intel.com>
SSG/DPD/TCAR (Technical Computing, Analyzers and Runtimes)
Tel: +44 117 9071438

From: "James H Cownie" <james.h.cownie@intel.com>
To: "Hal Finkel" <hfinkel@anl.gov>, "Carlo Bertolli" <cbertol@us.ibm.com>
Cc: openmp-dev@dcs-maillist2.engr.illinois.edu
Sent: Friday, August 8, 2014 9:09:56 AM
Subject: RE: [Openmp-dev] OS definitions

> As I recall, CNK pretends to be Linux, so KMP_OS_LINUX is already
> defined on CNK.

That would seem to be the case since there are other places that have
stuff like

#if (KMP_OS_LINUX && !KMP_OS_CNK)

Which is why I was proposing KMP_OS_DIALECT_CNK. (Or maybe
KMP_LINUX_DIALECT_CNK would be even better).

Sounds good to me. Feel free to do this, or perhaps better, outline exactly how you'd want this to work, and I'll test and implement this when I get back to work next week, and post a separate patch for review.

Thanks again,
Hal