<html><body>
<p><font size="2" face="sans-serif">Hi Jonathan</font><br>
<br>
<font size="2" face="sans-serif">Apologies for replying late. I believe this new version of the patch follows your guidelines (attached). I produced it starting from the last commits happened about a week ago or so.</font><br>
<br>
<font size="2" face="sans-serif">C Bergström: I tested this patch on both ppc64, ppc64le, and x86_64. I do not have any available ARM 64 architecture - can you please try it and let me know if I broke anything?</font><br>
<br>
<br>
<font size="2" face="sans-serif">Thanks</font><br>
<br>
<font size="2" face="sans-serif">-- Carlo</font><br>
<br>
<br>
<br>
<i>(See attached file: ppc64le-support.patch)</i><br>
<br>
<br>
<br>
<br>
<img width="16" height="16" src="cid:2__=0ABBF75CDF8786A98f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for "Peyton, Jonathan L" ---01/06/2015 04:03:30 PM---Carlo, “"><font size="2" color="#424282" face="sans-serif">"Peyton, Jonathan L" ---01/06/2015 04:03:30 PM---Carlo, “</font><br>
<br>
<font size="1" color="#5F5F5F" face="sans-serif">From:      </font><font size="1" face="sans-serif">"Peyton, Jonathan L" <jonathan.l.peyton@intel.com></font><br>
<font size="1" color="#5F5F5F" face="sans-serif">To:        </font><font size="1" face="sans-serif">Carlo Bertolli/Watson/IBM@IBMUS, "Cownie, James H" <james.h.cownie@intel.com></font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Cc:        </font><font size="1" face="sans-serif">C Bergström <cbergstrom@pathscale.com>, "openmp-dev@dcs-maillist2.engr.illinois.edu" <openmp-dev@dcs-maillist2.engr.illinois.edu></font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Date:      </font><font size="1" face="sans-serif">01/06/2015 04:03 PM</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Subject:   </font><font size="1" face="sans-serif">RE: Getting Architecture Patch</font><br>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<font size="2" color="#1F497D" face="Calibri">Carlo,</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" face="Arial">“</font><br>
<font size="2" face="Arial">I tried your patch on both p7 and p8 (le).</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
It works on p7, but I get the following error on p8:</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
CMake Error at cmake/HelperFunctions.cmake:37 (message):<br>
  check_variable(): arch = ppc64le is unknown</font><br>
