diff --git a/CMakeLists.txt b/CMakeLists.txt index d471799..9578218 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,12 @@ # Further, you can specify an explicit mpi compiler wrapper (full path or just the binary name) for each language, # where can be each of "C","CXX" or "Fortran". # This can be used independently of (but possibly with) the MPI_HOME setting. +# +# ============== PROFILING ==================== +# +# MPI_PROFILING: []| +# 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. @@ -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) @@ -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}") \ No newline at end of file +log("Finished configuration in ${CMAKE_CURRENT_BINARY_DIR}") diff --git a/CMakeScripts/OCCollectComponentDefinitions.cmake b/CMakeScripts/OCCollectComponentDefinitions.cmake index 99ed73a..ea52dc1 100644 --- a/CMakeScripts/OCCollectComponentDefinitions.cmake +++ b/CMakeScripts/OCCollectComponentDefinitions.cmake @@ -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 diff --git a/CMakeScripts/OCComponentSetupMacros.cmake b/CMakeScripts/OCComponentSetupMacros.cmake index 4f87303..e66ccc7 100644 --- a/CMakeScripts/OCComponentSetupMacros.cmake +++ b/CMakeScripts/OCComponentSetupMacros.cmake @@ -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 diff --git a/CMakeScripts/OCMPIConfig.cmake b/CMakeScripts/OCMPIConfig.cmake index 3422784..91babc4 100644 --- a/CMakeScripts/OCMPIConfig.cmake +++ b/CMakeScripts/OCMPIConfig.cmake @@ -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) diff --git a/CMakeScripts/OCToolchainFlags.cmake b/CMakeScripts/OCToolchainFlags.cmake index 5d332ef..67127d3 100644 --- a/CMakeScripts/OCToolchainFlags.cmake +++ b/CMakeScripts/OCToolchainFlags.cmake @@ -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 @@ -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. @@ -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) @@ -177,3 +180,4 @@ foreach(lang C CXX Fortran) message(STATUS "${lang} flags (DEBUG)=${CMAKE_${lang}_FLAGS_DEBUG}") endif() endforeach() + diff --git a/Templates/OpenCMISSDeveloper.template.cmake b/Templates/OpenCMISSDeveloper.template.cmake index 779ff0b..e695001 100644 --- a/Templates/OpenCMISSDeveloper.template.cmake +++ b/Templates/OpenCMISSDeveloper.template.cmake @@ -26,9 +26,9 @@ # # See also: OC_DEVEL_ALL_. # -# .. default:: NO +# .. default:: NO -#set(IRON_DEVEL YES) +set(IRON_DEVEL YES) ## # _REPO