Commit 6273668f authored by gsell's avatar gsell
Browse files

main CMakeList.txt:

- formatting changes
- type in Intel compile options fixed
parent 5b9527c6
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.10)
PROJECT (OPAL)
SET (OPAL_VERSION_MAJOR 1)
cmake_minimum_required (VERSION 3.0.2)
project (OPAL)
set (OPAL_VERSION_MAJOR 1)
SET (OPAL_VERSION_MINOR 9.0)
set (PACKAGE \"opal\")
set (PACKAGE_BUGREPORT \"opal@lists.psi.ch\")
......@@ -8,31 +8,30 @@ set (PACKAGE_NAME \"OPAL\")
set (PACKAGE_TARNAME \"opal\")
set (PACKAGE_VERSION "${OPAL_VERSION_MAJOR}.${OPAL_VERSION_MINOR}")
set (PACKAGE_VERSION_STR "\"${PACKAGE_VERSION}\"")
STRING (REGEX REPLACE "\\.([0-9])\\." ".0\\1." PACKAGE_VERSION ${PACKAGE_VERSION})
STRING (REGEX REPLACE "\\.([0-9])$" ".0\\1" PACKAGE_VERSION ${PACKAGE_VERSION})
STRING (REGEX REPLACE "\\." "" PACKAGE_VERSION ${PACKAGE_VERSION})
string (REGEX REPLACE "\\.([0-9])\\." ".0\\1." PACKAGE_VERSION ${PACKAGE_VERSION})
string (REGEX REPLACE "\\.([0-9])$" ".0\\1" PACKAGE_VERSION ${PACKAGE_VERSION})
string (REGEX REPLACE "\\." "" PACKAGE_VERSION ${PACKAGE_VERSION})
IF (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
ENDIF (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
endif ()
CMAKE_HOST_SYSTEM_INFORMATION(RESULT HOSTNAME QUERY HOSTNAME)
cmake_host_system_information (RESULT HOSTNAME QUERY HOSTNAME)
MESSAGE ("Build type is: " ${CMAKE_BUILD_TYPE})
MESSAGE ("Host OS System: ${CMAKE_HOST_SYSTEM}")
MESSAGE ("Hostname: ${HOSTNAME}")
message ("Build type is: " ${CMAKE_BUILD_TYPE})
message ("Host OS System: ${CMAKE_HOST_SYSTEM}")
message ("Hostname: ${HOSTNAME}")
# Select flags.
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ")
SET (CMAKE_CXX_FLAGS_RELEASE "-O3")
SET (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ")
set (CMAKE_CXX_FLAGS_RELEASE "-O3")
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
# Resolve all library dependencies
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
find_package (MPI REQUIRED)
message ("The C++ compiler identification is: ${CMAKE_CXX_COMPILER_ID}")
......@@ -50,13 +49,13 @@ add_compile_options (-Wall)
# compiler dependent flags
if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel" )
add_comile_options (-diag-disable 383 -diag-disable 981)
add_compile_options (-diag-disable 383 -diag-disable 981)
if (ENABLE_OpenMP)
add_compile_options (-openmp)
endif ()
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
add_compile_options (-Werror -Wsign-compare -Wunused-variable -Warray-bounds -DIPPL_RESTRICT_BUG)
add_compile_options (-Werror -Wsign-compare -Wunused-variable -Warray-bounds -DIPPL_RESTRICT_BUG)
if (ENABLE_OpenMP)
add_compile_options (-fopenmp)
endif ()
......@@ -72,7 +71,7 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
endif ()
else ()
message ("Unknown C++ compiler. Please use the GNU or Intel compiler, IF you are having problems.")
message ("Unknown C++ compiler. Please use the GNU or Intel compiler, if you are having problems.")
endif ()
enable_language (Fortran OPTIONAL)
......@@ -114,44 +113,34 @@ if (Boost_INCLUDE_DIRS)
include_directories (${Boost_INCLUDE_DIRS})
endif ()
OPTION (ENABLE_DKS "Enable DKS" OFF)
IF (ENABLE_DKS)
option (ENABLE_DKS "Enable DKS" OFF)
if (ENABLE_DKS)
find_package (dKS 1.1.1 REQUIRED HINTS $ENV{DKS_PREFIX} $ENV{DKS_DIR} $ENV{DKS})
set (DKS_VERSION_OPAL \"${DKS_VERSION}\")
MESSAGE ("Found DKS version: ${DKS_VERSION}")
MESSAGE ("Found DKS library: ${DKS_LIBRARY}")
MESSAGE ("Found DKS include dir: ${DKS_INCLUDE_DIR}")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDKS_MPI")
message ("Found DKS version: ${DKS_VERSION}")
message ("Found DKS library: ${DKS_LIBRARY}")
message ("Found DKS include dir: ${DKS_INCLUDE_DIR}")
add_compile_options (-DDKS_MPI)
### OpenCL compiler flags ###
#SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lOpenCL -pthread -DDKS_OPENCL")
#add_compile_options (-lOpenCL -pthread -DDKS_OPENCL)
### CUDA compiler flags ###
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDKS_CUDA")
add_compile_options(-DDKS_CUDA)
### if any accelerator enabled set flag to use DKS ###
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIPPL_DKS -DIPPL_DKS_CUDA -DOPAL_DKS")
ENDIF (ENABLE_DKS)
### END DKS part ###
# Handle options
OPTION (ENABLE_AMR "Enable AMReX based AMR solver" OFF)
OPTION (ENABLE_AMR_MG_SOLVER "Enable AMR MG solver" OFF)
OPTION (ENABLE_SAAMG_SOLVER "Enable iteartive SA-AMG-PCG self field solver" OFF)
OPTION (DBG_SCALARFIELD "Enable dump of scalar field rho_m" OFF)
OPTION (DBG_STENCIL "Dump stencil of iterative solver in matlab format" OFF)
OPTION (NO_FIELD_ASSIGN_OPTIMIZATION "Disable compiler optimization of IPPL field assignment" OFF)
add_compile_options (-DIPPL_DKS -DIPPL_DKS_CUDA -DOPAL_DKS)
endif ()
OPTION (BUILD_OPAL_UNIT_TESTS "Unit tests" OFF)
IF (BUILD_OPAL_UNIT_TESTS)
FIND_PACKAGE (GTest REQUIRED)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_UNIT_TESTS")
ENDIF (BUILD_OPAL_UNIT_TESTS)
# Handle options
option (BUILD_OPAL_UNIT_TESTS "Unit tests" OFF)
if (BUILD_OPAL_UNIT_TESTS)
find_package (GTest REQUIRED HINT $ENV{GTEST_PREFIX})
add_compile_options (-DWITH_UNIT_TESTS)
endif ()
OPTION (ENABLE_AMR "Enable AMReX based AMR solver" OFF)
IF (ENABLE_AMR)
MESSAGE ("Enable AMR_SOLVER " ${ENABLE_AMR})
ENABLE_LANGUAGE (Fortran)
......@@ -170,66 +159,60 @@ IF (ENABLE_AMR)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_AMR")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-but-set-variable -Wno-maybe-uninitialized")
ENDIF (ENABLE_AMR)
# remove digits from hostname: edison03 -> edison
STRING(REGEX MATCH "[^0-9]*" HOSTNAME_BASE "${HOSTNAME}")
# In case of Edison and Cori the find_package(Trilinos) gives the wrong
# Trilinos_TPL_LIBRARIES, instead of cray-tpsl/16.07.1 it uses
# cray-tpsl/16.06.1 libraries -> Linker error.
# We can avoid this issue by not going into the if-statement
IF (ENABLE_SAAMG_SOLVER OR ENABLE_AMR_MG_SOLVER)
ENDIF ()
IF ( ENABLE_SAAMG_SOLVER )
MESSAGE ("Enable SAAMG_SOLVER " ${ENABLE_SAAMG_SOLVER})
ELSE ( ENABLE_SAAMG_SOLVER )
MESSAGE ("Enable AMR_MG_SOLVER " ${ENABLE_AMR_MG_SOLVER})
ENDIF( ENABLE_SAAMG_SOLVER )
OPTION (ENABLE_AMR_MG_SOLVER "Enable AMR MG solver" OFF)
OPTION (ENABLE_SAAMG_SOLVER "Enable iteartive SA-AMG-PCG self field solver" OFF)
if (ENABLE_SAAMG_SOLVER OR ENABLE_AMR_MG_SOLVER)
#
# :FIXME: We have to add checks whether the required Trilinos modules
# are available. If there are problems of any kind with this
# configuration, either fix it in a general way or build your
# Trilinos. Host specific should be avoided in almost any case.
message ("Enable SAAMG_SOLVER: " ${ENABLE_SAAMG_SOLVER})
message ("Enable AMR_MG_SOLVER: " ${ENABLE_AMR_MG_SOLVER})
IF (NOT (
${HOSTNAME_BASE} MATCHES "edison" OR
${HOSTNAME_BASE} MATCHES "cori"))
find_package (Trilinos REQUIRED HINTS $ENV{TRILINOS_PREFIX} $ENV{TRILINOS_DIR} $ENV{TRILINOS})
message ("Found Trilinos: ${Trilinos_DIR}")
message (" Trilinos version: ${Trilinos_VERSION}")
message (" Trilinos package list: ${Trilinos_PACKAGE_LIST}")
message (" Trilinos libraries: ${Trilinos_LIBRARIES}")
message (" Trilinos TPL libraries: ${Trilinos_TPL_LIBRARIES}")
if (NOT ${MPI_CXX_COMPILER} STREQUAL ${Trilinos_CXX_COMPILER} )
message ("Compiler mismatch:")
message (" Trilinos was compiled with:")
message (" ${Trilinos_C_COMPILER}")
message (" ${Trilinos_CXX_COMPILER}")
message (" ${Trilinos_Fortran_COMPILER}")
message (" You are using:")
message (" ${CMAKE_C_COMPILER}")
message (" ${CMAKE_CXX_COMPILER}")
message (" ${CMAKE_Fortran_COMPILER}")
message (FATAL_ERROR "")
ENDIF ()
ENDIF ()
ENDIF ()
find_package (Trilinos REQUIRED HINTS $ENV{TRILINOS_PREFIX} $ENV{TRILINOS_DIR} $ENV{TRILINOS})
message ("Found Trilinos: ${Trilinos_DIR}")
message (" Trilinos version: ${Trilinos_VERSION}")
message (" Trilinos package list: ${Trilinos_PACKAGE_LIST}")
message (" Trilinos libraries: ${Trilinos_LIBRARIES}")
message (" Trilinos TPL libraries: ${Trilinos_TPL_LIBRARIES}")
if (NOT ${MPI_CXX_COMPILER} STREQUAL ${Trilinos_CXX_COMPILER} )
message ("Compiler mismatch:")
message (" Trilinos was compiled with:")
message (" ${Trilinos_C_COMPILER}")
message (" ${Trilinos_CXX_COMPILER}")
message (" ${Trilinos_Fortran_COMPILER}")
message (" You are using:")
message (" ${CMAKE_C_COMPILER}")
message (" ${CMAKE_CXX_COMPILER}")
message (" ${CMAKE_Fortran_COMPILER}")
message (FATAL_ERROR "")
endif ()
endif ()
OPTION (DBG_SCALARFIELD "Enable dump of scalar field rho_m" OFF)
IF (DBG_SCALARFIELD)
MESSAGE ("\nWrite scalar rho_m field is enabled ")
SET (CMAKE_CXX_FLAGS "-DDBG_SCALARFIELD ${CMAKE_CXX_FLAGS}")
ENDIF (DBG_SCALARFIELD)
ENDIF ()
OPTION (DBG_STENCIL "Dump stencil of iterative solver in matlab format" OFF)
IF (DBG_STENCIL)
MESSAGE ("\nWrite stencil is enabled ")
SET (CMAKE_CXX_FLAGS "-DDBG_STENCIL ${CMAKE_CXX_FLAGS}")
ENDIF (DBG_STENCIL)
ENDIF ()
OPTION (NO_FIELD_ASSIGN_OPTIMIZATION "Disable compiler optimization of IPPL field assignment" OFF)
IF (NO_FIELD_ASSIGN_OPTIMIZATION)
MESSAGE ("\nCompiler will not try to optimize field assignment")
SET (CMAKE_CXX_FLAGS
"-DdontOPTIMIZE_FIELD_ASSIGNMENT ${CMAKE_CXX_FLAGS}"
)
ENDIF (NO_FIELD_ASSIGN_OPTIMIZATION)
ENDIF ()
INCLUDE(FindGit)
IF(GIT_FOUND)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment