<html><body>
<p><tt><font size="2">Hi,</font></tt><br>
<br>
<tt><font size="2">I jave just noticed that my editor cut the lines in the patch...</font></tt><br>
<br>
<tt><font size="2">Below a good version of the patch.</font></tt><br>
<br>
<tt><font size="2">-- Carlo</font></tt><br>
<br>
<br>
<tt><font size="2">diff --git a/runtime/Makefile.bgq b/runtime/Makefile.bgq</font></tt><br>
<tt><font size="2">new file mode 100644</font></tt><br>
<tt><font size="2">index 0000000..d9aa914</font></tt><br>
<tt><font size="2">--- /dev/null</font></tt><br>
<tt><font size="2">+++ b/runtime/Makefile.bgq</font></tt><br>
<tt><font size="2">@@ -0,0 +1,76 @@</font></tt><br>
<tt><font size="2">+date := $(shell date '+%Y%m%d')</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+FEATURE_FLAGS = -DOMP_40_ENABLED=1 -DOMP_30_ENABLED=1 -DOMP_VERSION=201107 -DKMP_VERSION_MAJOR=5 \</font></tt><br>
<tt><font size="2">+              -DCACHE_LINE=64 -DKMP_ADJUST_BLOCKTIME=1 -DBUILD_I8 -DKMP_USE_ADAPTIVE_LOCKS=0 \</font></tt><br>
<tt><font size="2">+              -DKMP_DEBUG_ADAPTIVE_LOCKS=0 -DINTEL_NO_ITTNOTIFY_API -DKMP_VERSION_MINOR=0 -DKMP_VERSION_BUILD=0 \</font></tt><br>
<tt><font size="2">+              -DKMP_LIBRARY_FILE=\"libiomp5.so\" -D_KMP_BUILD_TIME="\"$(date)\"" -DKMP_GOMP_COMPAT</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+CPPFLAGS = ${FEATURE_FLAGS} -D__float128='long double'</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+CC = powerpc64-bgq-linux-gcc</font></tt><br>
<tt><font size="2">+CXX = powerpc64-bgq-linux-g++</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+all: build/libiomp5.a build/libiomp5.so</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/.dir:</font></tt><br>
<tt><font size="2">+      mkdir -p build</font></tt><br>
<tt><font size="2">+      touch build/.dir</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/omp.h:</font></tt><br>
<tt><font size="2">+      perl tools/expand-vars.pl --strict $$(echo $(FEATURE_FLAGS) | sed 's/-D/-D /g') \</font></tt><br>
<tt><font size="2">+        -D KMP_BUILD_DATE=$(date) -D Revision=Revision -D Date=Date \</font></tt><br>
<tt><font size="2">+        src/include/40/omp.h.var build/omp.h</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/%.o: src/%.cpp build/kmp_i18n_id.inc build/kmp_i18n_default.inc build/omp.h</font></tt><br>
<tt><font size="2">+      ${CXX} -c ${CPPFLAGS} -g -O3 -Isrc -Ibuild -o $@ $<</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/%.o: src/%.c build/kmp_i18n_id.inc build/kmp_i18n_default.inc build/omp.h</font></tt><br>
<tt><font size="2">+      ${CC} -x c++ -c ${CPPFLAGS} -g -O3 -Isrc -Ibuild -o $@ $<</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+OBJS =        build/kmp_alloc.o \</font></tt><br>
<tt><font size="2">+      build/kmp_atomic.o \</font></tt><br>
<tt><font size="2">+      build/kmp_cancel.o \</font></tt><br>
<tt><font size="2">+      build/kmp_csupport.o \</font></tt><br>
<tt><font size="2">+      build/kmp_dispatch.o \</font></tt><br>
<tt><font size="2">+      build/kmp_debug.o \</font></tt><br>
<tt><font size="2">+      build/kmp_environment.o \</font></tt><br>
<tt><font size="2">+      build/kmp_error.o \</font></tt><br>
<tt><font size="2">+      build/kmp_ftn_cdecl.o \</font></tt><br>
<tt><font size="2">+      build/kmp_ftn_extra.o \</font></tt><br>
<tt><font size="2">+      build/kmp_ftn_stdcall.o \</font></tt><br>
<tt><font size="2">+      build/kmp_global.o \</font></tt><br>
<tt><font size="2">+      build/kmp_i18n.o \</font></tt><br>
<tt><font size="2">+      build/kmp_io.o \</font></tt><br>
<tt><font size="2">+      build/kmp_itt.o \</font></tt><br>
<tt><font size="2">+      build/kmp_runtime.o \</font></tt><br>
<tt><font size="2">+      build/kmp_settings.o \</font></tt><br>
<tt><font size="2">+      build/kmp_sched.o \</font></tt><br>
<tt><font size="2">+      build/kmp_str.o \</font></tt><br>
<tt><font size="2">+      build/kmp_tasking.o \</font></tt><br>
<tt><font size="2">+      build/kmp_taskq.o \</font></tt><br>
<tt><font size="2">+      build/kmp_taskdeps.o \</font></tt><br>
<tt><font size="2">+      build/kmp_threadprivate.o \</font></tt><br>
<tt><font size="2">+      build/kmp_utility.o \</font></tt><br>
<tt><font size="2">+      build/kmp_version.o \</font></tt><br>
<tt><font size="2">+      build/kmp_lock.o \</font></tt><br>
<tt><font size="2">+      build/z_Linux_util.o</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+BGSYS_FLOOR=$(shell readlink /bgsys/drivers/ppcfloor)</font></tt><br>
<tt><font size="2">+build/libiomp5.so: $(OBJS)</font></tt><br>
<tt><font size="2">+      ${CXX} -Wl,--build-id -Wl,-rpath -Wl,${BGSYS_FLOOR}/gnu-linux/powerpc64-bgq-linux/lib -shared -o $@.1.0 $^ -Wl,-soname,$(shell basename $@.1) -lpthread</font></tt><br>
<tt><font size="2">+      (cd $(shell dirname $@) && ln -sf $(shell basename $@.1.0) $(shell basename $@.1))</font></tt><br>
<tt><font size="2">+      (cd $(shell dirname $@) && ln -sf $(shell basename $@.1) $(shell basename $@))</font></tt><br>
<tt><font size="2">+# Note: We should not need the --build-id when we switch to clang (it should add it for us).</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/libiomp5.a: $(OBJS)</font></tt><br>
<tt><font size="2">+      ar cr $@ $^</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/kmp_i18n_id.inc: src/i18n/en_US.txt tools/message-converter.pl build/.dir</font></tt><br>
<tt><font size="2">+      perl tools/message-converter.pl --prefix=kmp_i18n --enum=$@ $<</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+build/kmp_i18n_default.inc: src/i18n/en_US.txt tools/message-converter.pl build/.dir</font></tt><br>
<tt><font size="2">+      perl tools/message-converter.pl --prefix=kmp_i18n --default=$@ $<</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+clean:</font></tt><br>
<tt><font size="2">+      rm -rf build</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt</font></tt><br>
<tt><font size="2">index dd29966..4814cb4 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/CMakeLists.txt</font></tt><br>
<tt><font size="2">+++ b/runtime/src/CMakeLists.txt</font></tt><br>
<tt><font size="2">@@ -12,6 +12,9 @@ include_directories(</font></tt><br>
<tt><font size="2">   ${CMAKE_CURRENT_BINARY_DIR}</font></tt><br>
<tt><font size="2"> )</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+# detect architecture</font></tt><br>
<tt><font size="2">+EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCH )</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> if(WIN32)</font></tt><br>
<tt><font size="2">   set(OS_GEN "win")</font></tt><br>
<tt><font size="2"> elseif(APPLE)</font></tt><br>
<tt><font size="2">@@ -22,12 +25,14 @@ else()</font></tt><br>
<tt><font size="2">   message(FATAL_ERROR "Unsupported OS")</font></tt><br>
<tt><font size="2"> endif()</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-if("${ARCH}" STREQUAL "")</font></tt><br>
<tt><font size="2">+if(NOT "${ARCH}" STREQUAL "ppc64")</font></tt><br>
<tt><font size="2">   set(ARCH "32e")</font></tt><br>
<tt><font size="2">+  set(ARCH_STR "Intel(R) 64")</font></tt><br>
<tt><font size="2">+else()</font></tt><br>
<tt><font size="2">+# arch already set above</font></tt><br>
<tt><font size="2">+  set(ARCH_STR "PPC64")</font></tt><br>
<tt><font size="2"> endif()</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-set(ARCH_STR "Intel(R) 64")</font></tt><br>
<tt><font size="2">-</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "-D USE_ITT_BUILD")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D NDEBUG")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ARCH_STR=\"\\\"${ARCH_STR}\\\"\"")</font></tt><br>
<tt><font size="2">@@ -50,8 +55,13 @@ set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_LOAD_BALANCE")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_CBLKDATA")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D GUIDEDLL_EXPORTS")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_GOMP_COMPAT")</font></tt><br>
<tt><font size="2">-set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")</font></tt><br>
<tt><font size="2">-set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+#adaptive locks use x86 assembly - disable for ppc64</font></tt><br>
<tt><font size="2">+if(NOT "${ARCH}" STREQUAL "ppc64")</font></tt><br>
<tt><font size="2">+      set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")</font></tt><br>
<tt><font size="2">+      set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")</font></tt><br>
<tt><font size="2">+endif()</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_50_ENABLED=0")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_41_ENABLED=0")</font></tt><br>
<tt><font size="2"> set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_40_ENABLED=1")</font></tt><br>
<tt><font size="2">@@ -122,16 +132,35 @@ add_custom_command(</font></tt><br>
<tt><font size="2">   OUTPUT omp.h</font></tt><br>
<tt><font size="2">     COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/expand-vars.pl --strict -D Revision=\"\\$$Revision\" -D Date=\"\\$$Date\" -D KMP_TYPE=\"Performance\" -D KMP_ARCH=\"\\\"${ARCH_STR}\\\"\" -D KMP_VERSION_MAJOR=${VERSION} -D KMP_VERSION_MINOR=0 -D KMP_VERSION_BUILD=00000000 -D KMP_BUILD_DATE=\"${BUILD_TIME} UTC\" -D KMP_TARGET_COMPILER=12 -D KMP_DIAG=0 -D KMP_DEBUG_INFO=0 -D OMP_VERSION=${OMP_VERSION} ${CMAKE_CURRENT_SOURCE_DIR}/include/${OMP_VERSION_NUM}/omp.h.var omp.h</font></tt><br>
<tt><font size="2"> )</font></tt><br>
<tt><font size="2">-add_custom_command(</font></tt><br>
<tt><font size="2">-  OUTPUT z_Linux_asm.o</font></tt><br>
<tt><font size="2">-    COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D KMP_ASM_INTRINS -D KMP_GOMP_COMPAT -D KMP_ARCH_X86_64 -x assembler-with-cpp ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}</font></tt><br>
<tt><font size="2">-)</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+if(NOT "${ARCH}" STREQUAL "ppc64")</font></tt><br>
<tt><font size="2">+      add_custom_command(</font></tt><br>
<tt><font size="2">+                 OUTPUT z_Linux_asm.o</font></tt><br>
<tt><font size="2">+                    COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D KMP_ASM_INTRINS -D KMP_GOMP_COMPAT -D KMP_ARCH_X86_64 -x assembler-with-cpp ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}</font></tt><br>
<tt><font size="2">+      )</font></tt><br>
<tt><font size="2">+else()</font></tt><br>
<tt><font size="2">+      add_custom_command(</font></tt><br>
<tt><font size="2">+                 OUTPUT z_Linux_asm.o</font></tt><br>
<tt><font size="2">+                    COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D KMP_ASM_INTRINS -D KMP_GOMP_COMPAT -D KMP_ARCH_PPC64 -x assembler-with-cpp ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}</font></tt><br>
<tt><font size="2">+      )</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+endif()</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> add_custom_target(gen_kmp_i18n DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc omp.h z_Linux_asm.o)</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> if(NOT APPLE)</font></tt><br>
<tt><font size="2">-  set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt")</font></tt><br>
<tt><font size="2">+      set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt -ldl")</font></tt><br>
<tt><font size="2"> endif()</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> add_library(iomp5 SHARED ${SOURCES} z_Linux_asm.o)</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+# This is a workaround to a known ppc64 issue about libpthread. For more</font></tt><br>
<tt><font size="2">+# information see</font></tt><br>
<tt><font size="2">+# <a href="http://ryanarn.blogspot.com/2011/07/curious-case-of-pthreadatfork-on.html">http://ryanarn.blogspot.com/2011/07/curious-case-of-pthreadatfork-on.html</a></font></tt><br>
<tt><font size="2">+if("${ARCH}" STREQUAL "ppc64")</font></tt><br>
<tt><font size="2">+      find_library(PTHREAD NAMES pthread)</font></tt><br>
<tt><font size="2">+      target_link_libraries(iomp5 ${PTHREAD})</font></tt><br>
<tt><font size="2">+endif()</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> add_dependencies(iomp5 gen_kmp_i18n)</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h</font></tt><br>
<tt><font size="2">index a8c600b..f5dd10f 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp.h</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp.h</font></tt><br>
<tt><font size="2">@@ -459,9 +459,9 @@ typedef int PACKED_REDUCTION_METHOD_T;</font></tt><br>
<tt><font size="2"> /*</font></tt><br>
<tt><font size="2">  * Only Linux* OS and Windows* OS support thread affinity.</font></tt><br>
<tt><font size="2">  */</font></tt><br>
<tt><font size="2">-#if KMP_OS_LINUX || KMP_OS_WINDOWS</font></tt><br>
<tt><font size="2">+#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2"> # define KMP_AFFINITY_SUPPORTED 1</font></tt><br>
<tt><font size="2">-#elif KMP_OS_DARWIN || KMP_OS_FREEBSD</font></tt><br>
<tt><font size="2">+#elif KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_CNK || KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2"> // affinity not supported</font></tt><br>
<tt><font size="2"> # define KMP_AFFINITY_SUPPORTED 0</font></tt><br>
<tt><font size="2"> #else</font></tt><br>
<tt><font size="2">@@ -476,7 +476,7 @@ extern size_t __kmp_affin_mask_size;</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> # if KMP_OS_LINUX</font></tt><br>
<tt><font size="2"> //</font></tt><br>
<tt><font size="2">-// On Linux* OS, the mask isactually a vector of length __kmp_affin_mask_size</font></tt><br>
<tt><font size="2">+// On Linux* OS, the mask is actually a vector of length __kmp_affin_mask_size</font></tt><br>
<tt><font size="2"> // (in bytes).  It should be allocated on a word boundary.</font></tt><br>
<tt><font size="2"> //</font></tt><br>
<tt><font size="2"> // WARNING!!!  We have made the base type of the affinity mask unsigned char,</font></tt><br>
<tt><font size="2">@@ -946,6 +946,9 @@ extern unsigned int __kmp_place_core_offset;</font></tt><br>
<tt><font size="2"> #if KMP_OS_WINDOWS</font></tt><br>
<tt><font size="2"> #  define KMP_INIT_WAIT    64U          /* initial number of spin-tests   */</font></tt><br>
<tt><font size="2"> #  define KMP_NEXT_WAIT    32U          /* susequent number of spin-tests */</font></tt><br>
<tt><font size="2">+#elif KMP_OS_CNK</font></tt><br>
<tt><font size="2">+#  define KMP_INIT_WAIT    16U          /* initial number of spin-tests   */</font></tt><br>
<tt><font size="2">+#  define KMP_NEXT_WAIT     8U          /* susequent number of spin-tests */</font></tt><br>
<tt><font size="2"> #elif KMP_OS_LINUX</font></tt><br>
<tt><font size="2"> #  define KMP_INIT_WAIT  1024U          /* initial number of spin-tests   */</font></tt><br>
<tt><font size="2"> #  define KMP_NEXT_WAIT   512U          /* susequent number of spin-tests */</font></tt><br>
<tt><font size="2">@@ -971,6 +974,11 @@ extern void __kmp_x86_cpuid( int mode, int mode2, struct kmp_cpuid *p );</font></tt><br>
<tt><font size="2">   extern void __kmp_x86_pause( void );</font></tt><br>
<tt><font size="2"> # endif</font></tt><br>
<tt><font size="2"> # define KMP_CPU_PAUSE()        __kmp_x86_pause()</font></tt><br>
<tt><font size="2">+#elif KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+# define KMP_PPC64_PRI_LOW() __asm__ volatile ("or 1, 1, 1")</font></tt><br>
<tt><font size="2">+# define KMP_PPC64_PRI_MED() __asm__ volatile ("or 2, 2, 2")</font></tt><br>
<tt><font size="2">+# define KMP_PPC64_PRI_LOC_MB() __asm__ volatile ("" : : : "memory")</font></tt><br>
<tt><font size="2">+# define KMP_CPU_PAUSE() do { KMP_PPC64_PRI_LOW(); KMP_PPC64_PRI_MED(); KMP_PPC64_PRI_LOC_MB(); } while (0)</font></tt><br>
<tt><font size="2"> #else</font></tt><br>
<tt><font size="2"> # define KMP_CPU_PAUSE()        /* nothing to do */</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_csupport.c b/runtime/src/kmp_csupport.c</font></tt><br>
<tt><font size="2">index 18b6c35..0b7d3ed 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_csupport.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_csupport.c</font></tt><br>
<tt><font size="2">@@ -837,6 +837,19 @@ __kmpc_flush(ident_t *loc, ...)</font></tt><br>
<tt><font size="2">             #endif // KMP_MIC</font></tt><br>
<tt><font size="2">         #elif KMP_ARCH_ARM</font></tt><br>
<tt><font size="2">             // Nothing yet</font></tt><br>
<tt><font size="2">+      #elif KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+            // Nothing needed here (we have a real MB above).</font></tt><br>
<tt><font size="2">+            #if KMP_OS_CNK</font></tt><br>
<tt><font size="2">+              // The flushing thread needs to yield here; this prevents a</font></tt><br>
<tt><font size="2">+              // busy-waiting thread from saturating the pipeline. flush is</font></tt><br>
<tt><font size="2">+              // often used in loops like this:</font></tt><br>
<tt><font size="2">+                // while (!flag) {</font></tt><br>
<tt><font size="2">+                //   #pragma omp flush(flag)</font></tt><br>
<tt><font size="2">+                // }</font></tt><br>
<tt><font size="2">+              // and adding the yield here is good for at least a 10x speedup</font></tt><br>
<tt><font size="2">+              // when running >2 threads per core (on the NAS LU benchmark).</font></tt><br>
<tt><font size="2">+                __kmp_yield(TRUE);</font></tt><br>
<tt><font size="2">+            #endif</font></tt><br>
<tt><font size="2">         #else</font></tt><br>
<tt><font size="2">             #error Unknown or unsupported architecture</font></tt><br>
<tt><font size="2">         #endif</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_ftn_os.h b/runtime/src/kmp_ftn_os.h</font></tt><br>
<tt><font size="2">index f241751..d78d846 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_ftn_os.h</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_ftn_os.h</font></tt><br>
<tt><font size="2">@@ -478,7 +478,7 @@</font></tt><br>
<tt><font size="2"> //#define KMP_API_NAME_GOMP_TARGET_UPDATE                GOMP_target_update</font></tt><br>
<tt><font size="2"> #define KMP_API_NAME_GOMP_TEAMS                          GOMP_teams</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if KMP_OS_LINUX</font></tt><br>
<tt><font size="2">+#if KMP_OS_LINUX && !KMP_OS_CNK && !KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">     #define xstr(x) str(x) </font></tt><br>
<tt><font size="2">     #define str(x) #x</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_global.c b/runtime/src/kmp_global.c</font></tt><br>
<tt><font size="2">index aa1f8e3..d3c3195 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_global.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_global.c</font></tt><br>
<tt><font size="2">@@ -321,7 +321,11 @@ int        __kmp_env_consistency_check  = FALSE;  /* KMP_CONSISTENCY_CHECK speci</font></tt><br>
<tt><font size="2"> kmp_uint32 __kmp_yield_init = KMP_INIT_WAIT;</font></tt><br>
<tt><font size="2"> kmp_uint32 __kmp_yield_next = KMP_NEXT_WAIT;</font></tt><br>
<tt><font size="2"> kmp_uint32 __kmp_yielding_on = 1;</font></tt><br>
<tt><font size="2">+#if KMP_OS_CNK</font></tt><br>
<tt><font size="2">+kmp_uint32 __kmp_yield_cycle = 0;</font></tt><br>
<tt><font size="2">+#else</font></tt><br>
<tt><font size="2"> kmp_uint32 __kmp_yield_cycle = 1;     /* Yield-cycle is on by default */</font></tt><br>
<tt><font size="2">+#endif</font></tt><br>
<tt><font size="2"> kmp_int32  __kmp_yield_on_count = 10; /* By default, yielding is on for 10 monitor periods. */</font></tt><br>
<tt><font size="2"> kmp_int32  __kmp_yield_off_count = 1; /* By default, yielding is off for 1 monitor periods. */</font></tt><br>
<tt><font size="2"> /* ----------------------------------------------------- */</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_gsupport.c b/runtime/src/kmp_gsupport.c</font></tt><br>
<tt><font size="2">index 9d8e553..aa52024 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_gsupport.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_gsupport.c</font></tt><br>
<tt><font size="2">@@ -15,7 +15,7 @@</font></tt><br>
<tt><font size="2"> //===----------------------------------------------------------------------===//</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if defined(__x86_64)</font></tt><br>
<tt><font size="2">+#if defined(__x86_64) || defined (__powerpc64__)</font></tt><br>
<tt><font size="2"> # define KMP_I8</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2"> #include "kmp.h"</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_lock.h b/runtime/src/kmp_lock.h</font></tt><br>
<tt><font size="2">index 8009d18..c5ce838 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_lock.h</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_lock.h</font></tt><br>
<tt><font size="2">@@ -518,7 +518,7 @@ __kmp_destroy_bootstrap_lock( kmp_bootstrap_lock_t *lck )</font></tt><br>
<tt><font size="2"> // Internal RTL locks are also implemented as ticket locks, for now.</font></tt><br>
<tt><font size="2"> //</font></tt><br>
<tt><font size="2"> // FIXME - We should go through and figure out which lock kind works best for</font></tt><br>
<tt><font size="2">-// each internal lock, and use the type deeclaration and function calls for</font></tt><br>
<tt><font size="2">+// each internal lock, and use the type declaration and function calls for</font></tt><br>
<tt><font size="2"> // that explicit lock kind (and get rid of this section).</font></tt><br>
<tt><font size="2"> //</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_os.h b/runtime/src/kmp_os.h</font></tt><br>
<tt><font size="2">index bb5e72f..db1981e 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_os.h</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_os.h</font></tt><br>
<tt><font size="2">@@ -66,10 +66,12 @@</font></tt><br>
<tt><font size="2"> #define KMP_OS_FREEBSD  0</font></tt><br>
<tt><font size="2"> #define KMP_OS_DARWIN   0</font></tt><br>
<tt><font size="2"> #define KMP_OS_WINDOWS    0</font></tt><br>
<tt><font size="2">+#define KMP_OS_CNK      0</font></tt><br>
<tt><font size="2"> #define KMP_OS_UNIX     0  /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> #define KMP_ARCH_X86        0</font></tt><br>
<tt><font size="2"> #define KMP_ARCH_X86_64      0</font></tt><br>
<tt><font size="2">+#define KMP_ARCH_PPC64      0</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> #ifdef _WIN32</font></tt><br>
<tt><font size="2"> # undef KMP_OS_WINDOWS</font></tt><br>
<tt><font size="2">@@ -91,6 +93,11 @@</font></tt><br>
<tt><font size="2"> # define KMP_OS_FREEBSD 1</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+#if ( defined __bgq__ )</font></tt><br>
<tt><font size="2">+# undef KMP_OS_CNK</font></tt><br>
<tt><font size="2">+# define KMP_OS_CNK 1</font></tt><br>
<tt><font size="2">+#endif</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> #if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)</font></tt><br>
<tt><font size="2"> # error Unknown OS</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2">@@ -117,6 +124,9 @@</font></tt><br>
<tt><font size="2"> # elif defined __i386</font></tt><br>
<tt><font size="2"> #  undef KMP_ARCH_X86</font></tt><br>
<tt><font size="2"> #  define KMP_ARCH_X86 1</font></tt><br>
<tt><font size="2">+# elif defined __powerpc64__</font></tt><br>
<tt><font size="2">+#  undef KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+#  define KMP_ARCH_PPC64 1</font></tt><br>
<tt><font size="2"> # endif</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">@@ -156,7 +166,7 @@</font></tt><br>
<tt><font size="2"> # define KMP_ARCH_ARM 1</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM)</font></tt><br>
<tt><font size="2">+#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64)</font></tt><br>
<tt><font size="2"> # error Unknown or unsupported architecture</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">@@ -232,7 +242,7 @@</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> #if KMP_ARCH_X86 || KMP_ARCH_ARM</font></tt><br>
<tt><font size="2"> # define KMP_SIZE_T_SPEC KMP_UINT32_SPEC</font></tt><br>
<tt><font size="2">-#elif KMP_ARCH_X86_64</font></tt><br>
<tt><font size="2">+#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2"> # define KMP_SIZE_T_SPEC KMP_UINT64_SPEC</font></tt><br>
<tt><font size="2"> #else</font></tt><br>
<tt><font size="2"> # error "Can't determine size_t printf format specifier."</font></tt><br>
<tt><font size="2">@@ -657,6 +667,10 @@ extern kmp_real64 __kmp_test_then_add_real64 ( volatile kmp_real64 *p, kmp_real6</font></tt><br>
<tt><font size="2"> # endif</font></tt><br>
<tt><font size="2"> #endif /* KMP_OS_WINDOWS */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+#if KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+# define KMP_MB()       __sync_synchronize()</font></tt><br>
<tt><font size="2">+#endif</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> #ifndef KMP_MB</font></tt><br>
<tt><font size="2"> # define KMP_MB()       /* nothing to do */</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2">@@ -763,7 +777,7 @@ typedef void    (*microtask_t)( int *gtid, int *npr, ... );</font></tt><br>
<tt><font size="2"> #endif /* KMP_I8 */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> /* Workaround for Intel(R) 64 code gen bug when taking address of static array (Intel(R) 64 Tracker #138) */</font></tt><br>
<tt><font size="2">-#if KMP_ARCH_X86_64 && KMP_OS_LINUX</font></tt><br>
<tt><font size="2">+#if (KMP_ARCH_X86_64 || KMP_ARCH_PPC64) && KMP_OS_LINUX</font></tt><br>
<tt><font size="2"> # define STATIC_EFI2_WORKAROUND</font></tt><br>
<tt><font size="2"> #else</font></tt><br>
<tt><font size="2"> # define STATIC_EFI2_WORKAROUND static</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_runtime.c b/runtime/src/kmp_runtime.c</font></tt><br>
<tt><font size="2">index fea41d0..d243700 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_runtime.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_runtime.c</font></tt><br>
<tt><font size="2">@@ -8450,7 +8450,7 @@ __kmp_determine_reduction_method( ident_t *loc, kmp_int32 global_tid,</font></tt><br>
<tt><font size="2">         int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED;</font></tt><br>
<tt><font size="2">         int tree_available   = FAST_REDUCTION_TREE_METHOD_GENERATED;</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-        #if KMP_ARCH_X86_64</font></tt><br>
<tt><font size="2">+        #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">             #if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN</font></tt><br>
<tt><font size="2">                 #if KMP_MIC</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_settings.c b/runtime/src/kmp_settings.c</font></tt><br>
<tt><font size="2">index 54745cb..b85678e 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_settings.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_settings.c</font></tt><br>
<tt><font size="2">@@ -536,6 +536,7 @@ __kmp_stg_parse_file(</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> static char * par_range_to_print = NULL;</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+#ifdef KMP_DEBUG</font></tt><br>
<tt><font size="2"> static void</font></tt><br>
<tt><font size="2"> __kmp_stg_parse_par_range(</font></tt><br>
<tt><font size="2">     char const * name,</font></tt><br>
<tt><font size="2">@@ -614,7 +615,7 @@ __kmp_stg_parse_par_range(</font></tt><br>
<tt><font size="2">         break;</font></tt><br>
<tt><font size="2">     }</font></tt><br>
<tt><font size="2"> } // __kmp_stg_parse_par_range</font></tt><br>
<tt><font size="2">-</font></tt><br>
<tt><font size="2">+#endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> int</font></tt><br>
<tt><font size="2"> __kmp_initial_threads_capacity( int req_nproc )</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/kmp_version.c b/runtime/src/kmp_version.c</font></tt><br>
<tt><font size="2">index f64d052..5dc82d1 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/kmp_version.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/kmp_version.c</font></tt><br>
<tt><font size="2">@@ -20,7 +20,7 @@</font></tt><br>
<tt><font size="2"> #include "kmp_version.h"</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> // Replace with snapshot date YYYYMMDD for promotion build.</font></tt><br>
<tt><font size="2">-#define KMP_VERSION_BUILD    00000000</font></tt><br>
<tt><font size="2">+//#define KMP_VERSION_BUILD    00000000</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> // Helper macros to convert value of macro to string literal.</font></tt><br>
<tt><font size="2"> #define _stringer( x ) #x</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/makefile.mk b/runtime/src/makefile.mk</font></tt><br>
<tt><font size="2">index 9be8799..84d6ac2 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/makefile.mk</font></tt><br>
<tt><font size="2">+++ b/runtime/src/makefile.mk</font></tt><br>
<tt><font size="2">@@ -310,6 +310,9 @@ endif</font></tt><br>
<tt><font size="2"> ifeq "$(CPLUSPLUS)" "on"</font></tt><br>
<tt><font size="2">     ifeq "$(os)" "win"</font></tt><br>
<tt><font size="2">         c-flags   += -TP</font></tt><br>
<tt><font size="2">+    else ifeq "$(arch)" "ppc64"</font></tt><br>
<tt><font size="2">+    # c++0x on ppc64 linux removes definition of preproc. macros, needed in .hs</font></tt><br>
<tt><font size="2">+            c-flags   += -x c++ -std=gnu++0x</font></tt><br>
<tt><font size="2">     else</font></tt><br>
<tt><font size="2">         ifneq "$(filter gcc clang,$(c))" ""</font></tt><br>
<tt><font size="2">             c-flags   += -x c++ -std=c++0x</font></tt><br>
<tt><font size="2">@@ -370,7 +373,7 @@ ifeq "$(os)" "lin"</font></tt><br>
<tt><font size="2">             ld-flags-extra += -lirc_pic</font></tt><br>
<tt><font size="2">             endif</font></tt><br>
<tt><font size="2">         endif</font></tt><br>
<tt><font size="2">-        ifeq "$(filter 32 32e 64,$(arch))" ""</font></tt><br>
<tt><font size="2">+        ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""</font></tt><br>
<tt><font size="2">             ld-flags-extra += $(shell pkg-config --libs libffi)</font></tt><br>
<tt><font size="2">         endif</font></tt><br>
<tt><font size="2">     else</font></tt><br>
<tt><font size="2">@@ -581,9 +584,12 @@ ifneq "$(os)" "win"</font></tt><br>
<tt><font size="2">     ifeq "$(arch)" "arm"</font></tt><br>
<tt><font size="2">         z_Linux_asm$(obj) : \</font></tt><br>
<tt><font size="2">              cpp-flags += -D KMP_ARCH_ARM</font></tt><br>
<tt><font size="2">-    else</font></tt><br>
<tt><font size="2">+    else ifeq "$(arch)" "ppc64"</font></tt><br>
<tt><font size="2">+        z_Linux_asm$(obj) : \</font></tt><br>
<tt><font size="2">+                  cpp-flags += -D KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+      else</font></tt><br>
<tt><font size="2">         z_Linux_asm$(obj) : \</font></tt><br>
<tt><font size="2">-            cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e,$(arch)),_64)</font></tt><br>
<tt><font size="2">+                   cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e,$(arch)),_64)               </font></tt><br>
<tt><font size="2">     endif</font></tt><br>
<tt><font size="2"> endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">@@ -729,7 +735,9 @@ endif</font></tt><br>
<tt><font size="2">         else # 5</font></tt><br>
<tt><font size="2">             lib_c_items += kmp_gsupport</font></tt><br>
<tt><font size="2">         endif</font></tt><br>
<tt><font size="2">+#        ifneq "$(arch)" "ppc64"</font></tt><br>
<tt><font size="2">         lib_asm_items += z_Linux_asm</font></tt><br>
<tt><font size="2">+#         endif</font></tt><br>
<tt><font size="2">     endif</font></tt><br>
<tt><font size="2"> endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">@@ -1391,9 +1399,13 @@ ifneq "$(filter %-dyna win-%,$(os)-$(LINK_TYPE))" ""</font></tt><br>
<tt><font size="2">             td_exp += libc.so.6</font></tt><br>
<tt><font size="2">             td_exp += ld-linux-armhf.so.3</font></tt><br>
<tt><font size="2">         endif</font></tt><br>
<tt><font size="2">+        ifeq "$(arch)" "ppc64"</font></tt><br>
<tt><font size="2">+            td_exp += libc.so.6</font></tt><br>
<tt><font size="2">+            td_exp += ld64.so.1</font></tt><br>
<tt><font size="2">+        endif</font></tt><br>
<tt><font size="2">         td_exp += libdl.so.2</font></tt><br>
<tt><font size="2">         td_exp += libgcc_s.so.1</font></tt><br>
<tt><font size="2">-        ifeq "$(filter 32 32e 64,$(arch))" ""</font></tt><br>
<tt><font size="2">+        ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""</font></tt><br>
<tt><font size="2">             td_exp += libffi.so.6</font></tt><br>
<tt><font size="2">             td_exp += libffi.so.5</font></tt><br>
<tt><font size="2">         endif</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_config.h b/runtime/src/thirdparty/ittnotify/ittnotify_config.h</font></tt><br>
<tt><font size="2">index 40c8614..9e7b36b 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/thirdparty/ittnotify/ittnotify_config.h</font></tt><br>
<tt><font size="2">+++ b/runtime/src/thirdparty/ittnotify/ittnotify_config.h</font></tt><br>
<tt><font size="2">@@ -132,6 +132,11 @@</font></tt><br>
<tt><font size="2"> #  define ITT_ARCH_ARM  4</font></tt><br>
<tt><font size="2"> #endif /* ITT_ARCH_ARM */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+#ifndef ITT_ARCH_PPC64</font></tt><br>
<tt><font size="2">+#  define ITT_ARCH_PPC64  5</font></tt><br>
<tt><font size="2">+#endif /* ITT_ARCH_PPC64 */</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> #ifndef ITT_ARCH</font></tt><br>
<tt><font size="2"> #  if defined _M_IX86 || defined __i386__</font></tt><br>
<tt><font size="2"> #    define ITT_ARCH ITT_ARCH_IA32</font></tt><br>
<tt><font size="2">@@ -141,6 +146,8 @@</font></tt><br>
<tt><font size="2"> #    define ITT_ARCH ITT_ARCH_IA64</font></tt><br>
<tt><font size="2"> #  elif defined _M_ARM || __arm__</font></tt><br>
<tt><font size="2"> #    define ITT_ARCH ITT_ARCH_ARM</font></tt><br>
<tt><font size="2">+#  elif defined __powerpc64__</font></tt><br>
<tt><font size="2">+#    define ITT_ARCH ITT_ARCH_PPC64</font></tt><br>
<tt><font size="2"> #  endif</font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">@@ -274,7 +281,7 @@ ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)</font></tt><br>
<tt><font size="2">                           : "memory");</font></tt><br>
<tt><font size="2">     return result;</font></tt><br>
<tt><font size="2"> }</font></tt><br>
<tt><font size="2">-#elif ITT_ARCH==ITT_ARCH_ARM</font></tt><br>
<tt><font size="2">+#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64</font></tt><br>
<tt><font size="2"> #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)</font></tt><br>
<tt><font size="2"> #endif /* ITT_ARCH==ITT_ARCH_IA64 */</font></tt><br>
<tt><font size="2"> #ifndef ITT_SIMPLE_INIT</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/z_Linux_asm.s b/runtime/src/z_Linux_asm.s</font></tt><br>
<tt><font size="2">index 1f1ba1b..64c8052 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/z_Linux_asm.s</font></tt><br>
<tt><font size="2">+++ b/runtime/src/z_Linux_asm.s</font></tt><br>
<tt><font size="2">@@ -138,7 +138,7 @@ __kmp_unnamed_critical_addr:</font></tt><br>
<tt><font size="2"> #endif /* KMP_GOMP_COMPAT */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if KMP_ARCH_X86</font></tt><br>
<tt><font size="2">+#if KMP_ARCH_X86 && !KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> // -----------------------------------------------------------------------</font></tt><br>
<tt><font size="2"> // microtasking routines specifically written for IA-32 architecture</font></tt><br>
<tt><font size="2">@@ -1585,6 +1585,16 @@ __kmp_unnamed_critical_addr:</font></tt><br>
<tt><font size="2">     .size __kmp_unnamed_critical_addr,4</font></tt><br>
<tt><font size="2"> #endif /* KMP_ARCH_ARM */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+#if KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+    .data</font></tt><br>
<tt><font size="2">+    .comm .gomp_critical_user_,32,8</font></tt><br>
<tt><font size="2">+    .data</font></tt><br>
<tt><font size="2">+    .align 8</font></tt><br>
<tt><font size="2">+    .global __kmp_unnamed_critical_addr</font></tt><br>
<tt><font size="2">+__kmp_unnamed_criti
cal_addr:</font></tt><br>
<tt><font size="2">+    .8byte .gomp_critical_user_</font></tt><br>
<tt><font size="2">+    .size __kmp_unnamed_critical_addr,8</font></tt><br>
<tt><font size="2">+#endif /* KMP_ARCH_PPC64 */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> #if defined(__linux__)</font></tt><br>
<tt><font size="2"> .section .note.GNU-stack,"",@progbits</font></tt><br>
<tt><font size="2">diff --git a/runtime/src/z_Linux_util.c b/runtime/src/z_Linux_util.c</font></tt><br>
<tt><font size="2">index 7633f99..348f5d8 100644</font></tt><br>
<tt><font size="2">--- a/runtime/src/z_Linux_util.c</font></tt><br>
<tt><font size="2">+++ b/runtime/src/z_Linux_util.c</font></tt><br>
<tt><font size="2">@@ -32,7 +32,7 @@</font></tt><br>
<tt><font size="2"> #include <sys/resource.h></font></tt><br>
<tt><font size="2"> #include <sys/syscall.h></font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if KMP_OS_LINUX</font></tt><br>
<tt><font size="2">+#if KMP_OS_LINUX && !KMP_OS_CNK</font></tt><br>
<tt><font size="2"> # include <sys/sysinfo.h></font></tt><br>
<tt><font size="2"> # if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)</font></tt><br>
<tt><font size="2"> // We should really include <futex.h>, but that causes compatibility problems on different</font></tt><br>
<tt><font size="2">@@ -61,7 +61,7 @@</font></tt><br>
<tt><font size="2"> #include <fcntl.h></font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> // For non-x86 architecture</font></tt><br>
<tt><font size="2">-#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)</font></tt><br>
<tt><font size="2">+#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64)</font></tt><br>
<tt><font size="2"> # include <stdbool.h></font></tt><br>
<tt><font size="2"> # include <ffi.h></font></tt><br>
<tt><font size="2"> #endif</font></tt><br>
<tt><font size="2">@@ -110,7 +110,7 @@ __kmp_print_cond( char *buffer, kmp_cond_align_t *cond )</font></tt><br>
<tt><font size="2"> /* ------------------------------------------------------------------------ */</font></tt><br>
<tt><font size="2"> /* ------------------------------------------------------------------------ */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED</font></tt><br>
<tt><font size="2">+#if ( KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED)</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> /*</font></tt><br>
<tt><font size="2">  * Affinity support</font></tt><br>
<tt><font size="2">@@ -147,6 +147,19 @@ __kmp_print_cond( char *buffer, kmp_cond_align_t *cond )</font></tt><br>
<tt><font size="2"> #    error Wrong code for getaffinity system call.</font></tt><br>
<tt><font size="2"> #   endif /* __NR_sched_getaffinity */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">+#  elif KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+#   ifndef __NR_sched_setaffinity</font></tt><br>
<tt><font size="2">+#    define __NR_sched_setaffinity  222</font></tt><br>
<tt><font size="2">+#   elif __NR_sched_setaffinity != 222</font></tt><br>
<tt><font size="2">+#    error Wrong code for setaffinity system call.</font></tt><br>
<tt><font size="2">+#   endif /* __NR_sched_setaffinity */</font></tt><br>
<tt><font size="2">+#   ifndef __NR_sched_getaffinity</font></tt><br>
<tt><font size="2">+#    define __NR_sched_getaffinity  223</font></tt><br>
<tt><font size="2">+#   elif __NR_sched_getaffinity != 223</font></tt><br>
<tt><font size="2">+#    error Wrong code for getaffinity system call.</font></tt><br>
<tt><font size="2">+#   endif /* __NR_sched_getaffinity */</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2"> #  else</font></tt><br>
<tt><font size="2"> #   error Unknown or unsupported architecture</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">@@ -445,7 +458,7 @@ __kmp_change_thread_affinity_mask( int gtid, kmp_affin_mask_t *new_mask,</font></tt><br>
<tt><font size="2"> /* ------------------------------------------------------------------------ */</font></tt><br>
<tt><font size="2"> /* ------------------------------------------------------------------------ */</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)</font></tt><br>
<tt><font size="2">+#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) && !KMP_OS_CNK</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> int</font></tt><br>
<tt><font size="2"> __kmp_futex_determine_capable()</font></tt><br>
<tt><font size="2">@@ -462,7 +475,7 @@ __kmp_futex_determine_capable()</font></tt><br>
<tt><font size="2">     return retval;</font></tt><br>
<tt><font size="2"> }</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)</font></tt><br>
<tt><font size="2">+#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) && !KMP_OS_CNK</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> /* ------------------------------------------------------------------------ */</font></tt><br>
<tt><font size="2"> /* ------------------------------------------------------------------------ */</font></tt><br>
<tt><font size="2">@@ -481,7 +494,7 @@ __kmp_test_then_or32( volatile kmp_int32 *p, kmp_int32 d )</font></tt><br>
<tt><font size="2">     old_value = TCR_4( *p );</font></tt><br>
<tt><font size="2">     new_value = old_value | d;</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-    while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">+    while ( ! KMP_COMPARE_AND_STORE_REL32 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">     {</font></tt><br>
<tt><font size="2">         KMP_CPU_PAUSE();</font></tt><br>
<tt><font size="2">         old_value = TCR_4( *p );</font></tt><br>
<tt><font size="2">@@ -498,7 +511,7 @@ __kmp_test_then_and32( volatile kmp_int32 *p, kmp_int32 d )</font></tt><br>
<tt><font size="2">     old_value = TCR_4( *p );</font></tt><br>
<tt><font size="2">     new_value = old_value & d;</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-    while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">+    while ( ! KMP_COMPARE_AND_STORE_REL32 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">     {</font></tt><br>
<tt><font size="2">         KMP_CPU_PAUSE();</font></tt><br>
<tt><font size="2">         old_value = TCR_4( *p );</font></tt><br>
<tt><font size="2">@@ -507,7 +520,7 @@ __kmp_test_then_and32( volatile kmp_int32 *p, kmp_int32 d )</font></tt><br>
<tt><font size="2">     return old_value;</font></tt><br>
<tt><font size="2"> }</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-# if KMP_ARCH_X86</font></tt><br>
<tt><font size="2">+# if KMP_ARCH_X86 || KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2"> kmp_int64</font></tt><br>
<tt><font size="2"> __kmp_test_then_add64( volatile kmp_int64 *p, kmp_int64 d )</font></tt><br>
<tt><font size="2"> {</font></tt><br>
<tt><font size="2">@@ -516,7 +529,7 @@ __kmp_test_then_add64( volatile kmp_int64 *p, kmp_int64 d )</font></tt><br>
<tt><font size="2">     old_value = TCR_8( *p );</font></tt><br>
<tt><font size="2">     new_value = old_value + d;</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-    while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">+    while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">     {</font></tt><br>
<tt><font size="2">         KMP_CPU_PAUSE();</font></tt><br>
<tt><font size="2">         old_value = TCR_8( *p );</font></tt><br>
<tt><font size="2">@@ -533,7 +546,7 @@ __kmp_test_then_or64( volatile kmp_int64 *p, kmp_int64 d )</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">     old_value = TCR_8( *p );</font></tt><br>
<tt><font size="2">     new_value = old_value | d;</font></tt><br>
<tt><font size="2">-    while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">+    while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">     {</font></tt><br>
<tt><font size="2">         KMP_CPU_PAUSE();</font></tt><br>
<tt><font size="2">         old_value = TCR_8( *p );</font></tt><br>
<tt><font size="2">@@ -549,7 +562,7 @@ __kmp_test_then_and64( volatile kmp_int64 *p, kmp_int64 d )</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">     old_value = TCR_8( *p );</font></tt><br>
<tt><font size="2">     new_value = old_value & d;</font></tt><br>
<tt><font size="2">-    while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">+    while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) )</font></tt><br>
<tt><font size="2">     {</font></tt><br>
<tt><font size="2">         KMP_CPU_PAUSE();</font></tt><br>
<tt><font size="2">         old_value = TCR_8( *p );</font></tt><br>
<tt><font size="2">@@ -2527,7 +2540,7 @@ __kmp_get_load_balance( int max )</font></tt><br>
<tt><font size="2"> #endif // USE_LOAD_BALANCE</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)</font></tt><br>
<tt><font size="2">+#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64)</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, int argc,</font></tt><br>
<tt><font size="2">         void *p_argv[] )</font></tt><br>
<tt><font size="2">@@ -2561,7 +2574,89 @@ int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, int argc,</font></tt><br>
<tt><font size="2">     return 1;</font></tt><br>
<tt><font size="2"> }</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">-#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)</font></tt><br>
<tt><font size="2">+#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64)</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+#if KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+// we really only need the case with 1 argument, because CLANG always build</font></tt><br>
<tt><font size="2">+// a struct of pointers to shared variables referenced in the outlined function</font></tt><br>
<tt><font size="2">+int</font></tt><br>
<tt><font size="2">+__kmp_invoke_microtask( microtask_t pkfn,</font></tt><br>
<tt><font size="2">+                        int gtid, int tid,</font></tt><br>
<tt><font size="2">+                        int argc, void *p_argv[] ) {</font></tt><br>
<tt><font size="2">+  switch (argc) {</font></tt><br>
<tt><font size="2">+  default:</font></tt><br>
<tt><font size="2">+    fprintf(stderr, "Too many args to microtask: %d!\n", argc);</font></tt><br>
<tt><font size="2">+    fflush(stderr);</font></tt><br>
<tt><font size="2">+    exit(-1);</font></tt><br>
<tt><font size="2">+  case 0:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 1:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 2:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 3:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 4:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 5:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 6:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 7:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 8:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 9:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 10:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 11:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 12:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10],</font></tt><br>
<tt><font size="2">+            p_argv[11]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 13:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10],</font></tt><br>
<tt><font size="2">+            p_argv[11], p_argv[12]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 14:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10],</font></tt><br>
<tt><font size="2">+            p_argv[11], p_argv[12], p_argv[13]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  case 15:</font></tt><br>
<tt><font size="2">+    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4],</font></tt><br>
<tt><font size="2">+            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10],</font></tt><br>
<tt><font size="2">+            p_argv[11], p_argv[12], p_argv[13], p_argv[14]);</font></tt><br>
<tt><font size="2">+    break;</font></tt><br>
<tt><font size="2">+  }</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+  return 1;</font></tt><br>
<tt><font size="2">+}</font></tt><br>
<tt><font size="2">+</font></tt><br>
<tt><font size="2">+#endif</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> // end of file //</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">diff --git a/runtime/tools/lib/Platform.pm b/runtime/tools/lib/Platform.pm</font></tt><br>
<tt><font size="2">index 5b399f7..763f3cb 100644</font></tt><br>
<tt><font size="2">--- a/runtime/tools/lib/Platform.pm</font></tt><br>
<tt><font size="2">+++ b/runtime/tools/lib/Platform.pm</font></tt><br>
<tt><font size="2">@@ -50,6 +50,8 @@ sub canon_arch($) {</font></tt><br>
<tt><font size="2">             $arch = "32e";</font></tt><br>
<tt><font size="2">         } elsif ( $arch =~ m{\Aarm(?:v7\D*)?\z} ) {</font></tt><br>
<tt><font size="2">             $arch = "arm";</font></tt><br>
<tt><font size="2">+        } elsif ( $arch =~ m{\Appc64} ) {</font></tt><br>
<tt><font size="2">+          $arch = "ppc64";</font></tt><br>
<tt><font size="2">         } else {</font></tt><br>
<tt><font size="2">             $arch = undef;</font></tt><br>
<tt><font size="2">         }; # if</font></tt><br>
<tt><font size="2">@@ -62,6 +64,7 @@ sub canon_arch($) {</font></tt><br>
<tt><font size="2">         "32"  => "IA-32 architecture",</font></tt><br>
<tt><font size="2">         "32e" => "Intel(R) 64",</font></tt><br>
<tt><font size="2">         "arm" => "ARM",</font></tt><br>
<tt><font size="2">+        "ppc64" => "PPC64",</font></tt><br>
<tt><font size="2">     );</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">     sub legal_arch($) {</font></tt><br>
<tt><font size="2">@@ -159,6 +162,8 @@ sub target_options() {</font></tt><br>
<tt><font size="2">         $_host_arch = "32e";</font></tt><br>
<tt><font size="2">     } elsif ( $hardware_platform eq "arm" ) {</font></tt><br>
<tt><font size="2">         $_host_arch = "arm";</font></tt><br>
<tt><font size="2">+    } elsif ( $hardware_platform eq "ppc64" ) {</font></tt><br>
<tt><font size="2">+        $_host_arch = "ppc64";</font></tt><br>
<tt><font size="2">     } else {</font></tt><br>
<tt><font size="2">         die "Unsupported host hardware platform: \"$hardware_platform\"; stopped";</font></tt><br>
<tt><font size="2">     }; # if</font></tt><br>
<tt><font size="2">diff --git a/runtime/tools/lib/Uname.pm b/runtime/tools/lib/Uname.pm</font></tt><br>
<tt><font size="2">index e212501..52518b4 100644</font></tt><br>
<tt><font size="2">--- a/runtime/tools/lib/Uname.pm</font></tt><br>
<tt><font size="2">+++ b/runtime/tools/lib/Uname.pm</font></tt><br>
<tt><font size="2">@@ -147,6 +147,8 @@ if ( 0 ) {</font></tt><br>
<tt><font size="2">         $values{ hardware_platform } = "x86_64";</font></tt><br>
<tt><font size="2">     } elsif ( $values{ machine } =~ m{\Aarmv7\D*\z} ) {</font></tt><br>
<tt><font size="2">         $values{ hardware_platform } = "arm";</font></tt><br>
<tt><font size="2">+    } elsif ( $values{ machine } =~ m{\Appc64\z} ) {</font></tt><br>
<tt><font size="2">+        $values{ hardware_platform } = "ppc64";</font></tt><br>
<tt><font size="2">     } else {</font></tt><br>
<tt><font size="2">         die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";</font></tt><br>
<tt><font size="2">     }; # if</font></tt><br>
<tt><font size="2">diff --git a/runtime/tools/src/common-defs.mk b/runtime/tools/src/common-defs.mk</font></tt><br>
<tt><font size="2">index ebd1922..7eb64b0 100644</font></tt><br>
<tt><font size="2">--- a/runtime/tools/src/common-defs.mk</font></tt><br>
<tt><font size="2">+++ b/runtime/tools/src/common-defs.mk</font></tt><br>
<tt><font size="2">@@ -45,7 +45,7 @@ endif</font></tt><br>
<tt><font size="2"> # Description:</font></tt><br>
<tt><font size="2"> #     The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64.</font></tt><br>
<tt><font size="2"> #</font></tt><br>
<tt><font size="2">-legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(error Bad architecture specified: $(1))))))</font></tt><br>
<tt><font size="2">+legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(error Bad architecture specified: $(1)))))))</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> # Synopsis:</font></tt><br>
<tt><font size="2"> #     var_name = $(call check_variable,var,list)</font></tt><br>
<tt><font size="2">@@ -128,9 +128,9 @@ endif</font></tt><br>
<tt><font size="2"> # --------------------------------------------------------------------------------------------------</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2"> os       := $(call check_variable,os,lin lrb mac win)</font></tt><br>
<tt><font size="2">-arch     := $(call check_variable,arch,32 32e 64 arm)</font></tt><br>
<tt><font size="2">+arch     := $(call check_variable,arch,32 32e 64 arm ppc64)</font></tt><br>
<tt><font size="2"> platform := $(os)_$(arch)</font></tt><br>
<tt><font size="2">-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)</font></tt><br>
<tt><font size="2">+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></tt><br>
<tt><font size="2"> # oa-opts means "os and arch options". They are passed to almost all perl scripts.</font></tt><br>
<tt><font size="2"> oa-opts  := --os=$(os) --arch=$(arch)</font></tt><br>
<tt><font size="2"> </font></tt><br>
<tt><font size="2">diff --git a/runtime/tools/src/common-tools.mk b/runtime/tools/src/common-tools.mk</font></tt><br>
<tt><font size="2">index a9c9fbc..8c86791 100644</font></tt><br>
<tt><font size="2">--- a/runtime/tools/src/common-tools.mk</font></tt><br>
<tt><font size="2">+++ b/runtime/tools/src/common-tools.mk</font></tt><br>
<tt><font size="2">@@ -34,7 +34,7 @@</font></tt><br>
<tt><font size="2"> # "No rule to build .\kmp_i18n.inc". Using "./" solves the problem.</font></tt><br>
<tt><font size="2"> cpp-flags += -I ./</font></tt><br>
<tt><font size="2"> # For non-x86 architecture</font></tt><br>
<tt><font size="2">-ifeq "$(filter 32 32e 64,$(arch))" ""</font></tt><br>
<tt><font size="2">+ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""</font></tt><br>
<tt><font size="2">     cpp-flags += $(shell pkg-config --cflags libffi)</font></tt><br>
<tt><font size="2"> endif</font></tt><br>
<tt><font size="2"> # Add all VPATH directories to path for searching include files.</font></tt><br>
<br>
<tt><font size="2"><br>
</font></tt><br>
<tt><font size="2"><br>
> ------------------------------<br>
> <br>
> Message: 2<br>
> Date: Thu, 17 Jul 2014 13:43:56 -0400<br>
> From: Carlo Bertolli <cbertol@us.ibm.com><br>
> To: openmp-commits@dcs-maillist2.engr.illinois.edu<br>
> Cc: Michael Wong <michaelw@ca.ibm.com>, "Peyton,   Jonathan L"<br>
>    <jonathan.l.peyton@intel.com>,   Samuel F Antao <sfantao@us.ibm.com><br>
> Subject: [Openmp-commits] Add support for BGQ and PPC64<br>
> Message-ID:<br>
>    <OFB10D84DF.82E6C374-ON85257D18.0060BAA2-85257D18.006166FF@us.ibm.com><br>
> Content-Type: text/plain; charset="us-ascii"<br>
> <br>
> <br>
> <br>
> Hi,<br>
> <br>
> Attached a patch built on top of Hal Finkel's BGQ patch for PPC64 (thanks<br>
> Hal).<br>
> In this patch, I extended the existing cmake system while waiting for<br>
> patches from Intel, which I will fix once they get in.<br>
> <br>
> -- Carlo<br>
> <br>
> <br>
> <br>
> diff --git a/runtime/Makefile.bgq b/runtime/Makefile.bgq<br>
> new file mode 100644<br>
> index 0000000..d9aa914<br>
> --- /dev/null<br>
> +++ b/runtime/Makefile.bgq<br>
> @@ -0,0 +1,76 @@<br>
> +date := $(shell date '+%Y%m%d')<br>
> +<br>
> +FEATURE_FLAGS = -DOMP_40_ENABLED=1 -DOMP_30_ENABLED=1 -DOMP_VERSION=201107<br>
> -DKMP_VERSION_MAJOR=5 \<br>
> +      -DCACHE_LINE=64 -DKMP_ADJUST_BLOCKTIME=1 -DBUILD_I8<br>
> -DKMP_USE_ADAPTIVE_LOCKS=0 \<br>
> +      -DKMP_DEBUG_ADAPTIVE_LOCKS=0 -DINTEL_NO_ITTNOTIFY_API<br>
> -DKMP_VERSION_MINOR=0 -DKMP_VERSION_BUILD=0 \<br>
> +      -DKMP_LIBRARY_FILE=\"libiomp5.so\" -D_KMP_BUILD_TIME="\"$(date)\""<br>
> -DKMP_GOMP_COMPAT<br>
> +<br>
> +CPPFLAGS = ${FEATURE_FLAGS} -D__float128='long double'<br>
> +<br>
> +CC = powerpc64-bgq-linux-gcc<br>
> +CXX = powerpc64-bgq-linux-g++<br>
> +<br>
> +all: build/libiomp5.a build/libiomp5.so<br>
> +<br>
> +build/.dir:<br>
> +   mkdir -p build<br>
> +   touch build/.dir<br>
> +<br>
> +build/omp.h:<br>
> +   perl tools/expand-vars.pl --strict $$(echo $(FEATURE_FLAGS) | sed<br>
> 's/-D/-D /g') \<br>
> +     -D KMP_BUILD_DATE=$(date) -D Revision=Revision -D Date=Date \<br>
> +     src/include/40/omp.h.var build/omp.h<br>
> +<br>
> +build/%.o: src/%.cpp build/kmp_i18n_id.inc build/kmp_i18n_default.inc<br>
> build/omp.h<br>
> +   ${CXX} -c ${CPPFLAGS} -g -O3 -Isrc -Ibuild -o $@ $<<br>
> +<br>
> +build/%.o: src/%.c build/kmp_i18n_id.inc build/kmp_i18n_default.inc<br>
> build/omp.h<br>
> +   ${CC} -x c++ -c ${CPPFLAGS} -g -O3 -Isrc -Ibuild -o $@ $<<br>
> +<br>
> +OBJS =   build/kmp_alloc.o \<br>
> +   build/kmp_atomic.o \<br>
> +   build/kmp_cancel.o \<br>
> +   build/kmp_csupport.o \<br>
> +   build/kmp_dispatch.o \<br>
> +   build/kmp_debug.o \<br>
> +   build/kmp_environment.o \<br>
> +   build/kmp_error.o \<br>
> +   build/kmp_ftn_cdecl.o \<br>
> +   build/kmp_ftn_extra.o \<br>
> +   build/kmp_ftn_stdcall.o \<br>
> +   build/kmp_global.o \<br>
> +   build/kmp_i18n.o \<br>
> +   build/kmp_io.o \<br>
> +   build/kmp_itt.o \<br>
> +   build/kmp_runtime.o \<br>
> +   build/kmp_settings.o \<br>
> +   build/kmp_sched.o \<br>
> +   build/kmp_str.o \<br>
> +   build/kmp_tasking.o \<br>
> +   build/kmp_taskq.o \<br>
> +   build/kmp_taskdeps.o \<br>
> +   build/kmp_threadprivate.o \<br>
> +   build/kmp_utility.o \<br>
> +   build/kmp_version.o \<br>
> +   build/kmp_lock.o \<br>
> +   build/z_Linux_util.o<br>
> +<br>
> +BGSYS_FLOOR=$(shell readlink /bgsys/drivers/ppcfloor)<br>
> +build/libiomp5.so: $(OBJS)<br>
> +   ${CXX} -Wl,--build-id -Wl,-rpath -Wl,$<br>
> {BGSYS_FLOOR}/gnu-linux/powerpc64-bgq-linux/lib -shared -o $@.1.0 $^<br>
> -Wl,-soname,$(shell basename $@.1) -lpthread<br>
> +   (cd $(shell dirname $@) && ln -sf $(shell basename $@.1.0) $(shell<br>
> basename $@.1))<br>
> +   (cd $(shell dirname $@) && ln -sf $(shell basename $@.1) $(shell<br>
> basename $@))<br>
> +# Note: We should not need the --build-id when we switch to clang (it<br>
> should add it for us).<br>
> +<br>
> +build/libiomp5.a: $(OBJS)<br>
> +   ar cr $@ $^<br>
> +<br>
> +build/kmp_i18n_id.inc: src/i18n/en_US.txt tools/message-converter.pl<br>
> build/.dir<br>
> +   perl tools/message-converter.pl --prefix=kmp_i18n --enum=$@ $<<br>
> +<br>
> +build/kmp_i18n_default.inc: src/i18n/en_US.txt tools/message-converter.pl<br>
> build/.dir<br>
> +   perl tools/message-converter.pl --prefix=kmp_i18n --default=$@ $<<br>
> +<br>
> +clean:<br>
> +   rm -rf build<br>
> +<br>
> diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt<br>
> index dd29966..4814cb4 100644<br>
> --- a/runtime/src/CMakeLists.txt<br>
> +++ b/runtime/src/CMakeLists.txt<br>
> @@ -12,6 +12,9 @@ include_directories(<br>
>    ${CMAKE_CURRENT_BINARY_DIR}<br>
>  )<br>
> <br>
> +# detect architecture<br>
> +EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE<br>
> ARCH )<br>
> +<br>
>  if(WIN32)<br>
>    set(OS_GEN "win")<br>
>  elseif(APPLE)<br>
> @@ -22,12 +25,14 @@ else()<br>
>    message(FATAL_ERROR "Unsupported OS")<br>
>  endif()<br>
> <br>
> -if("${ARCH}" STREQUAL "")<br>
> +if(NOT "${ARCH}" STREQUAL "ppc64")<br>
>    set(ARCH "32e")<br>
> +  set(ARCH_STR "Intel(R) 64")<br>
> +else()<br>
> +# arch already set above<br>
> +  set(ARCH_STR "PPC64")<br>
>  endif()<br>
> <br>
> -set(ARCH_STR "Intel(R) 64")<br>
> -<br>
>  set(FEATURE_FLAGS "-D USE_ITT_BUILD")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D NDEBUG")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ARCH_STR=\"\\\"$<br>
> {ARCH_STR}\\\"\"")<br>
> @@ -50,8 +55,13 @@ set(FEATURE_FLAGS "${FEATURE_FLAGS} -D<br>
> USE_LOAD_BALANCE")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_CBLKDATA")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D GUIDEDLL_EXPORTS")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_GOMP_COMPAT")<br>
> -set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")<br>
> -set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")<br>
> +<br>
> +#adaptive locks use x86 assembly - disable for ppc64<br>
> +if(NOT "${ARCH}" STREQUAL "ppc64")<br>
> +   set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")<br>
> +   set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")<br>
> +endif()<br>
> +<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_50_ENABLED=0")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_41_ENABLED=0")<br>
>  set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_40_ENABLED=1")<br>
> @@ -122,16 +132,35 @@ add_custom_command(<br>
>    OUTPUT omp.h<br>
>      COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/expand-vars.pl<br>
> --strict -D Revision=\"\\$$Revision\" -D Date=\"\\$$Date\" -D KMP_TYPE=<br>
> \"Performance\" -D KMP_ARCH=\"\\\"${ARCH_STR}\\\"\" -D KMP_VERSION_MAJOR=$<br>
> {VERSION} -D KMP_VERSION_MINOR=0 -D KMP_VERSION_BUILD=00000000 -D<br>
> KMP_BUILD_DATE=\"${BUILD_TIME} UTC\" -D KMP_TARGET_COMPILER=12 -D<br>
> KMP_DIAG=0 -D KMP_DEBUG_INFO=0 -D OMP_VERSION=${OMP_VERSION} $<br>
> {CMAKE_CURRENT_SOURCE_DIR}/include/${OMP_VERSION_NUM}/omp.h.var omp.h<br>
>  )<br>
> -add_custom_command(<br>
> -  OUTPUT z_Linux_asm.o<br>
> -    COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D KMP_ASM_INTRINS<br>
> -D KMP_GOMP_COMPAT -D KMP_ARCH_X86_64 -x assembler-with-cpp $<br>
> {CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}<br>
> -)<br>
> +<br>
> +if(NOT "${ARCH}" STREQUAL "ppc64")<br>
> +   add_custom_command(<br>
> +        OUTPUT z_Linux_asm.o<br>
> +          COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D<br>
> KMP_ASM_INTRINS -D KMP_GOMP_COMPAT -D KMP_ARCH_X86_64 -x assembler-with-cpp<br>
> ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}<br>
> +   )<br>
> +else()<br>
> +   add_custom_command(<br>
> +        OUTPUT z_Linux_asm.o<br>
> +          COMMAND ${CMAKE_CXX_COMPILER} -c -o z_Linux_asm.o -D<br>
> KMP_ASM_INTRINS -D KMP_GOMP_COMPAT -D KMP_ARCH_PPC64 -x assembler-with-cpp<br>
> ${CMAKE_CURRENT_SOURCE_DIR}/${ASM_SOURCES}<br>
> +   )<br>
> +<br>
> +endif()<br>
> +<br>
> <br>
>  add_custom_target(gen_kmp_i18n DEPENDS kmp_i18n_id.inc<br>
> kmp_i18n_default.inc omp.h z_Linux_asm.o)<br>
> <br>
>  if(NOT APPLE)<br>
> -  set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=$<br>
> {CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt")<br>
> +   set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=$<br>
> {CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt -ldl")<br>
>  endif()<br>
> <br>
>  add_library(iomp5 SHARED ${SOURCES} z_Linux_asm.o)<br>
> +<br>
> +# This is a workaround to a known ppc64 issue about libpthread. For more<br>
> +# information see<br>
> +#<br>
> <a href="http://ryanarn.blogspot.com/2011/07/curious-case-of-pthreadatfork-on.html">http://ryanarn.blogspot.com/2011/07/curious-case-of-pthreadatfork-on.html</a><br>
> +if("${ARCH}" STREQUAL "ppc64")<br>
> +   find_library(PTHREAD NAMES pthread)<br>
> +   target_link_libraries(iomp5 ${PTHREAD})<br>
> +endif()<br>
> +<br>
>  add_dependencies(iomp5 gen_kmp_i18n)<br>
> diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h<br>
> index a8c600b..f5dd10f 100644<br>
> --- a/runtime/src/kmp.h<br>
> +++ b/runtime/src/kmp.h<br>
> @@ -459,9 +459,9 @@ typedef int PACKED_REDUCTION_METHOD_T;<br>
>  /*<br>
>   * Only Linux* OS and Windows* OS support thread affinity.<br>
>   */<br>
> -#if KMP_OS_LINUX || KMP_OS_WINDOWS<br>
> +#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64<br>
>  # define KMP_AFFINITY_SUPPORTED 1<br>
> -#elif KMP_OS_DARWIN || KMP_OS_FREEBSD<br>
> +#elif KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_CNK || KMP_ARCH_PPC64<br>
>  // affinity not supported<br>
>  # define KMP_AFFINITY_SUPPORTED 0<br>
>  #else<br>
> @@ -476,7 +476,7 @@ extern size_t __kmp_affin_mask_size;<br>
> <br>
>  # if KMP_OS_LINUX<br>
>  //<br>
> -// On Linux* OS, the mask isactually a vector of length<br>
> __kmp_affin_mask_size<br>
> +// On Linux* OS, the mask is actually a vector of length<br>
> __kmp_affin_mask_size<br>
>  // (in bytes).  It should be allocated on a word boundary.<br>
>  //<br>
>  // WARNING!!!  We have made the base type of the affinity mask unsigned<br>
> char,<br>
> @@ -946,6 +946,9 @@ extern unsigned int __kmp_place_core_offset;<br>
>  #if KMP_OS_WINDOWS<br>
>  #  define KMP_INIT_WAIT    64U          /* initial number of spin-tests<br>
> */<br>
>  #  define KMP_NEXT_WAIT    32U          /* susequent number of spin-tests<br>
> */<br>
> +#elif KMP_OS_CNK<br>
> +#  define KMP_INIT_WAIT    16U          /* initial number of spin-tests<br>
> */<br>
> +#  define KMP_NEXT_WAIT     8U          /* susequent number of spin-tests<br>
> */<br>
>  #elif KMP_OS_LINUX<br>
>  #  define KMP_INIT_WAIT  1024U          /* initial number of spin-tests<br>
> */<br>
>  #  define KMP_NEXT_WAIT   512U          /* susequent number of spin-tests<br>
> */<br>
> @@ -971,6 +974,11 @@ extern void __kmp_x86_cpuid( int mode, int mode2,<br>
> struct kmp_cpuid *p );<br>
>    extern void __kmp_x86_pause( void );<br>
>  # endif<br>
>  # define KMP_CPU_PAUSE()        __kmp_x86_pause()<br>
> +#elif KMP_ARCH_PPC64<br>
> +# define KMP_PPC64_PRI_LOW() __asm__ volatile ("or 1, 1, 1")<br>
> +# define KMP_PPC64_PRI_MED() __asm__ volatile ("or 2, 2, 2")<br>
> +# define KMP_PPC64_PRI_LOC_MB() __asm__ volatile ("" : : : "memory")<br>
> +# define KMP_CPU_PAUSE() do { KMP_PPC64_PRI_LOW(); KMP_PPC64_PRI_MED();<br>
> KMP_PPC64_PRI_LOC_MB(); } while (0)<br>
>  #else<br>
>  # define KMP_CPU_PAUSE()        /* nothing to do */<br>
>  #endif<br>
> diff --git a/runtime/src/kmp_csupport.c b/runtime/src/kmp_csupport.c<br>
> index 18b6c35..0b7d3ed 100644<br>
> --- a/runtime/src/kmp_csupport.c<br>
> +++ b/runtime/src/kmp_csupport.c<br>
> @@ -837,6 +837,19 @@ __kmpc_flush(ident_t *loc, ...)<br>
>              #endif // KMP_MIC<br>
>          #elif KMP_ARCH_ARM<br>
>              // Nothing yet<br>
> +   #elif KMP_ARCH_PPC64<br>
> +            // Nothing needed here (we have a real MB above).<br>
> +            #if KMP_OS_CNK<br>
> +      // The flushing thread needs to yield here; this prevents a<br>
> +      // busy-waiting thread from saturating the pipeline. flush is<br>
> +      // often used in loops like this:<br>
> +                // while (!flag) {<br>
> +                //   #pragma omp flush(flag)<br>
> +                // }<br>
> +      // and adding the yield here is good for at least a 10x speedup<br>
> +      // when running >2 threads per core (on the NAS LU benchmark).<br>
> +                __kmp_yield(TRUE);<br>
> +            #endif<br>
>          #else<br>
>              #error Unknown or unsupported architecture<br>
>          #endif<br>
> diff --git a/runtime/src/kmp_ftn_os.h b/runtime/src/kmp_ftn_os.h<br>
> index f241751..d78d846 100644<br>
> --- a/runtime/src/kmp_ftn_os.h<br>
> +++ b/runtime/src/kmp_ftn_os.h<br>
> @@ -478,7 +478,7 @@<br>
>  //#define KMP_API_NAME_GOMP_TARGET_UPDATE<br>
> GOMP_target_update<br>
>  #define KMP_API_NAME_GOMP_TEAMS                          GOMP_teams<br>
> <br>
> -#if KMP_OS_LINUX<br>
> +#if KMP_OS_LINUX && !KMP_OS_CNK && !KMP_ARCH_PPC64<br>
>      #define xstr(x) str(x)<br>
>      #define str(x) #x<br>
> <br>
> diff --git a/runtime/src/kmp_global.c b/runtime/src/kmp_global.c<br>
> index aa1f8e3..d3c3195 100644<br>
> --- a/runtime/src/kmp_global.c<br>
> +++ b/runtime/src/kmp_global.c<br>
> @@ -321,7 +321,11 @@ int        __kmp_env_consistency_check  = FALSE;  /*<br>
> KMP_CONSISTENCY_CHECK speci<br>
>  kmp_uint32 __kmp_yield_init = KMP_INIT_WAIT;<br>
>  kmp_uint32 __kmp_yield_next = KMP_NEXT_WAIT;<br>
>  kmp_uint32 __kmp_yielding_on = 1;<br>
> +#if KMP_OS_CNK<br>
> +kmp_uint32 __kmp_yield_cycle = 0;<br>
> +#else<br>
>  kmp_uint32 __
kmp_yield_cycle = 1;     /* Yield-cycle is on by default */<br>
> +#endif<br>
>  kmp_int32  __kmp_yield_on_count = 10; /* By default, yielding is on for 10<br>
> monitor periods. */<br>
>  kmp_int32  __kmp_yield_off_count = 1; /* By default, yielding is off for 1<br>
> monitor periods. */<br>
>  /* ----------------------------------------------------- */<br>
> diff --git a/runtime/src/kmp_gsupport.c b/runtime/src/kmp_gsupport.c<br>
> index 9d8e553..aa52024 100644<br>
> --- a/runtime/src/kmp_gsupport.c<br>
> +++ b/runtime/src/kmp_gsupport.c<br>
> @@ -15,7 +15,7 @@<br>
> <br>
> //<br>
> ===----------------------------------------------------------------------===//<br>
> <br>
> <br>
> -#if defined(__x86_64)<br>
> +#if defined(__x86_64) || defined (__powerpc64__)<br>
>  # define KMP_I8<br>
>  #endif<br>
>  #include "kmp.h"<br>
> diff --git a/runtime/src/kmp_lock.h b/runtime/src/kmp_lock.h<br>
> index 8009d18..c5ce838 100644<br>
> --- a/runtime/src/kmp_lock.h<br>
> +++ b/runtime/src/kmp_lock.h<br>
> @@ -518,7 +518,7 @@ __kmp_destroy_bootstrap_lock( kmp_bootstrap_lock_t<br>
> *lck )<br>
>  // Internal RTL locks are also implemented as ticket locks, for now.<br>
>  //<br>
>  // FIXME - We should go through and figure out which lock kind works best<br>
> for<br>
> -// each internal lock, and use the type deeclaration and function calls<br>
> for<br>
> +// each internal lock, and use the type declaration and function calls for<br>
>  // that explicit lock kind (and get rid of this section).<br>
>  //<br>
> <br>
> diff --git a/runtime/src/kmp_os.h b/runtime/src/kmp_os.h<br>
> index bb5e72f..db1981e 100644<br>
> --- a/runtime/src/kmp_os.h<br>
> +++ b/runtime/src/kmp_os.h<br>
> @@ -66,10 +66,12 @@<br>
>  #define KMP_OS_FREEBSD  0<br>
>  #define KMP_OS_DARWIN   0<br>
>  #define KMP_OS_WINDOWS    0<br>
> +#define KMP_OS_CNK      0<br>
>  #define KMP_OS_UNIX     0  /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN<br>
> etc. */<br>
> <br>
>  #define KMP_ARCH_X86        0<br>
>  #define KMP_ARCH_X86_64       0<br>
> +#define KMP_ARCH_PPC64      0<br>
> <br>
>  #ifdef _WIN32<br>
>  # undef KMP_OS_WINDOWS<br>
> @@ -91,6 +93,11 @@<br>
>  # define KMP_OS_FREEBSD 1<br>
>  #endif<br>
> <br>
> +#if ( defined __bgq__ )<br>
> +# undef KMP_OS_CNK<br>
> +# define KMP_OS_CNK 1<br>
> +#endif<br>
> +<br>
>  #if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS)<br>
>  # error Unknown OS<br>
>  #endif<br>
> @@ -117,6 +124,9 @@<br>
>  # elif defined __i386<br>
>  #  undef KMP_ARCH_X86<br>
>  #  define KMP_ARCH_X86 1<br>
> +# elif defined __powerpc64__<br>
> +#  undef KMP_ARCH_PPC64<br>
> +#  define KMP_ARCH_PPC64 1<br>
>  # endif<br>
>  #endif<br>
> <br>
> @@ -156,7 +166,7 @@<br>
>  # define KMP_ARCH_ARM 1<br>
>  #endif<br>
> <br>
> -#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM)<br>
> +#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64)<br>
>  # error Unknown or unsupported architecture<br>
>  #endif<br>
> <br>
> @@ -232,7 +242,7 @@<br>
> <br>
>  #if KMP_ARCH_X86 || KMP_ARCH_ARM<br>
>  # define KMP_SIZE_T_SPEC KMP_UINT32_SPEC<br>
> -#elif KMP_ARCH_X86_64<br>
> +#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64<br>
>  # define KMP_SIZE_T_SPEC KMP_UINT64_SPEC<br>
>  #else<br>
>  # error "Can't determine size_t printf format specifier."<br>
> @@ -657,6 +667,10 @@ extern kmp_real64 __kmp_test_then_add_real64<br>
> ( volatile kmp_real64 *p, kmp_real6<br>
>  # endif<br>
>  #endif /* KMP_OS_WINDOWS */<br>
> <br>
> +#if KMP_ARCH_PPC64<br>
> +# define KMP_MB()       __sync_synchronize()<br>
> +#endif<br>
> +<br>
>  #ifndef KMP_MB<br>
>  # define KMP_MB()       /* nothing to do */<br>
>  #endif<br>
> @@ -763,7 +777,7 @@ typedef void    (*microtask_t)( int *gtid, int<br>
> *npr, ... );<br>
>  #endif /* KMP_I8 */<br>
> <br>
>  /* Workaround for Intel(R) 64 code gen bug when taking address of static<br>
> array (Intel(R) 64 Tracker #138) */<br>
> -#if KMP_ARCH_X86_64 && KMP_OS_LINUX<br>
> +#if (KMP_ARCH_X86_64 || KMP_ARCH_PPC64) && KMP_OS_LINUX<br>
>  # define STATIC_EFI2_WORKAROUND<br>
>  #else<br>
>  # define STATIC_EFI2_WORKAROUND static<br>
> diff --git a/runtime/src/kmp_runtime.c b/runtime/src/kmp_runtime.c<br>
> index fea41d0..d243700 100644<br>
> --- a/runtime/src/kmp_runtime.c<br>
> +++ b/runtime/src/kmp_runtime.c<br>
> @@ -8450,7 +8450,7 @@ __kmp_determine_reduction_method( ident_t *loc,<br>
> kmp_int32 global_tid,<br>
>          int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED;<br>
>          int tree_available   = FAST_REDUCTION_TREE_METHOD_GENERATED;<br>
> <br>
> -        #if KMP_ARCH_X86_64<br>
> +        #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64<br>
> <br>
>              #if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS ||<br>
> KMP_OS_DARWIN<br>
>                  #if KMP_MIC<br>
> diff --git a/runtime/src/kmp_settings.c b/runtime/src/kmp_settings.c<br>
> index 54745cb..b85678e 100644<br>
> --- a/runtime/src/kmp_settings.c<br>
> +++ b/runtime/src/kmp_settings.c<br>
> @@ -536,6 +536,7 @@ __kmp_stg_parse_file(<br>
> <br>
>  static char * par_range_to_print = NULL;<br>
> <br>
> +#ifdef KMP_DEBUG<br>
>  static void<br>
>  __kmp_stg_parse_par_range(<br>
>      char const * name,<br>
> @@ -614,7 +615,7 @@ __kmp_stg_parse_par_range(<br>
>          break;<br>
>      }<br>
>  } // __kmp_stg_parse_par_range<br>
> -<br>
> +#endif<br>
> <br>
>  int<br>
>  __kmp_initial_threads_capacity( int req_nproc )<br>
> diff --git a/runtime/src/kmp_version.c b/runtime/src/kmp_version.c<br>
> index f64d052..5dc82d1 100644<br>
> --- a/runtime/src/kmp_version.c<br>
> +++ b/runtime/src/kmp_version.c<br>
> @@ -20,7 +20,7 @@<br>
>  #include "kmp_version.h"<br>
> <br>
>  // Replace with snapshot date YYYYMMDD for promotion build.<br>
> -#define KMP_VERSION_BUILD    00000000<br>
> +//#define KMP_VERSION_BUILD    00000000<br>
> <br>
>  // Helper macros to convert value of macro to string literal.<br>
>  #define _stringer( x ) #x<br>
> diff --git a/runtime/src/makefile.mk b/runtime/src/makefile.mk<br>
> index 9be8799..84d6ac2 100644<br>
> --- a/runtime/src/makefile.mk<br>
> +++ b/runtime/src/makefile.mk<br>
> @@ -310,6 +310,9 @@ endif<br>
>  ifeq "$(CPLUSPLUS)" "on"<br>
>      ifeq "$(os)" "win"<br>
>          c-flags   += -TP<br>
> +    else ifeq "$(arch)" "ppc64"<br>
> +    # c++0x on ppc64 linux removes definition of preproc. macros, needed<br>
> in .hs<br>
> +       c-flags   += -x c++ -std=gnu++0x<br>
>      else<br>
>          ifneq "$(filter gcc clang,$(c))" ""<br>
>              c-flags   += -x c++ -std=c++0x<br>
> @@ -370,7 +373,7 @@ ifeq "$(os)" "lin"<br>
>              ld-flags-extra += -lirc_pic<br>
>              endif<br>
>          endif<br>
> -        ifeq "$(filter 32 32e 64,$(arch))" ""<br>
> +        ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""<br>
>              ld-flags-extra += $(shell pkg-config --libs libffi)<br>
>          endif<br>
>      else<br>
> @@ -581,9 +584,12 @@ ifneq "$(os)" "win"<br>
>      ifeq "$(arch)" "arm"<br>
>          z_Linux_asm$(obj) : \<br>
>            cpp-flags += -D KMP_ARCH_ARM<br>
> -    else<br>
> +    else ifeq "$(arch)" "ppc64"<br>
> +        z_Linux_asm$(obj) : \<br>
> +          cpp-flags += -D KMP_ARCH_PPC64</font></tt><br>
<tt><font size="2">> +   else<br>
>          z_Linux_asm$(obj) : \<br>
> -            cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e,$(arch)),_64)<br>
> +              cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e,$(arch)),_64)<br>
> <br>
>      endif<br>
>  endif<br>
> <br>
> @@ -729,7 +735,9 @@ endif<br>
>          else # 5<br>
>              lib_c_items += kmp_gsupport<br>
>          endif<br>
> +#        ifneq "$(arch)" "ppc64"<br>
>          lib_asm_items += z_Linux_asm<br>
> +#       endif<br>
>      endif<br>
>  endif<br>
> <br>
> @@ -1391,9 +1399,13 @@ ifneq "$(filter %-dyna win-%,$(os)-$(LINK_TYPE))" ""<br>
>              td_exp += libc.so.6<br>
>              td_exp += ld-linux-armhf.so.3<br>
>          endif<br>
> +        ifeq "$(arch)" "ppc64"<br>
> +            td_exp += libc.so.6<br>
> +            td_exp += ld64.so.1<br>
> +        endif<br>
>          td_exp += libdl.so.2<br>
>          td_exp += libgcc_s.so.1<br>
> -        ifeq "$(filter 32 32e 64,$(arch))" ""<br>
> +        ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""<br>
>              td_exp += libffi.so.6<br>
>              td_exp += libffi.so.5<br>
>          endif<br>
> diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_config.h<br>
> b/runtime/src/thirdparty/ittnotify/ittnotify_config.h<br>
> index 40c8614..9e7b36b 100644<br>
> --- a/runtime/src/thirdparty/ittnotify/ittnotify_config.h<br>
> +++ b/runtime/src/thirdparty/ittnotify/ittnotify_config.h<br>
> @@ -132,6 +132,11 @@<br>
>  #  define ITT_ARCH_ARM  4<br>
>  #endif /* ITT_ARCH_ARM */<br>
> <br>
> +#ifndef ITT_ARCH_PPC64<br>
> +#  define ITT_ARCH_PPC64  5<br>
> +#endif /* ITT_ARCH_PPC64 */<br>
> +<br>
> +<br>
>  #ifndef ITT_ARCH<br>
>  #  if defined _M_IX86 || defined __i386__<br>
>  #    define ITT_ARCH ITT_ARCH_IA32<br>
> @@ -141,6 +146,8 @@<br>
>  #    define ITT_ARCH ITT_ARCH_IA64<br>
>  #  elif defined _M_ARM || __arm__<br>
>  #    define ITT_ARCH ITT_ARCH_ARM<br>
> +#  elif defined __powerpc64__<br>
> +#    define ITT_ARCH ITT_ARCH_PPC64<br>
>  #  endif<br>
>  #endif<br>
> <br>
> @@ -274,7 +281,7 @@ ITT_INLINE long __TBB_machine_fetchadd4(volatile void*<br>
> ptr, long addend)<br>
>                            : "memory");<br>
>      return result;<br>
>  }<br>
> -#elif ITT_ARCH==ITT_ARCH_ARM<br>
> +#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64<br>
>  #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)<br>
>  #endif /* ITT_ARCH==ITT_ARCH_IA64 */<br>
>  #ifndef ITT_SIMPLE_INIT<br>
> diff --git a/runtime/src/z_Linux_asm.s b/runtime/src/z_Linux_asm.s<br>
> index 1f1ba1b..64c8052 100644<br>
> --- a/runtime/src/z_Linux_asm.s<br>
> +++ b/runtime/src/z_Linux_asm.s<br>
> @@ -138,7 +138,7 @@ __kmp_unnamed_critical_addr:<br>
>  #endif /* KMP_GOMP_COMPAT */<br>
> <br>
> <br>
> -#if KMP_ARCH_X86<br>
> +#if KMP_ARCH_X86 && !KMP_ARCH_PPC64<br>
> <br>
>  // -----------------------------------------------------------------------<br>
>  // microtasking routines specifically written for IA-32 architecture<br>
> @@ -1585,6 +1585,16 @@ __kmp_unnamed_critical_addr:<br>
>      .size __kmp_unnamed_critical_addr,4<br>
>  #endif /* KMP_ARCH_ARM */<br>
> <br>
> +#if KMP_ARCH_PPC64<br>
> +    .data<br>
> +    .comm .gomp_critical_user_,32,8<br>
> +    .data<br>
> +    .align 8<br>
> +    .global __kmp_unnamed_critical_addr<br>
> +__kmp_unnamed_critical_addr:<br>
> +    .8byte .gomp_critical_user_<br>
> +    .size __kmp_unnamed_critical_addr,8<br>
> +#endif /* KMP_ARCH_PPC64 */<br>
> <br>
>  #if defined(__linux__)<br>
>  .section .note.GNU-stack,"",@progbits<br>
> diff --git a/runtime/src/z_Linux_util.c b/runtime/src/z_Linux_util.c<br>
> index 7633f99..348f5d8 100644<br>
> --- a/runtime/src/z_Linux_util.c<br>
> +++ b/runtime/src/z_Linux_util.c<br>
> @@ -32,7 +32,7 @@<br>
>  #include <sys/resource.h><br>
>  #include <sys/syscall.h><br>
> <br>
> -#if KMP_OS_LINUX<br>
> +#if KMP_OS_LINUX && !KMP_OS_CNK<br>
>  # include <sys/sysinfo.h><br>
>  # if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)<br>
>  // We should really include <futex.h>, but that causes compatibility<br>
> problems on different<br>
> @@ -61,7 +61,7 @@<br>
>  #include <fcntl.h><br>
> <br>
>  // For non-x86 architecture<br>
> -#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)<br>
> +#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 ||<br>
> KMP_ARCH_PPC64)<br>
>  # include <stdbool.h><br>
>  # include <ffi.h><br>
>  #endif<br>
> @@ -110,7 +110,7 @@ __kmp_print_cond( char *buffer, kmp_cond_align_t<br>
> *cond )<br>
>  /*<br>
> ------------------------------------------------------------------------ */<br>
>  /*<br>
> ------------------------------------------------------------------------ */<br>
> <br>
> -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED<br>
> +#if ( KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED)<br>
> <br>
>  /*<br>
>   * Affinity support<br>
> @@ -147,6 +147,19 @@ __kmp_print_cond( char *buffer, kmp_cond_align_t<br>
> *cond )<br>
>  #    error Wrong code for getaffinity system call.<br>
>  #   endif /* __NR_sched_getaffinity */<br>
> <br>
> +#  elif KMP_ARCH_PPC64<br>
> +#   ifndef __NR_sched_setaffinity<br>
> +#    define __NR_sched_setaffinity  222<br>
> +#   elif __NR_sched_setaffinity != 222<br>
> +#    error Wrong code for setaffinity system call.<br>
> +#   endif /* __NR_sched_setaffinity */<br>
> +#   ifndef __NR_sched_getaffinity<br>
> +#    define __NR_sched_getaffinity  223<br>
> +#   elif __NR_sched_getaffinity != 223<br>
> +#    error Wrong code for getaffinity system call.<br>
> +#   endif /* __NR_sched_getaffinity */<br>
> +<br>
> +<br>
>  #  else<br>
>  #   error Unknown or unsupported architecture<br>
> <br>
> @@ -445,7 +458,7 @@ __kmp_change_thread_affinity_mask( int gtid,<br>
> kmp_affin_mask_t *new_mask,<br>
>  /*<br>
> ------------------------------------------------------------------------ */<br>
>  /*<br>
> ------------------------------------------------------------------------ */<br>
> <br>
> -#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)<br>
> +#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)<br>
> && !KMP_OS_CNK<br>
> <br>
>  int<br>
>  __kmp_futex_determine_capable()<br>
> @@ -462,7 +475,7 @@ __kmp_futex_determine_capable()<br>
>      return retval;<br>
>  }<br>
> <br>
> -#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 ||<br>
> KMP_ARCH_ARM)<br>
> +#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 ||<br>
> KMP_ARCH_ARM) && !KMP_OS_CNK<br>
> <br>
>  /*<br>
> ------------------------------------------------------------------------ */<br>
>  /*<br>
> ------------------------------------------------------------------------ */<br>
> @@ -481,7 +494,7 @@ __kmp_test_then_or32( volatile kmp_int32 *p, kmp_int32<br>
> d )<br>
>      old_value = TCR_4( *p );<br>
>      new_value = old_value | d;<br>
> <br>
> -    while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) )<br>
> +    while ( ! KMP_COMPARE_AND_STORE_REL32 ( p, old_value, new_value ) )<br>
>      {<br>
>          KMP_CPU_PAUSE();<br>
>          old_value = TCR_4( *p );<br>
> @@ -498,7 +511,7 @@ __kmp_test_then_and32( volatile kmp_int32 *p, kmp_int32<br>
> d )<br>
>      old_value = TCR_4( *p );<br>
>      new_value = old_value & d;<br>
> <br>
> -    while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) )<br>
> +    while ( ! KMP_COMPARE_AND_STORE_REL32 ( p, old_value, new_value ) )<br>
>      {<br>
>          KMP_CPU_PAUSE();<br>
>          old_value = TCR_4( *p );<br>
> @@ -507,7 +520,7 @@ __kmp_test_then_and32( volatile kmp_int32 *p, kmp_int32<br>
> d )<br>
>      return old_value;<br>
>  }<br>
> <br>
> -# if KMP_ARCH_X86<br>
> +# if KMP_ARCH_X86 || KMP_ARCH_PPC64<br>
>  kmp_int64<br>
>  __kmp_test_then_add64( volatile kmp_int64 *p, kmp_int64 d )<br>
>  {<br>
> @@ -516,7 +529,7 @@ __kmp_test_then_add64( volatile kmp_int64 *p, kmp_int64<br>
> d )<br>
>      old_value = TCR_8( *p );<br>
>      new_value = old_value + d;<br>
> <br>
> -    while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )<br>
> +    while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) )<br>
>      {<br>
>          KMP_CPU_PAUSE();<br>
>          old_value = TCR_8( *p );<br>
> @@ -533,7 +546,7 @@ __kmp_test_then_or64( volatile kmp_int64 *p, kmp_int64<br>
> d )<br>
> <br>
>      old_value = TCR_8( *p );<br>
>      new_value = old_value | d;<br>
> -    while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )<br>
> +    while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) )<br>
>      {<br>
>          KMP_CPU_PAUSE();<br>
>          old_value = TCR_8( *p );<br>
> @@ -549,7 +562,7 @@ __kmp_test_then_and64( volatile kmp_int64 *p, kmp_int64<br>
> d )<br>
> <br>
>      old_value = TCR_8( *p );<br>
>      new_value = old_value & d;<br>
> -    while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) )<br>
> +    while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) )<br>
>      {<br>
>          KMP_CPU_PAUSE();<br>
>          old_value = TCR_8( *p );<br>
> @@ -2527,7 +2540,7 @@ __kmp_get_load_balance( int max )<br>
>  #endif // USE_LOAD_BALANCE<br>
> <br>
> <br>
> -#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)<br>
> +#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 ||<br>
> KMP_ARCH_PPC64)<br>
> <br>
>  int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, int argc,<br>
>          void *p_argv[] )<br>
> @@ -2561,7 +2574,89 @@ int __kmp_invoke_microtask( microtask_t pkfn, int<br>
> gtid, int tid, int argc,<br>
>      return 1;<br>
>  }<br>
> <br>
> -#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64)<br>
> +#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 ||<br>
> KMP_ARCH_PPC64)<br>
> +<br>
> +#if KMP_ARCH_PPC64<br>
> +<br>
> +// we really only need the case with 1 argument, because CLANG always<br>
> build<br>
> +// a struct of pointers to shared variables referenced in the outlined<br>
> function<br>
> +int<br>
> +__kmp_invoke_microtask( microtask_t pkfn,<br>
> +                        int gtid, int tid,<br>
> +                        int argc, void *p_argv[] ) {<br>
> +  switch (argc) {<br>
> +  default:<br>
> +    fprintf(stderr, "Too many args to microtask: %d!\n", argc);<br>
> +    fflush(stderr);<br>
> +    exit(-1);<br>
> +  case 0:<br>
> +    (*pkfn)(&gtid, &tid);<br>
> +    break;<br>
> +  case 1:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0]);<br>
> +    break;<br>
> +  case 2:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1]);<br>
> +    break;<br>
> +  case 3:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2]);<br>
> +    break;<br>
> +  case 4:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3]);<br>
> +    break;<br>
> +  case 5:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4]);<br>
> +    break;<br>
> +  case 6:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5]);<br>
> +    break;<br>
> +  case 7:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6]);<br>
> +    break;<br>
> +  case 8:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7]);<br>
> +    break;<br>
> +  case 9:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8]);<br>
> +    break;<br>
> +  case 10:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9]);<br>
> +    break;<br>
> +  case 11:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv<br>
> [10]);<br>
> +    break;<br>
> +  case 12:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv<br>
> [10],<br>
> +            p_argv[11]);<br>
> +    break;<br>
> +  case 13:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv<br>
> [10],<br>
> +            p_argv[11], p_argv[12]);<br>
> +    break;<br>
> +  case 14:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv<br>
> [10],<br>
> +            p_argv[11], p_argv[12], p_argv[13]);<br>
> +    break;<br>
> +  case 15:<br>
> +    (*pkfn)(&gtid, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3],<br>
> p_argv[4],<br>
> +            p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv<br>
> [10],<br>
> +            p_argv[11], p_argv[12], p_argv[13], p_argv[14]);<br>
> +    break;<br>
> +  }<br>
> +<br>
> +  return 1;<br>
> +}<br>
> +<br>
> +#endif<br>
> <br>
>  // end of file //<br>
> <br>
> diff --git a/runtime/tools/lib/Platform.pm b/runtime/tools/lib/Platform.pm<br>
> index 5b399f7..763f3cb 100644<br>
> --- a/runtime/tools/lib/Platform.pm<br>
> +++ b/runtime/tools/lib/Platform.pm<br>
> @@ -50,6 +50,8 @@ sub canon_arch($) {<br>
>              $arch = "32e";<br>
>          } elsif ( $arch =~ m{\Aarm(?:v7\D*)?\z} ) {<br>
>              $arch = "arm";<br>
> +        } elsif ( $arch =~ m{\Appc64} ) {<br>
> +           $arch = "ppc64";<br>
>          } else {<br>
>              $arch = undef;<br>
>          }; # if<br>
> @@ -62,6 +64,7 @@ sub canon_arch($) {<br>
>          "32"  => "IA-32 architecture",<br>
>          "32e" => "Intel(R) 64",<br>
>          "arm" => "ARM",<br>
> +        "ppc64" => "PPC64",<br>
>      );<br>
> <br>
>      sub legal_arch($) {<br>
> @@ -159,6 +162,8 @@ sub target_options() {<br>
>          $_host_arch = "32e";<br>
>      } elsif ( $hardware_platform eq "arm" ) {<br>
>          $_host_arch = "arm";<br>
> +    } elsif ( $hardware_platform eq "ppc64" ) {<br>
> +        $_host_arch = "ppc64";<br>
>      } else {<br>
>          die "Unsupported host hardware platform: \"$hardware_platform\";<br>
> stopped";<br>
>      }; # if<br>
> diff --git a/runtime/tools/lib/Uname.pm b/runtime/tools/lib/Uname.pm<br>
> index e212501..52518b4 100644<br>
> --- a/runtime/tools/lib/Uname.pm<br>
> +++ b/runtime/tools/lib/Uname.pm<br>
> @@ -147,6 +147,8 @@ if ( 0 ) {<br>
>          $values{ hardware_platform } = "x86_64";<br>
>      } elsif ( $values{ machine } =~ m{\Aarmv7\D*\z} ) {<br>
>          $values{ hardware_platform } = "arm";<br>
> +    } elsif ( $values{ machine } =~ m{\Appc64\z} ) {<br>
> +        $values{ hardware_platform } = "ppc64";<br>
>      } else {<br>
>          die "Unsupported machine (\"$values{ machine }\") returned by<br>
> POSIX::uname(); stopped";<br>
>      }; # if<br>
> diff --git a/runtime/tools/src/common-defs.mk<br>
> b/runtime/tools/src/common-defs.mk<br>
> index ebd1922..7eb64b0 100644<br>
> --- a/runtime/tools/src/common-defs.mk<br>
> +++ b/runtime/tools/src/common-defs.mk<br>
> @@ -45,7 +45,7 @@ endif<br>
>  # Description:<br>
>  #     The function return printable name of specified architecture, IA-32<br>
> architecture or Intel(R) 64.<br>
>  #<br>
> -legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R)<br>
> 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(error Bad<br>
> architecture specified: $(1))))))<br>
> +legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R)<br>
> 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter<br>
> ppc64,$(1)),PPC64,$(error Bad architecture specified: $(1)))))))<br>
> <br>
>  # Synopsis:<br>
>  #     var_name = $(call check_variable,var,list)<br>
> @@ -128,9 +128,9 @@ endif<br>
>  #<br>
> --------------------------------------------------------------------------------------------------<br>
> <br>
>  os       := $(call check_variable,os,lin lrb mac win)<br>
> -arch     := $(call check_variable,arch,32 32e 64 arm)<br>
> +arch     := $(call check_variable,arch,32 32e 64 arm ppc64)<br>
>  platform := $(os)_$(arch)<br>
> -platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm<br>
> lrb_32e mac_32 mac_32e win_32 win_32e win_64)<br>
> +platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm<br>
> lrb_32e mac_32 mac_32e win_32 win_32e win_64 lin_ppc64)<br>
>  # oa-opts means "os and arch options". They are passed to almost all perl<br>
> scripts.<br>
>  oa-opts  := --os=$(os) --arch=$(arch)<br>
> <br>
> diff --git a/runtime/tools/src/common-tools.mk<br>
> b/runtime/tools/src/common-tools.mk<br>
> index a9c9fbc..8c86791 100644<br>
> --- a/runtime/tools/src/common-tools.mk<br>
> +++ b/runtime/tools/src/common-tools.mk<br>
> @@ -34,7 +34,7 @@<br>
>  # "No rule to build .\kmp_i18n.inc". Using "./" solves the problem.<br>
>  cpp-flags += -I ./<br>
>  # For non-x86 architecture<br>
> -ifeq "$(filter 32 32e 64,$(arch))" ""<br>
> +ifeq "$(filter 32 32e 64 ppc64,$(arch))" ""<br>
>      cpp-flags += $(shell pkg-config --cflags libffi)<br>
>  endif<br>
>  # Add all VPATH directories to path for searching include files.<br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<a href="http://lists.cs.uiuc.edu/pipermail/openmp-commits/attachments/">http://lists.cs.uiuc.edu/pipermail/openmp-commits/attachments/</a><br>
> 20140717/41b2fdff/attachment.html><br>
> <br>
> ------------------------------<br>
> <br>
> _______________________________________________<br>
> Openmp-commits mailing list<br>
> Openmp-commits@dcs-maillist2.engr.illinois.edu<br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/openmp-commits">http://lists.cs.uiuc.edu/mailman/listinfo/openmp-commits</a><br>
> <br>
> <br>
> End of Openmp-commits Digest, Vol 6, Issue 1<br>
> ********************************************<br>
> <br>
</font></tt></body></html>