<font size="2" face="Arial"><br>
That string name ("ppc64le") is the default for p8 machines and we would like it to be distinguished from the p7 one ("ppc64") in iomp.</font><br>
<font size="2" face="Arial">“</font><br>
<font size="2" face="Arial"> </font><br>
<font size="2" color="#1F497D" face="Calibri">Your patch has these lines in it:</font><br>
<font size="2" face="Consolas">-set(arch_possible_values        32e 32 arm ppc64)</font><br>
<font size="2" face="Consolas">+set(arch_possible_values        32e 32 arm ppc64 ppc64le)</font><br>
<font size="2" color="#1F497D" face="Calibri">So the problem above should be taken care of by this.  The idea was to have my get_arch patch be independent of the recent architecture patches so that the commits can be in a logical order.</font><br>
<font size="2" color="#1F497D" face="Calibri">Ideally, the get_arch patch will be first, then the architecture ports are based off of that.</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" color="#1F497D" face="Calibri">Some comments below on the ppc64le patch…</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" color="#1F497D" face="Calibri">---Comment #1---</font><br>
<font size="2" color="#1F497D" face="Calibri">Below, the KMP_ARCH_PPC macro should be removed, then undelete these two lines:</font><br>
<font size="2" face="Consolas">-#  undef KMP_ARCH_PPC64</font><br>
<font size="2" face="Consolas">-#  define KMP_ARCH_PPC64 1</font><br>
<font size="2" color="#1F497D" face="Calibri">This way, there is generic KMP_ARCH_PPC64 and then the more specific KMP_ARCH_PPC64BE and KMP_ARCH_PPC64LE macros.</font><br>
<font size="2" color="#1F497D" face="Calibri">I think Jim wanted to get rid of the KMP_ARCH_PPC anyways because it might confuse between 32-bit and 64-bit.</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" face="Consolas">--- a/runtime/src/kmp_os.h</font><br>
<font size="2" face="Consolas">+++ b/runtime/src/kmp_os.h</font><br>
<font size="2" face="Consolas">@@ -75,7 +75,10 @@</font><br>
<font size="2" face="Consolas"> </font><br>
<font size="2" face="Consolas">#define KMP_ARCH_X86        0</font><br>
<font size="2" face="Consolas">#define KMP_ARCH_X86_64        0</font><br>
<font size="2" face="Consolas">-#define KMP_ARCH_PPC64      0</font><br>
<font size="2" face="Consolas">+#define KMP_ARCH_PPC64_BE   0</font><br>
<font size="2" face="Consolas">+#define KMP_ARCH_PPC64_LE   0</font><br>
<font size="2" face="Consolas">+</font><br>
<font size="2" face="Consolas">+#define KMP_ARCH_PPC (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE)</font><br>
<font size="2" face="Consolas"> </font><br>
<font size="2" face="Consolas">#ifdef _WIN32</font><br>
<font size="2" face="Consolas"># undef KMP_OS_WINDOWS</font><br>
<font size="2" face="Consolas">@@ -116,7 +119,7 @@</font><br>
<font size="2" face="Consolas"># define KMP_OS_UNIX 1</font><br>
<font size="2" face="Consolas">#endif</font><br>
<font size="2" face="Consolas"> </font><br>
<font size="2" face="Consolas">-#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64</font><br>
<font size="2" face="Consolas">+#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC</font><br>
<font size="2" face="Consolas"># define KMP_AFFINITY_SUPPORTED 1</font><br>
<font size="2" face="Consolas">#else</font><br>
<font size="2" face="Consolas"># define KMP_AFFINITY_SUPPORTED 0</font><br>
<font size="2" face="Consolas">@@ -140,8 +143,13 @@</font><br>
<font size="2" face="Consolas">#  undef KMP_ARCH_X86</font><br>
<font size="2" face="Consolas">#  define KMP_ARCH_X86 1</font><br>
<font size="2" face="Consolas"># elif defined __powerpc64__</font><br>
<font size="2" face="Consolas">-#  undef KMP_ARCH_PPC64</font><br>
<font size="2" face="Consolas">-#  define KMP_ARCH_PPC64 1</font><br>
<font size="2" face="Consolas">+#  if defined __LITTLE_ENDIAN__</font><br>
<font size="2" face="Consolas">+#   undef KMP_ARCH_PPC64_LE</font><br>
<font size="2" face="Consolas">+#   define KMP_ARCH_PPC64_LE 1</font><br>
<font size="2" face="Consolas">+#  else</font><br>
<font size="2" face="Consolas">+#   undef KMP_ARCH_PPC64_BE</font><br>
<font size="2" face="Consolas">+#   define KMP_ARCH_PPC64_BE 1</font><br>
<font size="2" face="Consolas">+#  endif</font><br>
<font size="2" face="Consolas"># endif</font><br>
<font size="2" face="Consolas">#endif</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" color="#1F497D" face="Calibri">In most places it seems there is already KMP_ARCH_PPC64.  So just eliminate the changes that look similar to this:</font><br>
<font size="2" face="Consolas">-#if KMP_ARCH_PPC64</font><br>
<font size="2" face="Consolas">+#if KMP_ARCH_PPC</font><br>
<font size="2" face="Consolas"> </font><br>
<font size="2" color="#1F497D" face="Calibri">---Comment #2---</font><br>
<font size="2" color="#1F497D" face="Calibri">It seems that there needs to be additions to the file </font><font size="2" face="Consolas">/runtime/tools/src/common-defs.mk, </font><font size="2" color="#1F497D" face="Calibri">because inside this file</font><br>
<font size="2" color="#1F497D" face="Calibri">Is where the architecture/platform checks are done.  It should look something like this:</font><br>
<font size="2" face="Consolas">os       := $(call check_variable,os,lin lrb mac win)</font><br>
<font size="2" face="Consolas">-arch     := $(call check_variable,arch,32 32e 64 arm ppc64)</font><br>
<font size="2" face="Consolas">+arch     := $(call check_variable,arch,32 32e 64 arm ppc64 ppc64le)</font><br>
<font size="2" face="Consolas">platform := $(os)_$(arch)</font><br>
<font size="2" face="Consolas">-platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lrb_32e mac_32 mac_32e win_32 win_32e win_64 lin_ppc64)</font><br>
<font size="2" face="Consolas">+platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lrb_32e mac_32 mac_32e win_32 win_32e win_64 lin_ppc64 lin_ppc64le)</font><br>
<font size="2" face="Consolas"># oa-opts means "os and arch options". They are passed to almost all perl scripts.</font><br>
<font size="2" face="Consolas">oa-opts  := --os=$(os) --arch=$(arch)</font><br>
<font size="2" color="#1F497D" face="Calibri">You will also have to modify the legal_arch variable (also in common-defs.mk) of nested if’s to include ppc64le.</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" color="#1F497D" face="Calibri">Also, this means you can get rid of the ppc64be value in these conditionals.</font><br>
<font size="2" face="Consolas">--- a/runtime/src/makefile.mk</font><br>
<font size="2" face="Consolas">+++ b/runtime/src/makefile.mk</font><br>
<font size="2" face="Consolas">@@ -491,7 +491,8 @@ cpp-flags += -D KMP_LIBRARY_FILE=\"$(lib_file)\"</font><br>
<font size="2" face="Consolas">cpp-flags += -D KMP_VERSION_MAJOR=$(VERSION)</font><br>
<font size="2" face="Consolas"> </font><br>
<font size="2" face="Consolas"># customize ppc64 cache line size to 128, 64 otherwise</font><br>
<font size="2" face="Consolas">-ifeq "$(arch)" "ppc64"</font><br>
<font size="2" face="Consolas">+#ifeq "$(arch)" "ppc64"</font><br>
<font size="2" face="Consolas">+ ifneq (,$(filter "$(arch)","ppc64be" "ppc64le" "ppc64"))</font><br>
<font size="2" face="Consolas">    cpp-flags += -D CACHE_LINE=128</font><br>
<font size="2" face="Consolas">else</font><br>
<font size="2" face="Consolas">    cpp-flags += -D CACHE_LINE=64</font><br>
<font size="2" face="Consolas">@@ -503,7 +504,7 @@ cpp-flags += -D KMP_ASM_INTRINS</font><br>
<font size="2" face="Consolas">cpp-flags += -D KMP_USE_INTERNODE_ALIGNMENT=0</font><br>
<font size="2" face="Consolas"># Linux and MIC compile with version symbols</font><br>
<font size="2" face="Consolas">ifneq "$(filter lin lrb,$(os))" ""</font><br>
<font size="2" face="Consolas">-ifeq "$(filter ppc64,$(arch))" ""</font><br>
<font size="2" face="Consolas">+ifneq (,$(filter "$(arch)","ppc64be" "ppc64le" "ppc64"))</font><br>
<font size="2" face="Consolas">     cpp-flags += -D KMP_USE_VERSION_SYMBOLS</font><br>
<font size="2" face="Consolas">endif</font><br>
<font size="2" face="Consolas">endif</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<a name="_MailEndCompose"></a><font size="2" color="#1F497D" face="Calibri">-- Johnny</font><br>
<font size="2" color="#1F497D" face="Calibri"> </font><br>
<font size="2" face="Calibri"><b>From:</b></font><font size="2" face="Calibri"> Carlo Bertolli [</font><font size="2" face="Calibri"><a href="mailto:cbertol@us.ibm.com">mailto:cbertol@us.ibm.com</a></font><font size="2" face="Calibri">] </font><font size="2" face="Calibri"><b><br>
Sent:</b></font><font size="2" face="Calibri"> Tuesday, December 23, 2014 12:50 PM</font><font size="2" face="Calibri"><b><br>
To:</b></font><font size="2" face="Calibri"> Peyton, Jonathan L; Cownie, James H</font><font size="2" face="Calibri"><b><br>
Cc:</b></font><font size="2" face="Calibri"> C Bergström; openmp-dev@dcs-maillist2.engr.illinois.edu</font><font size="2" face="Calibri"><b><br>
Subject:</b></font><font size="2" face="Calibri"> RE: Getting Architecture Patch</font><br>
<font size="3" face="Times New Roman"> </font>
<p><font size="2" face="Arial">Hi</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
Attached a patch that includes both Jonathan's own (cmake auto architecture detection) and some additional fix-ups by me to allow running on ppc64le architectures (Power 8).<br>
My part of the patch follows suggestions made by Jim Cownie regarding the macro definition.<br>
This also goes in the direction stated by Jim in one of his last e-mails related to a re-designing of architecture macros.</font><font size="3" face="Times New Roman"><br>
</font><font size="3" face="Times New Roman"><i><br>
(See attached file: cmake_auto_arch_and_ppc64.patch)</i></font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
Let me know if you prefer a patch as diffed from Jonathan's one.</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
Thanks</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
-- Carlo</font><font size="3" face="Times New Roman"><br>
<br>
<br>
</font><img src="cid:2__=0ABBF75CDF8786A98f9e8a93df938@us.ibm.com" width="16" height="16" alt="Inactive hide details for "Peyton, Jonathan L" ---12/17/2014 07:28:07 PM---New patch is attached. 1) No and no.  You can’t use"><font size="2" color="#424282" face="Arial">"Peyton, Jonathan L" ---12/17/2014 07:28:07 PM---New patch is attached. 1) No and no.  You can’t use #warn or #warning or the #pragma ways of doing a</font><font size="3" face="Times New Roman"><br>
</font><font size="1" color="#5F5F5F" face="Arial"><br>
From: </font><font size="1" face="Arial">"Peyton, Jonathan L" <</font><a href="mailto:jonathan.l.peyton@intel.com"><font size="1" color="#0000FF" face="Arial"><u>jonathan.l.peyton@intel.com</u></font></a><font size="1" face="Arial">></font><font size="1" color="#5F5F5F" face="Arial"><br>
To: </font><font size="1" face="Arial">C Bergström <</font><a href="mailto:cbergstrom@pathscale.com"><font size="1" color="#0000FF" face="Arial"><u>cbergstrom@pathscale.com</u></font></a><font size="1" face="Arial">>, Carlo Bertolli/Watson/IBM@IBMUS</font><font size="1" color="#5F5F5F" face="Arial"><br>
Cc: </font><font size="1" face="Arial">"</font><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><font size="1" color="#0000FF" face="Arial"><u>openmp-dev@dcs-maillist2.engr.illinois.edu</u></font></a><font size="1" face="Arial">" <</font><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><font size="1" color="#0000FF" face="Arial"><u>openmp-dev@dcs-maillist2.engr.illinois.edu</u></font></a><font size="1" face="Arial">></font><font size="1" color="#5F5F5F" face="Arial"><br>
Date: </font><font size="1" face="Arial">12/17/2014 07:28 PM</font><font size="1" color="#5F5F5F" face="Arial"><br>
Subject: </font><font size="1" face="Arial">RE: Getting Architecture Patch</font><br>
<hr width="100%" size="2" align="left" noshade><br>
<font size="3" face="Times New Roman"><br>
<br>
</font><font size="2" color="#1F497D" face="Calibri"><br>
New patch is attached.<br>
 <br>
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.<br>
 <br>
