[Openmp-dev] Getting Architecture Patch

Peyton, Jonathan L jonathan.l.peyton at intel.com
Wed Dec 17 16:27:57 PST 2014


New patch is attached.

1) No and no.  You can’t use #warn or #warning or the #pragma ways of doing a preprocessor warn/message/info because it isn’t standard (MSVC doesn’t have either #warn or #warning), #error is standard.  Also, you can’t rely on running a small program, and EVERYTHING I’ve seen emphasizes this point.  You can link but not actually run.  There is a specific reason, cross-compiling.  For example, if you relied on printf and are cross-compiling arm on an x86 host, then it won’t run on the x86 host system.

Since you asked what others do, I had looked at what CMake does specifically when detecting the compiler:
* Creates and links a small executable that has a main() function in it with a few global variables defined like
     char cmake_compiler_name[] = “COMPILER_NAME=[gcc]”;
     char cmake_compiler_version_major[] = “COMPILER_VERISON_MAJOR=[00000004]”
     char cmake_compiler_version_minor[] = “COMPILER_VERISON_MINOR=[00000008]”
     etc.
     These variables are set through an extensive search through compiler predefined macros and some clever preprocessing macros/tricks.
* Searches through the executable via regex to find something like “COMPILER_NAME=[gcc]” and extracts gcc, then 4, then 8 etc.
* An aside: because not every compiler produces a.out as default executable and not every compiler has –o flag to redirect output, it searches every file that was produced in the temporary work space besides the temporary.c file.
If you look at how LLVM does it, just look at GetHostTriple.cmake in llvm_root/cmake/modules/GetHostTriple.cmake.  It calls config.guess on non-Windows platforms ☺.

2) I personally don’t know about his one.  32e is embedded in lots of places including our internal tools and commercial product.  I can check with everybody else of course and see what they think, but you would have to wait till after the holiday season for anything to happen about it.

3) I did this in the new patch along with ppc64le

-- Johnny

From: C Bergström [mailto:cbergstrom at pathscale.com]
Sent: Wednesday, December 17, 2014 1:24 PM
To: Carlo Bertolli
Cc: Peyton, Jonathan L; openmp-dev at dcs-maillist2.engr.illinois.edu
Subject: Re: Getting Architecture Patch

3 nits

1) I think you can change it to #warn and avoid the compiler failure (please see what others are doing with similar approach and let me know). There's also possibility of actually linking and doing a printf which would avoid the whole regex mess.. Is there a strong reason for #error? (maybe faster?)

2) Would anyone @Intel strongly oppose a global rename of 32e to something which is more commonly used (x86_64, amd64 /* joking */ or x8664)

3) Can you include ARM64

Thanks

On Thu, Dec 18, 2014 at 1:53 AM, Carlo Bertolli <cbertol at us.ibm.com<mailto:cbertol at us.ibm.com>> wrote:

Hi Johnny


Thanks for this patch. I will give it a try on our machines and let you know.


Cheers

-- Carlo


[Inactive hide details for "Peyton, Jonathan L" ---12/17/2014 01:18:14 PM---Due to recent aarch64 and ppc64le port patches that]"Peyton, Jonathan L" ---12/17/2014 01:18:14 PM---Due to recent aarch64 and ppc64le port patches that have been sent, I have finished up this bit of c

From: "Peyton, Jonathan L" <jonathan.l.peyton at intel.com<mailto:jonathan.l.peyton at intel.com>>
To: "openmp-dev at dcs-maillist2.engr.illinois.edu<mailto:openmp-dev at dcs-maillist2.engr.illinois.edu>" <openmp-dev at dcs-maillist2.engr.illinois.edu<mailto:openmp-dev at dcs-maillist2.engr.illinois.edu>>
Cc: Carlo Bertolli/Watson/IBM at IBMUS, C Bergström <cbergstrom at pathscale.com<mailto:cbergstrom at pathscale.com>>
Date: 12/17/2014 01:18 PM
Subject: Getting Architecture Patch

________________________________



Due to recent aarch64 and ppc64le port patches that have been sent, I have finished up this bit of code for CMake which detects the architecture by probing the compiler.

Carlo and C. Bergström can you two look at this patch and see if it adequately solves the detecting architecture problem for you both and add the proper macro into the GetArchitecture.cmake (this will make sense once you look at the patch)?  I would like this to be committed before either port so both ports can use this new patch.

-- Johnny
 [attachment "cmake_get_arch.patch" deleted by Carlo Bertolli/Watson/IBM]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141218/9bba308d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 105 bytes
Desc: image001.gif
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141218/9bba308d/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_get_arch_v2.patch
Type: application/octet-stream
Size: 6685 bytes
Desc: cmake_get_arch_v2.patch
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141218/9bba308d/attachment.obj>


More information about the Openmp-dev mailing list