Skip to content
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
# Further, you can specify an explicit mpi compiler wrapper (full path or just the binary name) for each language,
# where <lang> can be each of "C","CXX" or "Fortran".
# This can be used independently of (but possibly with) the MPI_HOME setting.
#
# ============== PROFILING ====================
#
# MPI_PROFILING: []|<any value>
# If set, MPI profiling will be enabled. Currently Intel's VTune package is used for performance
# and analysis. It is only available if Intel compilers and MPI and being used.

########################################################
# If your cmake is older than 2.6 - goodbye.
Expand Down Expand Up @@ -95,6 +101,13 @@ if (NOT CMAKE_COMPATIBLE)
endif(NOT CMAKE_COMPATIBLE)
############################## END OF FULLY BACKWARDS-COMPATIBLE PART ###############################

# MPI Profiling only available when using Intel compilers
if(TOOLCHAIN STREQUAL "intel")
else()
set(MPI_PROFILING OFF)
endif()


# OPENCMISS_CMAKE_MIN_VERSION is defined in OCCMakeCheck
cmake_minimum_required(VERSION ${OPENCMISS_CMAKE_MIN_VERSION} FATAL_ERROR)

Expand Down Expand Up @@ -300,7 +313,10 @@ endif()
if (TOOLCHAIN)
message(STATUS "@ TOOLCHAIN: ${TOOLCHAIN}")
endif()
if (MPI_PROFILING)
message(STATUS "@ PROFILER: Intel VTune")
endif()
message(STATUS "@")
printnextsteps()

log("Finished configuration in ${CMAKE_CURRENT_BINARY_DIR}")
log("Finished configuration in ${CMAKE_CURRENT_BINARY_DIR}")
6 changes: 6 additions & 0 deletions CMakeScripts/OCCollectComponentDefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ LIST(APPEND COMPONENT_COMMON_DEFS
-DCMAKE_INSTALL_DEFAULT_COMPONENT_NAME=Development
)

if(TOOLCHAIN STREQUAL "intel")
LIST(APPEND COMPONENT_COMMON_DEFS
-DUSING_INTEL_COMPILERS=1
)
endif()

# Add compilers and flags
foreach(lang C CXX Fortran)
# Define flags
Expand Down
57 changes: 27 additions & 30 deletions CMakeScripts/OCComponentSetupMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -228,42 +228,39 @@ function(createExternalProjects COMPONENT_NAME SOURCE_DIR BINARY_DIR DEFS)
else()
set(_LOGFLAG 0)
endif()

log("Adding ${COMPONENT_NAME} with DEPS=${${COMPONENT_NAME}_DEPS}" VERBOSE)


ExternalProject_Add(${OC_EP_PREFIX}${COMPONENT_NAME}
DEPENDS ${${COMPONENT_NAME}_DEPS} ${COMPONENT_NAME}-sources
PREFIX ${BINARY_DIR}
LIST_SEPARATOR ${OC_LIST_SEPARATOR}
TMP_DIR ${BINARY_DIR}/ep_tmp
STAMP_DIR ${BINARY_DIR}/${_OC_EXTPROJ_STAMP_DIR}

#--Download step--------------
# Ideal solution - include in the external project that also builds.
# Still a mess with mixed download/build stamp files and even though the UPDATE_DISCONNECTED command
# skips the update command the configure etc dependency chain is yet executed each time :-(
#${DOWNLOAD_CMDS}
#UPDATE_DISCONNECTED 1 # Dont update without being asked. New feature of CMake 3.2.0-rc1
DEPENDS ${${COMPONENT_NAME}_DEPS} ${COMPONENT_NAME}-sources
PREFIX ${BINARY_DIR}
LIST_SEPARATOR ${OC_LIST_SEPARATOR}
TMP_DIR ${BINARY_DIR}/ep_tmp
STAMP_DIR ${BINARY_DIR}/${_OC_EXTPROJ_STAMP_DIR}

# Need empty download command, otherwise creation of external project fails with "no download info"
DOWNLOAD_COMMAND ""
#--Download step--------------
# Need empty download command, otherwise creation of external project fails with "no download info"
DOWNLOAD_COMMAND ""

#--Configure step-------------
CMAKE_COMMAND ${CMAKE_COMMAND} --no-warn-unused-cli # disables warnings for unused cmdline options
SOURCE_DIR ${SOURCE_DIR}
BINARY_DIR ${BINARY_DIR}
CMAKE_ARGS ${DEFS}
#--Configure step-------------
CMAKE_COMMAND ${CMAKE_COMMAND} --no-warn-unused-cli
SOURCE_DIR ${SOURCE_DIR}
BINARY_DIR ${BINARY_DIR}
CMAKE_ARGS ${DEFS}

#--Build step-----------------
BUILD_COMMAND ${BUILD_COMMAND}
#--Install step---------------
# currently set as extra arg (above), somehow does not work
#INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
INSTALL_COMMAND ${INSTALL_COMMAND}
# Logging
LOG_CONFIGURE ${_LOGFLAG}
LOG_BUILD ${_LOGFLAG}
LOG_INSTALL ${_LOGFLAG}
#--Build step-----------------
BUILD_COMMAND ${BUILD_COMMAND}

#--Install step---------------
INSTALL_COMMAND ${INSTALL_COMMAND}

# Logging
LOG_CONFIGURE ${_LOGFLAG}
LOG_BUILD ${_LOGFLAG}
LOG_INSTALL ${_LOGFLAG}
)

