[Openmp-dev] Getting Architecture Patch

Carlo Bertolli cbertol at us.ibm.com
Mon Dec 22 09:14:55 PST 2014


All

This patch adds up to Jonathan's one with the ppc64le case. Be warned that
it only implements auto-detection of the ppc64le architecture. I am working
on integrating my own patch, which permits compilation of ppc64le, with
this one.

(See attached file: cmake_get_arch_v3.patch)

Please, let me know of any issues

-- Carlo



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



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 J.

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> 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>
 To: "openmp-dev at dcs-maillist2.engr.illinois.edu" <
 openmp-dev at dcs-maillist2.engr.illinois.edu>
 Cc: Carlo Bertolli/Watson/IBM at IBMUS, C Bergström <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]
 [attachment "cmake_get_arch_v2.patch" deleted by Carlo
 Bertolli/Watson/IBM]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141222/2b43ee3d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141222/2b43ee3d/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_get_arch_v3.patch
Type: application/octet-stream
Size: 3445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20141222/2b43ee3d/attachment.obj>


More information about the Openmp-dev mailing list