diff -uNr openmp-r208472/CREDITS.txt openmp/CREDITS.txt --- openmp-r208472/CREDITS.txt 2014-05-21 15:14:51.000000000 -0400 +++ openmp/CREDITS.txt 2014-08-07 09:14:44.000000000 -0400 @@ -8,6 +8,9 @@ (W), PGP key ID and fingerprint (P), description (D), and snail-mail address (S). +N: Carlo Bertolli +D: IBM contributor to PowerPC support in CMake files and elsewhere. + N: Sunita Chandrasekaran D: Contributor to testsuite from OpenUH diff -uNr openmp-r208472/offload/doc/doxygen/config openmp/offload/doc/doxygen/config --- openmp-r208472/offload/doc/doxygen/config 2014-05-21 15:14:46.000000000 -0400 +++ openmp/offload/doc/doxygen/config 2014-08-05 10:10:07.000000000 -0400 @@ -1972,7 +1972,7 @@ EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will -# remove all refrences to function-like macros that are alone on a line, have an +# remove all references to function-like macros that are alone on a line, have an # all uppercase name, and do not end with a semicolon. Such function macros are # typically used for boiler-plate code, and will confuse the parser if not # removed. diff -uNr openmp-r208472/offload/src/cean_util.cpp openmp/offload/src/cean_util.cpp --- openmp-r208472/offload/src/cean_util.cpp 2014-05-21 15:14:51.000000000 -0400 +++ openmp/offload/src/cean_util.cpp 2014-08-05 10:10:19.000000000 -0400 @@ -60,7 +60,7 @@ return res; } -// check if ranges described by 1 argument could be transfered into ranges +// check if ranges described by 1 argument could be transferred into ranges // described by 2-nd one bool cean_ranges_match( CeanReadRanges * read_rng1, diff -uNr openmp-r208472/offload/src/cean_util.h openmp/offload/src/cean_util.h --- openmp-r208472/offload/src/cean_util.h 2014-05-21 15:14:51.000000000 -0400 +++ openmp/offload/src/cean_util.h 2014-08-05 10:10:18.000000000 -0400 @@ -60,7 +60,7 @@ // to read consequently contiguous ranges described by "ap" argument CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap); -// check if ranges described by 1 argument could be transfered into ranges +// check if ranges described by 1 argument could be transferred into ranges // described by 2-nd one bool cean_ranges_match( CeanReadRanges * read_rng1, @@ -75,7 +75,7 @@ int64_t *offset ); -// returns number of transfered bytes +// returns number of transferred bytes int64_t cean_get_transf_size(CeanReadRanges * read_rng); #if OFFLOAD_DEBUG > 0 diff -uNr openmp-r208472/offload/src/coi/coi_client.h openmp/offload/src/coi/coi_client.h --- openmp-r208472/offload/src/coi/coi_client.h 2014-05-21 15:14:50.000000000 -0400 +++ openmp/offload/src/coi/coi_client.h 2014-08-05 10:10:21.000000000 -0400 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// -// The interface betwen offload library and the COI API on the host +// The interface between offload library and the COI API on the host #ifndef COI_CLIENT_H_INCLUDED #define COI_CLIENT_H_INCLUDED diff -uNr openmp-r208472/offload/src/coi/coi_server.h openmp/offload/src/coi/coi_server.h --- openmp-r208472/offload/src/coi/coi_server.h 2014-05-21 15:14:50.000000000 -0400 +++ openmp/offload/src/coi/coi_server.h 2014-08-05 10:10:21.000000000 -0400 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// -//The interface betwen offload library and the COI API on the target. +//The interface between offload library and the COI API on the target. #ifndef COI_SERVER_H_INCLUDED #define COI_SERVER_H_INCLUDED diff -uNr openmp-r208472/offload/src/compiler_if_host.cpp openmp/offload/src/compiler_if_host.cpp --- openmp-r208472/offload/src/compiler_if_host.cpp 2014-05-21 15:14:51.000000000 -0400 +++ openmp/offload/src/compiler_if_host.cpp 2014-08-05 10:10:21.000000000 -0400 @@ -52,7 +52,7 @@ OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize); - // initalize all devices is init_type is on_offload_all + // initialize all devices is init_type is on_offload_all if (retval && __offload_init_type == c_init_on_offload_all) { for (int i = 0; i < mic_engines_total; i++) { mic_engines[i].init(); diff -uNr openmp-r208472/offload/src/offload_engine.h openmp/offload/src/offload_engine.h --- openmp-r208472/offload/src/offload_engine.h 2014-05-21 15:14:51.000000000 -0400 +++ openmp/offload/src/offload_engine.h 2014-08-05 10:10:19.000000000 -0400 @@ -214,7 +214,7 @@ { stack_ptr_data = new PtrData(0, size); } - // 1-st key value - begining of the stack at CPU + // 1-st key value - beginning of the stack at CPU const void * stack_cpu_addr; // 2-nd key value - identifier of routine invocation at CPU uint64_t routine_id; diff -uNr openmp-r208472/offload/src/offload_env.cpp openmp/offload/src/offload_env.cpp --- openmp-r208472/offload/src/offload_env.cpp 2014-05-21 15:14:51.000000000 -0400 +++ openmp/offload/src/offload_env.cpp 2014-08-05 10:10:18.000000000 -0400 @@ -126,7 +126,7 @@ else { card = get_card(card_number); if (!card) { - // definition for new card occured + // definition for new card occurred card = new CardEnvVars(card_number); card_spec_list.push_back(card); } @@ -299,7 +299,7 @@ // Collect all definitions for the card with number "card_num". // The returned result is vector of string pointers defining one // environment variable. The vector is terminated by NULL pointer. -// In the begining of the vector there are env vars defined as +// In the beginning of the vector there are env vars defined as // __= // or // __ENV= diff -uNr openmp-r208472/offload/src/offload_host.cpp openmp/offload/src/offload_host.cpp --- openmp-r208472/offload/src/offload_host.cpp 2014-05-21 15:14:51.000000000 -0400 +++ openmp/offload/src/offload_host.cpp 2014-08-05 10:10:19.000000000 -0400 @@ -2290,7 +2290,7 @@ // Send pointer data if source or destination or both of them are // noncontiguous. There is guarantee that length of destination enough for -// transfered data. +// transferred data. bool OffloadDescriptor::send_noncontiguous_pointer_data( int i, PtrData* src_data, @@ -2915,10 +2915,10 @@ return true; } -// recieve pointer data if source or destination or both of them are +// receive pointer data if source or destination or both of them are // noncontiguous. There is guarantee that length of destination enough for -// transfered data. -bool OffloadDescriptor::recieve_noncontiguous_pointer_data( +// transferred data. +bool OffloadDescriptor::receive_noncontiguous_pointer_data( int i, char* base, COIBUFFER dst_buf, @@ -2928,7 +2928,7 @@ int64_t offset_src, offset_dst; int64_t length_src, length_dst; int64_t length_src_cur, length_dst_cur; - int64_t recieve_size, data_recieved = 0; + int64_t receive_size, data_received = 0; COIRESULT res; bool dst_is_empty = true; bool src_is_empty = true; @@ -2939,10 +2939,10 @@ length_dst = !m_vars[i].into ? length_src : (m_vars_extra[i].read_rng_dst) ? m_vars_extra[i].read_rng_dst->range_size : m_vars[i].size; - recieve_size = (length_src < length_dst) ? length_src : length_dst; + receive_size = (length_src < length_dst) ? length_src : length_dst; // consequently get contiguous ranges, - // define corresponded destination offset and recieve data + // define corresponded destination offset and receive data do { // get sorce offset if (src_is_empty) { @@ -2953,7 +2953,7 @@ break; } } - else if (data_recieved == 0) { + else if (data_received == 0) { offset_src = 0; } else { @@ -2964,9 +2964,9 @@ else { // if source is contiguous or its contiguous range is greater // than destination one - offset_src += recieve_size; + offset_src += receive_size; } - length_src_cur -= recieve_size; + length_src_cur -= receive_size; src_is_empty = length_src_cur == 0; // get destination offset @@ -2995,9 +2995,9 @@ else { // if destination is contiguous or its contiguous range is greater // than source one - offset_dst += recieve_size; + offset_dst += receive_size; } - length_dst_cur -= recieve_size; + length_dst_cur -= receive_size; dst_is_empty = length_dst_cur == 0; if (dst_buf != 0) { @@ -3008,7 +3008,7 @@ m_vars[i].offset + offset_src + m_vars[i].mic_offset - m_vars_extra[i].src_data->alloc_disp, - recieve_size, + receive_size, COI_COPY_UNSPECIFIED, m_in_deps_total, m_in_deps_total > 0 ? m_in_deps : 0, @@ -3028,7 +3028,7 @@ m_vars[i].mic_offset - m_vars_extra[i].src_data->alloc_disp, base + offset_dst, - recieve_size, + receive_size, COI_COPY_UNSPECIFIED, m_in_deps_total, m_in_deps_total > 0 ? m_in_deps : 0, @@ -3041,7 +3041,7 @@ report_coi_error(c_buf_read, res); } } - data_recieved += recieve_size; + data_received += receive_size; } while (true); return true; @@ -3095,7 +3095,7 @@ if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { - recieve_noncontiguous_pointer_data( + receive_noncontiguous_pointer_data( i, base, dst_buf, event); } else if (dst_buf != 0) { @@ -3209,7 +3209,7 @@ if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { - recieve_noncontiguous_pointer_data( + receive_noncontiguous_pointer_data( i, base, dst_buf, event); } else if (dst_buf != 0) { @@ -3513,7 +3513,7 @@ ap = static_cast(vd3->ptr_array); - // "pointers_number" for total number of transfered pointers. + // "pointers_number" for total number of transferred pointers. // For each of them we create new var_desc and put it at the bottom // of the var_desc's array get_arr_desc_numbers(ap, sizeof(void *), ptr.offset, ptr.size, @@ -4241,7 +4241,7 @@ case ET_DYN: // Registration code for libraries is called from the DllMain - // context (on windows) and thus we cannot do anything usefull + // context (on windows) and thus we cannot do anything useful // here. So we just add it to the list of pending libraries for // the later use. __target_libs_lock.lock(); diff -uNr openmp-r208472/offload/src/offload_host.h openmp/offload/src/offload_host.h --- openmp-r208472/offload/src/offload_host.h 2014-05-21 15:14:49.000000000 -0400 +++ openmp/offload/src/offload_host.h 2014-08-05 10:10:18.000000000 -0400 @@ -107,7 +107,7 @@ PtrData* src_buf, PtrData* dst_buf, COIEVENT *event); - bool recieve_noncontiguous_pointer_data( + bool receive_noncontiguous_pointer_data( int i, char* src_data, COIBUFFER dst_buf, diff -uNr openmp-r208472/runtime/Build_With_CMake.txt openmp/runtime/Build_With_CMake.txt --- openmp-r208472/runtime/Build_With_CMake.txt 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/Build_With_CMake.txt 2014-08-07 09:14:44.000000000 -0400 @@ -0,0 +1,225 @@ +# +#//===----------------------------------------------------------------------===// +#// +#// The LLVM Compiler Infrastructure +#// +#// This file is dual licensed under the MIT and the University of Illinois Open +#// Source Licenses. See LICENSE.txt for details. +#// +#//===----------------------------------------------------------------------===// +# + + Building libiomp5 using CMake + ============================= + + ---- Version of CMake required: v2.8.0 or above ---- + +============================================ +How to call cmake initially, then repeatedly +============================================ +- When calling cmake for the first time, all needed compiler options + must be specified on the command line. After this initial call to + cmake, the compiler definitions must not be included for further calls + to cmake. Other options can be specified on the command line multiple + times including all definitions in the Build options section below. +- Example of configuring, building, reconfiguring, rebuilding: + $ mkdir build + $ cd build + $ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Darch=32 .. # Initial configuration + $ make all common + ... + $ make clean + $ cmake -Darch=32e -DCMAKE_BUILD_TYPE=Debug .. # Second configuration + $ make all common + ... + $ rm -rf * + $ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Darch=32e .. # Third configuration + $ make all common +- Notice in the example how the compiler definitions are only specified + for an empty build directory, but other Build options are used at any time. +- The file CMakeCache.txt which is created after the first call to cmake + is a configuration file which holds all the values for the Build options. + These configuration values can be changed using a text editor to modify + CMakeCache.txt as opposed to using definitions on the command line. +- To have cmake create a particular type of build generator file simply + inlude the -G option: + $ cmake -G "Unix Makefiles" ... + You can see a list of generators cmake supports by executing cmake with + no arguments and a list will be printed. + +===================== +Instructions to Build +===================== + $ cd libomp_top_level/ [ directory with src/ , exports/ , tools/ , etc. ] + $ mkdir build + $ cd build + + [ Linux* , Mac* Libraries ] + $ cmake -DCMAKE_C_COMPILER= -DCMAKE_CXX_COMPILER= .. + + [ Intel(R) Many Integrated Core Library (Intel(R) MIC Library) ] + $ cmake -DCMAKE_C_COMPILER= -DCMAKE_CXX_COMPILER= -Dos=mic -Darch=32e .. + + [ Windows Libraries ] + $ cmake -G "Unix Makefiles" -DCMAKE_C_COMPILER= -DCMAKE_CXX_COMPILER= -DCMAKE_ASM_MASM_COMPILER=[ml | ml64] -DCMAKE_BUILD_TYPE=Release .. + + $ make all common + +================= +Mac* Fat Libraries +================= +On OS X* machines, it is possible to build universal (or fat) libraries which +include both IA-32 architecture and Intel(R) 64 architecture objects in a +single archive; just build the 32 and 32e libraries separately: + $ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Darch=32 .. + $ make + $ cmake -Darch=32e .. + $ make +then invoke make again with a special argument as follows: + $ make fat +- The fat target is only available for the arch=32e configuration. +- The fat libraries will be put in exports/mac_32e/lib while the "thin" libraries + will be in exports/mac_32e/lib.thin and exports/mac_32/lib.thin + +================ +Compiler options +================ +-DCMAKE_C_COMPILER= +-DCMAKE_CXX_COMPILER= + +-DCMAKE_Fortran_COMPILER= +Unix* systems (Optional as compiler is default): +This option is only needed when -Dcreate_fortran_modules is true + +-DCMAKE_ASM_COMPILER= +This option isn't usually needed for Non-Windows* builds + +-DCMAKE_ASM_MASM_COMPILER=[ml | ml64 ] +This option is Windows* Only + +============= +Build options +============= + +========================== +==== Operating System ==== +========================== +-Dos=lin|mac|win|mic +* Operating system can be lin (Linux*), mac (Mac*), win (Windows*), or + mic (Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture)). + If not specified, cmake will try to determine your current operating system. + +====================== +==== Architecture ==== +====================== +-Darch=32|32e|arm|ppc64 +* Architecture can be 32 (IA-32 architecture), 32e (Intel(R) 64 architecture), + arm (ARM architecture), or ppc64 (PPC64 architecture). + This option, by default is chosen based on the + CMake variable CMAKE_SIZEOF_VOID_P. If it is 8, then Intel(R) 64 architecture + is assumed. If it is 4, then IA-32 architecture is assumed. If you want to + use a different architecture other than x86 based architecture, you must specify + it when calling cmake initially using this -Darch= option or by changing + the arch value via CMakeCache.txt or the CMake GUI after the initial CMake run. + +---- First values listed are the default value ---- +-Dlib_type=normal|profile|stubs +Library type can be normal, profile, or stubs. + +-DCMAKE_BUILD_TYPE=Release|Debug|RelWithDebInfo +Build type can be Release, Debug, or RelWithDebInfo. +See below for interaction when -DUSE_BUILDPL_RULES is on. + +-Dversion=5|4 +libiomp5 version can be 5 or 4. + +-Domp_version=40|30 +OpenMP version can be either 40 or 30. + +-Dmic_arch=knc|knf +Intel(R) MIC Architecture. Can be +knf (Knights Ferry) or knc (Knights Corner). +This value is ignored if os != mic + +-Dmic_os=lin|bsd +Operating system on Intel(R) MIC Architecture. +Can be either bsd or lin. This value is ignored if os != mic + +-Dcreate_fortran_modules=off|on +Should the Fortran modules be created (requires Fortran compiler) + +-Dstats=off|on +Should include stats-gathering code? + +===================== +==== Micro tests ==== +===================== +After the library has been built, five microtests are performed. +Some will be skipped based upon the platform. +These tests can be turned on (default) or off with the following options: +-Dtest_touch=on|off -- Should the touch test be done? +-Dtest_relo=on|off -- Should the position independent code test be done? +-Dtest_execstack=on|off -- Should the stack be checked for executability? +-Dtest_instr=on|off -- Should the Intel(R) MIC Libraries be checked + for correct instruction set? +-Dtest_deps=on|off -- Should libiomp5's dependencies be checked? +-Dtests=off|on -- Should any of the above tests be done? + +============================================ +==== How to append flags to compilation ==== +============================================ +- These flags are *appended*. They do not + overwrite any of the preset flags. +-DUSER_CPP_FLAGS= -- Additional C Preprocessor flags + (typically additional -Ddef=val flags) +-DUSER_C_FLAGS= -- Additional C compiler flags +-DUSER_CXX_FLAGS= -- Additional C++ compiler flags +-DUSER_ASM_FLAGS= -- Additional assembly flags +-DUSER_LD_FLAGS= -- Additional linker flags +-DUSER_LD_LIB_FLAGS= -- Additional libraries to link + to during link phase +-DUSER_F_FLAGS= -- Additional Fortran compiler flags + +=================================== +==== Feature Based Compilation ==== +=================================== +-DUSE_BUILDPL_RULES=false|true +Should the build imitate build.pl's build process. +When this is true, the Unix* Release builds will build libiomp5 +with -O2 and -g flags activated (same as RelWithDebInfo). Then, +the debug info is stripped out of the library and put into libiomp5.dbg +This is done for interaction with Intel(R) Parallel Amplifier. + +-DUSE_ADAPTIVE_LOCKS=true|false +Should adaptive (TSX-based) locks be included? +These are x86 specific. This feature is turned on by default +for IA-32 architecture and Intel(R) 64 architecture. +Otherwise, it is turned off. + +-DUSE_PREDEFINED_LINKER_FLAGS=true|false +Should the predefined linker flags in CommonFlags.cmake be included +in the link command? This is true by default and should work for +Linux*, Mac*, and Windows*. The --version-script flag on Unix* based +operating systems will be included regardless. + +======================== +Examples usages of CMake +======================== +---- Typical usage ---- +cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc .. +cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. +cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. + +---- With Various Options ---- +cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Dos=lin -Darch=32 .. +cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Dos=mac -Darch=32 -DCMAKE_BUILD_TYPE=Debug .. +cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort -Dtests=on -Dcreate_fortran_modules=on -DUSE_BUILDPL_RULES=on .. +cmake -DUSER_CFLAGS='Werror' -DUSER_CPP_FLAGS='-DNEW_FEATURE=1 -DOLD_FEATURE=0' -DUSER_CXX_FLAGS='-Werror -Wsign-compare' .. + +---- Stubs library ---- +cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -Dlib_type=stubs .. + +========= +Footnotes +========= +[*] Other names and brands may be claimed as the property of others. diff -uNr openmp-r208472/runtime/CMakeLists.txt openmp/runtime/CMakeLists.txt --- openmp-r208472/runtime/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/CMakeLists.txt 2014-08-07 09:14:44.000000000 -0400 @@ -0,0 +1,833 @@ +# +#//===----------------------------------------------------------------------===// +#// +#// The LLVM Compiler Infrastructure +#// +#// This file is dual licensed under the MIT and the University of Illinois Open +#// Source Licenses. See LICENSE.txt for details. +#// +#//===----------------------------------------------------------------------===// +# + +################ +# CMAKE libiomp5 +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +project(libiomp C CXX) + +######### +# GLOBALS +set(GLOBAL_DEBUG 0) + +# Add cmake directory to search for custom cmake functions +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) + +# Set base libomp directory (directory with exports/ , src/ , tools/ , etc.) +# The top-level CMakeLists.txt should define this variable. +set(LIBOMP_WORK ${CMAKE_CURRENT_SOURCE_DIR}) + +# These include files are in cmake/ subdirectory except for FindPerl which is a cmake standard module +include(HelperFunctions) +include(Definitions) # -D definitions when compiling +include(CommonFlags) # compiler, assembler, fortran, linker flags common for all compilers +include(SourceFiles) # source files to compile +include(PerlFlags) # Perl flags for generate-def.pl and expand-vars.pl +include(FindPerl) # Standard cmake module to check for Perl + +#################################################################### +# CONFIGURATION +# +# * Any variable/value that is CACHE-ed can be changed after the initial run of cmake +# through the file, CMakeCache.txt which is in the build directory. +# * If you change any value in CMakeCache.txt, then just run cmake .. +# and the changed will be picked up. One can also use -DVARIABLE=VALUE +# when calling cmake to changed configuration values. +# * CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_ASM_MASM_COMPILER, CMAKE_ASM_COMPILER, +# CMAKE_Fortran_COMPILER can only by specified on the initial run of cmake. +# This means you cannot specify -DCMAKE_C_COMPILER= on a subsequent run of cmake +# in the same build directory until that build directory is emptied. +# If you want to change the compiler, then empty the build directory and rerun cmake. + +# Build Configuration +set(os_possible_values lin mac win mic) +set(arch_possible_values 32e 32 arm ppc64) +set(build_type_possible_values release debug relwithdebinfo) +set(omp_version_possible_values 40 30) +set(lib_type_possible_values normal profile stubs) +set(mic_arch_possible_values knf knc) +set(mic_os_possible_values bsd lin) + +# Below, cmake will try and determine the operating system and architecture for you (it assumes Intel architecture) +# These values are set in CMakeCache.txt when cmake is first run (-Dvar_name=... will take precedence) +# parameter | default value +# ---------------------------- +# Right now, this build system considers os=lin to mean "Unix-like that is not MAC" +if(${APPLE}) # Apple goes first because CMake considers Mac to be a Unix based operating system, while libiomp5 considers it a special case + set(os mac CACHE STRING "The operating system to build for (lin/mac/win/mic)") +elseif(${UNIX}) + set(os lin CACHE STRING "The operating system to build for (lin/mac/win/mic)") +elseif(${WIN32}) + set(os win CACHE STRING "The operating system to build for (lin/mac/win/mic)") +else() + set(os lin CACHE STRING "The operating system to build for (lin/mac/win/mic)") +endif() + +# set to default architecture if the user did not specify an architecture explicitly +if(NOT arch) + if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") + set(arch 32 CACHE STRING "The architecture to build for (32e/32/arm/ppc64). 32e is Intel(R) 64 architecture, 32 is IA-32 architecture") + else() + set(arch 32e CACHE STRING "The architecture to build for (32e/32/arm/ppc64). 32e is Intel(R) 64 architecture, 32 is IA-32 architecture") + endif() +endif() + +set(lib_type normal CACHE STRING "Performance,Profiling,Stubs library (normal/profile/stubs)") +set(version 5 CACHE STRING "Produce libguide (version 4) or libiomp5 (version 5)") +set(omp_version 40 CACHE STRING "The OpenMP version (40/30)") +set(mic_arch knc CACHE STRING "Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) (knf/knc). Ignored if not Intel(R) MIC Architecture build.") +set(mic_os lin CACHE STRING "Intel(R) MIC Architecture operating system (bsd/lin). Ignored if not Intel(R) MIC Architecture build.") +set(create_fortran_modules false CACHE STRING "Create Fortran module files? (requires fortran compiler)") + +# - These tests are little tests performed after the library is formed. +# - The library won't be copied to the exports directory until it has passed/skipped all below tests +# - To skip these tests, just pass -Dtests=OFF to cmake or change tests value in CMakeCache.txt to OFF after running cmake +set(test_touch true CACHE BOOL "Perform a small touch test?" ) +set(test_relo true CACHE BOOL "Perform a relocation test for dynamic libraries?" ) +set(test_execstack true CACHE BOOL "Perform a execstack test for linux dynamic libraries?" ) +set(test_instr true CACHE BOOL "Perform an instruction test for Intel(R) MIC Architecture libraries?" ) +set(test_deps true CACHE BOOL "Perform a library dependency test?" ) +set(tests false CACHE BOOL "Perform touch, relo, execstack, instr, and deps tests?" ) + +# - stats-gathering enables OpenMP stats where things like the number of parallel regions, clock ticks spent in +# particular openmp regions are recorded. +set(stats false CACHE BOOL "Stats-Gathering functionality?" ) + +# User specified flags. These are appended to the predetermined flags found in CommonFlags.cmake and ${CMAKE_C_COMPILER_ID}/*Flags.cmake (i.e., GNU/CFlags.cmake) +set(USER_C_FLAGS "" CACHE STRING "Appended user specified C compiler flags." ) +set(USER_CXX_FLAGS "" CACHE STRING "Appended user specified C++ compiler flags." ) +set(USER_CPP_FLAGS "" CACHE STRING "Appended user specified C preprocessor flags." ) +set(USER_ASM_FLAGS "" CACHE STRING "Appended user specified assembler flags." ) +set(USER_LD_FLAGS "" CACHE STRING "Appended user specified linker flags." ) +set(USER_LD_LIB_FLAGS "" CACHE STRING "Appended user specified linked libs flags. (i.e., -lm)") +set(USER_F_FLAGS "" CACHE STRING "Appended user specified Fortran compiler flags. These are only used if create_fortran_modules==true." ) + +# - Allow three build types: Release, Debug, RelWithDebInfo (these relate to build.pl's release, debug, and diag settings respectively) +# - default is Release (when CMAKE_BUILD_TYPE is not defined) +# - CMAKE_BUILD_TYPE affects the -O and -g flags (CMake magically includes correct version of them on per compiler basis) +# - typical: Release = -O3 -DNDEBUG +# RelWithDebInfo = -O2 -g -DNDEBUG +# Debug = -g +if(CMAKE_BUILD_TYPE) + # CMAKE_BUILD_TYPE was defined, check for validity + string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lowercase) + check_variable(cmake_build_type_lowercase "${build_type_possible_values}") +else() + # CMAKE_BUILD_TYPE was not defined, set default to Release + unset(CMAKE_BUILD_TYPE CACHE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Release/Debug/RelWithDebInfo") + string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lowercase) + check_variable(cmake_build_type_lowercase "${build_type_possible_values}") +endif() + +# Check valid values +check_variable(os "${os_possible_values}" ) +check_variable(arch "${arch_possible_values}" ) +check_variable(omp_version "${omp_version_possible_values}") +check_variable(lib_type "${lib_type_possible_values}" ) +if("${os}" STREQUAL "mic") + check_variable(mic_arch "${mic_arch_possible_values}" ) + check_variable(mic_os "${mic_os_possible_values}" ) +endif() +# Get the build number from kmp_version.c +get_build_number("${LIBOMP_WORK}" build_number) + +# Getting time and date +# As of now, no timestamp will be created. +set(date "No Timestamp") + +################################################################# +# Set some useful flags variables for other parts of cmake to use +# Operating System +set(LINUX FALSE) +set(MAC FALSE) +set(WINDOWS FALSE) +set(MIC FALSE) +set(FREEBSD FALSE) +if("${os}" STREQUAL "lin") + set(LINUX TRUE) + set(real_os lin) +elseif("${os}" STREQUAL "mac") + set(MAC TRUE) + set(real_os mac) +elseif("${os}" STREQUAL "win") + set(WINDOWS TRUE) + set(real_os win) +elseif("${os}" STREQUAL "mic") + set(MIC TRUE) + set(real_os lrb) +endif() +if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") + set(FREEBSD TRUE) +endif() + +# Architecture +set(IA32 FALSE) +set(INTEL64 FALSE) +set(ARM FALSE) +set(PPC64 FALSE) +if("${arch}" STREQUAL "32") # IA-32 architecture + set(IA32 TRUE) +elseif("${arch}" STREQUAL "32e") # Intel(R) 64 architecture + set(INTEL64 TRUE) +elseif("${arch}" STREQUAL "arm") # ARM architecture + set(ARM TRUE) +elseif("${arch}" STREQUAL "ppc64") # PPC64 architecture + set(PPC64 TRUE) +endif() + +# Set some flags based on build_type +# cmake_build_type_lowercase is based off of CMAKE_BUILD_TYPE, just put in lowercase. +set(RELEASE_BUILD FALSE) +set(DEBUG_BUILD FALSE) +set(RELWITHDEBINFO_BUILD FALSE) +if("${cmake_build_type_lowercase}" STREQUAL "release") + set(RELEASE_BUILD TRUE) +elseif("${cmake_build_type_lowercase}" STREQUAL "debug") + set(DEBUG_BUILD TRUE) +elseif("${cmake_build_type_lowercase}" STREQUAL "relwithdebinfo") + set(RELWITHDEBINFO_BUILD TRUE) +endif() + +# Stats-gathering on or off? +set(STATS_GATHERING FALSE) +if("${stats}") # string "on" or "ON" is seen as boolean TRUE + set(STATS_GATHERING TRUE) +endif() + +# Include itt notify interface? Right now, always. +set(USE_ITT_NOTIFY TRUE) + +# normal, profile, stubs library. +set(NORMAL_LIBRARY FALSE) +set(STUBS_LIBRARY FALSE) +set(PROFILE_LIBRARY FALSE) +if("${lib_type}" STREQUAL "normal") + set(NORMAL_LIBRARY TRUE) +elseif("${lib_type}" STREQUAL "profile") + set(PROFILE_LIBRARY TRUE) +elseif("${lib_type}" STREQUAL "stubs") + set(STUBS_LIBRARY TRUE) +endif() + +############################################### +# Features for compilation and build in general + +# - Does the compiler support a 128-bit floating point data type? Default is false +# - If a compiler does, then change it in the CMakeCache.txt file (or using the cmake GUI) +# or send to cmake -DCOMPILER_SUPPORTS_QUAD_PRECISION=true +# - If COMPILER_SUPPORTS_QUAD_PRECISION is true, then a corresponding COMPILER_QUAD_TYPE must be given +# This is the compiler's quad-precision data type. +# ** TODO: This isn't complete yet. Finish it. Requires changing macros in kmp_os.h ** +set(COMPILER_SUPPORTS_QUAD_PRECISION false CACHE BOOL "*INCOMPLETE* Does the compiler support a 128-bit floating point type?") +set(COMPILER_QUAD_TYPE "" CACHE STRING "*INCOMPLETE* The quad precision data type (i.e., for gcc, __float128)") + +# - Should the orignal build rules for builds be used? (cmake/OriginalBuildRules.cmake). This setting is off by default. +# - This always compiles with -g. And if it is a release build, the debug info is stripped out via objcopy and put into libiomp5.dbg. +set(USE_BUILDPL_RULES false CACHE BOOL "Should the build follow build.pl rules/recipes?") + +# - Should the build use the predefined linker flags (OS-dependent) in CommonFlags.cmake? +# - these predefined linker flags should work for Windows, Mac, and True Linux for the most popular compilers/linkers +set(USE_PREDEFINED_LINKER_FLAGS true CACHE BOOL "Should the build use the predefined linker flags in CommonFlags.cmake?") + +# - TSX based locks have __asm code which can be troublesome for some compilers. This feature is also x86 specific. +if({${IA32} OR ${INTEL64}) + set(USE_ADAPTIVE_LOCKS true CACHE BOOL "Should TSX-based lock be compiled (adaptive lock in kmp_lock.cpp). These are x86 specific.") +else() + set(USE_ADAPTIVE_LOCKS false CACHE BOOL "Should TSX-based lock be compiled (adaptive lock in kmp_lock.cpp). These are x86 specific.") +endif() + +################################## +# Error checking the configuration +if(${STATS_GATHERING} AND (${WINDOWS} OR ${MAC})) + error_say("Stats-gathering functionality is only supported on x86-Linux and Intel(R) MIC Architecture") +endif() +if(${STATS_GATHERING} AND NOT (${IA32} OR ${INTEL64})) + error_say("Stats-gathering functionality is only supported on x86-Linux and Intel(R) MIC Architecture") +endif() +if(${USE_ADAPTIVE_LOCKS} AND NOT(${IA32} OR ${INTEL64})) + error_say("Adaptive locks (TSX) functionality is only supported on x86 Architecture") +endif() + +############################################### +# - Create the suffix for the export directory +# - Only add to suffix when not a default value +# - Example suffix: .deb.30.s1 +# final export directory: exports/lin_32e.deb.30.s1/lib +# - These suffixes imply the build is a Debug, OpenMP 3.0, Stats-Gathering version of the library +if(NOT "${cmake_build_type_lowercase}" STREQUAL "release") + string(SUBSTRING "${cmake_build_type_lowercase}" 0 3 build_type_suffix) + set(suffix "${suffix}.${build_type_suffix}") +endif() +if(NOT "${omp_version}" STREQUAL "40") + set(suffix "${suffix}.${omp_version}") +endif() +if(${STATS_GATHERING}) + set(suffix "${suffix}.s1") +endif() +if(${MIC}) + if(NOT "${mic_arch}" STREQUAL "knf") + set(suffix "${suffix}.${mic_arch}") + endif() + if(NOT "${mic_os}" STREQUAL "bsd") + set(suffix "${suffix}.${mic_os}") + endif() +endif() + +#################################### +# Setting file extensions / suffixes +set(obj ${CMAKE_C_OUTPUT_EXTENSION} ) +set(lib ${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) +set(exe ${CMAKE_EXECUTABLE_SUFFIX} ) + +###################### +# Find perl executable +# Perl is used to create omp.h (and other headers) along with kmp_i18n_id.inc and kmp_i18n_default.inc (see below in Rules section) +if(NOT "${PERL_FOUND}") # variable is defined in FindPerl Standard CMake Module + error_say("Error: Could not find valid perl") +endif() + +######################### +# Setting directory names +set(platform "${real_os}_${arch}" ) # i.e., lin_32e, mac_32 +set(build_dir "${CMAKE_CURRENT_BINARY_DIR}" ) # build directory (Where CMakeCache.txt is created, build files generated) +set(src_dir "${LIBOMP_WORK}/src" ) +set(tools_dir "${LIBOMP_WORK}/tools" ) +set(export_dir "${LIBOMP_WORK}/exports" ) +set(export_cmn_dir "${export_dir}/common${suffix}" ) +set(export_ptf_dir "${export_dir}/${platform}${suffix}") +_export_lib_dir(${platform} export_lib_dir) # set exports directory (relative to build_dir) i.e., ../exports/lin_32e/lib/ + # or i.e., ../exports/mac_32e/lib.thin/ for mac +if(${MAC}) + # macs use lib.thin/ subdirectory for non-fat libraries that only contain one architecture + # macs use lib/ subdirectory for fat libraries that contain both IA-32 architecture and Intel(R) 64 architecture code. + _export_lib_fat_dir(${platform} export_lib_fat_dir) +endif() +set(inc_dir "${LIBOMP_WORK}/src/include/${omp_version}") + +############################ +# Setting final library name +set(lib_item "libiomp") +if(${PROFILE_LIBRARY}) + set(lib_item "${lib_item}prof") +endif() +if(${STUBS_LIBRARY}) + set(lib_item "${lib_item}stubs") +endif() +set(lib_item "${lib_item}${version}") +if(${WINDOWS}) + set(lib_item "${lib_item}md") +endif() +set(lib_ext "${dll}") +# ${lib_file} is real library name: +# libiomp5.so for Linux +# libiomp5.dylib for Mac +# libiomp5md.dll for Windows +set(lib_file "${lib_item}${lib_ext}") + +######################################## +# Setting export file names (full paths) +if(${WINDOWS}) + set(imp_file "${lib_item}${lib}") # this is exported (libiomp5md.lib) + set(def_file "${lib_item}.def") # this is not exported + set(rc_file "${lib_item}.rc") # this is not exported + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" OR ${USE_BUILDPL_RULES}) + set(pdb_file "${lib_file}.pdb") # this is exported if it exists (libiomp5md.dll.pdb) + endif() +endif() +set(export_lib_files "${lib_file}" "${imp_file}" "${pdb_file}") +set(export_inc_files "iomp_lib.h") +set(export_mod_files "omp_lib.mod" "omp_lib_kinds.mod") +set(export_cmn_files1 "omp.h" "omp_lib.h" "omp_lib.f" "omp_lib.f90") +set(export_cmn_files2 "iomp.h") +add_prefix("${export_lib_dir}/" export_lib_files) +add_prefix("${export_ptf_dir}/include_compat/" export_inc_files) +add_prefix("${export_ptf_dir}/include/" export_mod_files) +add_prefix("${export_cmn_dir}/include/" export_cmn_files1) +add_prefix("${export_cmn_dir}/include_compat/" export_cmn_files2) +set(export_cmn_files "${export_cmn_files1}" "${export_cmn_files2}") +if("${export_lib_fat_dir}") + set(export_lib_fat_files "${lib_file}" "${imp_file}") + add_prefix("${export_lib_fat_dir}/" export_lib_fat_files) +endif() + +######################### +# Getting legal type/arch +set_legal_type(legal_type) +set_legal_arch(legal_arch) + +################################################# +# Preprocessor Definitions (cmake/Definitions.cmake) +# Preprocessor Includes +# Compiler (C/C++) Flags (cmake/CommonFlags.cmake) +# Assembler Flags (cmake/CommonFlags.cmake) +# Fortran Flags (cmake/CommonFlags.cmake) +# Linker Flags (cmake/CommonFlags.cmake) +# Archiver Flags (cmake/CommonFlags.cmake) +# Helper Perl Script Flags (cmake/PerlFlags.cmake) +# * Inside the cmake/CommonFlags.cmake file, the USER_*_FLAGS are added. +# * Cannot use CMAKE_*_FLAGS directly because -x c++ is put in the linker command and mangles the linking phase. + +# preprocessor flags (-D definitions and -I includes) +# Grab environment variable CPPFLAGS and append those to definitions +set(include_dirs ${CMAKE_CURRENT_BINARY_DIR} ${src_dir} ${src_dir}/i18n ${inc_dir} ${src_dir}/thirdparty/ittnotify) +include_directories(${include_dirs}) + +# Grab assembler-dependent flags +# CMake will look for cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake to append additional assembler flags. +if(${WINDOWS}) + # Windows based systems use CMAKE_ASM_MASM_COMPILER + # The windows assembly files are in MASM format, and they require a tool that can handle MASM syntax (ml.exe or ml64.exe typically) + enable_language(ASM_MASM) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_ASM_MASM_COMPILER_ID} ${CMAKE_MODULE_PATH}) + find_file(assembler_specific_include_file_found AsmFlags.cmake ${CMAKE_MODULE_PATH}) + if(assembler_specific_include_file_found) + include(AsmFlags) + append_assembler_specific_asm_flags(ASM_FLAGS) + else() + warning_say("Could not find cmake/${CMAKE_ASM_MASM_COMPILER_ID}/AsmFlags.cmake: will only use default flags") + endif() +else() + # Unix (including Mac) based systems use CMAKE_ASM_COMPILER + # Unix assembly files can be handled by compiler usually. + enable_language(ASM) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_ASM_COMPILER_ID} ${CMAKE_MODULE_PATH}) + find_file(assembler_specific_include_file_found AsmFlags.cmake ${CMAKE_MODULE_PATH}) + if(assembler_specific_include_file_found) + include(AsmFlags) + append_assembler_specific_asm_flags(ASM_FLAGS) + else() + warning_say("Could not find cmake/${CMAKE_ASM_COMPILER_ID}/AsmFlags.cmake: will only use default flags") + endif() +endif() +# Grab compiler-dependent flags +# Cmake will look for cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake to append additional c, cxx, and linker flags. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_C_COMPILER_ID} ${CMAKE_MODULE_PATH}) +find_file(compiler_specific_include_file_found CFlags.cmake ${CMAKE_MODULE_PATH}) +if(compiler_specific_include_file_found) + include(CFlags) # COMPILER_SUPPORTS_QUAD_PRECISION changed in here + append_compiler_specific_c_and_cxx_flags(C_FLAGS CXX_FLAGS) + append_compiler_specific_linker_flags(LD_FLAGS LD_LIB_FLAGS) +else() + warning_say("Could not find cmake/${CMAKE_C_COMPILER_ID}/CFlags.cmake: will only use default flags") +endif() + +# Grab all the compiler-independent flags +append_c_and_cxx_flags_common(C_FLAGS CXX_FLAGS) +append_asm_flags_common(ASM_FLAGS) +append_fort_flags_common(F_FLAGS) +append_linker_flags_common(LD_FLAGS LD_LIB_FLAGS) +append_archiver_flags_common(AR_FLAGS) +append_cpp_flags(DEFINITIONS_FLAGS) + +# Setup the flags correctly for cmake (covert to string) +# Pretty them up (STRIP any beginning and trailing whitespace) +list_to_string("${DEFINITIONS_FLAGS}" DEFINITIONS_FLAGS) +list_to_string("${C_FLAGS}" C_FLAGS ) +list_to_string("${CXX_FLAGS}" CXX_FLAGS ) +list_to_string("${ASM_FLAGS}" ASM_FLAGS ) +list_to_string("${LD_FLAGS}" LD_FLAGS ) +list_to_string("${LD_LIB_FLAGS}" LD_LIB_FLAGS ) +list_to_string("${AR_FLAGS}" AR_FLAGS ) # Windows specific for creating import library +string(STRIP "${DEFINITIONS_FLAGS}" DEFINITIONS_FLAGS) +string(STRIP "${C_FLAGS}" C_FLAGS ) +string(STRIP "${CXX_FLAGS}" CXX_FLAGS ) +string(STRIP "${ASM_FLAGS}" ASM_FLAGS ) +string(STRIP "${LD_FLAGS}" LD_FLAGS ) +string(STRIP "${LD_LIB_FLAGS}" LD_LIB_FLAGS ) +string(STRIP "${AR_FLAGS}" AR_FLAGS ) # Windows specific for creating import library + +# Grab the Perl flags +set_ev_flags(ev_flags) # expand-vars.pl flags +set_gd_flags(gd_flags) # generate-def.pl flags (Windows only) +set(oa_opts "--os=${real_os}" "--arch=${arch}") # sent to the perl scripts + +######################################################### +# Getting correct source files (cmake/SourceFiles.cmake) +set_c_files(lib_c_items) +set_cpp_files(lib_cxx_items) +set_asm_files(lib_asm_items) +set_imp_c_files(imp_c_items) # Windows-specific + +################################### +# Setting all source file variables +set(lib_src_files "${lib_c_items}" "${lib_cxx_items}" "${lib_asm_items}") +set(imp_src_files "${imp_c_items}") +add_prefix("${src_dir}/" lib_src_files) +add_prefix("${src_dir}/" imp_src_files) # Windows-specific +add_prefix("${src_dir}/" lib_c_items ) +add_prefix("${src_dir}/" lib_cxx_items) +add_prefix("${src_dir}/" lib_asm_items) +add_prefix("${src_dir}/" imp_c_items ) # Windows-specific + +##################################################################### +# Debug print outs. Will print "variable = ${variable}" if GLOBAL_DEBUG == 1 +if(GLOBAL_DEBUG) + include(CMakePrintSystemInformation) +endif() +debug_say_var(CMAKE_ASM_COMPILE_OBJECT) +debug_say_var(CMAKE_RC_COMPILER) +debug_say_var(CMAKE_C_COMPILER_ID) +debug_say_var(LIBOMP_WORK) +debug_say_var(date) +debug_say_var(stats) +debug_say_var(lib_file) +debug_say_var(export_lib_files) +debug_say_var(DEFINITIONS_FLAGS) +debug_say_var(C_FLAGS) +debug_say_var(CXX_FLAGS) +debug_say_var(ASM_FLAGS) +debug_say_var(F_FLAGS) +debug_say_var(LD_FLAGS) +debug_say_var(LD_LIB_FLAGS) +debug_say_var(AR_FLAGS) +debug_say_var(ev_flags) +debug_say_var(gd_flags) +debug_say_var(oa_opts) +debug_say_var(lib_c_items) +debug_say_var(lib_cxx_items) +debug_say_var(lib_asm_items) +debug_say_var(imp_c_items) +debug_say_var(lib_src_files) +debug_say_var(imp_src_files) + +#################################################################### +# --------------------- # +# --- Rules/Recipes --- # +# --------------------- # +#################################################################### +# Below, ${ldeps} always stands for "local dependencies" for the +# next immediate target to be created via add_custom_target() or +# add_custom_command() + +#################### +# --- Create all --- +add_custom_target(lib ALL DEPENDS ${export_lib_files}) +add_custom_target(inc ALL DEPENDS ${export_inc_files}) +if(${create_fortran_modules}) +add_custom_target(mod ALL DEPENDS ${export_mod_files}) +endif() +# --- Enforce the tests to be completed/skipped before copying to exports directory --- +if(${tests}) + if(${WINDOWS}) + set(test-dependencies test-touch-mt/.success test-touch-md/.success test-relo/.success test-execstack/.success test-instr/.success test-deps/.success) + else() + set(test-dependencies test-touch-rt/.success test-relo/.success test-execstack/.success test-instr/.success test-deps/.success) + endif() + set_source_files_properties(${export_lib_files} PROPERTIES OBJECT_DEPENDS "${test-dependencies}") +endif() + +############################# +# --- Create Common Files --- +add_custom_target(common DEPENDS ${export_cmn_files}) +add_custom_target(clean-common COMMAND ${CMAKE_COMMAND} -E remove -f ${export_cmn_files}) + +########################################## +# --- Copy files to export directories --- +# - just a simple copy recipe which acts as an install step +# - copies out of the src_dir into the dest_dir +# +# dest_dir/target : src_dir/target +# cp src_dir/target dest_dir/target +macro (simple_copy_recipe target src_dir dest_dir) + get_source_file_property(extra_depends ${dest_dir}/${target} OBJECT_DEPENDS) + if("${extra_depends}" MATCHES "NOTFOUND") + set(extra_depends) + endif() + set(ldeps ${src_dir}/${target} "${extra_depends}") + if(NOT "${target}" STREQUAL "") + file(MAKE_DIRECTORY ${dest_dir}) # make sure destination directory exists + add_custom_command( + OUTPUT ${dest_dir}/${target} + COMMAND ${CMAKE_COMMAND} -E copy ${src_dir}/${target} ${dest_dir}/${target} + DEPENDS ${ldeps} + ) + endif() +endmacro() +# copy from build directory to final resting places in exports directory +simple_copy_recipe("omp.h" "${build_dir}" "${export_cmn_dir}/include") +simple_copy_recipe("omp_lib.h" "${build_dir}" "${export_cmn_dir}/include") +simple_copy_recipe("omp_lib.f" "${build_dir}" "${export_cmn_dir}/include") +simple_copy_recipe("omp_lib.f90" "${build_dir}" "${export_cmn_dir}/include") +simple_copy_recipe("iomp.h" "${build_dir}" "${export_cmn_dir}/include_compat") +simple_copy_recipe("${lib_file}" "${build_dir}" "${export_lib_dir}") +simple_copy_recipe("${imp_file}" "${build_dir}" "${export_lib_dir}") +simple_copy_recipe("${pdb_file}" "${build_dir}" "${export_lib_dir}") +simple_copy_recipe("${dbg_file}" "${build_dir}" "${export_lib_dir}") +simple_copy_recipe("omp_lib.mod" "${build_dir}" "${export_ptf_dir}/include") +simple_copy_recipe("omp_lib_kinds.mod" "${build_dir}" "${export_ptf_dir}/include") +simple_copy_recipe("iomp_lib.h" "${build_dir}" "${export_ptf_dir}/include_compat") + +###################################################### +# --- Build the main library --- +# $(lib_file) <== Main library file to create + +# objects depend on : .inc files and omp.h +# This way the *.inc and omp.h are generated before any compilations take place +add_custom_target(needed-headers DEPENDS ${build_dir}/kmp_i18n_id.inc ${build_dir}/kmp_i18n_default.inc ${build_dir}/omp.h) + +# For Windows, there is a definitions file (.def) and resource file (.res) created using generate-def.pl and rc.exe respectively. +if(${WINDOWS}) + add_custom_target(needed-windows-files DEPENDS ${build_dir}/${def_file} ${build_dir}/${rc_file}) + list(APPEND lib_src_files ${build_dir}/${rc_file}) + # The windows assembly files are in MASM format, and they require a tool that can handle MASM syntax (ml.exe or ml64.exe typically) + enable_language(ASM_MASM) +else() + # Unix assembly files can be handled by compiler. + enable_language(ASM) +endif() + +# Remove any cmake-automatic linking of libraries by linker, This is so linux +# and mac don't include libstdc++ just because we compile c++ files. +if(${USE_PREDEFINED_LINKER_FLAGS}) + set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "") + set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") + set(CMAKE_ASM_IMPLICIT_LINK_LIBRARIES "") +endif() + +# --- ${lib_file} rule --- +add_library(iomp5 SHARED ${lib_src_files}) +set_target_properties(iomp5 PROPERTIES + PREFIX "" SUFFIX "" # Take control + OUTPUT_NAME "${lib_file}" # of output name + LINK_FLAGS "${LD_FLAGS}" + LINKER_LANGUAGE C # use C Compiler for linking step + SKIP_BUILD_RPATH true # have Mac linker -install_name just be "-install_name libiomp5.dylib" +) +# Target lib (export files) depend on the library (iomp5) being built +add_dependencies(lib iomp5) + +# Linking command will include libraries in LD_LIB_FLAGS +target_link_libraries(iomp5 ${LD_LIB_FLAGS}) + +# Create *.inc and omp.h before compiling any sources +add_dependencies(iomp5 needed-headers) +if(${WINDOWS}) +# Create .def and .rc file before compiling any sources + add_dependencies(iomp5 needed-windows-files) +endif() + +# Set the compiler flags for each type of source +set_source_files_properties(${lib_c_items} + ${imp_c_items} PROPERTIES COMPILE_FLAGS "${C_FLAGS}" ) +set_source_files_properties(${lib_cxx_items} PROPERTIES COMPILE_FLAGS "${CXX_FLAGS}") +set_source_files_properties(${lib_asm_items} PROPERTIES COMPILE_FLAGS "${ASM_FLAGS}") +# Set the -D definitions for all sources +add_definitions(${DEFINITIONS_FLAGS}) + +# If creating a build that imitates build.pl's rules then set USE_BUILDPL_RULES to true +if(${USE_BUILDPL_RULES}) + include(BuildPLRules) +endif() + +###################################################### +# --- Source file specific flags --- +# kmp_version.o : -D _KMP_BUILD_TIME="\"$(date)}\"" +set_source_files_properties(${src_dir}/kmp_version.c PROPERTIES COMPILE_DEFINITIONS "_KMP_BUILD_TIME=\"\\\"${date}\\\"\"") + +# z_Linux_asm.o : -D KMP_ARCH_* +if(${ARM}) + set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_ARM") +elseif(${INTEL64}) + set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_X86_64") +elseif(${IA32}) + set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_X86") +elseif(${PPC64}) + set_source_files_properties(${src_dir}/z_Linux_asm.s PROPERTIES COMPILE_DEFINITIONS "KMP_ARCH_PPC64") +endif() + +if(${WINDOWS}) + set_source_files_properties(${src_dir}/thirdparty/ittnotify/ittnotify_static.c PROPERTIES COMPILE_DEFINITIONS "UNICODE") +endif() + +###################################################### +# MAC specific build rules +if(${MAC}) + # fat library rules + if(${INTEL64}) + _export_lib_fat_dir( "mac_32e" export_fat_mac_32e) + _export_lib_dir( "mac_32" export_mac_32 ) + _export_lib_dir( "mac_32e" export_mac_32e ) + file(MAKE_DIRECTORY ${export_fat_mac_32e}) + add_custom_target(fat + COMMAND ${CMAKE_COMMAND} -E echo Building 32 and 32e fat libraries from ${export_mac_32}/${lib_file} and ${export_mac_32e}/${lib_file} + COMMAND ${CMAKE_COMMAND} -E echo Will put fat library in ${export_fat_mac_32e} directory + COMMAND lipo -create -output ${export_fat_mac_32e}/${lib_file} ${export_mac_32}/${lib_file} ${export_mac_32e}/${lib_file} + ) + endif() +endif() + +###################################################### +# Windows specific build rules +if(${WINDOWS}) + + # --- Create $(imp_file) --- + # This file is first created in the unstripped/${lib_file} creation step. + # It is then "re-linked" to include kmp_import.c which prevents linking of both Visual Studio OpenMP and newly built OpenMP + if(NOT "${imp_file}" STREQUAL "") + set(generated_import_file ${lib_file}${lib}) + add_library(iomp5imp STATIC ${generated_import_file} ${imp_src_files}) + set_source_files_properties(${generated_import_file} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE) + set_target_properties(iomp5imp PROPERTIES + PREFIX "" SUFFIX "" + OUTPUT_NAME "${imp_file}" + STATIC_LIBRARY_FLAGS "${AR_FLAGS}" + LINKER_LANGUAGE C + SKIP_BUILD_RPATH true + ) + add_custom_command(TARGET iomp5imp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove -f ${imp_file}) + add_dependencies(iomp5imp iomp5) + endif() + + # --- Create $(def_file) --- + if(NOT "${def_file}" STREQUAL "") + string_to_list("${gd_flags}" gd_flags) + add_custom_command( + OUTPUT ${def_file} + COMMAND ${PERL_EXECUTABLE} ${tools_dir}/generate-def.pl ${gd_flags} -o ${def_file} ${src_dir}/dllexports + DEPENDS ${src_dir}/dllexports ${tools_dir}/generate-def.pl + ) + endif() + + # --- Create $(rc_file) --- + if(NOT "${rc_file}" STREQUAL "") + add_custom_command( + OUTPUT ${rc_file} + COMMAND ${CMAKE_COMMAND} -E copy libiomp.rc ${rc_file} + DEPENDS libiomp.rc + ) + endif() +endif() + +###################################################### +# kmp_i18n_id.inc and kmp_i18n_default.inc +set(perlcmd "${PERL_EXECUTABLE}" "${tools_dir}/message-converter.pl" "${oa_opts}" "--prefix=kmp_i18n" "--enum=kmp_i18n_id.inc" "${src_dir}/i18n/en_US.txt") +add_custom_command( + OUTPUT ${build_dir}/kmp_i18n_id.inc + COMMAND ${perlcmd} + DEPENDS ${src_dir}/i18n/en_US.txt ${tools_dir}/message-converter.pl +) +set(perlcmd "${PERL_EXECUTABLE}" "${tools_dir}/message-converter.pl" "${oa_opts}" "--prefix=kmp_i18n" "--default=kmp_i18n_default.inc" "${src_dir}/i18n/en_US.txt") +add_custom_command( + OUTPUT ${build_dir}/kmp_i18n_default.inc + COMMAND ${perlcmd} + DEPENDS ${src_dir}/i18n/en_US.txt ${tools_dir}/message-converter.pl +) + +###################################################### +# Micro test rules for after library has been built (cmake/MicroTests.cmake) +# - Only perform if ${tests} == true (specify when invoking: cmake -Dtests=on ...) +if(${tests}) + include(MicroTests) +endif() + +###################################################### +# --- Create Fortran Files --- +# omp_lib.mod +if(${create_fortran_modules}) + # Grab fortran-compiler-dependent flags + # Cmake will look for cmake/${CMAKE_Fortran_COMPILER_ID}/FortranFlags.cmake to append additional fortran flags. + enable_language(Fortran) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_Fortran_COMPILER_ID} ${CMAKE_MODULE_PATH}) + find_file(fortran_specific_include_file_found FortranFlags.cmake ${CMAKE_MODULE_PATH}) + if(fortran_specific_include_file_found) + include(FortranFlags) + append_fortran_compiler_specific_fort_flags(F_FLAGS) + else() + warning_say("Could not find cmake/${CMAKE_Fortran_COMPILER_ID}/FortranFlags.cmake: will only use default flags in CommonFlags.cmake") + endif() + set(omp_lib_f "omp_lib.f90" ) + add_custom_command( + OUTPUT "omp_lib.mod" + COMMAND ${CMAKE_Fortran_COMPILER} -c ${F_FLAGS} ${omp_lib_f} + DEPENDS ${omp_lib_f} + ) + add_custom_command( + OUTPUT "omp_lib_kinds.mod" + COMMAND ${CMAKE_Fortran_COMPILER} -c ${F_FLAGS} ${omp_lib_f} + DEPENDS ${omp_lib_f} + ) + # clean omp_lib.o from build directory when "make clean" + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES omp_lib${obj}) +endif() + +############################################################### +# --- Using expand-vars.pl to generate files --- +# - 'file' is generated using expand-vars.pl and 'file'.var +# - Any .h .f .f90 .rc files should be created with this recipe +macro(expand_vars_recipe filename) + get_source_file_property(extra_ev_flags ${filename} COMPILE_DEFINITIONS) + if("${extra_ev_flags}" MATCHES "NOTFOUND") + set(extra_ev_flags) + else() + string_to_list("${extra_ev_flags}" extra_ev_flags) + endif() + find_file(${filename}_path ${filename}.var PATHS ${src_dir}/include/${omp_version} ${src_dir}) + set(ldeps "${${filename}_path}" "${src_dir}/kmp_version.c" "${tools_dir}/expand-vars.pl") + set(expandvarscmd ${PERL_EXECUTABLE} ${tools_dir}/expand-vars.pl --strict ${ev_flags} ${extra_ev_flags} ${${filename}_path} ${filename}) + if(NOT "${filename}" STREQUAL "") + add_custom_command( + OUTPUT ${filename} + COMMAND ${expandvarscmd} + DEPENDS ${ldeps} + ) + endif() +endmacro() +string_to_list("${ev_flags}" ev_flags) +# omp_lib.h : ev-flags += -D KMP_INT_PTR_KIND="int_ptr_kind()" +set_source_files_properties(omp_lib.h PROPERTIES COMPILE_DEFINITIONS "-D KMP_INT_PTR_KIND=\"int_ptr_kind()\"") +# iomp_lib.h : ev-flags += -D KMP_INT_PTR_KIND=$(if $(filter 32,$(arch)),4,8) +if(${IA32}) # 32 bit archs + set_source_files_properties(iomp_lib.h PROPERTIES COMPILE_DEFINITIONS "-D KMP_INT_PTR_KIND=4") +else() + set_source_files_properties(iomp_lib.h PROPERTIES COMPILE_DEFINITIONS "-D KMP_INT_PTR_KIND=8") +endif() +# libiomp.rc : ev-flags += -D KMP_FILE=$(lib_file) +set_source_files_properties(libiomp.rc PROPERTIES COMPILE_DEFINITIONS "-D KMP_FILE=${lib_file}") +expand_vars_recipe(omp.h) +expand_vars_recipe(omp_lib.h) +expand_vars_recipe(omp_lib.f) +expand_vars_recipe(omp_lib.f90) +expand_vars_recipe(iomp.h) +expand_vars_recipe(iomp_lib.h) +expand_vars_recipe(libiomp.rc) + + +#################################################################### +# Print configuration after all variables are set. +say("") +say("----------------------- CONFIGURATION -----------------------") +say("Operating System : ${os}") +say("Architecture : ${arch}") +say("Build Type : ${CMAKE_BUILD_TYPE}") +say("OpenMP Version : ${omp_version}") +say("Lib Type : ${lib_type}") +if(${MIC}) + say("Intel(R) MIC Architecture : ${mic_arch}") + say("Intel(R) MIC Architecture OS : ${mic_os}") +endif() +say("Fortran Modules : ${create_fortran_modules}") +# will say development if all zeros +if("${build_number}" STREQUAL "00000000") + set(build "development") +else() + set(build "${build_number}") +endif() +say("Build : ${build}") +say("Stats-Gathering : ${stats}") +say("Use build.pl rules : ${USE_BUILDPL_RULES}") +say("Adaptive locks : ${USE_ADAPTIVE_LOCKS}") +say("Use predefined linker flags : ${USE_PREDEFINED_LINKER_FLAGS}") +say("Compiler supports quad precision : ${COMPILER_SUPPORTS_QUAD_PRECISION}") +say("-------------------------------------------------------------") +say("") + diff -uNr openmp-r208472/runtime/CMakeLists.txt.old openmp/runtime/CMakeLists.txt.old --- openmp-r208472/runtime/CMakeLists.txt.old 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/CMakeLists.txt.old 2014-08-05 10:09:42.000000000 -0400 @@ -0,0 +1,8 @@ +project(openmp) +cmake_minimum_required(VERSION 2.8) + +set(VERSION 5) +set(OMP_VERSION "201107") +set(OMP_VERSION_NUM "40") + +add_subdirectory(src) diff -uNr openmp-r208472/runtime/README.txt openmp/runtime/README.txt --- openmp-r208472/runtime/README.txt 2014-05-21 15:14:56.000000000 -0400 +++ openmp/runtime/README.txt 2014-08-05 10:09:30.000000000 -0400 @@ -37,7 +37,7 @@ current working directory. omp_os: Operating system. By default, the build will attempt to - detect this. Currently supports "linux", "macos", and + detect this. Currently supports "linux", "freebsd", "macos", and "windows". arch: Architecture. By default, the build will attempt to @@ -68,6 +68,10 @@ make compiler=gcc +There is also an experimental CMake build system. This is *not* yet +supported for production use and resulting binaries have not been checked +for compatibility. + Supported RTL Build Configurations ================================== diff -uNr openmp-r208472/runtime/cmake/BuildPLRules.cmake openmp/runtime/cmake/BuildPLRules.cmake --- openmp-r208472/runtime/cmake/BuildPLRules.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/BuildPLRules.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,100 @@ +############################################################################### +# This file contains additional build rules that correspond to build.pl's rules +# Building libiomp5.dbg is linux only, Windows will build libiomp5md.dll.pdb +# +# ######### BUILD DEPENDENCIES ########## +# +# exports/.../libiomp5.so exports/.../libiomp5.dbg +# [copy] | | [copy] +# | | +# ./libiomp5.so ./libiomp5.dbg +# [copy] / OR \____________ [copy] | [copy] +# / \ | +# ./unstripped/libiomp5.so ./stripped/libiomp5.so ./unstripped/libiomp5.dbg +# / \ / +# / [linking] \[strip] /[strip and store] +# / \ / +# ${objs} (maybe compiled with -g) ./unstripped/libiomp5.so (library with debug info in it) +# | +# | [linking] +# | +# ${objs} (always compiled with -g) +# +# For icc Linux builds, we always include debugging information via -g and create libiomp5.dbg +# so that Intel(R) Parallel Amplifier can use the .dbg file. +# For icc Windows builds, we always include debugging information via -Zi and create libiomp5.pdb +# in a fashion similar to libiomp5.dbg +# For icc Mac builds, we don't bother with the debug info. + +# We build library in unstripped directory +file(MAKE_DIRECTORY ${build_dir}/unstripped) + +# Only build the .dbg file for Release builds +# Debug and RelWithDebInfo builds should not create a .dbg file. +# The debug info should remain in the library file. +if(${LINUX} AND ${RELEASE_BUILD}) + set(dbg_file ${lib_item}.dbg) +endif() + +################################ +# --- Create $(lib_file).dbg --- +if(NOT "${dbg_file}" STREQUAL "") + # if a ${dbg_file} file is going to be created, then + file(MAKE_DIRECTORY ${build_dir}/stripped) + + # ./${lib_file} : stripped/${lib_file} + # copy stripped/${lib_file} ./${lib_file} + simple_copy_recipe("${lib_file}" "${build_dir}/stripped" "${build_dir}") + + # stripped/${lib_file} : unstripped/${lib_file} ./${dbg_file} + # objcopy --strip-debug unstripped/${lib_file} stripped/${lib_file}.tmp + # objcopy --add-gnu-debuglink=${dbg_file} stripped/${lib_file}.tmp stripped/${lib_file} + add_custom_command( + OUTPUT ${build_dir}/stripped/${lib_file} + COMMAND ${CMAKE_OBJCOPY} --strip-debug ${build_dir}/unstripped/${lib_file} ${build_dir}/stripped/${lib_file}.tmp + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${dbg_file} ${build_dir}/stripped/${lib_file}.tmp ${build_dir}/stripped/${lib_file} + DEPENDS "${build_dir}/${dbg_file}" + ) + + # ./${dbg_file} : unstripped/${dbg_file} + # copy unstripped/${dbg_file} ./${dbg_file} + simple_copy_recipe("${dbg_file}" "${build_dir}/unstripped" "${build_dir}") + + # unstripped/${dbg_file} : unstripped/${lib_file} + # objcopy --only-keep-debug unstripped/${lib_file} unstripped/${dbg_file} + add_custom_command( + OUTPUT ${build_dir}/unstripped/${dbg_file} + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${build_dir}/unstripped/${lib_file} ${build_dir}/unstripped/${dbg_file} + DEPENDS iomp5 + ) + +else() + + # ./${lib_file} : unstripped/${lib_file} + # copy unstripped/${lib_file} ./${lib_file} + simple_copy_recipe("${lib_file}" "${build_dir}/unstripped" "${build_dir}") +endif() + +# Windows specific command to move around debug info files post-build +if(NOT "${pdb_file}" STREQUAL "" AND ${RELEASE_BUILD}) + add_custom_command(TARGET iomp5 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename ${pdb_file} ${pdb_file}.nonstripped + COMMAND ${CMAKE_COMMAND} -E rename ${pdb_file}.stripped ${pdb_file} + ) +endif() + +# Have icc build libiomp5 in unstripped directory +set_target_properties(iomp5 PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${build_dir}/unstripped" + RUNTIME_OUTPUT_DIRECTORY "${build_dir}/unstripped" + ARCHIVE_OUTPUT_DIRECTORY "${build_dir}" +) + +# Always use RelWithDebInfo flags for Release builds when using the build.pl's build rules (use -g -O2 instead of just -O3) +# The debug info is then stripped out at the end of the build and put into libiomp5.dbg for Linux +if(${RELEASE_BUILD} AND NOT ${MAC}) + set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO} ) + set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) + set(CMAKE_ASM_FLAGS_RELEASE ${CMAKE_ASM_FLAGS_RELWITHDEBINFO}) +endif() + diff -uNr openmp-r208472/runtime/cmake/Clang/AsmFlags.cmake openmp/runtime/cmake/Clang/AsmFlags.cmake --- openmp-r208472/runtime/cmake/Clang/AsmFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/Clang/AsmFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,16 @@ +# This file holds Clang (clang/clang++) specific compiler dependent flags +# The flag types are: +# 1) Assembly flags + +######################################################### +# Assembly flags +function(append_assembler_specific_asm_flags input_asm_flags) + set(local_asm_flags) + append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed + if(${IA32}) + append_asm_flags("-m32") # Generate 32 bit IA-32 architecture code + append_asm_flags("-msse2") # Allow use of Streaming SIMD Instructions + endif() + set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/Clang/CFlags.cmake openmp/runtime/cmake/Clang/CFlags.cmake --- openmp-r208472/runtime/cmake/Clang/CFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/Clang/CFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,38 @@ +# This file holds Clang (clang/clang++) specific compiler dependent flags +# The flag types are: +# 1) C/C++ Compiler flags +# 2) Linker flags + +######################################################### +# C/C++ Compiler flags +function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags) + set(local_c_flags) + set(local_cxx_flags) + append_c_and_cxx_flags("-std=c++0x") # Enables support for many C++11 (formerly known as C++0x) features. The following are the most recently added features: + append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled. + append_c_and_cxx_flags("-x c++") # Compile C files as C++ files + if(${IA32}) + append_c_and_cxx_flags("-m32") # Generate 32 bit IA-32 architecture code + append_c_and_cxx_flags("-msse2") # Allow use of Streaming SIMD Instructions + elseif(${ARM}) + append_c_and_cxx_flags("-marm") # Target the ARM architecture + endif() + append_c_and_cxx_flags("-Wno-unused-value") # Don't warn about unused values + append_c_and_cxx_flags("-Wno-switch") # Don't warn about switch statements that don't cover entire range of values + set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE) + set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE) +endfunction() + +######################################################### +# Linker flags +function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs) + set(local_ld_flags) + set(local_ld_flags_libs) + if(${IA32}) + append_linker_flags("-m32") + append_linker_flags("-msse2") + endif() + set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE) + set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/CommonFlags.cmake openmp/runtime/cmake/CommonFlags.cmake --- openmp-r208472/runtime/cmake/CommonFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/CommonFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,133 @@ +# This file holds the common flags independent of compiler +# The flag types are: +# 1) Assembly flags (append_asm_flags_common) +# 2) C/C++ Compiler flags (append_c_and_cxx_flags_common) +# 3) Fortran Compiler flags (append_fort_flags_common) +# 4) Linker flags (append_linker_flags_common) +# 5) Archiver flags (append_archiver_flags_common) + +# These append_* macros all append to the corresponding list variable holding the flags. +macro(append_c_flags new_flag) + list(APPEND local_c_flags "${new_flag}") +endmacro() + +macro(append_cxx_flags new_flag) + list(APPEND local_cxx_flags "${new_flag}") +endmacro() + +macro(append_c_and_cxx_flags new_flag) + append_c_flags("${new_flag}") + append_cxx_flags("${new_flag}") +endmacro() + +macro(append_asm_flags new_flag) + list(APPEND local_asm_flags "${new_flag}") +endmacro() + +macro(append_fort_flags new_flag) + list(APPEND local_fort_flags "${new_flag}") +endmacro() + +# The difference between linker_flags and linker_flags_libs is linker_flags_libs +# is put at the end of the linker command where linking libraries should be done. +macro(append_linker_flags new_flag) + list(APPEND local_ld_flags "${new_flag}") +endmacro() + +macro(append_linker_flags_library new_flag) + list(APPEND local_ld_flags_libs "${new_flag}") +endmacro() + +macro(append_archiver_flags new_flag) + list(APPEND local_ar_flags "${new_flag}") +endmacro() + +######################################################### +# Global Assembly flags +function(append_asm_flags_common input_asm_flags) + set(local_asm_flags) + set(${input_asm_flags} "${${input_asm_flags}}" "${local_asm_flags}" "${USER_ASM_FLAGS}" PARENT_SCOPE) +endfunction() + +######################################################### +# Global C/C++ Compiler flags +function(append_c_and_cxx_flags_common input_c_flags input_cxx_flags) + set(local_c_flags) + set(local_cxx_flags) + set(${input_c_flags} "${${input_c_flags}}" "${local_c_flags}" "${USER_C_FLAGS}" PARENT_SCOPE) + set(${input_cxx_flags} "${${input_cxx_flags}}" "${local_cxx_flags}" "${USER_CXX_FLAGS}" PARENT_SCOPE) +endfunction() + +######################################################### +# Global Fortran Compiler flags (for creating .mod files) +function(append_fort_flags_common input_fort_flags) + set(local_fort_flags) + set(${input_fort_flags} "${${input_fort_flags}}" "${local_fort_flags}" "${USER_F_FLAGS}" PARENT_SCOPE) +endfunction() + +######################################################### +# Linker flags +function(append_linker_flags_common input_ld_flags input_ld_flags_libs) + set(local_ld_flags) + set(local_ld_flags_libs) + + ################################# + # Windows linker flags + if(${WINDOWS}) + + ################## + # MAC linker flags + elseif(${MAC}) + if(${USE_PREDEFINED_LINKER_FLAGS}) + append_linker_flags("-single_module") + append_linker_flags("-current_version ${version}.0") + append_linker_flags("-compatibility_version ${version}.0") + endif() + ##################################################################################### + # Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) linker flags + elseif(${MIC}) + if(${USE_PREDEFINED_LINKER_FLAGS}) + append_linker_flags("-Wl,-x") + append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object. + append_linker_flags("-Wl,--as-needed") + append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries + if(NOT ${STUBS_LIBRARY}) + append_linker_flags_library("-pthread") # link in pthread library + append_linker_flags_library("-ldl") # link in libdl (dynamic loader library) + endif() + if(${STATS_GATHERING}) + append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it) + endif() + endif() + ######################### + # Unix based linker flags + else() + # For now, always include --version-script flag on Unix systems. + append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries + if(${USE_PREDEFINED_LINKER_FLAGS}) + append_linker_flags("-Wl,-z,noexecstack") # Marks the object as not requiring executable stack. + append_linker_flags("-Wl,--as-needed") # Only adds library dependencies as they are needed. (if libiomp5 actually uses a function from the library, then add it) + if(NOT ${STUBS_LIBRARY}) + append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object. + append_linker_flags("-Wl,-fini=__kmp_internal_end_fini") # When creating an ELF executable or shared object, call NAME when the + # executable or shared object is unloaded, by setting DT_FINI to the + # address of the function. By default, the linker uses "_fini" as the function to call. + append_linker_flags_library("-pthread") # link pthread library + if(NOT ${FREEBSD}) + append_linker_flags_library("-Wl,-ldl") # link in libdl (dynamic loader library) + endif() + endif() + endif() # if(${USE_PREDEFINED_LINKER_FLAGS}) + endif() # if(${OPERATING_SYSTEM}) ... + + set(${input_ld_flags} "${${input_ld_flags}}" "${local_ld_flags}" "${USER_LD_FLAGS}" PARENT_SCOPE) + set(${input_ld_flags_libs} "${${input_ld_flags_libs}}" "${local_ld_flags_libs}" "${USER_LD_LIB_FLAGS}" PARENT_SCOPE) +endfunction() + +######################################################### +# Archiver Flags +function(append_archiver_flags_common input_ar_flags) + set(local_ar_flags) + set(${input_ar_flags} "${${input_ar_flags}}" "${local_ar_flags}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/Definitions.cmake openmp/runtime/cmake/Definitions.cmake --- openmp-r208472/runtime/cmake/Definitions.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/Definitions.cmake 2014-08-07 09:14:44.000000000 -0400 @@ -0,0 +1,138 @@ +# +#//===----------------------------------------------------------------------===// +#// +#// The LLVM Compiler Infrastructure +#// +#// This file is dual licensed under the MIT and the University of Illinois Open +#// Source Licenses. See LICENSE.txt for details. +#// +#//===----------------------------------------------------------------------===// +# + +# void append_definitions(string new_flag); +# - appends new_flag to cpp_flags list +macro(append_definitions new_flag) + list(APPEND local_cpp_flags "${new_flag}") +endmacro() + +function(append_cpp_flags input_cpp_flags) + set(local_cpp_flags) + + append_definitions("-D USE_ITT_BUILD") + append_definitions("-D KMP_ARCH_STR=\"\\\\\"${legal_arch}\\\\\"\"") + append_definitions("-D BUILD_I8") + append_definitions("-D KMP_LIBRARY_FILE=\\\\\"${lib_file}\\\\\"") # yes... you need 5 backslashes... + append_definitions("-D KMP_VERSION_MAJOR=${version}") + + # customize to 128 bytes for ppc64 + if(${PPC64}) + append_definitions("-D CACHE_LINE=128") + else() + append_definitions("-D CACHE_LINE=64") + endif() + + append_definitions("-D KMP_ADJUST_BLOCKTIME=1") + append_definitions("-D BUILD_PARALLEL_ORDERED") + append_definitions("-D KMP_ASM_INTRINS") + if(${USE_ITT_NOTIFY}) + append_definitions("-D USE_ITT_NOTIFY=1") + else() + append_definitions("-D USE_ITT_NOTIFY=0") + append_definitions("-D INTEL_NO_ITTNOTIFY_API") + endif() + append_definitions("-D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_") + + ##################### + # Windows definitions + if(${WINDOWS}) + append_definitions("-D _CRT_SECURE_NO_WARNINGS") + append_definitions("-D _CRT_SECURE_NO_DEPRECATE") + append_definitions("-D _WINDOWS") + append_definitions("-D _WINNT") + append_definitions("-D _WIN32_WINNT=0x0501") + append_definitions("-D KMP_WIN_CDECL") + append_definitions("-D _USRDLL") + if(${DEBUG_BUILD}) + append_definitions("-D _ITERATOR_DEBUG_LEVEL=0") + endif() + else() # Other than windows... (Unix based systems, Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture), and Mac) + append_definitions("-D _GNU_SOURCE") + append_definitions("-D _REENTRANT") + append_definitions("-D BUILD_TV") + append_definitions("-D USE_CBLKDATA") + if(NOT "${version}" STREQUAL "4") + append_definitions("-D KMP_GOMP_COMPAT") + endif() + endif() + + ####################################### + # Intel(R) MIC Architecture definitions + if(${MIC}) + append_definitions("-D KMP_TDATA_GTID") + else() # Other than Intel(R) MIC Architecture... + append_definitions("-D USE_LOAD_BALANCE") + endif() + + ################## + # Unix definitions + if(${LINUX}) + append_definitions("-D KMP_TDATA_GTID") + endif() + + ################################## + # Other conditional definitions + append_definitions("-D KMP_USE_ASSERT") + append_definitions("-D GUIDEDLL_EXPORTS") + if(${STUBS_LIBRARY}) + append_definitions("-D KMP_STUB") + endif() + if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD}) + append_definitions("-D KMP_DEBUG") + endif() + if(${DEBUG_BUILD}) + append_definitions("-D _DEBUG") + append_definitions("-D BUILD_DEBUG") + endif() + if(${STATS_GATHERING}) + append_definitions("-D KMP_STATS_ENABLED=1") + else() + append_definitions("-D KMP_STATS_ENABLED=0") + endif() + + # OpenMP version flags + set(have_omp_50 0) + set(have_omp_41 0) + set(have_omp_40 0) + set(have_omp_30 0) + if(${omp_version} EQUAL 50 OR ${omp_version} GREATER 50) + set(have_omp_50 1) + endif() + if(${omp_version} EQUAL 41 OR ${omp_version} GREATER 41) + set(have_omp_41 1) + endif() + if(${omp_version} EQUAL 40 OR ${omp_version} GREATER 40) + set(have_omp_40 1) + endif() + if(${omp_version} EQUAL 30 OR ${omp_version} GREATER 30) + set(have_omp_30 1) + endif() + append_definitions("-D OMP_50_ENABLED=${have_omp_50}") + append_definitions("-D OMP_41_ENABLED=${have_omp_41}") + append_definitions("-D OMP_40_ENABLED=${have_omp_40}") + append_definitions("-D OMP_30_ENABLED=${have_omp_30}") + + # Architectural definitions + if(${INTEL64} OR ${IA32}) + if(${USE_ADAPTIVE_LOCKS}) + append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=1") + else() + append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=0") + endif() + append_definitions("-D KMP_DEBUG_ADAPTIVE_LOCKS=0") + else() + append_definitions("-D KMP_USE_ADAPTIVE_LOCKS=0") + append_definitions("-D KMP_DEBUG_ADAPTIVE_LOCKS=0") + endif() + set(${input_cpp_flags} "${${input_cpp_flags}}" "${local_cpp_flags}" "${USER_CPP_FLAGS}" "$ENV{CPPFLAGS}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/GNU/AsmFlags.cmake openmp/runtime/cmake/GNU/AsmFlags.cmake --- openmp-r208472/runtime/cmake/GNU/AsmFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/GNU/AsmFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,16 @@ +# This file holds GNU (gcc/g++) specific compiler dependent flags +# The flag types are: +# 1) Assembly flags + +######################################################### +# Assembly flags +function(append_assembler_specific_asm_flags input_asm_flags) + set(local_asm_flags) + append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed + if(${IA32}) + append_asm_flags("-m32") # Generate 32 bit IA-32 architecture code + append_asm_flags("-msse2") # Allow use of Streaming SIMD Instructions + endif() + set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/GNU/CFlags.cmake openmp/runtime/cmake/GNU/CFlags.cmake --- openmp-r208472/runtime/cmake/GNU/CFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/GNU/CFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,45 @@ +# This file holds GNU (gcc/g++) specific compiler dependent flags +# The flag types are: +# 2) C/C++ Compiler flags +# 4) Linker flags +unset(COMPILER_SUPPORTS_QUAD_PRECISION CACHE) +set(COMPILER_SUPPORTS_QUAD_PRECISION true CACHE BOOL "Does the compiler support a 128-bit floating point type?") +set(COMPILER_QUAD_TYPE __float128) + +######################################################### +# C/C++ Compiler flags +function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags) + set(local_c_flags) + set(local_cxx_flags) + append_c_and_cxx_flags("-std=c++0x") # Enables support for many C++11 (formerly known as C++0x) features. The following are the most recently added features: + append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled. + append_c_and_cxx_flags("-x c++") # Compile C files as C++ files + if(${IA32}) + append_c_and_cxx_flags("-m32") # Generate 32 bit IA-32 architecture code + append_c_and_cxx_flags("-msse2") # Allow use of Streaming SIMD Instructions + elseif(${ARM}) + append_c_and_cxx_flags("-marm") # Target the ARM architecture + endif() + set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE) + set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE) +endfunction() + +######################################################### +# Linker flags +function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs) + set(local_ld_flags) + set(local_ld_flags_libs) + if(${WINDOWS}) + elseif(${MAC}) + elseif(${MIC}) + else() + append_linker_flags("-static-libgcc") # Causes libgcc to be linked in statically + endif() + if(${IA32}) + append_linker_flags("-m32") + append_linker_flags("-msse2") + endif() + set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE) + set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/GNU/FortranFlags.cmake openmp/runtime/cmake/GNU/FortranFlags.cmake --- openmp-r208472/runtime/cmake/GNU/FortranFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/GNU/FortranFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,14 @@ +# This file holds GNU (gcc/g++) specific compiler dependent flags +# The flag types are: +# 1) Fortran Compiler flags + +######################################################### +# Fortran Compiler flags (for creating .mod files) +function(append_fortran_compiler_specific_fort_flags input_fort_flags) + set(local_fort_flags) + if(${IA32}) + append_fort_flags("-m32") + append_fort_flags("-msse2") + endif() + set(${input_fort_flags} ${${input_fort_flags}} "${local_fort_flags}" PARENT_SCOPE) +endfunction() diff -uNr openmp-r208472/runtime/cmake/HelperFunctions.cmake openmp/runtime/cmake/HelperFunctions.cmake --- openmp-r208472/runtime/cmake/HelperFunctions.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/HelperFunctions.cmake 2014-08-07 09:14:44.000000000 -0400 @@ -0,0 +1,256 @@ +# +#//===----------------------------------------------------------------------===// +#// +#// The LLVM Compiler Infrastructure +#// +#// This file is dual licensed under the MIT and the University of Illinois Open +#// Source Licenses. See LICENSE.txt for details. +#// +#//===----------------------------------------------------------------------===// +# + +####################################### FUNCTIONS/MACROS ########################################### +# It should be noted that in cmake, functions can only be used on a single line with the return value +# stored in a parameter you send to the function. There isn't a true return value. So technically, +# all functions would have a C/C++ prototype of: +# void function_name(parameter1, parameter2, ...); +# +# If you want a return value, you have to use a parameter so the function prototype would be: +# void function_name(input_parameter1, input_parameter2, ..., return_value) +# ################## + +# void say(string message_to_user); +# - prints out message_to_user +macro(say message_to_user) + message("${message_to_user}") +endmacro() + +# void warning_say(string message_to_user); +# - prints out message_to_user with a warning +macro(warning_say message_to_user) + message(WARNING "${message_to_user}") +endmacro() + +# void error_say(string message_to_user); +# - prints out message_to_user with an error and exits cmake +macro(error_say message_to_user) + message(FATAL_ERROR "${message_to_user}") +endmacro() + +# void debug_say(string message_to_developer); +# - prints out message when GLOBAL_DEBUG == 1 (for debugging cmake build) +macro(debug_say message_to_developer) + if(${GLOBAL_DEBUG} STREQUAL "1") + say("DEBUG: ${message_to_developer}") + endif() +endmacro() + +# void debug_say_var(variable var); +# - prints the variable name and its value (for debugging cmake build) +macro(debug_say_var var) + if(${GLOBAL_DEBUG} STREQUAL "1") + say("DEBUG: Variable: ${var} = ${${var}} ") + endif() +endmacro() + +# void set_legal_arch(string* return_arch_string); +# - returns (through return_arch_string) the formal architecture +# string or warns user of unknown architecture +function(set_legal_arch return_arch_string) + if(${IA32}) + set(${return_arch_string} "IA-32" PARENT_SCOPE) + elseif(${INTEL64}) + set(${return_arch_string} "Intel(R) 64" PARENT_SCOPE) + elseif(${MIC}) + set(${return_arch_string} "Intel(R) Many Integrated Core Architecture" PARENT_SCOPE) + elseif(${arch} STREQUAL "l1") + set(${return_arch_string} "L1OM" PARENT_SCOPE) + elseif(${ARM}) + set(${return_arch_string} "ARM" PARENT_SCOPE) + elseif(${PPC64}) + set(${return_arch_string} "PPC64" PARENT_SCOPE) + else() + warning_say("set_legal_arch(): Warning: Unknown architecture...") + endif() +endfunction() + +# void check_variable(string var, string var_name, listvalues_list); +# - runs through values_list checking if ${var} == values_list[i] for any i. +# - if the var is found, then just print it out +# - if the var is not found, then warn user +function(check_variable var values_list) + set(valid_flag 0) + foreach(value IN LISTS values_list) + if("${${var}}" STREQUAL "${value}") + set(valid_flag 1) + set(the_value "${value}") + endif() + endforeach() + if(${valid_flag} EQUAL 0) + error_say("check_variable(): ${var} = ${${var}} is unknown") + endif() +endfunction() + +# void _export_lib_dir(string export_dir, string platform, string suffix, string* return_value); +# - basically a special case for mac platforms where it adds '.thin' to the output lib directory +function(_export_lib_dir pltfrm return_value) + if(${MAC}) + set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib.thin" PARENT_SCOPE) + else() + set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib" PARENT_SCOPE) + endif() +endfunction() + +# void _export_lib_fat_dir(string export_dir, string platform, string suffix, string* return_value); +# - another mac specialty case for fat libraries. +# - this sets export_lib_fat_dir in the MAIN part of CMakeLists.txt +function(_export_lib_fat_dir pltfrm return_value) + set(${return_value} "${export_dir}/${pltfrm}${suffix}/lib" PARENT_SCOPE) +endfunction() + +# void get_build_number(string src_dir, string* return_build_number); +# - grab the eight digit build number (or 00000000) from kmp_version.c +function(get_build_number src_dir return_build_number) + # sets file_lines_list to a list of all lines in kmp_version.c + file(STRINGS "${src_dir}/src/kmp_version.c" file_lines_list) + + # runs through each line in kmp_version.c + foreach(line IN LISTS file_lines_list) + # if the line begins with "#define KMP_VERSION_BUILD" then we take not of the build number + string(REGEX MATCH "^[ \t]*#define[ \t]+KMP_VERSION_BUILD" valid "${line}") + if(NOT "${valid}" STREQUAL "") # if we matched "#define KMP_VERSION_BUILD", then grab the build number + string(REGEX REPLACE "^[ \t]*#define[ \t]+KMP_VERSION_BUILD[ \t]+([0-9]+)" "\\1" + build_number "${line}" + ) + endif() + endforeach() + set(${return_build_number} "${build_number}" PARENT_SCOPE) # return build number +endfunction() + +# void set_legal_type(string* return_legal_type); +# - set the legal type name Performance/Profiling/Stub +function(set_legal_type return_legal_type) + if(${NORMAL_LIBRARY}) + set(${return_legal_type} "Performance" PARENT_SCOPE) + elseif(${PROFILE_LIBRARY}) + set(${return_legal_type} "Profiling" PARENT_SCOPE) + elseif(${STUBS_LIBRARY}) + set(${return_legal_type} "Stub" PARENT_SCOPE) + endif() +endfunction() + +# void set_mac_os_new(bool* return_mac_os_new); +# - sets the return_mac_os_new variable to true or false based on macosx version +# - no real "cmakey" way to do this. Have to call execute_process() +function(set_mac_os_new return_mac_os_new) + execute_process(COMMAND "sw_vers" "-productVersion" OUTPUT_VARIABLE mac_osx_version) + if("${mac_osx_version}" VERSION_GREATER "10.6") + set(${return_mac_os_new} TRUE PARENT_SCOPE) + else() + set(${return_mac_os_new} FALSE PARENT_SCOPE) + endif() +endfunction() + +# void add_prefix(string prefix, list* list_of_items); +# - returns list_of_items with prefix prepended to all items +# - original list is modified +function(add_prefix prefix list_of_items) + set(local_list "") + foreach(item IN LISTS "${list_of_items}") + if(NOT "${item}" STREQUAL "") + list(APPEND local_list "${prefix}${item}") + endif() + endforeach() + set(${list_of_items} "${local_list}" PARENT_SCOPE) +endfunction() + +# void add_suffix(string suffix, list* list_of_items); +# - returns list_of_items with suffix appended to all items +# - original list is modified +function(add_suffix suffix list_of_items) + set(local_list "") + foreach(item IN LISTS "${list_of_items}") + if(NOT "${item}" STREQUAL "") + list(APPEND local_list "${item}${suffix}") + endif() + endforeach() + set(${list_of_items} "${local_list}" PARENT_SCOPE) +endfunction() + +# void strip_suffix(list list_of_items, list* return_list); +# - returns a new list with suffix stripped (i.e., foo.c => foo) +# - list_of_items is not modified, return_list is modified +function(strip_suffix list_of_items return_list) + set(local_list "") + foreach(item IN LISTS "${list_of_items}") + if(NOT "${item}" STREQUAL "") + get_filename_component(filename "${item}" NAME_WE) + list(APPEND local_list "${filename}") + endif() + endforeach() + set(${return_list} "${local_list}" PARENT_SCOPE) +endfunction() + +# void list_to_string(list list_of_things, string* return_string); +# - converts a list to a space separated string +function(list_to_string list_of_things return_string) + string(REPLACE ";" " " output_variable "${list_of_things}") + set(${return_string} "${output_variable}" PARENT_SCOPE) +endfunction() + +# void string_to_list(string str, list* return_list); +# - converts a string to a semicolon separated list +# - what it really does is just string_replace all running whitespace to a semicolon +# - in cmake, a list is strings separated by semicolons: i.e., list of four items, list = "item1;item2;item3;item4" +function(string_to_list str return_list) + set(outstr) + string(REGEX REPLACE "[ \t]+" ";" outstr "${str}") + set(${return_list} "${outstr}" PARENT_SCOPE) +endfunction() + +# void get_date(string* return_date); +# - returns the current date "yyyy-mm-dd hh:mm:ss UTC" +# - this function alone causes the need for CMake v2.8.11 (TIMESTAMP) +#function(get_date return_date) +# string(TIMESTAMP local_date "%Y-%m-%d %H:%M:%S UTC" UTC) +# set(${return_date} ${local_date} PARENT_SCOPE) +#endfunction() + +# void find_a_program(string program_name, list extra_paths, bool fail_on_not_found, string return_variable_name); +# - returns the full path of a program_name +# - first looks in the list of extra_paths +# - if not found in extra_paths, then look through system path +# - errors out if fail_on_not_found == true and cmake could not find program_name. +function(find_a_program program_name extra_paths fail_on_not_found return_variable_name) + # first try to find the program in the extra_paths + find_program(${return_variable_name} "${program_name}" PATHS "${extra_paths}" DOC "Path to ${program_name}" NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) + if("${${return_variable_name}}" MATCHES NOTFOUND) + # if no extra_paths, or couldn't find it, then look in system $PATH + find_program(${return_variable_name} "${program_name}" DOC "Path to ${program_name}") + if("${${return_variable_name}}" MATCHES NOTFOUND AND ${fail_on_not_found}) + error_say("Error: Could not find program: ${program_name}") + endif() + endif() + + if(NOT "${${return_variable_name}}" MATCHES NOTFOUND) + say("-- Found ${program_name}: ${${return_variable_name}}") + endif() + + set(${return_variable_name} ${${return_variable_name}} PARENT_SCOPE) +endfunction() + +# WINDOWS SPECIFIC +# void replace_md_with_mt(string flags_var) +# - This macro replaces the /MD compiler flags (Windows specific) with /MT compiler flags +# - This does nothing if no /MD flags were replaced. +macro(replace_md_with_mt flags_var) + set(flags_var_name ${flags_var}) # i.e., CMAKE_C_FLAGS_RELEASE + set(flags_var_value ${${flags_var}}) # i.e., "/MD /O2 ..." + string(REPLACE /MD /MT temp_out "${flags_var_value}") + string(COMPARE NOTEQUAL "${temp_out}" "${flags_var_value}" something_was_replaced) + if("${something_was_replaced}") + unset(${flags_var_name} CACHE) + set(${flags_var_name} ${temp_out} CACHE STRING "Replaced /MD with /MT compiler flags") + endif() +endmacro() + diff -uNr openmp-r208472/runtime/cmake/Intel/AsmFlags.cmake openmp/runtime/cmake/Intel/AsmFlags.cmake --- openmp-r208472/runtime/cmake/Intel/AsmFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/Intel/AsmFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,31 @@ +# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags +# The flag types are: +# 1) Assembly flags + +######################################################### +# Assembly flags +function(append_assembler_specific_asm_flags input_asm_flags) + set(local_asm_flags) + append_asm_flags("-x assembler-with-cpp") # Assembly file that needs to be preprocessed + if(${IA32}) + append_asm_flags("-safeseh") # Registers exception handlers for safe exception handling. + append_asm_flags("-coff") # Generates common object file format (COFF) type of object module. + # Generally required for Win32 assembly language development. + append_asm_flags("-D _M_IA32") + elseif(${INTEL64}) + append_asm_flags("-D _M_AMD64") + endif() + if(${MIC}) + append_asm_flags("-mmic") # Build Intel(R) MIC Architecture native code + endif() + if(${WINDOWS}) + # CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead + # So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE. + # replace_md_with_mt() is in HelperFunctions.cmake + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG) + endif() + set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE) +endfunction() diff -uNr openmp-r208472/runtime/cmake/Intel/CFlags.cmake openmp/runtime/cmake/Intel/CFlags.cmake --- openmp-r208472/runtime/cmake/Intel/CFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/Intel/CFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,148 @@ +# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags +# The flag types are: +# 2) C/C++ Compiler flags +# 4) Linker flags + +# icc has a 128-bit floating point type called _Quad. Always compile with 128-bit floating point if it exists. +unset(COMPILER_SUPPORTS_QUAD_PRECISION CACHE) +set(COMPILER_SUPPORTS_QUAD_PRECISION true CACHE BOOL "Does the compiler support a 128-bit floating point type?") +set(COMPILER_QUAD_TYPE _Quad) + +######################################################### +# icc C/C++ Compiler flags +function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags) + set(local_c_flags) + set(local_cxx_flags) + if(${WINDOWS}) + + append_c_flags("-TP") # Tells the compiler to process a file as a C++ source file. + append_cxx_flags("-EHsc") # Enable C++ exception handling. + append_c_and_cxx_flags("-nologo") # Turn off tool banner. + append_c_and_cxx_flags("-W3") # Enables diagnostics for remarks, warnings, and errors. + # Additional warnings are also enabled above level 2 warnings. + append_c_and_cxx_flags("-WX") # Change all Warnings to Errors + append_c_and_cxx_flags("-GS") # Lets you control the threshold at which the stack checking routine is called or not called. + append_c_and_cxx_flags("-Qoption,cpp,--extended_float_types") # Enabled _Quad type. + if(${IA32}) + append_c_and_cxx_flags("-arch:ia32") # Tells the compiler which features it may target (ia32) + append_c_and_cxx_flags("-Oy-") # equivalent to -fno-omit-frame-pointer + endif() + append_c_and_cxx_flags("-Qlong_double") # enable long double + append_c_and_cxx_flags("-Qdiag-disable:177") # Disable warning: "... declared but never referenced" + if(${IA32}) + append_c_and_cxx_flags("-Qsafeseh") # Registers exception handlers for safe exception handling. + endif() + if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD}) + append_c_and_cxx_flags("-Qinline-min-size=1") # Specifies the upper limit for the size of what the inliner considers to be a small routine. + else() + append_c_and_cxx_flags("-Od") # Disables all optimizations. + append_c_and_cxx_flags("-RTC1") # Enables run-time checks of the stack frame, and enables run-time checks for unintialized variables. + append_c_and_cxx_flags("-MTd") # Tells the linker to search for unresolved references in a multithreaded, static run-time library. + endif() + else() + append_c_and_cxx_flags("-Wsign-compare") # warn on sign comparisons + append_c_and_cxx_flags("-Werror") # Changes all warnings to errors. + append_c_and_cxx_flags("-Qoption,cpp,--extended_float_types") # Enabled _Quad type. + append_c_and_cxx_flags("-fno-exceptions") # Exception handling table generation is disabled. + append_c_and_cxx_flags("-x c++") # Compile C files as C++ files + if(${MIC}) + append_c_and_cxx_flags("-mmic") # Build Intel(R) MIC Architecture native code + append_c_and_cxx_flags("-ftls-model=initial-exec") # Changes the thread local storage (TLS) model. Generates a restrictive, optimized TLS code. + # To use this setting, the thread-local variables accessed must be defined in one of the + # modules available to the program. + append_c_and_cxx_flags("-opt-streaming-stores never") # Disables generation of streaming stores for optimization. + append_c_and_cxx_flags("-sox") # Tells the compiler to save the compilation options and version number + # in the executable file. It also lets you choose whether to include + # lists of certain functions. + elseif(${LINUX}) + append_c_and_cxx_flags("-Werror") # Changes all warnings to errors. + append_c_and_cxx_flags("-sox") + if(${IA32}) + append_c_and_cxx_flags("-falign-stack=maintain-16-byte") # Tells the compiler the stack alignment to use on entry to routines. + append_c_and_cxx_flags("-mia32") # Tells the compiler which features it may target (ia32) + endif() + endif() + endif() + # CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead + # So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE. + # replace_md_with_mt() is in HelperFunctions.cmake + if(${WINDOWS}) + replace_md_with_mt(CMAKE_C_FLAGS) + replace_md_with_mt(CMAKE_C_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_C_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_C_FLAGS_DEBUG) + replace_md_with_mt(CMAKE_CXX_FLAGS) + replace_md_with_mt(CMAKE_CXX_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_CXX_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_CXX_FLAGS_DEBUG) + endif() + set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE) + set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE) +endfunction() + +######################################################### +# icc Linker flags +function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs) + set(local_ld_flags) + set(local_ld_flags_libs) + if(${WINDOWS}) + # Have icc use link.exe directly when Windows + set(CMAKE_C_CREATE_SHARED_LIBRARY "link.exe /out: " PARENT_SCOPE) + set(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDFLAGS}" CACHE STRING "Linker Flags" FORCE) + append_linker_flags("-nologo") # Turn off tool banner. + append_linker_flags("-dll") + append_linker_flags("-WX:NO") + append_linker_flags("-incremental:no") + append_linker_flags("-version:${version}.0") + append_linker_flags("-NXCompat") + append_linker_flags("-DynamicBase") # This option modifies the header of an executable to indicate + # whether the application should be randomly rebased at load time. + if(${IA32}) + append_linker_flags("-machine:i386") + append_linker_flags("-safeseh") + elseif(${INTEL64}) + append_linker_flags("-machine:amd64") + endif() + if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD}) + if(NOT "${pdb_file}" STREQUAL "") + append_linker_flags("-debug") + append_linker_flags("-pdb:${pdb_file}") + endif() + else() + if(NOT "${pdb_file}" STREQUAL "") + append_linker_flags("-debug") + append_linker_flags("-pdb:${pdb_file}") + append_linker_flags("-pdbstripped:${pdb_file}.stripped") + endif() + endif() + if(NOT "${imp_file}" STREQUAL "") + append_linker_flags("-implib:${lib_file}${lib}") + endif() + if(NOT "${def_file}" STREQUAL "") + append_linker_flags("-def:${def_file}") + endif() + elseif(${MAC}) + append_linker_flags("-no-intel-extensions") + if(NOT ${STUBS_LIBRARY}) + append_linker_flags_library("-pthread") # link in pthread library + append_linker_flags_library("-ldl") # link in libdl (dynamic loader library) + endif() + if(${STATS_GATHERING}) + append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it) + endif() + elseif(${MIC}) + append_linker_flags("-mmic") # enable MIC linking + append_linker_flags("-static-intel") # Causes Intel-provided libraries to be linked in statically. + append_linker_flags("-no-intel-extensions") # Enables or disables all Intel C and Intel C++ language extensions. + else() + append_linker_flags("-static-intel") # Causes Intel-provided libraries to be linked in statically. + append_linker_flags("-Werror") # Warnings become errors + if(${IA32}) + append_linker_flags_library("-lirc_pic") # link in libirc_pic + endif() + endif() + + set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE) + set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/Intel/FortranFlags.cmake openmp/runtime/cmake/Intel/FortranFlags.cmake --- openmp-r208472/runtime/cmake/Intel/FortranFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/Intel/FortranFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,29 @@ +# This file holds Intel(R) C Compiler / Intel(R) C++ Compiler / Intel(R) Fortran Compiler (icc/icpc/icl.exe/ifort) dependent flags +# The flag types are: +# 1) Fortran Compiler flags + +######################################################### +# icc Fortran Compiler flags (for creating .mod files) +function(append_fortran_compiler_specific_fort_flags input_fort_flags) + set(local_fort_flags) + #set(CMAKE_Fortran_FLAGS "$ENV{FFLAGS}" CACHE STRING "Fortran flags" FORCE) + #set(CMAKE_Fortran_FLAGS_RELEASE "" CACHE STRING "Fortran flags" FORCE) + #set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Fortran flags" FORCE) + #set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "" CACHE STRING "Fortran flags" FORCE) + if(${WINDOWS}) + append_fort_flags("-Qdiag-disable:177,5082") + append_fort_flags("-Qsox") + append_fort_flags("-nologo") + append_fort_flags("-GS") + append_fort_flags("-DynamicBase") + append_fort_flags("-Zi") + else() + if(${MIC}) + append_fort_flags("-mmic") + endif() + if(NOT ${MAC}) + append_fort_flags("-sox") + endif() + endif() + set(${input_fort_flags} ${${input_fort_flags}} "${local_fort_flags}" PARENT_SCOPE) +endfunction() diff -uNr openmp-r208472/runtime/cmake/MSVC/AsmFlags.cmake openmp/runtime/cmake/MSVC/AsmFlags.cmake --- openmp-r208472/runtime/cmake/MSVC/AsmFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/MSVC/AsmFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,26 @@ +# This file holds Microsoft Visual Studio dependent flags +# The flag types are: +# 1) Assembly flags + +######################################################### +# Assembly flags +function(append_assembler_specific_asm_flags input_asm_flags) + set(local_asm_flags) + append_asm_flags("-nologo") # Turn off tool banner. + if(${IA32}) + append_asm_flags("-safeseh") # Registers exception handlers for safe exception handling. + append_asm_flags("-coff") # Generates common object file format (COFF) type of object module. + # Generally required for Win32 assembly language development. + append_asm_flags("-D _M_IA32") + elseif(${INTEL64}) + append_asm_flags("-D _M_AMD64") + endif() + # CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead + # So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE. + # replace_md_with_mt() is in HelperFunctions.cmake + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG) + set(${input_asm_flags} ${${input_asm_flags}} "${local_asm_flags}" PARENT_SCOPE) +endfunction() diff -uNr openmp-r208472/runtime/cmake/MSVC/CFlags.cmake openmp/runtime/cmake/MSVC/CFlags.cmake --- openmp-r208472/runtime/cmake/MSVC/CFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/MSVC/CFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,64 @@ +# This file holds Microsoft Visual Studio dependent flags +# The flag types are: +# 1) C/C++ Compiler flags +# 2) Fortran Compiler flags + +######################################################### +# Visual Studio C/C++ Compiler flags +function(append_compiler_specific_c_and_cxx_flags input_c_flags input_cxx_flags) + set(local_c_flags) + set(local_cxx_flags) + append_c_flags("-TP") # Tells the compiler to process a file as a C++ source file. + append_cxx_flags("-EHsc") # Enable C++ exception handling. + append_c_and_cxx_flags("-W3") # Enables diagnostics for remarks, warnings, and errors. + # Additional warnings are also enabled above level 2 warnings. + append_c_and_cxx_flags("-GS") # Lets you control the threshold at which the stack checking routine is called or not called. + if(${IA32}) + append_c_and_cxx_flags("-arch:ia32") # Tells the compiler which features it may target (ia32) + append_c_and_cxx_flags("-Oy-") # equivalent to -fno-omit-frame-pointer + endif() + # CMake prefers the /MD flags when compiling Windows sources, but libiomp5 needs to use /MT instead + # So we replace these /MD instances with /MT within the CMAKE_*_FLAGS variables and put that out to the CACHE. + # replace_md_with_mt() is in HelperFunctions.cmake + replace_md_with_mt(CMAKE_C_FLAGS) + replace_md_with_mt(CMAKE_C_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_C_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_C_FLAGS_DEBUG) + replace_md_with_mt(CMAKE_CXX_FLAGS) + replace_md_with_mt(CMAKE_CXX_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_CXX_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_CXX_FLAGS_DEBUG) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELEASE) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO) + replace_md_with_mt(CMAKE_ASM_MASM_FLAGS_DEBUG) + set(${input_c_flags} ${${input_c_flags}} "${local_c_flags}" PARENT_SCOPE) + set(${input_cxx_flags} ${${input_cxx_flags}} "${local_cxx_flags}" PARENT_SCOPE) +endfunction() + +######################################################### +# Visual Studio Linker flags +function(append_compiler_specific_linker_flags input_ld_flags input_ld_flags_libs) + set(local_ld_flags) + set(local_ld_flags_libs) + append_linker_flags("-WX:NO") + append_linker_flags("-version:${version}.0") + append_linker_flags("-NXCompat") + append_linker_flags("-DynamicBase") # This option modifies the header of an executable to indicate + # whether the application should be randomly rebased at load time. + if(${IA32}) + append_linker_flags("-machine:i386") + append_linker_flags("-safeseh") + elseif(${INTEL64}) + append_linker_flags("-machine:amd64") + endif() + if(NOT "${def_file}" STREQUAL "") + append_linker_flags("-def:${def_file}") + endif() + # Have Visual Studio use link.exe directly + #set(CMAKE_C_CREATE_SHARED_LIBRARY "link.exe /out: " PARENT_SCOPE) + #set(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDLFAGS}" CACHE STRING "Linker Flags" FORCE) + set(${input_ld_flags} ${${input_ld_flags}} "${local_ld_flags}" PARENT_SCOPE) + set(${input_ld_flags_libs} ${${input_ld_flags_libs}} "${local_ld_flags_libs}" PARENT_SCOPE) +endfunction() + diff -uNr openmp-r208472/runtime/cmake/MicroTests.cmake openmp/runtime/cmake/MicroTests.cmake --- openmp-r208472/runtime/cmake/MicroTests.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/MicroTests.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,277 @@ +###################################################### +# MICRO TESTS +# The following micro-tests are small tests to perform on +# the library just created in ${build_dir}/, there are currently +# five micro-tests: +# (1) test-touch +# - Compile and run a small program using newly created libiomp5 library +# - Fails if test-touch.c does not compile or if test-touch.c does not run after compilation +# - Program dependencies: gcc or g++, grep, bourne shell +# - Available for all Linux,Mac,Windows builds. Not availble on Intel(R) MIC Architecture builds. +# (2) test-relo +# - Tests dynamic libraries for position-dependent code (can not have any position dependent code) +# - Fails if TEXTREL is in output of readelf -d libiomp5.so command +# - Program dependencies: readelf, grep, bourne shell +# - Available for Linux, Intel(R) MIC Architecture dynamic library builds. Not available otherwise. +# (3) test-execstack +# - Tests if stack is executable +# - Fails if stack is executable. Should only be readable and writable. Not exectuable. +# - Program dependencies: perl, readelf +# - Available for Linux dynamic library builds. Not available otherwise. +# (4) test-instr (Intel(R) MIC Architecutre only) +# - Tests Intel(R) MIC Architecture libraries for valid instruction set +# - Fails if finds invalid instruction for Intel(R) MIC Architecture (wasn't compiled with correct flags) +# - Program dependencies: perl, objdump +# - Available for Intel(R) MIC Architecture builds. Not available otherwise. +# (5) test-deps +# - Tests newly created libiomp5 for library dependencies +# - Fails if sees a dependence not listed in td_exp variable below +# - Program dependencies: perl, (linux)readelf, (mac)otool[64], (windows)link.exe +# - Available for Linux,Mac,Windows, Intel(R) MIC Architecture dynamic builds and Windows static builds. Not available otherwise. +# +# All tests can be turned off by including -Dtests=off when calling cmake +# An individual test can be turned off by issuing something like -Dtest_touch=off when calling cmake + +# test-touch +if(NOT ${MIC} AND ${test_touch} AND ${tests}) + if(${WINDOWS}) + set(do_test_touch_mt TRUE) + if(${do_test_touch_mt}) + set(test_touch_items ${test_touch_items} test-touch-md test-touch-mt) + else() + set(test_touch_items ${test_touch_items} test-touch-md) + endif() + else() + set(test_touch_items ${test_touch_items} test-touch-rt) + endif() + set(regular_test_touch_items "${test_touch_items}") + add_suffix("/.success" regular_test_touch_items) + # test-touch : ${test_touch_items}/.success + set(ldeps "${regular_test_touch_items}") + add_custom_target( test-touch DEPENDS ${ldeps}) + + if(${WINDOWS}) + # pick test-touch compiler + set(tt-c cl) + # test-touch compilation flags + list(APPEND tt-c-flags -nologo) + if(${RELEASE_BUILD} OR ${RELWITHDEBINFO_BUILD}) + list(APPEND tt-c-flags-mt -MT) + list(APPEND tt-c-flags-md -MD) + else() + list(APPEND tt-c-flags-mt -MTd) + list(APPEND tt-c-flags-md -MDd) + endif() + list(APPEND tt-libs ${build_dir}/${imp_file}) + list(APPEND tt-ld-flags -link -nodefaultlib:oldnames) + if(${IA32}) + list(APPEND tt-ld-flags -safeseh) + endif() + list(APPEND tt-ld-flags-v -verbose) + else() # (Unix based systems, Intel(R) MIC Architecture, and Mac) + # pick test-touch compiler + if(${STD_CPP_LIB}) + set(tt-c ${CMAKE_CXX_COMPILER}) + else() + set(tt-c ${CMAKE_C_COMPILER}) + endif() + # test-touch compilation flags + if(${LINUX}) + list(APPEND tt-c-flags -pthread) + endif() + if(${IA32}) + list(APPEND tt-c-flags -m32) + elseif(${INTEL64}) + list(APPEND tt-c-flags -m64) + endif() + list(APPEND tt-libs ${build_dir}/${lib_file}) + if(${MAC}) + list(APPEND tt-ld-flags-v -Wl,-t) + set(tt-env "DYLD_LIBRARY_PATH=.:$ENV{DYLD_LIBRARY_PATH}") + else() + list(APPEND tt-ld-flags-v -Wl,--verbose) + set(tt-env LD_LIBRARY_PATH=".:${build_dir}:$ENV{LD_LIBRARY_PATH}") + endif() + endif() + list(APPEND tt-c-flags "${tt-c-flags-rt}") + list(APPEND tt-env "KMP_VERSION=1") + + macro(test_touch_recipe test_touch_dir) + file(MAKE_DIRECTORY ${build_dir}/${test_touch_dir}) + set(ldeps ${src_dir}/test-touch.c ${build_dir}/${lib_file}) + set(tt-exe-file ${test_touch_dir}/test-touch${exe}) + if(${WINDOWS}) + # ****** list(APPEND tt-c-flags -Fo$(dir $@)test-touch${obj} -Fe$(dir $@)test-touch${exe}) ******* + set(tt-c-flags-out -Fo${test_touch_dir}/test-touch${obj} -Fe${test_touch_dir}/test-touch${exe}) + list(APPEND ldeps ${build_dir}/${imp_file}) + else() + # ****** list(APPEND tt-c-flags -o $(dir $@)test-touch${exe}) ******** + set(tt-c-flags-out -o ${test_touch_dir}/test-touch${exe}) + endif() + add_custom_command( + OUTPUT ${test_touch_dir}/.success + COMMAND ${CMAKE_COMMAND} -E remove -f ${test_touch_dir}/* + COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags} + COMMAND ${CMAKE_COMMAND} -E remove -f ${tt-exe-file} + COMMAND ${tt-c} ${tt-c-flags-out} ${tt-c-flags} ${src_dir}/test-touch.c ${tt-libs} ${tt-ld-flags} ${tt-ld-flags-v} > ${test_touch_dir}/build.log 2>&1 + COMMAND ${tt-env} ${tt-exe-file} + #COMMAND grep -i -e \"[^_]libirc\" ${test_touch_dir}/build.log > ${test_touch_dir}/libirc.log \; [ $$? -eq 1 ] + COMMAND ${CMAKE_COMMAND} -E touch ${test_touch_dir}/.success + DEPENDS ${ldeps} + ) + endmacro() + if(${WINDOWS}) + test_touch_recipe(test-touch-mt) + test_touch_recipe(test-touch-md) + else() + test_touch_recipe(test-touch-rt) + endif() +else() + add_custom_target(test-touch DEPENDS test-touch/.success) + macro(test_touch_recipe_skip test_touch_dir) + if(${tests} AND ${test_touch}) + set(test_touch_message 'test-touch is not available for the Intel(R) MIC Architecture. Will not perform it.') + else() + set(test_touch_message "test-touch is turned off. Will not perform it.") + endif() + add_custom_command( + OUTPUT ${test_touch_dir}/.success + COMMAND ${CMAKE_COMMAND} -E echo ${test_touch_message} + ) + endmacro() + test_touch_recipe_skip(test-touch-rt) + test_touch_recipe_skip(test-touch-mt) + test_touch_recipe_skip(test-touch-md) +endif() + +# test-relo +add_custom_target(test-relo DEPENDS test-relo/.success) +if((${LINUX} OR ${MIC}) AND ${test_relo} AND ${tests}) + file(MAKE_DIRECTORY ${build_dir}/test-relo) + add_custom_command( + OUTPUT test-relo/.success + COMMAND readelf -d ${build_dir}/${lib_file} > test-relo/readelf.log + COMMAND grep -e TEXTREL test-relo/readelf.log \; [ $$? -eq 1 ] + COMMAND ${CMAKE_COMMAND} -E touch test-relo/.success + DEPENDS ${build_dir}/${lib_file} + ) +else() + if(${tests} AND ${test_relo}) + set(test_relo_message 'test-relo is only available for dynamic library on Linux or Intel(R) MIC Architecture. Will not perform it.') + else() + set(test_relo_message "test-relo is turned off. Will not perform it.") + endif() + add_custom_command( + OUTPUT test-relo/.success + COMMAND ${CMAKE_COMMAND} -E echo ${test_relo_message} + ) +endif() + +# test-execstack +add_custom_target(test-execstack DEPENDS test-execstack/.success) +if(${LINUX} AND ${test_execstack} AND ${tests}) + file(MAKE_DIRECTORY ${build_dir}/test-execstack) + add_custom_command( + OUTPUT test-execstack/.success + COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-execstack.pl ${build_dir}/${lib_file} + COMMAND ${CMAKE_COMMAND} -E touch test-execstack/.success + DEPENDS ${build_dir}/${lib_file} + ) +else() + if(${tests} AND ${test_execstack}) + set(test_execstack_message "test-execstack is only available for dynamic library on Linux. Will not perform it.") + else() + set(test_execstack_message "test-execstack is turned off. Will not perform it.") + endif() + add_custom_command( + OUTPUT test-execstack/.success + COMMAND ${CMAKE_COMMAND} -E echo ${test_execstack_message} + ) +endif() + +# test-instr +add_custom_target(test-instr DEPENDS test-instr/.success) +if(${MIC} AND ${test_instr} AND ${tests}) + file(MAKE_DIRECTORY ${build_dir}/test-instr) + add_custom_command( + OUTPUT test-instr/.success + COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-instruction-set.pl ${oa_opts} --show --mic-arch=${mic_arch} --mic-os=${mic_os} ${build_dir}/${lib_file} + COMMAND ${CMAKE_COMMAND} -E touch test-instr/.success + DEPENDS ${build_dir}/${lib_file} ${tools_dir}/check-instruction-set.pl + ) +else() + if(${tests} AND ${test_instr}) + set(test_instr_message 'test-instr is only available for Intel(R) MIC Architecture libraries. Will not perform it.') + else() + set(test_instr_message "test-instr is turned off. Will not perform it.") + endif() + add_custom_command( + OUTPUT test-instr/.success + COMMAND ${CMAKE_COMMAND} -E echo ${test_instr_message} + ) +endif() + +# test-deps +add_custom_target(test-deps DEPENDS test-deps/.success) +if(${test_deps} AND ${tests}) + set(td_exp) + if(${FREEBSD}) + set(td_exp libc.so.7 libthr.so.3 libunwind.so.5) + elseif(${LINUX}) + set(td_exp libdl.so.2,libgcc_s.so.1) + if(NOT ${IA32} AND NOT ${INTEL64}) + set(td_exp ${td_exp},libffi.so.6,libffi.so.5) + endif() + if(${IA32}) + set(td_exp ${td_exp},libc.so.6,ld-linux.so.2) + elseif(${INTEL64}) + set(td_exp ${td_exp},libc.so.6,ld-linux-x86-64.so.2) + elseif(${ARM}) + set(td_exp ${td_exp},libc.so.6,ld-linux-armhf.so.3) + endif() + if(${STD_CPP_LIB}) + set(td_exp ${td_exp},libstdc++.so.6) + endif() + if(NOT ${STUBS_LIBRARY}) + set(td_exp ${td_exp},libpthread.so.0) + endif() + elseif(${MIC}) + if("${mic_os}" STREQUAL "lin") + set(td_exp libc.so.6,libpthread.so.0,libdl.so.2) + if(${STD_CPP_LIB}) + set(td_exp ${td_exp},libstdc++.so.6) + endif() + if("${mic_arch}" STREQUAL "knf") + set(td_exp ${td_exp},ld-linux-l1om.so.2,libgcc_s.so.1) + elseif("${mic_arch}" STREQUAL "knc") + set(td_exp ${td_exp},ld-linux-k1om.so.2) + endif() + elseif("${mic_os}" STREQUAL "bsd") + set(td_exp libc.so.7,libthr.so.3,libunwind.so.5) + endif() + elseif(${MAC}) + set(td_exp /usr/lib/libSystem.B.dylib) + elseif(${WINDOWS}) + set(td_exp kernel32.dll) + endif() + + file(MAKE_DIRECTORY ${build_dir}/test-deps) + add_custom_command( + OUTPUT test-deps/.success + COMMAND ${PERL_EXECUTABLE} ${tools_dir}/check-depends.pl ${oa_opts} --expected="${td_exp}" ${build_dir}/${lib_file} + COMMAND ${CMAKE_COMMAND} -E touch test-deps/.success + DEPENDS ${build_dir}/${lib_file} ${tools_dir}/check-depends.pl + ) +else() + if(${tests} AND ${test_deps}) + set(test_deps_message 'test-deps is available for dynamic libraries on Linux, Mac, Intel(R) MIC Architecture, Windows and static libraries on Windows. Will not perform it.') + else() + set(test_deps_message "test-deps is turned off. Will not perform it.") + endif() + add_custom_command( + OUTPUT test-deps/.success + COMMAND ${CMAKE_COMMAND} -E echo ${test_deps_message} + ) +endif() +# END OF TESTS +###################################################### diff -uNr openmp-r208472/runtime/cmake/PerlFlags.cmake openmp/runtime/cmake/PerlFlags.cmake --- openmp-r208472/runtime/cmake/PerlFlags.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/PerlFlags.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,90 @@ +# +#//===----------------------------------------------------------------------===// +#// +#// The LLVM Compiler Infrastructure +#// +#// This file is dual licensed under the MIT and the University of Illinois Open +#// Source Licenses. See LICENSE.txt for details. +#// +#//===----------------------------------------------------------------------===// +# + +# void append_ev_flags(string new_flag); +# - appends new_flag to ev_flags list +macro(append_ev_flags new_flag) + list(APPEND local_ev_flags "${new_flag}") +endmacro() + +# void append_gd_flags(string new_flag); +# - appends new_flag to gd_flags list +macro(append_gd_flags new_flag) + list(APPEND local_gd_flags "${new_flag}") +endmacro() + +include(HelperFunctions) # for set_legal_type(), set_legal_arch() + +# Perl expand-vars.pl flags +function(set_ev_flags input_ev_flags) + set(local_ev_flags) + set_legal_type("${lib_type}" legal_type) + set_legal_arch("${arch}" legal_arch) + # need -D Revision="\$Revision" to show up + append_ev_flags("-D Revision=\"\\\\$$Revision\"") + append_ev_flags("-D Date=\"\\\\$$Date\"") + append_ev_flags("-D KMP_TYPE=\"${legal_type}\"") + append_ev_flags("-D KMP_ARCH=\"${legal_arch}\"") + append_ev_flags("-D KMP_VERSION_MAJOR=${version}") + append_ev_flags("-D KMP_VERSION_MINOR=0") + append_ev_flags("-D KMP_VERSION_BUILD=${build_number}") + append_ev_flags("-D KMP_BUILD_DATE=\"${date}\"") + append_ev_flags("-D KMP_TARGET_COMPILER=12") + if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD}) + append_ev_flags("-D KMP_DIAG=1") + append_ev_flags("-D KMP_DEBUG_INFO=1") + else() + append_ev_flags("-D KMP_DIAG=0") + append_ev_flags("-D KMP_DEBUG_INFO=0") + endif() + if(${omp_version} EQUAL 40) + append_ev_flags("-D OMP_VERSION=201307") + elseif(${omp_version} EQUAL 30) + append_ev_flags("-D OMP_VERSION=201107") + else() + append_ev_flags("-D OMP_VERSION=200505") + endif() + set(${input_ev_flags} "${local_ev_flags}" PARENT_SCOPE) +endfunction() + +function(set_gd_flags input_gd_flags) + set(local_gd_flags) + if(${IA32}) + append_gd_flags("-D arch_32") + elseif(${INTEL64}) + append_gd_flags("-D arch_32e") + else() + append_gd_flags("-D arch_${arch}") + endif() + if(${NORMAL_LIBRARY}) + append_gd_flags("-D norm") + elseif(${PROFILE_LIBRARY}) + append_gd_flags("-D prof") + elseif(${STUBS_LIBRARY}) + append_gd_flags("-D stub") + endif() + if(${omp_version} GREATER 40 OR ${omp_version} EQUAL 40) + append_gd_flags("-D OMP_40") + endif() + if(${omp_version} GREATER 30 OR ${omp_version} EQUAL 30) + append_gd_flags("-D OMP_30") + endif() + if(NOT "${version}" STREQUAL "4") + append_gd_flags("-D msvc_compat") + endif() + if(${DEBUG_BUILD} OR ${RELWITHDEBINFO_BUILD}) + append_gd_flags("-D KMP_DEBUG") + endif() + if(${COMPILER_SUPPORTS_QUAD_PRECISION}) + append_gd_flags("-D HAVE_QUAD") + endif() + set(${input_gd_flags} "${local_gd_flags}" PARENT_SCOPE) +endfunction() diff -uNr openmp-r208472/runtime/cmake/SourceFiles.cmake openmp/runtime/cmake/SourceFiles.cmake --- openmp-r208472/runtime/cmake/SourceFiles.cmake 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/cmake/SourceFiles.cmake 2014-08-05 10:09:30.000000000 -0400 @@ -0,0 +1,110 @@ +# +#//===----------------------------------------------------------------------===// +#// +#// The LLVM Compiler Infrastructure +#// +#// This file is dual licensed under the MIT and the University of Illinois Open +#// Source Licenses. See LICENSE.txt for details. +#// +#//===----------------------------------------------------------------------===// +# + +macro(append_c_source_file new_c_file) + list(APPEND local_c_source_files "${new_c_file}") +endmacro() + +macro(append_cpp_source_file new_cpp_file) + list(APPEND local_cpp_source_files "${new_cpp_file}") +endmacro() + +macro(append_asm_source_file new_asm_file) + list(APPEND local_asm_source_files "${new_asm_file}") +endmacro() + +macro(append_imp_c_source_file new_import_c_file) + list(APPEND local_imp_c_files "${new_import_c_file}") +endmacro() + +# files are relative to the src directory + +function(set_c_files input_c_source_files) + set(local_c_source_files "") + append_c_source_file("kmp_ftn_cdecl.c") + append_c_source_file("kmp_ftn_extra.c") + append_c_source_file("kmp_version.c") + if(${STUBS_LIBRARY}) + append_c_source_file("kmp_stub.c") + else() + append_c_source_file("kmp_alloc.c") + append_c_source_file("kmp_atomic.c") + append_c_source_file("kmp_csupport.c") + append_c_source_file("kmp_debug.c") + append_c_source_file("kmp_itt.c") + append_c_source_file("kmp_environment.c") + append_c_source_file("kmp_error.c") + append_c_source_file("kmp_global.c") + append_c_source_file("kmp_i18n.c") + append_c_source_file("kmp_io.c") + append_c_source_file("kmp_runtime.c") + append_c_source_file("kmp_settings.c") + append_c_source_file("kmp_str.c") + append_c_source_file("kmp_tasking.c") + append_c_source_file("kmp_taskq.c") + append_c_source_file("kmp_threadprivate.c") + append_c_source_file("kmp_utility.c") + if(${USE_ITT_NOTIFY}) + append_c_source_file("thirdparty/ittnotify/ittnotify_static.c") + endif() + if(${WINDOWS}) + append_c_source_file("z_Windows_NT_util.c") + append_c_source_file("z_Windows_NT-586_util.c") + else() + append_c_source_file("z_Linux_util.c") + append_c_source_file("kmp_gsupport.c") + endif() + endif() + set(${input_c_source_files} "${local_c_source_files}" PARENT_SCOPE) +endfunction() + +function(set_cpp_files input_cpp_source_files) + set(local_cpp_source_files "") + if(NOT ${STUBS_LIBRARY}) + #append_cpp_source_file("kmp_barrier.cpp") + append_cpp_source_file("kmp_affinity.cpp") + append_cpp_source_file("kmp_dispatch.cpp") + append_cpp_source_file("kmp_lock.cpp") + append_cpp_source_file("kmp_sched.cpp") + if("${omp_version}" STREQUAL "40") + append_cpp_source_file("kmp_taskdeps.cpp") + append_cpp_source_file("kmp_cancel.cpp") + endif() + #if(${STATS_GATHERING}) + # append_cpp_source_file("kmp_stats.cpp") + # append_cpp_source_file("kmp_stats_timing.cpp") + #endif() + endif() + + set(${input_cpp_source_files} "${local_cpp_source_files}" PARENT_SCOPE) +endfunction() + + +function(set_asm_files input_asm_source_files) + set(local_asm_source_files "") + if(NOT ${STUBS_LIBRARY}) + if(${WINDOWS}) + append_asm_source_file("z_Windows_NT-586_asm.asm") + else() + append_asm_source_file("z_Linux_asm.s") + endif() + endif() + set(${input_asm_source_files} "${local_asm_source_files}" PARENT_SCOPE) +endfunction() + + +function(set_imp_c_files input_imp_c_files) + set(local_imp_c_files "") + if(${WINDOWS}) + append_imp_c_source_file("kmp_import.c") + endif() + set(${input_imp_c_files} "${local_imp_c_files}" PARENT_SCOPE) +endfunction() diff -uNr openmp-r208472/runtime/src/CMakeLists.txt openmp/runtime/src/CMakeLists.txt --- openmp-r208472/runtime/src/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ openmp/runtime/src/CMakeLists.txt 2014-08-07 09:14:44.000000000 -0400 @@ -0,0 +1,179 @@ +set(OMP_SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}") + +execute_process(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE BUILD_TIME) +string(REGEX REPLACE "\n" "" BUILD_TIME ${BUILD_TIME}) + +include_directories( + . + include + include/${OMP_VERSION} + i18n + thirdparty/ittnotify + ${CMAKE_CURRENT_BINARY_DIR} +) + +if(WIN32) + set(OS_GEN "win") +elseif(APPLE) + set(OS_GEN "mac") +elseif(UNIX) + set(OS_GEN "lin") +else() + message(FATAL_ERROR "Unsupported OS") +endif() + +if(arch) + set(ARCH ${arch}) #acquire from command line +else() #assume default + set(ARCH "32e") +endif() + +if("${arch}" STREQUAL "32e") + set(ARCH_STR "Intel(R) 64") +elseif("${arch}" STREQUAL "ppc64") + set(ARCH_STR "PPC64") +endif() + +set(FEATURE_FLAGS "-D USE_ITT_BUILD") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D NDEBUG") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ARCH_STR=\"\\\"${ARCH_STR}\\\"\"") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D _GNU_SOURCE") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D _REENTRANT") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ASSERT") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D BUILD_I8") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D BUILD_TV") + +if(APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -current_version 5.0") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -compatibility_version 5.0") +endif() + +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_LIBRARY_FILE=\\\"libiomp5.${OMP_SHLIBEXT}\\\"") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_VERSION_MAJOR=${VERSION}") + +# customize cache line size for ppc64 to 128 bytes: 64 in all other cases +if("${arch}" STREQUAL "ppc64") + set(FEATURE_FLAGS "${FEATURE_FLAGS} -D CACHE_LINE=128") +else() + set(FEATURE_FLAGS "${FEATURE_FLAGS} -D CACHE_LINE=64") +endif() + +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ADJUST_BLOCKTIME=1") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D BUILD_PARALLEL_ORDERED") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_ASM_INTRINS") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_LOAD_BALANCE") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_CBLKDATA") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D GUIDEDLL_EXPORTS") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_GOMP_COMPAT") + +#adaptive locks use x86 assembly - disable for ppc64 +if("${arch}" STREQUAL "32e" OR "${arch}" STREQUAL "32" OR "${arch}" STREQUAL "arm") + set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1") + set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0") +endif() + +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_50_ENABLED=0") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_41_ENABLED=0") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_40_ENABLED=1") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D OMP_30_ENABLED=1") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D USE_ITT_NOTIFY=1") +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_") +if (NOT APPLE) + set(FEATURE_FLAGS "${FEATURE_FLAGS} -D KMP_TDATA_GTID") +endif() +set(FEATURE_FLAGS "${FEATURE_FLAGS} -D _KMP_BUILD_TIME=\"\\\"${BUILD_TIME} UTC\\\"\"") + +set(COMMON_FLAGS "-fPIC") +set(COMMON_FLAGS "${COMMON_FLAGS} -Wno-unused-value") +set(COMMON_FLAGS "${COMMON_FLAGS} -Wno-switch") +set(COMMON_FLAGS "${COMMON_FLAGS} -Wno-deprecated-register") +set(COMMON_FLAGS "${COMMON_FLAGS} -fno-exceptions") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FEATURE_FLAGS} ${COMMON_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FEATURE_FLAGS} ${COMMON_FLAGS}") + +set(ASM_SOURCES + z_Linux_asm.s +) +set(SOURCES + thirdparty/ittnotify/ittnotify_static.c + kmp_affinity.cpp + kmp_alloc.c + kmp_atomic.c + kmp_cancel.cpp + kmp_csupport.c + kmp_debug.c + kmp_dispatch.cpp + kmp_environment.c + kmp_error.c + kmp_ftn_cdecl.c + kmp_ftn_extra.c + kmp_global.c + kmp_gsupport.c + kmp_i18n.c + kmp_io.c + kmp_itt.c + kmp_lock.cpp + kmp_runtime.c + kmp_sched.cpp + kmp_settings.c + kmp_str.c + kmp_taskdeps.cpp + kmp_tasking.c + kmp_taskq.c + kmp_threadprivate.c + kmp_utility.c + kmp_version.c + z_Linux_util.c +) + +set_source_files_properties(${SOURCES} PROPERTIES LANGUAGE CXX) +set_source_files_properties(${ASM_SOURCES} PROPERTIES LANGUAGE CXX) + +add_custom_command( + OUTPUT kmp_i18n_id.inc + COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/message-converter.pl --os=${OS_GEN} --arch=${ARCH} --prefix=kmp_i18n --enum=kmp_i18n_id.inc ${CMAKE_CURRENT_SOURCE_DIR}/i18n/en_US.txt +) +add_custom_command( + OUTPUT kmp_i18n_default.inc + COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/../tools/message-converter.pl --os=${OS_GEN} --arch=${ARCH} --prefix=kmp_i18n --default=kmp_i18n_default.inc ${CMAKE_CURRENT_SOURCE_DIR}/i18n/en_US.txt +) +add_custom_command( + OUTPUT omp.h + 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 +) + +if("${ARCH}" STREQUAL "ppc64") + add_custom_command( + OUTPUT z_Linux_asm.o + 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} + ) +else() + add_custom_command( + OUTPUT z_Linux_asm.o + 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} + ) +endif() + + +add_custom_target(gen_kmp_i18n DEPENDS kmp_i18n_id.inc kmp_i18n_default.inc omp.h z_Linux_asm.o) + +if(NOT APPLE) + if(${ARCH} STREQUAL "ppc64" AND ${OS_GEN} STREQUAL "lin") + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt -ldl") + else() + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt") + endif() +endif() + +add_library(iomp5 SHARED ${SOURCES} z_Linux_asm.o) + +# This is a workaround to a known ppc64 issue about libpthread. For more +# information see +# http://ryanarn.blogspot.com/2011/07/curious-case-of-pthreadatfork-on.html +if("${ARCH}" STREQUAL "ppc64") + find_library(PTHREAD NAMES pthread) + target_link_libraries(iomp5 ${PTHREAD}) +endif() + +add_dependencies(iomp5 gen_kmp_i18n) diff -uNr openmp-r208472/runtime/src/dllexports openmp/runtime/src/dllexports --- openmp-r208472/runtime/src/dllexports 2014-05-21 15:14:55.000000000 -0400 +++ openmp/runtime/src/dllexports 2014-08-05 10:09:40.000000000 -0400 @@ -471,7 +471,9 @@ # ATOMIC entries + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_div 2000 + %endif __kmpc_atomic_fixed1_add 2001 __kmpc_atomic_fixed1_andb 2002 @@ -577,6 +579,7 @@ __kmpc_atomic_cmplx10_sub 2094 __kmpc_atomic_cmplx10_mul 2095 __kmpc_atomic_cmplx10_div 2096 + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_add 2097 __kmpc_atomic_cmplx16_sub 2098 __kmpc_atomic_cmplx16_mul 2099 @@ -627,6 +630,7 @@ __kmpc_atomic_float10_sub_fp 2136 __kmpc_atomic_float10_mul_fp 2137 __kmpc_atomic_float10_div_fp 2138 + %endif __kmpc_atomic_fixed1_mul_float8 2169 __kmpc_atomic_fixed1_div_float8 2170 @@ -661,6 +665,7 @@ %ifdef arch_32 + %ifdef HAVE_QUAD __kmpc_atomic_float16_add_a16 2255 __kmpc_atomic_float16_sub_a16 2256 __kmpc_atomic_float16_mul_a16 2257 @@ -672,6 +677,7 @@ __kmpc_atomic_cmplx16_sub_a16 2262 __kmpc_atomic_cmplx16_mul_a16 2263 __kmpc_atomic_cmplx16_div_a16 2264 + %endif %endif @@ -686,14 +692,18 @@ __kmpc_atomic_float4_rd 2269 __kmpc_atomic_float8_rd 2270 __kmpc_atomic_float10_rd 2271 + %ifdef HAVE_QUAD __kmpc_atomic_float16_rd 2272 + %endif __kmpc_atomic_cmplx4_rd 2273 __kmpc_atomic_cmplx8_rd 2274 __kmpc_atomic_cmplx10_rd 2275 + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_rd 2276 - %ifdef arch_32 - __kmpc_atomic_float16_a16_rd 2277 - __kmpc_atomic_cmplx16_a16_rd 2278 + %ifdef arch_32 + __kmpc_atomic_float16_a16_rd 2277 + __kmpc_atomic_cmplx16_a16_rd 2278 + %endif %endif __kmpc_atomic_fixed1_wr 2279 __kmpc_atomic_fixed2_wr 2280 @@ -702,15 +712,19 @@ __kmpc_atomic_float4_wr 2283 __kmpc_atomic_float8_wr 2284 __kmpc_atomic_float10_wr 2285 + %ifdef HAVE_QUAD __kmpc_atomic_float16_wr 2286 + %endif __kmpc_atomic_cmplx4_wr 2287 __kmpc_atomic_cmplx8_wr 2288 __kmpc_atomic_cmplx10_wr 2289 + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_wr 2290 %ifdef arch_32 __kmpc_atomic_float16_a16_wr 2291 __kmpc_atomic_cmplx16_a16_wr 2292 %endif + %endif __kmpc_atomic_fixed1_add_cpt 2293 __kmpc_atomic_fixed1_andb_cpt 2294 __kmpc_atomic_fixed1_div_cpt 2295 @@ -783,8 +797,10 @@ __kmpc_atomic_float4_min_cpt 2362 __kmpc_atomic_float8_max_cpt 2363 __kmpc_atomic_float8_min_cpt 2364 + %ifdef HAVE_QUAD __kmpc_atomic_float16_max_cpt 2365 __kmpc_atomic_float16_min_cpt 2366 + %endif __kmpc_atomic_fixed1_neqv_cpt 2367 __kmpc_atomic_fixed2_neqv_cpt 2368 __kmpc_atomic_fixed4_neqv_cpt 2369 @@ -797,10 +813,12 @@ __kmpc_atomic_float10_sub_cpt 2376 __kmpc_atomic_float10_mul_cpt 2377 __kmpc_atomic_float10_div_cpt 2378 + %ifdef HAVE_QUAD __kmpc_atomic_float16_add_cpt 2379 __kmpc_atomic_float16_sub_cpt 2380 __kmpc_atomic_float16_mul_cpt 2381 __kmpc_atomic_float16_div_cpt 2382 + %endif __kmpc_atomic_cmplx4_add_cpt 2383 __kmpc_atomic_cmplx4_sub_cpt 2384 __kmpc_atomic_cmplx4_mul_cpt 2385 @@ -813,13 +831,16 @@ __kmpc_atomic_cmplx10_sub_cpt 2392 __kmpc_atomic_cmplx10_mul_cpt 2393 __kmpc_atomic_cmplx10_div_cpt 2394 + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_add_cpt 2395 __kmpc_atomic_cmplx16_sub_cpt 2396 __kmpc_atomic_cmplx16_mul_cpt 2397 __kmpc_atomic_cmplx16_div_cpt 2398 + %endif #__kmpc_atomic_cmplx4_add_cpt_tmp 2409 %ifdef arch_32 + %ifdef HAVE_QUAD __kmpc_atomic_float16_add_a16_cpt 2399 __kmpc_atomic_float16_sub_a16_cpt 2400 __kmpc_atomic_float16_mul_a16_cpt 2401 @@ -831,6 +852,7 @@ __kmpc_atomic_cmplx16_mul_a16_cpt 2407 __kmpc_atomic_cmplx16_div_a16_cpt 2408 %endif + %endif __kmpc_atomic_start 2410 __kmpc_atomic_end 2411 @@ -846,16 +868,20 @@ __kmpc_atomic_float4_swp 2416 __kmpc_atomic_float8_swp 2417 __kmpc_atomic_float10_swp 2418 + %ifdef HAVE_QUAD __kmpc_atomic_float16_swp 2419 + %endif __kmpc_atomic_cmplx4_swp 2420 __kmpc_atomic_cmplx8_swp 2421 __kmpc_atomic_cmplx10_swp 2422 + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_swp 2423 %ifdef arch_32 __kmpc_atomic_float16_a16_swp 2424 __kmpc_atomic_cmplx16_a16_swp 2425 %endif + %endif __kmpc_atomic_fixed1_sub_cpt_rev 2426 __kmpc_atomic_fixed1_div_cpt_rev 2427 @@ -887,14 +913,17 @@ __kmpc_atomic_float8_div_cpt_rev 2453 __kmpc_atomic_float10_sub_cpt_rev 2454 __kmpc_atomic_float10_div_cpt_rev 2455 + %ifdef HAVE_QUAD __kmpc_atomic_float16_sub_cpt_rev 2456 __kmpc_atomic_float16_div_cpt_rev 2457 + %endif __kmpc_atomic_cmplx4_sub_cpt_rev 2458 __kmpc_atomic_cmplx4_div_cpt_rev 2459 __kmpc_atomic_cmplx8_sub_cpt_rev 2460 __kmpc_atomic_cmplx8_div_cpt_rev 2461 __kmpc_atomic_cmplx10_sub_cpt_rev 2462 __kmpc_atomic_cmplx10_div_cpt_rev 2463 + %ifdef HAVE_QUAD __kmpc_atomic_cmplx16_sub_cpt_rev 2464 __kmpc_atomic_cmplx16_div_cpt_rev 2465 @@ -904,6 +933,7 @@ __kmpc_atomic_cmplx16_sub_a16_cpt_rev 2468 __kmpc_atomic_cmplx16_div_a16_cpt_rev 2469 %endif + %endif %endif # OMP_40 diff -uNr openmp-r208472/runtime/src/kmp.h openmp/runtime/src/kmp.h --- openmp-r208472/runtime/src/kmp.h 2014-05-21 15:14:53.000000000 -0400 +++ openmp/runtime/src/kmp.h 2014-08-07 09:14:44.000000000 -0400 @@ -459,9 +459,9 @@ /* * Only Linux* OS and Windows* OS support thread affinity. */ -#if KMP_OS_LINUX || KMP_OS_WINDOWS +#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK && !KMP_ARCH_PPC64 # define KMP_AFFINITY_SUPPORTED 1 -#elif KMP_OS_DARWIN || KMP_OS_FREEBSD +#elif KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_CNK || KMP_ARCH_PPC64 // affinity not supported # define KMP_AFFINITY_SUPPORTED 0 #else @@ -476,7 +476,7 @@ # if KMP_OS_LINUX // -// On Linux* OS, the mask isactually a vector of length __kmp_affin_mask_size +// On Linux* OS, the mask is actually a vector of length __kmp_affin_mask_size // (in bytes). It should be allocated on a word boundary. // // WARNING!!! We have made the base type of the affinity mask unsigned char, @@ -946,6 +946,9 @@ #if KMP_OS_WINDOWS # define KMP_INIT_WAIT 64U /* initial number of spin-tests */ # define KMP_NEXT_WAIT 32U /* susequent number of spin-tests */ +#elif KMP_OS_CNK +# define KMP_INIT_WAIT 16U /* initial number of spin-tests */ +# define KMP_NEXT_WAIT 8U /* susequent number of spin-tests */ #elif KMP_OS_LINUX # define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ # define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ @@ -971,6 +974,11 @@ extern void __kmp_x86_pause( void ); # endif # define KMP_CPU_PAUSE() __kmp_x86_pause() +#elif KMP_ARCH_PPC64 +# define KMP_PPC64_PRI_LOW() __asm__ volatile ("or 1, 1, 1") +# define KMP_PPC64_PRI_MED() __asm__ volatile ("or 2, 2, 2") +# define KMP_PPC64_PRI_LOC_MB() __asm__ volatile ("" : : : "memory") +# define KMP_CPU_PAUSE() do { KMP_PPC64_PRI_LOW(); KMP_PPC64_PRI_MED(); KMP_PPC64_PRI_LOC_MB(); } while (0) #else # define KMP_CPU_PAUSE() /* nothing to do */ #endif diff -uNr openmp-r208472/runtime/src/kmp_csupport.c openmp/runtime/src/kmp_csupport.c --- openmp-r208472/runtime/src/kmp_csupport.c 2014-05-21 15:14:54.000000000 -0400 +++ openmp/runtime/src/kmp_csupport.c 2014-08-07 09:14:44.000000000 -0400 @@ -828,7 +828,7 @@ if ( ! __kmp_cpuinfo.sse2 ) { // CPU cannot execute SSE2 instructions. } else { - #if KMP_COMPILER_ICC + #if KMP_COMPILER_ICC || KMP_COMPILER_MSVC _mm_mfence(); #else __sync_synchronize(); @@ -837,6 +837,19 @@ #endif // KMP_MIC #elif KMP_ARCH_ARM // Nothing yet + #elif KMP_ARCH_PPC64 + // Nothing needed here (we have a real MB above). + #if KMP_OS_CNK + // The flushing thread needs to yield here; this prevents a + // busy-waiting thread from saturating the pipeline. flush is + // often used in loops like this: + // while (!flag) { + // #pragma omp flush(flag) + // } + // and adding the yield here is good for at least a 10x speedup + // when running >2 threads per core (on the NAS LU benchmark). + __kmp_yield(TRUE); + #endif #else #error Unknown or unsupported architecture #endif diff -uNr openmp-r208472/runtime/src/kmp_ftn_entry.h openmp/runtime/src/kmp_ftn_entry.h --- openmp-r208472/runtime/src/kmp_ftn_entry.h 2014-05-21 15:14:53.000000000 -0400 +++ openmp/runtime/src/kmp_ftn_entry.h 2014-08-05 10:09:40.000000000 -0400 @@ -263,7 +263,7 @@ #if KMP_OS_WINDOWS && KMP_ARCH_X86_64 if ( __kmp_num_proc_groups <= 1 ) { - return KMP_CPU_SETSIZE; + return (int)KMP_CPU_SETSIZE; } #endif /* KMP_OS_WINDOWS && KMP_ARCH_X86_64 */ return __kmp_xproc; @@ -412,7 +412,7 @@ gtid = __kmp_entry_gtid(); #elif KMP_OS_WINDOWS if (!__kmp_init_parallel || - (gtid = ((kmp_intptr_t)TlsGetValue( __kmp_gtid_threadprivate_key ))) == 0) { + (gtid = (int)((kmp_intptr_t)TlsGetValue( __kmp_gtid_threadprivate_key ))) == 0) { // Either library isn't initialized or thread is not registered // 0 is the correct TID in this case return 0; @@ -463,7 +463,6 @@ #ifdef KMP_STUB return 1; #else - int gtid; if ( ! TCR_4(__kmp_init_middle) ) { __kmp_middle_initialize(); } @@ -1013,7 +1012,7 @@ { #ifndef KMP_STUB #ifdef PASS_ARGS_BY_VALUE - int len = strlen( str ); + int len = (int)strlen( str ); #endif __kmp_aux_set_defaults( str, len ); #endif diff -uNr openmp-r208472/runtime/src/kmp_ftn_os.h openmp/runtime/src/kmp_ftn_os.h --- openmp-r208472/runtime/src/kmp_ftn_os.h 2014-05-21 15:14:56.000000000 -0400 +++ openmp/runtime/src/kmp_ftn_os.h 2014-08-07 09:14:44.000000000 -0400 @@ -478,7 +478,7 @@ //#define KMP_API_NAME_GOMP_TARGET_UPDATE GOMP_target_update #define KMP_API_NAME_GOMP_TEAMS GOMP_teams -#if KMP_OS_LINUX +#if KMP_OS_LINUX && !KMP_OS_CNK && !KMP_ARCH_PPC64 #define xstr(x) str(x) #define str(x) #x diff -uNr openmp-r208472/runtime/src/kmp_global.c openmp/runtime/src/kmp_global.c --- openmp-r208472/runtime/src/kmp_global.c 2014-05-21 15:14:55.000000000 -0400 +++ openmp/runtime/src/kmp_global.c 2014-08-07 09:14:44.000000000 -0400 @@ -321,7 +321,11 @@ kmp_uint32 __kmp_yield_init = KMP_INIT_WAIT; kmp_uint32 __kmp_yield_next = KMP_NEXT_WAIT; kmp_uint32 __kmp_yielding_on = 1; +#if KMP_OS_CNK +kmp_uint32 __kmp_yield_cycle = 0; +#else kmp_uint32 __kmp_yield_cycle = 1; /* Yield-cycle is on by default */ +#endif kmp_int32 __kmp_yield_on_count = 10; /* By default, yielding is on for 10 monitor periods. */ kmp_int32 __kmp_yield_off_count = 1; /* By default, yielding is off for 1 monitor periods. */ /* ----------------------------------------------------- */ diff -uNr openmp-r208472/runtime/src/kmp_gsupport.c openmp/runtime/src/kmp_gsupport.c --- openmp-r208472/runtime/src/kmp_gsupport.c 2014-05-21 15:14:54.000000000 -0400 +++ openmp/runtime/src/kmp_gsupport.c 2014-08-07 09:14:44.000000000 -0400 @@ -15,7 +15,7 @@ //===----------------------------------------------------------------------===// -#if defined(__x86_64) +#if defined(__x86_64) || defined (__powerpc64__) # define KMP_I8 #endif #include "kmp.h" diff -uNr openmp-r208472/runtime/src/kmp_lock.h openmp/runtime/src/kmp_lock.h --- openmp-r208472/runtime/src/kmp_lock.h 2014-05-21 15:14:55.000000000 -0400 +++ openmp/runtime/src/kmp_lock.h 2014-08-07 09:14:44.000000000 -0400 @@ -518,7 +518,7 @@ // Internal RTL locks are also implemented as ticket locks, for now. // // FIXME - We should go through and figure out which lock kind works best for -// each internal lock, and use the type deeclaration and function calls for +// each internal lock, and use the type declaration and function calls for // that explicit lock kind (and get rid of this section). // diff -uNr openmp-r208472/runtime/src/kmp_os.h openmp/runtime/src/kmp_os.h --- openmp-r208472/runtime/src/kmp_os.h 2014-05-21 15:14:54.000000000 -0400 +++ openmp/runtime/src/kmp_os.h 2014-08-07 09:14:44.000000000 -0400 @@ -46,6 +46,7 @@ #define KMP_COMPILER_ICC 0 #define KMP_COMPILER_GCC 0 #define KMP_COMPILER_CLANG 0 +#define KMP_COMPILER_MSVC 0 #if defined( __INTEL_COMPILER ) # undef KMP_COMPILER_ICC @@ -56,6 +57,9 @@ #elif defined( __GNUC__ ) # undef KMP_COMPILER_GCC # define KMP_COMPILER_GCC 1 +#elif defined( _MSC_VER ) +# undef KMP_COMPILER_MSVC +# define KMP_COMPILER_MSVC 1 #else # error Unknown compiler #endif @@ -66,10 +70,12 @@ #define KMP_OS_FREEBSD 0 #define KMP_OS_DARWIN 0 #define KMP_OS_WINDOWS 0 +#define KMP_OS_CNK 0 #define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */ #define KMP_ARCH_X86 0 #define KMP_ARCH_X86_64 0 +#define KMP_ARCH_PPC64 0 #ifdef _WIN32 # undef KMP_OS_WINDOWS @@ -81,9 +87,14 @@ # define KMP_OS_DARWIN 1 #endif +// in some ppc64 linux installations, only the second condition is met #if ( defined __linux ) # undef KMP_OS_LINUX # define KMP_OS_LINUX 1 +#elif ( defined __linux__) +# undef KMP_OS_LINUX +# define KMP_OS_LINUX 1 +#else #endif #if ( defined __FreeBSD__ ) @@ -91,6 +102,11 @@ # define KMP_OS_FREEBSD 1 #endif +#if ( defined __bgq__ ) +# undef KMP_OS_CNK +# define KMP_OS_CNK 1 +#endif + #if (1 != KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_DARWIN + KMP_OS_WINDOWS) # error Unknown OS #endif @@ -117,6 +133,9 @@ # elif defined __i386 # undef KMP_ARCH_X86 # define KMP_ARCH_X86 1 +# elif defined __powerpc64__ +# undef KMP_ARCH_PPC64 +# define KMP_ARCH_PPC64 1 # endif #endif @@ -156,7 +175,7 @@ # define KMP_ARCH_ARM 1 #endif -#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM) +#if (1 != KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64) # error Unknown or unsupported architecture #endif @@ -175,6 +194,8 @@ typedef __float128 _Quad; # undef KMP_HAVE_QUAD # define KMP_HAVE_QUAD 1 +# elif KMP_COMPILER_MSVC + typedef long double _Quad; # endif #else # if __LDBL_MAX_EXP__ >= 16384 && KMP_COMPILER_GCC @@ -232,7 +253,7 @@ #if KMP_ARCH_X86 || KMP_ARCH_ARM # define KMP_SIZE_T_SPEC KMP_UINT32_SPEC -#elif KMP_ARCH_X86_64 +#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 # define KMP_SIZE_T_SPEC KMP_UINT64_SPEC #else # error "Can't determine size_t printf format specifier." @@ -657,6 +678,10 @@ # endif #endif /* KMP_OS_WINDOWS */ +#if KMP_ARCH_PPC64 +# define KMP_MB() __sync_synchronize() +#endif + #ifndef KMP_MB # define KMP_MB() /* nothing to do */ #endif @@ -763,7 +788,7 @@ #endif /* KMP_I8 */ /* Workaround for Intel(R) 64 code gen bug when taking address of static array (Intel(R) 64 Tracker #138) */ -#if KMP_ARCH_X86_64 && KMP_OS_LINUX +#if (KMP_ARCH_X86_64 || KMP_ARCH_PPC64) && KMP_OS_LINUX # define STATIC_EFI2_WORKAROUND #else # define STATIC_EFI2_WORKAROUND static diff -uNr openmp-r208472/runtime/src/kmp_runtime.c openmp/runtime/src/kmp_runtime.c --- openmp-r208472/runtime/src/kmp_runtime.c 2014-05-21 15:14:55.000000000 -0400 +++ openmp/runtime/src/kmp_runtime.c 2014-08-07 09:14:44.000000000 -0400 @@ -8450,7 +8450,7 @@ int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED; int tree_available = FAST_REDUCTION_TREE_METHOD_GENERATED; - #if KMP_ARCH_X86_64 + #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 #if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN #if KMP_MIC diff -uNr openmp-r208472/runtime/src/kmp_settings.c openmp/runtime/src/kmp_settings.c --- openmp-r208472/runtime/src/kmp_settings.c 2014-05-21 15:14:52.000000000 -0400 +++ openmp/runtime/src/kmp_settings.c 2014-08-07 09:14:44.000000000 -0400 @@ -536,6 +536,7 @@ static char * par_range_to_print = NULL; +#ifdef KMP_DEBUG static void __kmp_stg_parse_par_range( char const * name, @@ -614,7 +615,7 @@ break; } } // __kmp_stg_parse_par_range - +#endif int __kmp_initial_threads_capacity( int req_nproc ) diff -uNr openmp-r208472/runtime/src/kmp_str.h openmp/runtime/src/kmp_str.h --- openmp-r208472/runtime/src/kmp_str.h 2014-05-21 15:14:54.000000000 -0400 +++ openmp/runtime/src/kmp_str.h 2014-08-05 10:09:40.000000000 -0400 @@ -28,9 +28,8 @@ #endif // __cplusplus #if KMP_OS_WINDOWS - #define strdup _strdup - #define snprintf _snprintf - #define vsnprintf _vsnprintf +# define strdup _strdup +# define snprintf _snprintf #endif /* some macros to replace ctype.h functions */ diff -uNr openmp-r208472/runtime/src/kmp_version.c openmp/runtime/src/kmp_version.c --- openmp-r208472/runtime/src/kmp_version.c 2014-05-21 15:14:54.000000000 -0400 +++ openmp/runtime/src/kmp_version.c 2014-08-05 10:09:40.000000000 -0400 @@ -53,6 +53,8 @@ #define KMP_COMPILER "Clang " stringer( __clang_major__ ) "." stringer( __clang_minor__ ) #elif KMP_COMPILER_GCC #define KMP_COMPILER "GCC " stringer( __GNUC__ ) "." stringer( __GNUC_MINOR__ ) +#elif KMP_COMPILER_MSVC + #define KMP_COMPILER "MSVC " stringer( __MSC_FULL_VER ) #endif #ifndef KMP_COMPILER #warning "Unknown compiler" diff -uNr openmp-r208472/runtime/src/makefile.mk openmp/runtime/src/makefile.mk --- openmp-r208472/runtime/src/makefile.mk 2014-05-21 15:14:55.000000000 -0400 +++ openmp/runtime/src/makefile.mk 2014-08-07 09:14:44.000000000 -0400 @@ -73,6 +73,8 @@ TARGET_COMPILER := $(call check_variable,TARGET_COMPILER,12 11) # Library version: 4 -- legacy, 5 -- compat. VERSION := $(call check_variable,VERSION,5 4) +# quad precision floating point +HAVE_QUAD = 1 VPATH += $(src_dir) VPATH += $(src_dir)i18n/ @@ -171,6 +173,7 @@ ld-flags += -m32 -msse as-flags += -m32 -msse endif + HAVE_QUAD = 0 endif ifeq "$(LINK_TYPE)" "dyna" @@ -310,6 +313,9 @@ ifeq "$(CPLUSPLUS)" "on" ifeq "$(os)" "win" c-flags += -TP + else ifeq "$(arch)" "ppc64" + # c++0x on ppc64 linux removes definition of preproc. macros, needed in .hs + c-flags += -x c++ -std=gnu++0x else ifneq "$(filter gcc clang,$(c))" "" c-flags += -x c++ -std=c++0x @@ -370,7 +376,7 @@ ld-flags-extra += -lirc_pic endif endif - ifeq "$(filter 32 32e 64,$(arch))" "" + ifeq "$(filter 32 32e 64 ppc64,$(arch))" "" ld-flags-extra += $(shell pkg-config --libs libffi) endif else @@ -466,7 +472,14 @@ endif cpp-flags += -D KMP_LIBRARY_FILE=\"$(lib_file)\" cpp-flags += -D KMP_VERSION_MAJOR=$(VERSION) -cpp-flags += -D CACHE_LINE=64 + +# customize ppc64 cache line size to 128, 64 otherwise +ifeq "$(arch)" "ppc64" + cpp-flags += -D CACHE_LINE=128 +else + cpp-flags += -D CACHE_LINE=64 +endif + cpp-flags += -D KMP_ADJUST_BLOCKTIME=1 cpp-flags += -D BUILD_PARALLEL_ORDERED cpp-flags += -D KMP_ASM_INTRINS @@ -581,9 +594,12 @@ ifeq "$(arch)" "arm" z_Linux_asm$(obj) : \ cpp-flags += -D KMP_ARCH_ARM - else + else ifeq "$(arch)" "ppc64" z_Linux_asm$(obj) : \ - cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e,$(arch)),_64) + cpp-flags += -D KMP_ARCH_PPC64 + else + z_Linux_asm$(obj) : \ + cpp-flags += -D KMP_ARCH_X86$(if $(filter 32e,$(arch)),_64) endif endif @@ -596,6 +612,9 @@ gd-flags += -D arch_$(arch) gd-flags += -D $(LIB_TYPE) +ifeq "$(HAVE_QUAD)" "1" + gd-flags += -D HAVE_QUAD +endif ifeq "$(OMP_VERSION)" "40" gd-flags += -D OMP_40 -D OMP_30 else @@ -729,7 +748,9 @@ else # 5 lib_c_items += kmp_gsupport endif +# ifneq "$(arch)" "ppc64" lib_asm_items += z_Linux_asm +# endif endif endif @@ -1391,9 +1412,13 @@ td_exp += libc.so.6 td_exp += ld-linux-armhf.so.3 endif + ifeq "$(arch)" "ppc64" + td_exp += libc.so.6 + td_exp += ld64.so.1 + endif td_exp += libdl.so.2 td_exp += libgcc_s.so.1 - ifeq "$(filter 32 32e 64,$(arch))" "" + ifeq "$(filter 32 32e 64 ppc64,$(arch))" "" td_exp += libffi.so.6 td_exp += libffi.so.5 endif diff -uNr openmp-r208472/runtime/src/thirdparty/ittnotify/ittnotify_config.h openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h --- openmp-r208472/runtime/src/thirdparty/ittnotify/ittnotify_config.h 2014-05-21 15:14:53.000000000 -0400 +++ openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h 2014-08-07 09:14:44.000000000 -0400 @@ -132,6 +132,11 @@ # define ITT_ARCH_ARM 4 #endif /* ITT_ARCH_ARM */ +#ifndef ITT_ARCH_PPC64 +# define ITT_ARCH_PPC64 5 +#endif /* ITT_ARCH_PPC64 */ + + #ifndef ITT_ARCH # if defined _M_IX86 || defined __i386__ # define ITT_ARCH ITT_ARCH_IA32 @@ -141,6 +146,8 @@ # define ITT_ARCH ITT_ARCH_IA64 # elif defined _M_ARM || __arm__ # define ITT_ARCH ITT_ARCH_ARM +# elif defined __powerpc64__ +# define ITT_ARCH ITT_ARCH_PPC64 # endif #endif @@ -274,7 +281,7 @@ : "memory"); return result; } -#elif ITT_ARCH==ITT_ARCH_ARM +#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val) #endif /* ITT_ARCH==ITT_ARCH_IA64 */ #ifndef ITT_SIMPLE_INIT diff -uNr openmp-r208472/runtime/src/z_Linux_asm.s openmp/runtime/src/z_Linux_asm.s --- openmp-r208472/runtime/src/z_Linux_asm.s 2014-05-21 15:14:56.000000000 -0400 +++ openmp/runtime/src/z_Linux_asm.s 2014-08-07 09:14:44.000000000 -0400 @@ -138,7 +138,7 @@ #endif /* KMP_GOMP_COMPAT */ -#if KMP_ARCH_X86 +#if KMP_ARCH_X86 && !KMP_ARCH_PPC64 // ----------------------------------------------------------------------- // microtasking routines specifically written for IA-32 architecture @@ -1585,6 +1585,16 @@ .size __kmp_unnamed_critical_addr,4 #endif /* KMP_ARCH_ARM */ +#if KMP_ARCH_PPC64 + .data + .comm .gomp_critical_user_,32,8 + .data + .align 8 + .global __kmp_unnamed_critical_addr +__kmp_unnamed_critical_addr: + .8byte .gomp_critical_user_ + .size __kmp_unnamed_critical_addr,8 +#endif /* KMP_ARCH_PPC64 */ #if defined(__linux__) .section .note.GNU-stack,"",@progbits diff -uNr openmp-r208472/runtime/src/z_Linux_util.c openmp/runtime/src/z_Linux_util.c --- openmp-r208472/runtime/src/z_Linux_util.c 2014-05-21 15:14:56.000000000 -0400 +++ openmp/runtime/src/z_Linux_util.c 2014-08-07 09:14:44.000000000 -0400 @@ -32,7 +32,7 @@ #include #include -#if KMP_OS_LINUX +#if KMP_OS_LINUX && !KMP_OS_CNK # include # if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) // We should really include , but that causes compatibility problems on different @@ -61,7 +61,7 @@ #include // For non-x86 architecture -#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64) +#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64) # include # include #endif @@ -110,7 +110,7 @@ /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if ( KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED) /* * Affinity support @@ -147,6 +147,19 @@ # error Wrong code for getaffinity system call. # endif /* __NR_sched_getaffinity */ +# elif KMP_ARCH_PPC64 +# ifndef __NR_sched_setaffinity +# define __NR_sched_setaffinity 222 +# elif __NR_sched_setaffinity != 222 +# error Wrong code for setaffinity system call. +# endif /* __NR_sched_setaffinity */ +# ifndef __NR_sched_getaffinity +# define __NR_sched_getaffinity 223 +# elif __NR_sched_getaffinity != 223 +# error Wrong code for getaffinity system call. +# endif /* __NR_sched_getaffinity */ + + # else # error Unknown or unsupported architecture @@ -445,7 +458,7 @@ /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ -#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) +#if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) && !KMP_OS_CNK int __kmp_futex_determine_capable() @@ -462,7 +475,7 @@ return retval; } -#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) +#endif // KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) && !KMP_OS_CNK /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ @@ -481,7 +494,7 @@ old_value = TCR_4( *p ); new_value = old_value | d; - while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) ) + while ( ! KMP_COMPARE_AND_STORE_REL32 ( p, old_value, new_value ) ) { KMP_CPU_PAUSE(); old_value = TCR_4( *p ); @@ -498,7 +511,7 @@ old_value = TCR_4( *p ); new_value = old_value & d; - while ( ! __kmp_compare_and_store32 ( p, old_value, new_value ) ) + while ( ! KMP_COMPARE_AND_STORE_REL32 ( p, old_value, new_value ) ) { KMP_CPU_PAUSE(); old_value = TCR_4( *p ); @@ -507,7 +520,7 @@ return old_value; } -# if KMP_ARCH_X86 +# if KMP_ARCH_X86 || KMP_ARCH_PPC64 kmp_int64 __kmp_test_then_add64( volatile kmp_int64 *p, kmp_int64 d ) { @@ -516,7 +529,7 @@ old_value = TCR_8( *p ); new_value = old_value + d; - while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) ) + while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) ) { KMP_CPU_PAUSE(); old_value = TCR_8( *p ); @@ -533,7 +546,7 @@ old_value = TCR_8( *p ); new_value = old_value | d; - while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) ) + while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) ) { KMP_CPU_PAUSE(); old_value = TCR_8( *p ); @@ -549,7 +562,7 @@ old_value = TCR_8( *p ); new_value = old_value & d; - while ( ! __kmp_compare_and_store64 ( p, old_value, new_value ) ) + while ( ! KMP_COMPARE_AND_STORE_REL64 ( p, old_value, new_value ) ) { KMP_CPU_PAUSE(); old_value = TCR_8( *p ); @@ -2527,7 +2540,7 @@ #endif // USE_LOAD_BALANCE -#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64) +#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64) int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, int argc, void *p_argv[] ) @@ -2561,7 +2574,89 @@ return 1; } -#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64) +#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64) + +#if KMP_ARCH_PPC64 + +// we really only need the case with 1 argument, because CLANG always build +// a struct of pointers to shared variables referenced in the outlined function +int +__kmp_invoke_microtask( microtask_t pkfn, + int gtid, int tid, + int argc, void *p_argv[] ) { + switch (argc) { + default: + fprintf(stderr, "Too many args to microtask: %d!\n", argc); + fflush(stderr); + exit(-1); + case 0: + (*pkfn)(>id, &tid); + break; + case 1: + (*pkfn)(>id, &tid, p_argv[0]); + break; + case 2: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1]); + break; + case 3: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2]); + break; + case 4: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3]); + break; + case 5: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4]); + break; + case 6: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5]); + break; + case 7: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6]); + break; + case 8: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7]); + break; + case 9: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8]); + break; + case 10: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9]); + break; + case 11: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10]); + break; + case 12: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10], + p_argv[11]); + break; + case 13: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10], + p_argv[11], p_argv[12]); + break; + case 14: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10], + p_argv[11], p_argv[12], p_argv[13]); + break; + case 15: + (*pkfn)(>id, &tid, p_argv[0], p_argv[1], p_argv[2], p_argv[3], p_argv[4], + p_argv[5], p_argv[6], p_argv[7], p_argv[8], p_argv[9], p_argv[10], + p_argv[11], p_argv[12], p_argv[13], p_argv[14]); + break; + } + + return 1; +} + +#endif // end of file // diff -uNr openmp-r208472/runtime/tools/lib/Platform.pm openmp/runtime/tools/lib/Platform.pm --- openmp-r208472/runtime/tools/lib/Platform.pm 2014-05-21 15:14:56.000000000 -0400 +++ openmp/runtime/tools/lib/Platform.pm 2014-08-07 09:14:44.000000000 -0400 @@ -50,6 +50,8 @@ $arch = "32e"; } elsif ( $arch =~ m{\Aarm(?:v7\D*)?\z} ) { $arch = "arm"; + } elsif ( $arch =~ m{\Appc64} ) { + $arch = "ppc64"; } else { $arch = undef; }; # if @@ -159,6 +161,8 @@ $_host_arch = "32e"; } elsif ( $hardware_platform eq "arm" ) { $_host_arch = "arm"; + } elsif ( $hardware_platform eq "ppc64" ) { + $_host_arch = "ppc64"; } else { die "Unsupported host hardware platform: \"$hardware_platform\"; stopped"; }; # if diff -uNr openmp-r208472/runtime/tools/lib/Uname.pm openmp/runtime/tools/lib/Uname.pm --- openmp-r208472/runtime/tools/lib/Uname.pm 2014-05-21 15:14:56.000000000 -0400 +++ openmp/runtime/tools/lib/Uname.pm 2014-08-07 09:14:44.000000000 -0400 @@ -147,6 +147,8 @@ $values{ hardware_platform } = "x86_64"; } elsif ( $values{ machine } =~ m{\Aarmv7\D*\z} ) { $values{ hardware_platform } = "arm"; + } elsif ( $values{ machine } =~ m{\Appc64\z} ) { + $values{ hardware_platform } = "ppc64"; } else { die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped"; }; # if diff -uNr openmp-r208472/runtime/tools/src/common-defs.mk openmp/runtime/tools/src/common-defs.mk --- openmp-r208472/runtime/tools/src/common-defs.mk 2014-05-21 15:14:57.000000000 -0400 +++ openmp/runtime/tools/src/common-defs.mk 2014-08-07 09:14:44.000000000 -0400 @@ -45,7 +45,7 @@ # Description: # The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64. # -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)))))) +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))))))) # Synopsis: # var_name = $(call check_variable,var,list) @@ -128,9 +128,9 @@ # -------------------------------------------------------------------------------------------------- os := $(call check_variable,os,lin lrb mac win) -arch := $(call check_variable,arch,32 32e 64 arm) +arch := $(call check_variable,arch,32 32e 64 arm ppc64) platform := $(os)_$(arch) -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) +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) # oa-opts means "os and arch options". They are passed to almost all perl scripts. oa-opts := --os=$(os) --arch=$(arch) diff -uNr openmp-r208472/testsuite/c/omp_barrier.c openmp/testsuite/c/omp_barrier.c --- openmp-r208472/testsuite/c/omp_barrier.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_barrier.c 2014-08-05 10:09:53.000000000 -0400 @@ -1,5 +1,5 @@ -Test which checks the omp barrier directive. The test creates several threads and sends one of them sleeping before setting a flag. After the barrier the other ones do some littel work depending on the flag. +Test which checks the omp barrier directive. The test creates several threads and sends one of them sleeping before setting a flag. After the barrier the other ones do some little work depending on the flag. 2.0 omp barrier diff -uNr openmp-r208472/testsuite/c/omp_for_schedule_guided.c openmp/testsuite/c/omp_for_schedule_guided.c --- openmp-r208472/testsuite/c/omp_for_schedule_guided.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_for_schedule_guided.c 2014-08-05 10:09:53.000000000 -0400 @@ -214,7 +214,7 @@ fprintf (logFile, "Chunksize did not decrease: %d instead of %d\n", chunksizes[i],expected_chunk_size); #endif - /* calculating the remaining ammount of work */ + /* calculating the remaining amount of work */ openwork -= chunksizes[i]; } } diff -uNr openmp-r208472/testsuite/c/omp_parallel_for_if.c openmp/testsuite/c/omp_parallel_for_if.c --- openmp-r208472/testsuite/c/omp_parallel_for_if.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_parallel_for_if.c 2014-08-05 10:09:53.000000000 -0400 @@ -33,6 +33,6 @@ known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2; fprintf (logFile, "Number of threads determined by omp_get_num_threads: %d\n", num_threads); return (known_sum == sum && num_threads == 1); -} /* end of check_paralel_for_private */ +} /* end of check_parallel_for_private */ diff -uNr openmp-r208472/testsuite/c/omp_parallel_for_private.c openmp/testsuite/c/omp_parallel_for_private.c --- openmp-r208472/testsuite/c/omp_parallel_for_private.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_parallel_for_private.c 2014-08-05 10:09:53.000000000 -0400 @@ -43,6 +43,6 @@ known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2; return (known_sum == sum); -} /* end of check_paralel_for_private */ +} /* end of check_parallel_for_private */ diff -uNr openmp-r208472/testsuite/c/omp_parallel_sections_private.c openmp/testsuite/c/omp_parallel_sections_private.c --- openmp-r208472/testsuite/c/omp_parallel_sections_private.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_parallel_sections_private.c 2014-08-05 10:09:51.000000000 -0400 @@ -56,7 +56,7 @@ sum= sum+sum0; } /*end of critical */ } - } /*end of paralell sections*/ + } /*end of parallel sections*/ known_sum=(999*1000)/2+7; return (known_sum==sum); diff -uNr openmp-r208472/testsuite/c/omp_single.c openmp/testsuite/c/omp_single.c --- openmp-r208472/testsuite/c/omp_single.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_single.c 2014-08-05 10:09:52.000000000 -0400 @@ -1,5 +1,5 @@ -Test which checks the omp single directive by controling how often a directive is called in an omp single region. +Test which checks the omp single directive by controlling how often a directive is called in an omp single region. 2.0 omp single omp parallel private,omp flush diff -uNr openmp-r208472/testsuite/c/omp_task.c openmp/testsuite/c/omp_task.c --- openmp-r208472/testsuite/c/omp_task.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_task.c 2014-08-05 10:09:53.000000000 -0400 @@ -47,6 +47,6 @@ return 1; } return 0; -} /* end of check_paralel_for_private */ +} /* end of check_parallel_for_private */ diff -uNr openmp-r208472/testsuite/c/omp_task_final.c openmp/testsuite/c/omp_task_final.c --- openmp-r208472/testsuite/c/omp_task_final.c 2014-05-21 15:14:45.000000000 -0400 +++ openmp/testsuite/c/omp_task_final.c 2014-08-05 10:09:52.000000000 -0400 @@ -47,6 +47,6 @@ error++; } return (error==0); -} /* end of check_paralel_for_private */ +} /* end of check_parallel_for_private */ diff -uNr openmp-r208472/testsuite/fortran/do_schedule_guided.f openmp/testsuite/fortran/do_schedule_guided.f --- openmp-r208472/testsuite/fortran/do_schedule_guided.f 2014-05-21 15:14:44.000000000 -0400 +++ openmp/testsuite/fortran/do_schedule_guided.f 2014-08-05 10:10:03.000000000 -0400 @@ -7,7 +7,7 @@ ! TODO: ! C. Niethammer: ! Find check to decide if the test was run as schedule(static) because - ! this also can pass the test if the work is devided into thread-counts + ! this also can pass the test if the work is divided into thread-counts INTEGER FUNCTION do_schedule_guided() IMPLICIT NONE INTEGER omp_get_thread_num,omp_get_num_threads diff -uNr openmp-r208472/testsuite/fortran/omp_barrier.f openmp/testsuite/fortran/omp_barrier.f --- openmp-r208472/testsuite/fortran/omp_barrier.f 2014-05-21 15:14:44.000000000 -0400 +++ openmp/testsuite/fortran/omp_barrier.f 2014-08-05 10:10:03.000000000 -0400 @@ -1,5 +1,5 @@ -Test which checks the omp barrier directive. The test creates several threads and sends one of them sleeping before setting a flag. After the barrier the other ones do some littel work depending on the flag. +Test which checks the omp barrier directive. The test creates several threads and sends one of them sleeping before setting a flag. After the barrier the other ones do some little work depending on the flag. 2.0 omp barrier diff -uNr openmp-r208472/testsuite/fortran/omp_num_threads.f openmp/testsuite/fortran/omp_num_threads.f --- openmp-r208472/testsuite/fortran/omp_num_threads.f 2014-05-21 15:14:44.000000000 -0400 +++ openmp/testsuite/fortran/omp_num_threads.f 2014-08-05 10:10:04.000000000 -0400 @@ -24,7 +24,7 @@ !Yi Wen added omp_Set_dynamics here to make sure num_threads clause work !Thanks to Dr. Yin Ma in Absoft. should be not be called before the test loop -!becuase it allows the dynamic adjustment of the number of threads at runtime +!because it allows the dynamic adjustment of the number of threads at runtime !instead of using the max_threads set. !CALL OMP_SET_DYNAMIC(.TRUE.) diff -uNr openmp-r208472/testsuite/fortran/omp_single.f openmp/testsuite/fortran/omp_single.f --- openmp-r208472/testsuite/fortran/omp_single.f 2014-05-21 15:14:44.000000000 -0400 +++ openmp/testsuite/fortran/omp_single.f 2014-08-05 10:10:05.000000000 -0400 @@ -1,5 +1,5 @@ -Test which checks the omp single directive by controling how often a directive is called in an omp single region. +Test which checks the omp single directive by controlling how often a directive is called in an omp single region. 2.0 omp single omp parallel private,omp flush diff -uNr openmp-r208472/testsuite/ompts_parser.pl openmp/testsuite/ompts_parser.pl --- openmp-r208472/testsuite/ompts_parser.pl 2014-05-21 15:14:46.000000000 -0400 +++ openmp/testsuite/ompts_parser.pl 2014-08-05 10:10:01.000000000 -0400 @@ -131,7 +131,7 @@ $code = "#include \"omp_testsuite.h\"\n".$orphvarsdef . $orphfuncsdefs . $code . $orphfuncs; } else { - print "An error occured!"; + print "An error occurred!"; } } # remove parameters between tags, added by joon diff -uNr openmp-r208472/testsuite/ompts_standaloneProc.f openmp/testsuite/ompts_standaloneProc.f --- openmp-r208472/testsuite/ompts_standaloneProc.f 2014-05-21 15:14:46.000000000 -0400 +++ openmp/testsuite/ompts_standaloneProc.f 2014-08-05 10:09:51.000000000 -0400 @@ -44,7 +44,7 @@ DO j = 1, N temp = () IF (temp .EQ. 1) THEN - WRITE (1,*) j, ". test successfull." + WRITE (1,*) j, ". test successful." success = success + 1 ELSE WRITE (1,*) "Error: ",j, ". test failed."