Since you asked what others do, I had looked at what CMake does specifically when detecting the compiler:<br>
* Creates and links a small executable that has a main() function in it with a few global variables defined like <br>
     char cmake_compiler_name[] = “COMPILER_NAME=[gcc]”;<br>
     char cmake_compiler_version_major[] = “COMPILER_VERISON_MAJOR=[00000004]”<br>
     char cmake_compiler_version_minor[] = “COMPILER_VERISON_MINOR=[00000008]”<br>
     etc.<br>
     These variables are set through an extensive search through compiler predefined macros and some clever preprocessing macros/tricks.<br>
* Searches through the executable via regex to find something like “COMPILER_NAME=[gcc]” and extracts gcc, then 4, then 8 etc.<br>
* 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.<br>
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 </font><font size="2" color="#1F497D" face="Wingdings">J</font><font size="2" color="#1F497D" face="Calibri">.<br>
 <br>
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.<br>
 <br>
3) I did this in the new patch along with ppc64le<br>
 <br>
-- Johnny<br>
 </font><font size="2" face="Calibri"><b><br>
From:</b></font><font size="2" face="Calibri"> C Bergström [</font><a href="mailto:cbergstrom@pathscale.com"><font size="2" color="#0000FF" face="Calibri"><u>mailto:cbergstrom@pathscale.com</u></font></a><font size="2" face="Calibri">] </font><font size="2" face="Calibri"><b><br>
Sent:</b></font><font size="2" face="Calibri"> Wednesday, December 17, 2014 1:24 PM</font><font size="2" face="Calibri"><b><br>
To:</b></font><font size="2" face="Calibri"> Carlo Bertolli</font><font size="2" face="Calibri"><b><br>
Cc:</b></font><font size="2" face="Calibri"> Peyton, Jonathan L; </font><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu"><font size="2" color="#0000FF" face="Calibri"><u>openmp-dev@dcs-maillist2.engr.illinois.edu</u></font></a><font size="2" face="Calibri"><b><br>
Subject:</b></font><font size="2" face="Calibri"> Re: Getting Architecture Patch</font><font size="3" face="Times New Roman"><br>
 <br>
