Commit a743ffe2 authored by Vít Hanousek's avatar Vít Hanousek
Browse files

Merge branch 'develop' into mpi

parents 72901f0d 57015d46
Loading
Loading
Loading
Loading
+86 −9
Original line number Diff line number Diff line
@@ -18,14 +18,24 @@ stages:
    WITH_CUDA: "no"
    WITH_CUDA_ARCH: "auto"
    WITH_MIC: "no"
    WITH_MPI: "no"
    WITH_TESTS: "yes"
    WITH_COVERAGE: "no"
    WITH_EXAMPLES: "yes"
    # these are built only in the "full" config
    WITH_BENCHMARKS: "no"
    WITH_EXAMPLES: "no"
    WITH_TOOLS: "no"
    WITH_PYTHON: "no"

# template for build jobs
.build_template_def: &build_template
    stage: build
    script:
        # set MPI compiler wrapper
        - if [[ ${WITH_MPI} == "yes" ]]; then
                export CXX=mpicxx;
                export CC=mpicc;
          fi
        # all cores including hyperthreading
#        - export NUM_CORES=$(grep "core id" /proc/cpuinfo | wc -l)
#       # all pyhsical cores
@@ -46,7 +56,10 @@ stages:
                -DWITH_MIC=${WITH_MIC}
                -DWITH_TESTS=${WITH_TESTS}
                -DWITH_COVERAGE=${WITH_COVERAGE}
                -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
                -DWITH_TOOLS=${WITH_TOOLS}
                -DWITH_PYTHON=${WITH_PYTHON}
#        - make
#        - make test
#        - make install
@@ -61,7 +74,7 @@ stages:
# Cuda builds are specified first because they take more time than host-only builds,
# which can be allocated on hosts whitout GPUs.

cuda_Debug:
cuda_base_Debug:
    <<: *build_template
    tags:
        - gpu
@@ -70,7 +83,7 @@ cuda_Debug:
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug

cuda_Release:
cuda_base_Release:
    <<: *build_template
    tags:
        - gpu
@@ -79,38 +92,94 @@ cuda_Release:
        WITH_CUDA: "yes"
        BUILD_TYPE: Release

cuda+openmp_Debug:
cuda_mpi_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug

cuda+openmp_Release:
cuda_mpi_Release:
    <<: *build_template
    tags:
        - openmp
        - gpu
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Release

default_Debug:
cuda_full_Debug:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
        WITH_EXAMPLES: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

default_Release:
cuda_full_Release:
    <<: *build_template
    tags:
        - openmp
        - gpu
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_CUDA: "yes"
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_EXAMPLES: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

openmp_Debug:
default_base_Debug:
    <<: *build_template

default_base_Release:
    <<: *build_template
    variables:
        <<: *default_cmake_flags
        BUILD_TYPE: Release

default_mpi_Debug:
    <<: *build_template
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Debug

default_mpi_Release:
    <<: *build_template
    tags:
        - openmp
        - mpi
    variables:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        WITH_MPI: "yes"
        BUILD_TYPE: Release

default_full_Debug:
    <<: *build_template
    tags:
        - openmp
@@ -118,8 +187,12 @@ openmp_Debug:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        BUILD_TYPE: Debug
        WITH_BENCHMARKS: "yes"
        WITH_EXAMPLES: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"

openmp_Release:
default_full_Release:
    <<: *build_template
    tags:
        - openmp
@@ -127,3 +200,7 @@ openmp_Release:
        <<: *default_cmake_flags
        WITH_OPENMP: "yes"
        BUILD_TYPE: Release
        WITH_BENCHMARKS: "yes"
        WITH_EXAMPLES: "yes"
        WITH_TOOLS: "yes"
        WITH_PYTHON: "yes"
+22 −11
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ option(WITH_TESTS "Build tests" ON)
option(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF)
option(WITH_EXAMPLES "Compile the 'examples' directory" ON)
option(WITH_TOOLS "Compile the 'src/Tools' directory" ON)
option(WITH_BENCHMARKS "Compile the 'src/Benchmarks' directory" ON)
option(WITH_PYTHON "Compile the Python bindings" ON)
option(WITH_TEMPLATES_INSTANTIATION "Enable explicit template instantiation" OFF)

@@ -62,6 +63,20 @@ else()
    set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin )
endif()

# check if the compiler is good enough
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
   # GCC 5.0 is the first release with full C++11 support (due to libstdc++)
   # https://gcc.gnu.org/gcc-5/changes.html
   if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")
      message(FATAL_ERROR "Insufficient GCC version")
   endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   # Clang 3.4 has full C++14 support: http://clang.llvm.org/cxx_status.html
   if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4")
      message(FATAL_ERROR "Insufficient Clang version")
   endif()
endif()