set_target_properties(${OC_EP_PREFIX}${COMPONENT_NAME} PROPERTIES FOLDER "ExternalProjects")

# See OpenCMISSDeveloper.cmake
Expand Down
2 changes: 1 addition & 1 deletion CMakeScripts/OCMPIConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ if (NOT MPI_FOUND)
set(MPI_C_COMPILER ${OWN_MPI_INSTALL_DIR}/bin/mpicc)
set(MPI_CXX_COMPILER ${OWN_MPI_INSTALL_DIR}/bin/mpicxx)
set(MPI_Fortran_COMPILER ${OWN_MPI_INSTALL_DIR}/bin/mpifort)
elseif (MPI STREQUAL mpich)
elseif (MPI STREQUAL mpich)
set(_MPI_VERSION ${MPICH_VERSION})
if (MPI_BUILD_TYPE STREQUAL RELEASE)
list(APPEND _MPI_EXTRA_PARAMS --enable-fast=O3,ndebug --disable-error-checking --without-timing --without-mpit-pvars)
Expand Down
14 changes: 9 additions & 5 deletions CMakeScripts/OCToolchainFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ if (CMAKE_COMPILER_IS_GNUC OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR MINGW)
# ABI Flag -m$(ABI)

# These flags are set by CMake by default anyways.
# addFlagAll("-O3" RELEASE)
addFlagAll("-O0" DEBUG)

# Release

addFlagAll("-Ofast" RELEASE)
addFlagAll("-O3" RELEASE)

# Debug

Expand Down Expand Up @@ -92,7 +91,8 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID STREQUAL "
# ABI Flag -m$(ABI)

# CMake default anyways
#addFlagAll("-O3" RELEASE)
addFlagAll("-O3" RELEASE)
addFlagAll("-g" RELEASE)

# Somehow CMake does not add the appropriate C-standard flags even though
# the C_STANDARD variable is set. Well do it manually for now.
Expand All @@ -103,8 +103,11 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID STREQUAL "
# addFlag("-std=c99" C)
#endif()

# Release
# addFlagAll("-fast" RELEASE)
# Release - needed for Intel Parallel Studio 2017+
addFlagAll("-fPIE" Fortran RELEASE)

# Release - added for vector optimisation
addFlagAll("-xAVX" RELEASE)

# Debug
addFlagAll("-traceback" DEBUG)
Expand Down Expand Up @@ -177,3 +180,4 @@ foreach(lang C CXX Fortran)
message(STATUS "${lang} flags (DEBUG)=${CMAKE_${lang}_FLAGS_DEBUG}")
endif()
endforeach()

4 changes: 2 additions & 2 deletions Templates/OpenCMISSDeveloper.template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#
# See also: OC_DEVEL_ALL_.
#
# .. default:: NO
# .. default:: NO

#set(IRON_DEVEL YES)
set(IRON_DEVEL YES)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be off by default.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParMetis needs to be installed from its devel branch. The normal branch uses the wrong real type in metis.h. Didn't know how to force the OpenCMISS build system to use the ParMETIS devel branch only.


##
# <COMP>_REPO
Expand Down