This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add entry for Intel Compiler 18
ClosedPublic

Authored by sconvent on Nov 23 2017, 3:15 AM.

Diff Detail

Repository
rOMP OpenMP

Event Timeline

sconvent created this revision.Nov 23 2017, 3:15 AM
This revision is now accepted and ready to land.Nov 29 2017, 5:08 AM
Hahnfeld edited edge metadata.Nov 29 2017, 6:19 AM

Question to Intel: At the moment we have to add a new compiler version each year. Can we switch to the same process used for Clang and GCC, i.e. automatically getting the version and composing the string?

Question to Intel: At the moment we have to add a new compiler version each year. Can we switch to the same process used for Clang and GCC, i.e. automatically getting the version and composing the string?

Intel compiler provides just two version-related macros, e.g.
#define INTEL_COMPILER 1800
#define
INTEL_COMPILER_UPDATE 1

Is there a simple way to turn them into "18.0.1" (and also "9999" into "mainline")?

Question to Intel: At the moment we have to add a new compiler version each year. Can we switch to the same process used for Clang and GCC, i.e. automatically getting the version and composing the string?

Intel compiler provides just two version-related macros, e.g.

#define __INTEL_COMPILER 1800
#define __INTEL_COMPILER_UPDATE 1

Is there a simple way to turn them into "18.0.1" (and also "9999" into "mainline")?

You probably need to special case 9998 and 9999 - which is fine because these values don't change. For released versions (at least for the current way of defining the macros) the following should be possible (not tested):

#define KMP_COMPILER "Intel C++ Compiler " stringer(__INTEL_COMPILER / 100) "." stringer(__INTEL_COMPILER % 100) "." stringer(__INTEL_COMPILER_UPDATE)

Maybe you need to assign the temporary values to other defines for the macro magic to work, I'm not too familiar with how it works...

protze.joachim edited edge metadata.Dec 5 2017, 5:33 AM

LGTM

For released versions (at least for the current way of defining the macros) the following should be possible (not tested):

#define KMP_COMPILER "Intel C++ Compiler " stringer(__INTEL_COMPILER / 100) "." stringer(__INTEL_COMPILER % 100) "." stringer(__INTEL_COMPILER_UPDATE)

Maybe you need to assign the temporary values to other defines for the macro magic to work, I'm not too familiar with how it works...

The preprocessor cannot do arithmetic replacements. So stringer will not work.
One way would be to calculate the value on execution.
Since CMake has the information, we could configure the source and let CMake provide the compiler version.

LGTM

I didn't want to block this revision, I agree that this needs to be done with the current code.

For released versions (at least for the current way of defining the macros) the following should be possible (not tested):

#define KMP_COMPILER "Intel C++ Compiler " stringer(__INTEL_COMPILER / 100) "." stringer(__INTEL_COMPILER % 100) "." stringer(__INTEL_COMPILER_UPDATE)

Maybe you need to assign the temporary values to other defines for the macro magic to work, I'm not too familiar with how it works...

The preprocessor cannot do arithmetic replacements. So stringer will not work.
One way would be to calculate the value on execution.
Since CMake has the information, we could configure the source and let CMake provide the compiler version.

You are right, my code doesn't work as intended. So maybe @omalyshe can convince the compiler team to add the macros that would simplify life? :-) (just found out where this information is printed, never used KMP_VERSION=1 before...)

So maybe @omalyshe can convince the compiler team to add the macros that would simplify life? :-)

Compiler itself somehow cope with it when printing the version. I'll try find out- how.
$ icc -V
Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0 Build 20171115
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.

This revision was automatically updated to reflect the committed changes.