3 nits<br>
 <br>
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?)<br>
 <br>
2) Would anyone @Intel strongly oppose a global rename of 32e to something which is more commonly used (x86_64, amd64 /* joking */ or x8664)<br>
 <br>
3) Can you include ARM64<br>
 <br>
Thanks<br>
 <br>
On Thu, Dec 18, 2014 at 1:53 AM, Carlo Bertolli <</font><a href="mailto:cbertol@us.ibm.com" target="_blank"><font size="3" color="#0000FF" face="Times New Roman"><u>cbertol@us.ibm.com</u></font></a><font size="3" face="Times New Roman">> wrote: </font>
<ul style="padding-left: 36pt"><font size="3" face="Arial"><br>
Hi Johnny</font><font size="3" face="Times New Roman"><br>
</font><font size="3" face="Arial"><br>
<br>
Thanks for this patch. I will give it a try on our machines and let you know.</font><font size="3" face="Times New Roman"><br>
</font><font size="3" face="Arial"><br>
<br>
Cheers<br>
<br>
-- Carlo</font><font size="3" face="Times New Roman"><br>
<br>
<br>
</font><img src="cid:2__=0ABBF75CDF8786A98f9e8a93df938@us.ibm.com" width="16" height="16" alt="Inactive hide details for "Peyton, Jonathan L" ---12/17/2014 01:18:14 PM---Due to recent aarch64 and ppc64le port patches that "><font size="3" color="#424282" face="Arial">"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</font><font size="1" color="#5F5F5F" face="Arial"><br>
<br>
From: </font><font size="1" face="Arial">"Peyton, Jonathan L" <</font><a href="mailto:jonathan.l.peyton@intel.com" target="_blank"><font size="1" color="#0000FF" face="Arial"><u>jonathan.l.peyton@intel.com</u></font></a><font size="1" face="Arial">></font><font size="1" color="#5F5F5F" face="Arial"><br>
To: </font><font size="1" face="Arial">"</font><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu" target="_blank"><font size="1" color="#0000FF" face="Arial"><u>openmp-dev@dcs-maillist2.engr.illinois.edu</u></font></a><font size="1" face="Arial">" <</font><a href="mailto:openmp-dev@dcs-maillist2.engr.illinois.edu" target="_blank"><font size="1" color="#0000FF" face="Arial"><u>openmp-dev@dcs-maillist2.engr.illinois.edu</u></font></a><font size="1" face="Arial">></font><font size="1" color="#5F5F5F" face="Arial"><br>
Cc: </font><font size="1" face="Arial">Carlo Bertolli/Watson/IBM@IBMUS, C Bergström <</font><a href="mailto:cbergstrom@pathscale.com" target="_blank"><font size="1" color="#0000FF" face="Arial"><u>cbergstrom@pathscale.com</u></font></a><font size="1" face="Arial">></font><font size="1" color="#5F5F5F" face="Arial"><br>
Date: </font><font size="1" face="Arial">12/17/2014 01:18 PM</font><font size="1" color="#5F5F5F" face="Arial"><br>
Subject: </font><font size="1" face="Arial">Getting Architecture Patch</font><br>
<hr width="100%" size="2" align="left" noshade><br>
<font size="3" face="Times New Roman"><br>
<br>
</font><font size="3" face="Calibri"><br>
<br>
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.<br>
<br>
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.<br>
<br>
-- Johnny<br>
[attachment "cmake_get_arch.patch" deleted by Carlo Bertolli/Watson/IBM] [attachment "cmake_get_arch_v2.patch" deleted by Carlo Bertolli/Watson/IBM] </font><br>
</ul>
</body></html>