# set Debug/Release options
set( CMAKE_CXX_FLAGS "-std=c++11 -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
@@ -109,10 +124,11 @@ endif()
#####
# Check for MPI -- poznej podle vraperu compileru -- da se testovat preklad bez MPI
#
if( ${CXX_COMPILER_NAME} STREQUAL "mpic++" )
if( ${CXX_COMPILER_NAME} STREQUAL "mpicxx" )
   message( "MPI compiler detected."    )
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_MPI" )
   set( CUDA_HOST_COMPILER "mpic++" )
   set( CUDA_HOST_COMPILER "mpicxx" )
   set( BUILD_MPI ON )
endif()

####
@@ -150,7 +166,7 @@ if( ${WITH_CUDA} )
            endif()
        endif()
        # An extra CUDA_ARCH_HOST_COMPILER variable for compiling tnl-cuda-arch alone,
        # because it SHOULD NOT be compiled using mpic++, which would cause weird
        # because it SHOULD NOT be compiled using mpicxx, which would cause weird
        # RPATH_CHANGE error in cmake.
        # FIXME: find better solution to switch between MPI-enabled and MPI-disabled binaries in cmake
        if( NOT $ENV{CUDA_ARCH_HOST_COMPILER} STREQUAL "" )
@@ -406,15 +422,9 @@ INCLUDE_DIRECTORIES( ${PROJECT_BUILD_PATH} )
LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} )

# Add all subdirectories
# Note that it is important to start building examples as soon as possible,
# because they take the longest time and other stuff can be pipelined before
# they are finished (at least with Ninja).
if( WITH_EXAMPLES STREQUAL "yes" )
   add_subdirectory( examples )
endif( WITH_EXAMPLES STREQUAL "yes" )
if( WITH_TESTS STREQUAL "yes" )
if( ${WITH_TESTS} )
    add_subdirectory( tests )
endif( WITH_TESTS STREQUAL "yes" )
endif()
add_subdirectory( src )
add_subdirectory( share )

@@ -458,6 +468,7 @@ message( " WITH_TESTS=${WITH_TESTS}" )
message( "   WITH_COVERAGE=${WITH_COVERAGE}" )
message( "   WITH_EXAMPLES=${WITH_EXAMPLES}" )
message( "   WITH_TOOLS=${WITH_TOOLS}" )
message( "   WITH_BENCHMARKS=${WITH_BENCHMARKS}" )
message( "   WITH_PYTHON=${WITH_PYTHON}" )
message( "   WITH_TEMPLATES_INSTANTIATION=${WITH_TEMPLATES_INSTANTIATION}" )
# Print compiler options
+9 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ WITH_COVERAGE="no"
WITH_EXAMPLES="yes"
WITH_PYTHON="yes"
WITH_TOOLS="yes"
WITH_BENCHMARKS="yes"

WITH_TEMPLATE_INSTANTIATION="no"
INSTANTIATE_LONG_INT="no"
@@ -60,6 +61,7 @@ do
        --with-coverage=*                ) WITH_COVERAGE="${option#*=}" ;;
        --with-examples=*                ) WITH_EXAMPLES="${option#*=}" ;;
        --with-tools=*                   ) WITH_TOOLS="${option#*=}" ;;
        --with-benchmarks=*              ) WITH_BENCHMARKS="${option#*=}" ;;
        --with-python=*                  ) WITH_PYTHON="${option#*=}" ;;
        --with-templates-instantiation=* ) WITH_TEMPLATE_INSTANTIATION="${option#*=}" ;;
        --instantiate-long-int=*         ) INSTANTIATE_LONG_INT="${option#*=}" ;;
@@ -114,17 +116,18 @@ if [[ ${WITH_CLANG} == "yes" ]]; then
fi

if [[ ${WITH_MPI} == "yes" ]]; then
    if [[ ! -x  "$(command -v mpic++)" ]]; then
       echo "Warning:mpic++ is not installed on this system. MPI support is turned off." 
    # NOTE: OpenMPI provides mpic++, but Intel MPI does not
    if [[ ! -x  "$(command -v mpicxx)" ]]; then
       echo "Warning: mpicxx is not installed on this system. MPI support is turned off."
    else
       # instruct OpenMPI to use the original compiler
       # reference: https://www.open-mpi.org/faq/?category=mpi-apps#override-wrappers-after-v1.0
       # FIXME: this does not work with CUDA_HOST_COMPILER=mpic++
       # FIXME: this does not work with CUDA_HOST_COMPILER=mpicxx
#       if [ -n "$CXX" ]; then
#          export OMPI_CXX="$CXX"
#       fi
       export CXX=mpic++
       export CUDA_HOST_COMPILER=mpic++
       export CXX=mpicxx
       export CUDA_HOST_COMPILER=mpicxx
    fi
    if [[ ! -x  "$(command -v mpicc)" ]]; then
       echo "Warning: mpicc is not installed on this system." 
@@ -163,6 +166,7 @@ cmake_command=(
         -DWITH_COVERAGE=${WITH_COVERAGE}
         -DWITH_EXAMPLES=${WITH_EXAMPLES}
         -DWITH_TOOLS=${WITH_TOOLS}
         -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
         -DWITH_PYTHON=${WITH_PYTHON}
         -DDCMTK_DIR=${DCMTK_DIR}
         -DWITH_TEMPLATE_INSTANTIATION=${WITH_TEMPLATE_INSTANTIATION}
+2 −1
Original line number Diff line number Diff line
add_subdirectory( Tools )
add_subdirectory (cmake)
add_subdirectory (pkgconfig)

share/Tools/CMakeLists.txt

deleted100644 → 0
+0 −2
Original line number Diff line number Diff line
add_subdirectory (cmake)
add_subdirectory (pkgconfig)
Loading