[Openmp-dev] On Improving the Build System revisited

Jack Howarth howarth.mailing.lists at gmail.com
Fri May 30 10:24:12 PDT 2014


   Using the overall file locations and structure from the openmprtl site,
this shouldn't be that hard to set the cmake build machinery up. For
example, the Cmakefiles.txt in openmp-3.5.0/runtime would just be something
like…

cmake_minimum_required(VERSION 2.8.1)

project(libiomp)

enable_language(C ASM)

set(VERSION 5)
set(OMP_VERSION_NUM "40")

# set debug as default build
if("${BUILD_TYPE}" STREQUAL "")
        set(BUILD_TYPE "Debug")
endif()

# set 64bit as default architecture
if("${ARCH}" STREQUAL "")
        set(ARCH "32e")
endif()
set(ARCH_STR "Intel(R) 64")

set(COMMON_FLAGS "${COMMON_FLAGS} -D USE_ITT_BUILD")
set(COMMON_FLAGS "${COMMON_FLAGS} -D NDEBUG")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_ARCH_STR=\"\\\"${ARCH_STR}\\\"\"")
set(COMMON_FLAGS "${COMMON_FLAGS} -D _GNU_SOURCE")
set(COMMON_FLAGS "${COMMON_FLAGS} -D _REENTRANT")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_USE_ASSERT")
set(COMMON_FLAGS "${COMMON_FLAGS} -D BUILD_I8")
set(COMMON_FLAGS "${COMMON_FLAGS} -D BUILD_TV")
if(APPLE)
        set(COMMON_FLAGS "${COMMON_FLAGS} -D
KMP_LIBRARY_FILE=\\\"libiomp5.dylib\\\"")
else()
        set(COMMON_FLAGS "${COMMON_FLAGS} -D
KMP_LIBRARY_FILE=\\\"libiomp5.so\\\"")
endif()
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_VERSION_MAJOR=${VERSION}")
set(COMMON_FLAGS "${COMMON_FLAGS} -D CACHE_LINE=64")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_ADJUST_BLOCKTIME=1")
set(COMMON_FLAGS "${COMMON_FLAGS} -D BUILD_PARALLEL_ORDERED")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_ASM_INTRINS")
set(COMMON_FLAGS "${COMMON_FLAGS} -D USE_LOAD_BALANCE")
set(COMMON_FLAGS "${COMMON_FLAGS} -D USE_CBLKDATA")
set(COMMON_FLAGS "${COMMON_FLAGS} -D GUIDEDLL_EXPORTS")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_GOMP_COMPAT")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_USE_ADAPTIVE_LOCKS=1")
set(COMMON_FLAGS "${COMMON_FLAGS} -D KMP_DEBUG_ADAPTIVE_LOCKS=0")

if("${OMP_VERSION_NUM}" STREQUAL "40")
        set(COMMON_FLAGS "${COMMON_FLAGS} -D OMP_50_ENABLED=0")
        set(COMMON_FLAGS "${COMMON_FLAGS} -D OMP_41_ENABLED=0")
        set(COMMON_FLAGS "${COMMON_FLAGS} -D OMP_40_ENABLED=1")
        set(COMMON_FLAGS "${COMMON_FLAGS} -D OMP_30_ENABLED=1")
endif()

set(COMMON_FLAGS "${COMMON_FLAGS} -D USE_ITT_NOTIFY=1")
set(COMMON_FLAGS "${COMMON_FLAGS} -D INTEL_ITTNOTIFY_PREFIX=__kmp_itt_")

set(C_CXX_COMMON_FLAGS "${C_CXX_COMMON_FLAGS} -fPIC")

if(${BUILD_TYPE} STREQUAL "Debug")
        set(COMMON_FLAGS "${COMMON_FLAGS} -g")
endif()

# Silence some warnings
set(C_CXX_COMMON_FLAGS "${C_CXX_COMMON_FLAGS} -Wno-unused-value")
set(C_CXX_COMMON_FLAGS "${C_CXX_COMMON_FLAGS} -Wno-switch")
set(C_CXX_COMMON_FLAGS "${C_CXX_COMMON_FLAGS} -Wno-switch")

# Disable exception handling.
set(C_CXX_COMMON_FLAGS "${C_CXX_COMMON_FLAGS} -fno-exceptions")

# Disable use of EBP as general purpose register.
if(NOT ${ARCH} STREQUAL "64")
        set(C_CXX_COMMON_FLAGS "${C_CXX_COMMON_FLAGS}
-fno-omit-frame-pointer")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS} ${C_CXX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}
${C_CXX_COMMON_FLAGS}")

add_subdirectory(src)

   IMHO, I don't think there is much intellectual property here as it is a
fairly standard cmake syntax which is adjusted to mimic the flags emitted
by the current build.pl scripts (which is how I made my adjustments anyway).
       Jack


On Fri, May 30, 2014 at 12:37 PM, Jack Howarth <
howarth.mailing.lists at gmail.com> wrote:

> Alp,
>     Are you thinking of these?
>
>
> https://github.com/pathscale/openmprtl/blob/master/itt/libomp_oss/CMakeLists.txt
>
>            Jack
> ps Worse case we can at least look at those as a template on how to
> construct ours.
>
>
> On Fri, May 30, 2014 at 11:00 AM, Alp Toker <alp at nuanti.com> wrote:
>
>>
>> On 30/05/2014 17:51, Jack Howarth wrote:
>>
>>> Should it be an out of source build like libcxx?
>>>
>>
>> Yep, exactly.
>>
>> Will try to dig up the CMake files, they're pretty neat. Some
>> Intel/icc-specific functionality is missing IIRC but otherwise fine.
>>
>> Alp.
>>
>>
>>>
>>> On Fri, May 30, 2014 at 8:56 AM, John Leidel (jleidel) <
>>> jleidel at micron.com <mailto:jleidel at micron.com>> wrote:
>>>
>>>     Why not structure this as an LLVM "project" as defined in
>>>     http://llvm.org/docs/Projects.html?
>>>
>>>
>>>     John D. Leidel
>>>
>>>     On May 30, 2014, at 7:30 AM, Alp Toker <alp at nuanti.com
>>>     <mailto:alp at nuanti.com>> wrote:
>>>
>>>     >
>>>     > On 30/05/2014 15:18, Jack Howarth wrote:
>>>     >>    Has anyone started on integrating the openmp build into the
>>>     llvm build yet? If not, I would suggest we start by borrowing the
>>>     build machinery files from polly as the starting point. Like
>>>     polly, openmp provides a support library for the compiler and
>>>     should be built in the tools subdirectory..
>>>     >
>>>     > Polly is completely different to the OpenMP runtime. Polly uses
>>>     LLVM libraries, and can be seen as part of the compilation host
>>>     toolchain, while this is an independent runtime library that runs
>>>     on the target. So the build systems are tangential.
>>>     >
>>>     >
>>>     >> Also, the polly cmake  and autogen directories are fairly
>>>     spartan so they should be easy to refashion for openmp.
>>>     >
>>>     > There's a simple CMake setup on one of the GitHub branches of
>>>     this project, C. Bergström may know better if they can be
>>>     contributed. Either way that's closer to what's needed here.
>>>     >
>>>     > Alp.
>>>     >
>>>     >
>>>     >>           Jack
>>>     >>
>>>     >>
>>>     >> _______________________________________________
>>>     >> Openmp-dev mailing list
>>>     >> Openmp-dev at dcs-maillist2.engr.illinois.edu
>>>     <mailto:Openmp-dev at dcs-maillist2.engr.illinois.edu>
>>>
>>>     >> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev
>>>     >
>>>     > --
>>>     > http://www.nuanti.com
>>>     > the browser experts
>>>     >
>>>     > _______________________________________________
>>>     > Openmp-dev mailing list
>>>     > Openmp-dev at dcs-maillist2.engr.illinois.edu
>>>     <mailto:Openmp-dev at dcs-maillist2.engr.illinois.edu>
>>>     > http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev
>>>
>>>
>>>
>> --
>> http://www.nuanti.com
>> the browser experts
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20140530/2e3a0dcd/attachment.html>


More information about the Openmp-dev mailing list