From 8b8078af463236e5889e50aafb3987cac6dbafb1 Mon Sep 17 00:00:00 2001 From: Florent Pruvost <florent.pruvost@inria.fr> Date: Thu, 12 Feb 2015 16:39:07 +0000 Subject: [PATCH] remove cmake_modules, they are located in trunk/morse_distrib and we have to give the path to it to configure with MORSE_DISTRIB_DIR, ex: MORSE_DISTRIB_DIR=~/morse/trunk/morse_distrib - this to avoid duplication of these cmake modules between projects (chameleon, pastix, maphys, scallfmm) - for releases the directory should be copied in the root of the project, ex: ~/chameleon-1.0/cmake_modules/ --- CMakeLists.txt | 1447 +++++++++-------- cmake_modules/GenPkgConfig.cmake | 135 -- cmake_modules/PrintOpts.cmake | 85 - cmake_modules/array2d.cmake | 46 - cmake_modules/morse/AuxilaryFlags.cmake | 35 - cmake_modules/morse/ColorizeMessage.cmake | 79 - cmake_modules/morse/FindHeadersAndLibs.cmake | 100 -- cmake_modules/morse/MorseInit.cmake | 55 - cmake_modules/morse/ParseArguments.cmake | 71 - cmake_modules/morse/PrintFindStatus.cmake | 210 --- cmake_modules/morse/RulesPrecisions.cmake | 257 --- cmake_modules/morse/find/FindBLAS.cmake | 918 ----------- cmake_modules/morse/find/FindBLASEXT.cmake | 335 ---- cmake_modules/morse/find/FindCBLAS.cmake | 300 ---- cmake_modules/morse/find/FindCHAMELEON.cmake | 586 ------- cmake_modules/morse/find/FindFXT.cmake | 244 --- cmake_modules/morse/find/FindHWLOC.cmake | 251 --- cmake_modules/morse/find/FindLAPACK.cmake | 497 ------ cmake_modules/morse/find/FindLAPACKE.cmake | 300 ---- cmake_modules/morse/find/FindLAPACKEXT.cmake | 296 ---- cmake_modules/morse/find/FindMAGMA.cmake | 338 ---- cmake_modules/morse/find/FindMETIS.cmake | 214 --- cmake_modules/morse/find/FindMPIEXT.cmake | 120 -- cmake_modules/morse/find/FindMUMPS.cmake | 621 ------- cmake_modules/morse/find/FindPARMETIS.cmake | 237 --- cmake_modules/morse/find/FindPASTIX.cmake | 608 ------- cmake_modules/morse/find/FindPTSCOTCH.cmake | 315 ---- cmake_modules/morse/find/FindQUARK.cmake | 248 --- cmake_modules/morse/find/FindSCALAPACK.cmake | 450 ----- cmake_modules/morse/find/FindSCOTCH.cmake | 297 ---- cmake_modules/morse/find/FindSTARPU.cmake | 658 -------- cmake_modules/morse/find/FindTMG.cmake | 264 --- cmake_modules/morse/find/MORSE-Copyright.txt | 41 - .../morse/precision_generator/Conversion.py | 266 --- .../morse/precision_generator/codegen.py | 120 -- .../precision_generator/genDependencies.py | 211 --- .../morse/precision_generator/subs.py | 968 ----------- 37 files changed, 732 insertions(+), 11491 deletions(-) delete mode 100644 cmake_modules/GenPkgConfig.cmake delete mode 100644 cmake_modules/PrintOpts.cmake delete mode 100644 cmake_modules/array2d.cmake delete mode 100644 cmake_modules/morse/AuxilaryFlags.cmake delete mode 100644 cmake_modules/morse/ColorizeMessage.cmake delete mode 100644 cmake_modules/morse/FindHeadersAndLibs.cmake delete mode 100644 cmake_modules/morse/MorseInit.cmake delete mode 100644 cmake_modules/morse/ParseArguments.cmake delete mode 100644 cmake_modules/morse/PrintFindStatus.cmake delete mode 100644 cmake_modules/morse/RulesPrecisions.cmake delete mode 100644 cmake_modules/morse/find/FindBLAS.cmake delete mode 100644 cmake_modules/morse/find/FindBLASEXT.cmake delete mode 100644 cmake_modules/morse/find/FindCBLAS.cmake delete mode 100644 cmake_modules/morse/find/FindCHAMELEON.cmake delete mode 100644 cmake_modules/morse/find/FindFXT.cmake delete mode 100644 cmake_modules/morse/find/FindHWLOC.cmake delete mode 100644 cmake_modules/morse/find/FindLAPACK.cmake delete mode 100644 cmake_modules/morse/find/FindLAPACKE.cmake delete mode 100644 cmake_modules/morse/find/FindLAPACKEXT.cmake delete mode 100644 cmake_modules/morse/find/FindMAGMA.cmake delete mode 100644 cmake_modules/morse/find/FindMETIS.cmake delete mode 100644 cmake_modules/morse/find/FindMPIEXT.cmake delete mode 100644 cmake_modules/morse/find/FindMUMPS.cmake delete mode 100644 cmake_modules/morse/find/FindPARMETIS.cmake delete mode 100644 cmake_modules/morse/find/FindPASTIX.cmake delete mode 100644 cmake_modules/morse/find/FindPTSCOTCH.cmake delete mode 100644 cmake_modules/morse/find/FindQUARK.cmake delete mode 100644 cmake_modules/morse/find/FindSCALAPACK.cmake delete mode 100644 cmake_modules/morse/find/FindSCOTCH.cmake delete mode 100644 cmake_modules/morse/find/FindSTARPU.cmake delete mode 100644 cmake_modules/morse/find/FindTMG.cmake delete mode 100644 cmake_modules/morse/find/MORSE-Copyright.txt delete mode 100644 cmake_modules/morse/precision_generator/Conversion.py delete mode 100755 cmake_modules/morse/precision_generator/codegen.py delete mode 100755 cmake_modules/morse/precision_generator/genDependencies.py delete mode 100644 cmake_modules/morse/precision_generator/subs.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d306e59d..a18e9883f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,828 +41,845 @@ set(CHAMELEON_VERSION_MAJOR 0) set(CHAMELEON_VERSION_MINOR 9) set(CHAMELEON_VERSION_PATCH 0) -# Add extra cmake module path and initialize morse cmake modules -# -------------------------------------------------------------- -set( MORSE_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/morse ) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) -list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}) -include(MorseInit) -include(GenPkgConfig) - -############################################# -# # -# Compilation of CHAMELEON # -# # -############################################# - - -############################################################################### -# Parameters/Options # -###################### - -set(CHAMELEON_DEFINITIONS_LIST "") - -# Set the RPATH config -# -------------------- - -# use, i.e. don't skip the full RPATH for the build tree -set(CMAKE_SKIP_BUILD_RPATH FALSE) - -# when building, don't use the install RPATH already -# (but later on when installing) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - -# the RPATH to be used when installing -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - -# Misc options -# ------------ -option(BUILD_SHARED_LIBS "Build shared libraries" OFF) - -# Define precision supported by CHAMELEON -# ----------------------------------------- -set( RP_CHAMELEON_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py ) -set( RP_CHAMELEON_PRECISIONS "s;d;c;z" ) -include(RulesPrecisions) - -# Options to select the runtime -# ----------------------------- - -# Create a list of possible runtime -set(CHAMELEON_SCHED_list "STARPU" "QUARK") - -# Initially StarPU runtime is enabled -option(CHAMELEON_SCHED_STARPU - "Enable StarPU scheduler as the default runtime - (Conflict with other CHAMELEON_SCHED_* options)" ON) -option(CHAMELEON_SCHED_QUARK - "Enable Quark scheduler as the default runtime - (Conflict with other CHAMELEON_SCHED_* options)" OFF) - -if (CHAMELEON_SCHED_QUARK) - set(CHAMELEON_SCHED_STARPU OFF) -elseif (CHAMELEON_SCHED_STARPU) - set(CHAMELEON_SCHED_QUARK OFF) -endif() -if (CHAMELEON_SCHED_STARPU) - message("-- ${BoldGreen}CHAMELEON_SCHED_STARPU is set to ON: CHAMELEON uses StarPU runtime${ColourReset}") - message("-- ${BoldGreen}To use CHAMELEON with QUARK runtime: set CHAMELEON_SCHED_QUARK" - "to ON (CHAMELEON_SCHED_STARPU will be disabled)${ColourReset}") -elseif(CHAMELEON_SCHED_QUARK) - message("-- ${BoldGreen}CHAMELEON_SCHED_QUARK is set to ON: CHAMELEON uses QUARK runtime${ColourReset}") - message("-- ${BoldGreen}To use CHAMELEON with StarPU runtime: set CHAMELEON_SCHED_STARPU" - "to ON (CHAMELEON_SCHED_QUARK will be disabled)${ColourReset}") -endif() - -# Check that one, and only one, SCHED option is set to ON -# count number of runtime sets to ON -math(EXPR number_of_active_runtime 0) -foreach (runtime ${CHAMELEON_SCHED_list}) - if (CHAMELEON_SCHED_${runtime}) - math(EXPR number_of_active_runtime "${number_of_active_runtime}+1") +set( MORSE_DISTRIB_DIR "" CACHE PATH "Directory of MORSE distribution") + +if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/") + + # Add extra cmake module path and initialize morse cmake modules + # -------------------------------------------------------------- + if(MORSE_DISTRIB_DIR) + list(APPEND CMAKE_MODULE_PATH ${MORSE_DISTRIB_DIR}/cmake_modules) + list(APPEND CMAKE_MODULE_PATH "${MORSE_DISTRIB_DIR}/cmake_modules/morse") + set(MORSE_CMAKE_MODULE_PATH ${MORSE_DISTRIB_DIR}/cmake_modules/morse ) + elseif(EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/") + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse") + set(MORSE_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/morse ) endif() -endforeach() -if (NOT number_of_active_runtime STREQUAL 1) - message(FATAL_ERROR - "Number of active runtime is ${number_of_active_runtime}, " - "the user should activate one (and only one) runtime. ") -endif() + include(MorseInit) + include(GenPkgConfig) -# Warning if not coherent options -if (CHAMELEON_USE_MPI AND NOT CHAMELEON_SCHED_STARPU) - message(WARNING "You have activated MPI but CHAMELEON_SCHED_STARPU is OFF.\n" - "You should use StarPU Runtime system if you want to benefit from MPI.\n" - "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" - "configure to do so.") -endif() + ############################################# + # # + # Compilation of CHAMELEON # + # # + ############################################# -if(CHAMELEON_USE_CUDA AND NOT CHAMELEON_SCHED_STARPU) - message(WARNING "You have activated CUDA but CHAMELEON_SCHED_STARPU is OFF.\n" - "You should use StarPU Runtime system if you want to benefit from GPUs.\n" - "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" - "configure to do so.") -endif() -if(CHAMELEON_USE_MAGMA AND NOT CHAMELEON_SCHED_STARPU) - message(WARNING "You have activated MAGMA but CHAMELEON_SCHED_STARPU is OFF.\n" - "You should use StarPU Runtime system if you want to benefit from GPUs.\n" - "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" - "configure to do so.") -endif() + ############################################################################### + # Parameters/Options # + ###################### -if(CHAMELEON_USE_FXT AND NOT CHAMELEON_SCHED_STARPU) - message(WARNING "You have activated FXT but CHAMELEON_SCHED_STARPU is OFF.\n" - "You should use StarPU Runtime system if you want to benefit from FxT.\n" - "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" - "configure to do so.") -endif() + set(CHAMELEON_DEFINITIONS_LIST "") -# Additional options -# ------------------ + # Set the RPATH config + # -------------------- -# Enable the distributed interface (allowed only when StarPU is enabled) -# TODO: Default should be changed to ON/OFF when it will be ok -cmake_dependent_option(CHAMELEON_USE_MPI - "Enable distributed memory through MPI" OFF - "CHAMELEON_SCHED_STARPU" OFF) -if (NOT CHAMELEON_USE_MPI) - message("-- ${BoldGreen}CHAMELEON_USE_MPI is set to OFF, turn it ON to use MPI (only with StarPU)${ColourReset}") -endif() + # use, i.e. don't skip the full RPATH for the build tree + set(CMAKE_SKIP_BUILD_RPATH FALSE) -# Enable Cuda kernels if StarPU (only if StarPU runtime is enabled) -# TODO: Default should be changed to ON/OFF when it will be ok -cmake_dependent_option(CHAMELEON_USE_CUDA - "Enable CUDA kernels" OFF - "CHAMELEON_SCHED_STARPU" OFF) -if (NOT CHAMELEON_USE_CUDA) - message("-- ${BoldGreen}CHAMELEON_USE_CUDA is set to OFF, turn it ON to use CUDA (only with StarPU)${ColourReset}") -endif() + # when building, don't use the install RPATH already + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -# Enable MAGMA advanced kernels if CUDA is enabled -cmake_dependent_option(CHAMELEON_USE_MAGMA - "Enable MAGMA Cuda kernels" OFF - "CHAMELEON_USE_CUDA" OFF) -if (NOT CHAMELEON_USE_MAGMA) - message("-- ${BoldGreen}CHAMELEON_USE_MAGMA is set to OFF, turn it ON to use MAGMA (only with StarPU)${ColourReset}") -endif() + # the RPATH to be used when installing + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -# Enable FXT if StarPU (only if StarPU runtime is enabled) -cmake_dependent_option(CHAMELEON_USE_FXT - "Enable FXT with STARPU" OFF - "CHAMELEON_SCHED_STARPU" OFF) -if (NOT CHAMELEON_USE_FXT) - message("-- ${BoldGreen}CHAMELEON_USE_FXT is set to OFF, turn it ON to use FxT (only with StarPU)${ColourReset}") -endif() + # Misc options + # ------------ + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -# Options to enable/disable testings and timings -# ---------------------------------------------- -option(CHAMELEON_ENABLE_DOCS "Enable documentation build" ON) -if (CHAMELEON_ENABLE_DOCS) - message("-- ${BoldGreen}CHAMELEON_ENABLE_DOCS is set to ON, turn it OFF to avoid building docs${ColourReset}") -endif() -option(CHAMELEON_ENABLE_EXAMPLE "Enable examples build" ON) -if (CHAMELEON_ENABLE_EXAMPLE) - message("-- ${BoldGreen}CHAMELEON_ENABLE_EXAMPLE is set to ON, turn it OFF to avoid building examples${ColourReset}") -endif() -option(CHAMELEON_ENABLE_TESTING "Enable testings build" ON) -if (CHAMELEON_ENABLE_TESTING) - message("-- ${BoldGreen}CHAMELEON_ENABLE_TESTING is set to ON, turn it OFF to avoid building testing${ColourReset}") -endif() -option(CHAMELEON_ENABLE_TIMING "Enable timings build" ON) -if (CHAMELEON_ENABLE_TIMING) - message("-- ${BoldGreen}CHAMELEON_ENABLE_TIMING is set to ON, turn it OFF to avoid building timing${ColourReset}") -endif() + # Define precision supported by CHAMELEON + # ----------------------------------------- + set( RP_CHAMELEON_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py ) + set( RP_CHAMELEON_PRECISIONS "s;d;c;z" ) + include(RulesPrecisions) + + # Options to select the runtime + # ----------------------------- + + # Create a list of possible runtime + set(CHAMELEON_SCHED_list "STARPU" "QUARK") -# Option to activate or not simulation mode (use Simgrid through StarPU) -# ---------------------------------------------------------------------- -if(CHAMELEON_SCHED_STARPU) - option(CHAMELEON_SIMULATION "Enable simulation mode using Simgrid through StarPU" OFF) - if (NOT CHAMELEON_SIMULATION) - message("-- ${BoldGreen}CHAMELEON_SIMULATION is set to OFF, turn it ON to use" - "SIMULATION mode (only with StarPU compiled with SimGrid)${ColourReset}") + # Initially StarPU runtime is enabled + option(CHAMELEON_SCHED_STARPU + "Enable StarPU scheduler as the default runtime + (Conflict with other CHAMELEON_SCHED_* options)" ON) + option(CHAMELEON_SCHED_QUARK + "Enable Quark scheduler as the default runtime + (Conflict with other CHAMELEON_SCHED_* options)" OFF) + + if (CHAMELEON_SCHED_QUARK) + set(CHAMELEON_SCHED_STARPU OFF) + elseif (CHAMELEON_SCHED_STARPU) + set(CHAMELEON_SCHED_QUARK OFF) + endif() + if (CHAMELEON_SCHED_STARPU) + message("-- ${BoldGreen}CHAMELEON_SCHED_STARPU is set to ON: CHAMELEON uses StarPU runtime${ColourReset}") + message("-- ${BoldGreen}To use CHAMELEON with QUARK runtime: set CHAMELEON_SCHED_QUARK" + "to ON (CHAMELEON_SCHED_STARPU will be disabled)${ColourReset}") + elseif(CHAMELEON_SCHED_QUARK) + message("-- ${BoldGreen}CHAMELEON_SCHED_QUARK is set to ON: CHAMELEON uses QUARK runtime${ColourReset}") + message("-- ${BoldGreen}To use CHAMELEON with StarPU runtime: set CHAMELEON_SCHED_STARPU" + "to ON (CHAMELEON_SCHED_QUARK will be disabled)${ColourReset}") endif() -endif() -# Initially we need to generate files for different precisions -# TODO: use this option to avoid generate multiple precisions each time we launch cmake -#option(CHAMELEON_GEN_PREC "Generate source files precisions" ON) -#------------------------------------------------------------------------------ - - -############################################################################### -# Look for dependencies # -######################### - -#find_package(MUMPS REQUIRED COMPONENTS SEQ) -#find_package(MUMPS REQUIRED) -#message(FATAL_ERROR "MUMPS_FOUND: ${MUMPS_FOUND}") - -# Check for Thread library -# ------------------------ -set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -find_package(Threads REQUIRED) -if( THREADS_FOUND ) - list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -endif () - -# Add math library to the list of extra -# it normally exists on all common systems provided with a C compiler -set(M_LIBRARIES "") -if(UNIX OR WIN32) - find_library( - M_m_LIBRARY - NAMES m - ) - mark_as_advanced(M_m_LIBRARY) - if (M_m_LIBRARY) - list(APPEND M_LIBRARIES "${M_m_LIBRARY}") - list(APPEND EXTRA_LIBRARIES "${M_m_LIBRARY}") - else() - message(FATAL_ERROR "Could NOT find libm on your system." - "Are you sure to a have a C compiler installed?") + # Check that one, and only one, SCHED option is set to ON + # count number of runtime sets to ON + math(EXPR number_of_active_runtime 0) + foreach (runtime ${CHAMELEON_SCHED_list}) + if (CHAMELEON_SCHED_${runtime}) + math(EXPR number_of_active_runtime "${number_of_active_runtime}+1") + endif() + endforeach() + if (NOT number_of_active_runtime STREQUAL 1) + message(FATAL_ERROR + "Number of active runtime is ${number_of_active_runtime}, " + "the user should activate one (and only one) runtime. ") endif() -endif() -# Try to find librt (libposix4 - POSIX.1b Realtime Extensions library) -# on Unix systems except Apple ones because it does not exist on it -set(RT_LIBRARIES "") -if(UNIX AND NOT APPLE) - find_library( - RT_rt_LIBRARY - NAMES rt - ) - mark_as_advanced(RT_rt_LIBRARY) - if (RT_rt_LIBRARY) - list(APPEND RT_LIBRARIES "${RT_rt_LIBRARY}") - list(APPEND EXTRA_LIBRARIES "${RT_rt_LIBRARY}") - else() - message(FATAL_ERROR "Could NOT find librt on your system") + # Warning if not coherent options + if (CHAMELEON_USE_MPI AND NOT CHAMELEON_SCHED_STARPU) + message(WARNING "You have activated MPI but CHAMELEON_SCHED_STARPU is OFF.\n" + "You should use StarPU Runtime system if you want to benefit from MPI.\n" + "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" + "configure to do so.") endif() -endif() -# If simulation we don't enter in kernel functions so that we don't need to -# link with concerned libraries -if(NOT CHAMELEON_SIMULATION) + if(CHAMELEON_USE_CUDA AND NOT CHAMELEON_SCHED_STARPU) + message(WARNING "You have activated CUDA but CHAMELEON_SCHED_STARPU is OFF.\n" + "You should use StarPU Runtime system if you want to benefit from GPUs.\n" + "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" + "configure to do so.") + endif() - # CHAMELEON depends on CBLAS - #---------------------------- - find_package(BLASEXT REQUIRED) - if(BLAS_FOUND AND BLAS_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${BLAS_LIBRARY_DIRS}") - else() - message(FATAL_ERROR "A BLAS library is required but has not been found") + if(CHAMELEON_USE_MAGMA AND NOT CHAMELEON_SCHED_STARPU) + message(WARNING "You have activated MAGMA but CHAMELEON_SCHED_STARPU is OFF.\n" + "You should use StarPU Runtime system if you want to benefit from GPUs.\n" + "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" + "configure to do so.") endif() - find_package(CBLAS) - if(CBLAS_FOUND) - include_directories(${CBLAS_INCLUDE_DIRS}) - if(CBLAS_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS}") + if(CHAMELEON_USE_FXT AND NOT CHAMELEON_SCHED_STARPU) + message(WARNING "You have activated FXT but CHAMELEON_SCHED_STARPU is OFF.\n" + "You should use StarPU Runtime system if you want to benefit from FxT.\n" + "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n" + "configure to do so.") + endif() + + # Additional options + # ------------------ + + # Enable the distributed interface (allowed only when StarPU is enabled) + # TODO: Default should be changed to ON/OFF when it will be ok + cmake_dependent_option(CHAMELEON_USE_MPI + "Enable distributed memory through MPI" OFF + "CHAMELEON_SCHED_STARPU" OFF) + if (NOT CHAMELEON_USE_MPI) + message("-- ${BoldGreen}CHAMELEON_USE_MPI is set to OFF, turn it ON to use MPI (only with StarPU)${ColourReset}") + endif() + + # Enable Cuda kernels if StarPU (only if StarPU runtime is enabled) + # TODO: Default should be changed to ON/OFF when it will be ok + cmake_dependent_option(CHAMELEON_USE_CUDA + "Enable CUDA kernels" OFF + "CHAMELEON_SCHED_STARPU" OFF) + if (NOT CHAMELEON_USE_CUDA) + message("-- ${BoldGreen}CHAMELEON_USE_CUDA is set to OFF, turn it ON to use CUDA (only with StarPU)${ColourReset}") + endif() + + # Enable MAGMA advanced kernels if CUDA is enabled + cmake_dependent_option(CHAMELEON_USE_MAGMA + "Enable MAGMA Cuda kernels" OFF + "CHAMELEON_USE_CUDA" OFF) + if (NOT CHAMELEON_USE_MAGMA) + message("-- ${BoldGreen}CHAMELEON_USE_MAGMA is set to OFF, turn it ON to use MAGMA (only with StarPU)${ColourReset}") + endif() + + # Enable FXT if StarPU (only if StarPU runtime is enabled) + cmake_dependent_option(CHAMELEON_USE_FXT + "Enable FXT with STARPU" OFF + "CHAMELEON_SCHED_STARPU" OFF) + if (NOT CHAMELEON_USE_FXT) + message("-- ${BoldGreen}CHAMELEON_USE_FXT is set to OFF, turn it ON to use FxT (only with StarPU)${ColourReset}") + endif() + + # Options to enable/disable testings and timings + # ---------------------------------------------- + option(CHAMELEON_ENABLE_DOCS "Enable documentation build" ON) + if (CHAMELEON_ENABLE_DOCS) + message("-- ${BoldGreen}CHAMELEON_ENABLE_DOCS is set to ON, turn it OFF to avoid building docs${ColourReset}") + endif() + option(CHAMELEON_ENABLE_EXAMPLE "Enable examples build" ON) + if (CHAMELEON_ENABLE_EXAMPLE) + message("-- ${BoldGreen}CHAMELEON_ENABLE_EXAMPLE is set to ON, turn it OFF to avoid building examples${ColourReset}") + endif() + option(CHAMELEON_ENABLE_TESTING "Enable testings build" ON) + if (CHAMELEON_ENABLE_TESTING) + message("-- ${BoldGreen}CHAMELEON_ENABLE_TESTING is set to ON, turn it OFF to avoid building testing${ColourReset}") + endif() + option(CHAMELEON_ENABLE_TIMING "Enable timings build" ON) + if (CHAMELEON_ENABLE_TIMING) + message("-- ${BoldGreen}CHAMELEON_ENABLE_TIMING is set to ON, turn it OFF to avoid building timing${ColourReset}") + endif() + + # Option to activate or not simulation mode (use Simgrid through StarPU) + # ---------------------------------------------------------------------- + if(CHAMELEON_SCHED_STARPU) + option(CHAMELEON_SIMULATION "Enable simulation mode using Simgrid through StarPU" OFF) + if (NOT CHAMELEON_SIMULATION) + message("-- ${BoldGreen}CHAMELEON_SIMULATION is set to OFF, turn it ON to use" + "SIMULATION mode (only with StarPU compiled with SimGrid)${ColourReset}") endif() - else() - if(MORSE_VERBOSE_FIND_PACKAGE) - if(CBLAS_STANDALONE OR NOT CBLAS_WORKS) - if (NOT CBLAS_cblas.h_DIRS) - Print_Find_Header_Status(cblas cblas.h) - endif () - if (NOT CBLAS_cblas_LIBRARY) - Print_Find_Library_Status(cblas libcblas) - endif () - endif() + endif() + + # Initially we need to generate files for different precisions + # TODO: use this option to avoid generate multiple precisions each time we launch cmake + #option(CHAMELEON_GEN_PREC "Generate source files precisions" ON) + #------------------------------------------------------------------------------ + + + ############################################################################### + # Look for dependencies # + ######################### + + + # Check for Thread library + # ------------------------ + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + find_package(Threads REQUIRED) + if( THREADS_FOUND ) + list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + endif () + + # Add math library to the list of extra + # it normally exists on all common systems provided with a C compiler + set(M_LIBRARIES "") + if(UNIX OR WIN32) + find_library( + M_m_LIBRARY + NAMES m + ) + mark_as_advanced(M_m_LIBRARY) + if (M_m_LIBRARY) + list(APPEND M_LIBRARIES "${M_m_LIBRARY}") + list(APPEND EXTRA_LIBRARIES "${M_m_LIBRARY}") else() - message(WARNING "CBLAS library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" - "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + message(FATAL_ERROR "Could NOT find libm on your system." + "Are you sure to a have a C compiler installed?") endif() - message(FATAL_ERROR "A CBLAS library is required but has not been found") endif() - # CHAMELEON depends on LAPACKE - #----------------------------- - find_package(LAPACKEXT REQUIRED) - if(LAPACK_FOUND AND LAPACK_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}") - else() - message(FATAL_ERROR "A LAPACK library is required but has not been found") + # Try to find librt (libposix4 - POSIX.1b Realtime Extensions library) + # on Unix systems except Apple ones because it does not exist on it + set(RT_LIBRARIES "") + if(UNIX AND NOT APPLE) + find_library( + RT_rt_LIBRARY + NAMES rt + ) + mark_as_advanced(RT_rt_LIBRARY) + if (RT_rt_LIBRARY) + list(APPEND RT_LIBRARIES "${RT_rt_LIBRARY}") + list(APPEND EXTRA_LIBRARIES "${RT_rt_LIBRARY}") + else() + message(FATAL_ERROR "Could NOT find librt on your system") + endif() endif() - # standalone version of lapacke seems useless for now - # let the comment in case we meet some problems of non existing lapacke - # functions in lapack library such as mkl, acml, ... - #set(LAPACKE_STANDALONE TRUE) - find_package(LAPACKE) - if(LAPACKE_FOUND) - include_directories(${LAPACKE_INCLUDE_DIRS}) - if(LAPACKE_LIBRARY_DIRS) + # If simulation we don't enter in kernel functions so that we don't need to + # link with concerned libraries + if(NOT CHAMELEON_SIMULATION) + + # CHAMELEON depends on CBLAS + #---------------------------- + find_package(BLASEXT REQUIRED) + if(BLAS_FOUND AND BLAS_LIBRARY_DIRS) # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS}") + list(APPEND CMAKE_INSTALL_RPATH "${BLAS_LIBRARY_DIRS}") + else() + message(FATAL_ERROR "A BLAS library is required but has not been found") endif() - else() - if(MORSE_VERBOSE_FIND_PACKAGE) - if (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS) - if (NOT LAPACKE_lapacke.h_DIRS) - Print_Find_Header_Status(lapacke lapacke.h) - endif () - if (NOT LAPACKE_lapacke_LIBRARY) - Print_Find_Library_Status(lapacke liblapacke) - endif () + + find_package(CBLAS) + if(CBLAS_FOUND) + include_directories(${CBLAS_INCLUDE_DIRS}) + if(CBLAS_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS}") endif() else() - message(WARNING "LAPACKE library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" - "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + if(MORSE_VERBOSE_FIND_PACKAGE) + if(CBLAS_STANDALONE OR NOT CBLAS_WORKS) + if (NOT CBLAS_cblas.h_DIRS) + Print_Find_Header_Status(cblas cblas.h) + endif () + if (NOT CBLAS_cblas_LIBRARY) + Print_Find_Library_Status(cblas libcblas) + endif () + endif() + else() + message(WARNING "CBLAS library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" + "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + endif() + message(FATAL_ERROR "A CBLAS library is required but has not been found") endif() - message(FATAL_ERROR "A LAPACKE library is required but has not been found") - endif() - # CHAMELEON depends on TMG - #-------------------------- - if (CHAMELEON_ENABLE_TESTING OR CHAMELEON_ENABLE_TIMING) - find_package(TMG) - if(TMG_FOUND AND TMG_LIBRARY_DIRS) + # CHAMELEON depends on LAPACKE + #----------------------------- + find_package(LAPACKEXT REQUIRED) + if(LAPACK_FOUND AND LAPACK_LIBRARY_DIRS) # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${TMG_LIBRARY_DIRS}") + list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}") else() - message(FATAL_ERROR "A TMG library is required but has not been found") + message(FATAL_ERROR "A LAPACK library is required but has not been found") endif() - endif() - # CHAMELEON depends on CUDA/CUBLAS - #---------------------------------- - if (CHAMELEON_USE_CUDA) - - find_package(CUDA REQUIRED) - - if (CUDA_FOUND) - message("-- ${Blue}Add definition CHAMELEON_USE_CUDA" - " - Activate CUDA in Chameleon${ColourReset}") - add_definitions(-DCHAMELEON_USE_CUDA) - if(CUDA_VERSION VERSION_LESS "3.0") - set(CUDA_HOST_COMPILATION_CPP OFF) - endif(CUDA_VERSION VERSION_LESS "3.0") - set(CUDA_BUILD_EMULATION OFF) - include_directories(${CUDA_INCLUDE_DIRS}) - list(APPEND EXTRA_LIBRARIES ${CUDA_LIBRARIES}) # need CUDA libs to link. - list(APPEND EXTRA_SOURCES src/gpu_data.c) - set(saved_include "${CMAKE_REQUIRED_INCLUDES}") - set(saved_libs "${CMAKE_REQUIRED_LIBRARIES}") - set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${CUDA_INCLUDE_DIRS}") - set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${CUDA_LIBRARIES}") - if(CUDA_VERSION VERSION_LESS "4.0") - set(CUDA_HAVE_PEER_DEVICE_MEMORY_ACCESS 0) - else() - check_function_exists(cuDeviceCanAccessPeer CUDA_HAVE_PEER_DEVICE_MEMORY_ACCESS) + # standalone version of lapacke seems useless for now + # let the comment in case we meet some problems of non existing lapacke + # functions in lapack library such as mkl, acml, ... + #set(LAPACKE_STANDALONE TRUE) + find_package(LAPACKE) + if(LAPACKE_FOUND) + include_directories(${LAPACKE_INCLUDE_DIRS}) + if(LAPACKE_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS}") endif() - set(CMAKE_REQUIRED_INCLUDES "${saved_include}") - set(CMAKE_REQUIRED_LIBRARIES "${saved_libs}") - #FindHeader(CUDA cublas_v2.h) - #if(CUDA_cublas_v2.h_DIRS) - #add_definitions(-DCHAMELEON_USE_CUBLAS_V2) - #endif() - endif (CUDA_FOUND) - - # CHAMELEON depends on MAGMA gpu kernels - # call our cmake module to test (in cmake_modules) - # change this call position if not appropriated - #---------------------------------------------- - if ( CUDA_FOUND AND CHAMELEON_USE_MAGMA ) - set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired") - find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} COMPONENTS CBLAS LAPACK CUDA) - if ( MAGMA_FOUND ) - message("-- ${Blue}Add definition CHAMELEON_USE_CUBLAS" - " - Use GPU kernels from cuBLAS${ColourReset}") - add_definitions(-DCHAMELEON_USE_CUBLAS) - message("-- ${Blue}Add definition CHAMELEON_USE_MAGMA" - " - Use GPU kernels from MAGMA${ColourReset}") - add_definitions(-DCHAMELEON_USE_MAGMA) - list(APPEND EXTRA_LIBRARIES ${CUDA_CUBLAS_LIBRARIES}) - include_directories(${MAGMA_INCLUDE_DIRS}) - if(MAGMA_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${MAGMA_LIBRARY_DIRS}") - endif() - else( MAGMA_FOUND ) - if(MORSE_VERBOSE_FIND_PACKAGE) - if (NOT MAGMA_magma.h_DIRS) - Print_Find_Header_Status(magma magma.h) + else() + if(MORSE_VERBOSE_FIND_PACKAGE) + if (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS) + if (NOT LAPACKE_lapacke.h_DIRS) + Print_Find_Header_Status(lapacke lapacke.h) endif () - if (NOT MAGMA_magma_LIBRARY) - Print_Find_Library_Status(magma libmagma) + if (NOT LAPACKE_lapacke_LIBRARY) + Print_Find_Library_Status(lapacke liblapacke) endif () - else() - message(WARNING "MAGMA library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" - "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") endif() - message(FATAL_ERROR "MAGMA library is required but has not been found") - endif( MAGMA_FOUND ) + else() + message(WARNING "LAPACKE library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" + "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + endif() + message(FATAL_ERROR "A LAPACKE library is required but has not been found") endif() - endif(CHAMELEON_USE_CUDA) - - # CHAMELEON depends on MPI - #------------------------- - if (CHAMELEON_USE_MPI) - - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) + # CHAMELEON depends on TMG + #-------------------------- + if (CHAMELEON_ENABLE_TESTING OR CHAMELEON_ENABLE_TIMING) + find_package(TMG) + if(TMG_FOUND AND TMG_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${TMG_LIBRARY_DIRS}") + else() + message(FATAL_ERROR "A TMG library is required but has not been found") + endif() endif() - find_package(MPI REQUIRED) - - if (MPI_C_FOUND) - message("-- ${Blue}Add definition CHAMELEON_USE_MPI" - " - Activate MPI in Chameleon${ColourReset}") - add_definitions(-DCHAMELEON_USE_MPI) - list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES} ) - include_directories( ${MPI_C_INCLUDE_PATH} ) - # tests for intel mpi - #list(APPEND MPI_C_COMPILE_FLAGS "-mt_mpi") - #list(APPEND MPI_COMPILE_FLAGS "-mt_mpi") - endif (MPI_C_FOUND) - - endif (CHAMELEON_USE_MPI) - -else (NOT CHAMELEON_SIMULATION) - - message("${BoldBlue}Simulation mode of CHAMELEON is activated (CHAMELEON_SIMULATION=ON)." - "\nThis mode allows you to simulate execution of algorithms with StarPU compiled with SimGrid." - "\nTo do so, we provide some perfmodels in the simucore/perfmodels/ directory of CHAMELEON sources." - "\nThe resulting directory where to find perfmodels is: ${CMAKE_CURRENT_SOURCE_DIR}/simucore/perfmodels." - "\nTo use these perfmodels, please set your STARPU_HOME environment variable to ${CMAKE_CURRENT_SOURCE_DIR}/simucore/perfmodels." - "\nFinally, you need to set your STARPU_HOSTNAME environment variable to the name of the machine to simulate." - "For example: STARPU_HOSTNAME=mirage." - "\nNote that only POTRF kernels with block sizes of 320 or 960 (simple and double precision) on mirage machine are available for now." - "\nDatabase of models is subject to change, it should be enrich in a near future.${ColourReset}") - - if (CHAMELEON_USE_CUDA) - set(CHAMELEON_USE_CUDA OFF) - message("${BoldBlue}CHAMELEON_USE_CUDA is set to ON but we turn it OFF." - "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," - "we do not need to link with CUDA.${ColourReset}") - endif () - if (CHAMELEON_USE_MAGMA) - set(CHAMELEON_USE_MAGMA OFF) - message("${BoldBlue}CHAMELEON_USE_MAGMA is set to ON but we turn it OFF." - "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," - "we do not need to link with MAGMA.${ColourReset}") - endif () - if (CHAMELEON_USE_MPI) - set(CHAMELEON_USE_MPI OFF) - message("${BoldBlue}CHAMELEON_USE_MPI is set to ON but we turn it OFF." - "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," - "we do not need to link with MPI.${ColourReset}") - endif () - if (CHAMELEON_ENABLE_TESTING) - set(CHAMELEON_ENABLE_TESTING OFF) - message("${BoldBlue}CHAMELEON_ENABLE_TESTING is set to ON but we turn it OFF." - "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," - "there is no sense in compiling testing drivers that are used to check" - "numerical correctness of algorithms and kernels.${ColourReset}") - endif () - -endif(NOT CHAMELEON_SIMULATION) + # CHAMELEON depends on CUDA/CUBLAS + #---------------------------------- + if (CHAMELEON_USE_CUDA) + + find_package(CUDA REQUIRED) + + if (CUDA_FOUND) + message("-- ${Blue}Add definition CHAMELEON_USE_CUDA" + " - Activate CUDA in Chameleon${ColourReset}") + add_definitions(-DCHAMELEON_USE_CUDA) + if(CUDA_VERSION VERSION_LESS "3.0") + set(CUDA_HOST_COMPILATION_CPP OFF) + endif(CUDA_VERSION VERSION_LESS "3.0") + set(CUDA_BUILD_EMULATION OFF) + include_directories(${CUDA_INCLUDE_DIRS}) + list(APPEND EXTRA_LIBRARIES ${CUDA_LIBRARIES}) # need CUDA libs to link. + list(APPEND EXTRA_SOURCES src/gpu_data.c) + set(saved_include "${CMAKE_REQUIRED_INCLUDES}") + set(saved_libs "${CMAKE_REQUIRED_LIBRARIES}") + set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${CUDA_INCLUDE_DIRS}") + set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${CUDA_LIBRARIES}") + if(CUDA_VERSION VERSION_LESS "4.0") + set(CUDA_HAVE_PEER_DEVICE_MEMORY_ACCESS 0) + else() + check_function_exists(cuDeviceCanAccessPeer CUDA_HAVE_PEER_DEVICE_MEMORY_ACCESS) + endif() + set(CMAKE_REQUIRED_INCLUDES "${saved_include}") + set(CMAKE_REQUIRED_LIBRARIES "${saved_libs}") + #FindHeader(CUDA cublas_v2.h) + #if(CUDA_cublas_v2.h_DIRS) + #add_definitions(-DCHAMELEON_USE_CUBLAS_V2) + #endif() + endif (CUDA_FOUND) + + # CHAMELEON depends on MAGMA gpu kernels + # call our cmake module to test (in cmake_modules) + # change this call position if not appropriated + #---------------------------------------------- + if ( CUDA_FOUND AND CHAMELEON_USE_MAGMA ) + set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired") + find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} COMPONENTS CBLAS LAPACK CUDA) + if ( MAGMA_FOUND ) + message("-- ${Blue}Add definition CHAMELEON_USE_CUBLAS" + " - Use GPU kernels from cuBLAS${ColourReset}") + add_definitions(-DCHAMELEON_USE_CUBLAS) + message("-- ${Blue}Add definition CHAMELEON_USE_MAGMA" + " - Use GPU kernels from MAGMA${ColourReset}") + add_definitions(-DCHAMELEON_USE_MAGMA) + list(APPEND EXTRA_LIBRARIES ${CUDA_CUBLAS_LIBRARIES}) + include_directories(${MAGMA_INCLUDE_DIRS}) + if(MAGMA_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${MAGMA_LIBRARY_DIRS}") + endif() + else( MAGMA_FOUND ) + if(MORSE_VERBOSE_FIND_PACKAGE) + if (NOT MAGMA_magma.h_DIRS) + Print_Find_Header_Status(magma magma.h) + endif () + if (NOT MAGMA_magma_LIBRARY) + Print_Find_Library_Status(magma libmagma) + endif () + else() + message(WARNING "MAGMA library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" + "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + endif() + message(FATAL_ERROR "MAGMA library is required but has not been found") + endif( MAGMA_FOUND ) + endif() -# CHAMELEON depends on a runtime -# ------------------------------- - -# TODO: discuss on this with Manu -# try to find starpu runtime -if( CHAMELEON_SCHED_STARPU ) + endif(CHAMELEON_USE_CUDA) - set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired") + # CHAMELEON depends on MPI + #------------------------- + if (CHAMELEON_USE_MPI) - # create list of components in order to make a single call to find_package(starpu...) - if(NOT CHAMELEON_SIMULATION) - set(STARPU_COMPONENT_LIST "HWLOC") - if(CHAMELEON_USE_MPI) - list(APPEND STARPU_COMPONENT_LIST "MPI") + # allows to use an external mpi compilation by setting compilers with + # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 + # at cmake configure + if(NOT MPI_C_COMPILER) + set(MPI_C_COMPILER mpicc) + endif() + find_package(MPI REQUIRED) + + if (MPI_C_FOUND) + message("-- ${Blue}Add definition CHAMELEON_USE_MPI" + " - Activate MPI in Chameleon${ColourReset}") + add_definitions(-DCHAMELEON_USE_MPI) + list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES} ) + include_directories( ${MPI_C_INCLUDE_PATH} ) + # tests for intel mpi + #list(APPEND MPI_C_COMPILE_FLAGS "-mt_mpi") + #list(APPEND MPI_COMPILE_FLAGS "-mt_mpi") + endif (MPI_C_FOUND) + + endif (CHAMELEON_USE_MPI) + + else (NOT CHAMELEON_SIMULATION) + + message("${BoldBlue}Simulation mode of CHAMELEON is activated (CHAMELEON_SIMULATION=ON)." + "\nThis mode allows you to simulate execution of algorithms with StarPU compiled with SimGrid." + "\nTo do so, we provide some perfmodels in the simucore/perfmodels/ directory of CHAMELEON sources." + "\nThe resulting directory where to find perfmodels is: ${CMAKE_CURRENT_SOURCE_DIR}/simucore/perfmodels." + "\nTo use these perfmodels, please set your STARPU_HOME environment variable to ${CMAKE_CURRENT_SOURCE_DIR}/simucore/perfmodels." + "\nFinally, you need to set your STARPU_HOSTNAME environment variable to the name of the machine to simulate." + "For example: STARPU_HOSTNAME=mirage." + "\nNote that only POTRF kernels with block sizes of 320 or 960 (simple and double precision) on mirage machine are available for now." + "\nDatabase of models is subject to change, it should be enrich in a near future.${ColourReset}") + + if (CHAMELEON_USE_CUDA) + set(CHAMELEON_USE_CUDA OFF) + message("${BoldBlue}CHAMELEON_USE_CUDA is set to ON but we turn it OFF." + "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," + "we do not need to link with CUDA.${ColourReset}") + endif () + if (CHAMELEON_USE_MAGMA) + set(CHAMELEON_USE_MAGMA OFF) + message("${BoldBlue}CHAMELEON_USE_MAGMA is set to ON but we turn it OFF." + "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," + "we do not need to link with MAGMA.${ColourReset}") + endif () + if (CHAMELEON_USE_MPI) + set(CHAMELEON_USE_MPI OFF) + message("${BoldBlue}CHAMELEON_USE_MPI is set to ON but we turn it OFF." + "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," + "we do not need to link with MPI.${ColourReset}") + endif () + if (CHAMELEON_ENABLE_TESTING) + set(CHAMELEON_ENABLE_TESTING OFF) + message("${BoldBlue}CHAMELEON_ENABLE_TESTING is set to ON but we turn it OFF." + "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON)," + "there is no sense in compiling testing drivers that are used to check" + "numerical correctness of algorithms and kernels.${ColourReset}") + endif () + + endif(NOT CHAMELEON_SIMULATION) + + + # CHAMELEON depends on a runtime + # ------------------------------- + + # TODO: discuss on this with Manu + # try to find starpu runtime + if( CHAMELEON_SCHED_STARPU ) + + set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired") + + # create list of components in order to make a single call to find_package(starpu...) + if(NOT CHAMELEON_SIMULATION) + set(STARPU_COMPONENT_LIST "HWLOC") + if(CHAMELEON_USE_MPI) + list(APPEND STARPU_COMPONENT_LIST "MPI") + endif() + if(CHAMELEON_USE_CUDA) + list(APPEND STARPU_COMPONENT_LIST "CUDA") + endif() endif() - if(CHAMELEON_USE_CUDA) - list(APPEND STARPU_COMPONENT_LIST "CUDA") + if(CHAMELEON_USE_FXT) + list(APPEND STARPU_COMPONENT_LIST "FXT") endif() - endif() - if(CHAMELEON_USE_FXT) - list(APPEND STARPU_COMPONENT_LIST "FXT") - endif() - find_package(STARPU ${CHAMELEON_STARPU_VERSION} - COMPONENTS ${STARPU_COMPONENT_LIST}) - - # Add definition and include_dir if found - if ( STARPU_FOUND ) - message("-- ${Blue}Add definition CHAMELEON_SCHED_STARPU" - " - Activate StarPU in Chameleon${ColourReset}") - add_definitions(-DCHAMELEON_SCHED_STARPU) # TODO: remove that - include_directories(${STARPU_INCLUDE_DIRS}) - set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}") - foreach(libdir ${STARPU_LIBRARY_DIRS}) - list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}") - endforeach() - string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - if(CHAMELEON_USE_FXT) - # check if fxt profiling is accessible in starpu and activate it in chameleon - set(CMAKE_REQUIRED_LIBRARIES "${STARPU_SHM_LIBRARIES}") - unset(STARPU_FXT_START_PROFILING_FOUND CACHE) - check_function_exists(starpu_fxt_start_profiling STARPU_FXT_START_PROFILING_FOUND) - if ( STARPU_FXT_START_PROFILING_FOUND ) - message("-- ${Blue}Add definition HAVE_STARPU_FXT_PROFILING" - " - Activate FxT profiling through StarPU${ColourReset}") - add_definitions(-DHAVE_STARPU_FXT_PROFILING) - else() - message("-- ${Red}Looking for starpu with fxt" - " - starpu_fxt_start_profiling() test fails in StarPU${ColourReset}") - message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}") + find_package(STARPU ${CHAMELEON_STARPU_VERSION} + COMPONENTS ${STARPU_COMPONENT_LIST}) + + # Add definition and include_dir if found + if ( STARPU_FOUND ) + message("-- ${Blue}Add definition CHAMELEON_SCHED_STARPU" + " - Activate StarPU in Chameleon${ColourReset}") + add_definitions(-DCHAMELEON_SCHED_STARPU) # TODO: remove that + include_directories(${STARPU_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}") + foreach(libdir ${STARPU_LIBRARY_DIRS}) + list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}") + endforeach() + string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + if(CHAMELEON_USE_FXT) + # check if fxt profiling is accessible in starpu and activate it in chameleon + set(CMAKE_REQUIRED_LIBRARIES "${STARPU_SHM_LIBRARIES}") + unset(STARPU_FXT_START_PROFILING_FOUND CACHE) + check_function_exists(starpu_fxt_start_profiling STARPU_FXT_START_PROFILING_FOUND) + if ( STARPU_FXT_START_PROFILING_FOUND ) + message("-- ${Blue}Add definition HAVE_STARPU_FXT_PROFILING" + " - Activate FxT profiling through StarPU${ColourReset}") + add_definitions(-DHAVE_STARPU_FXT_PROFILING) + else() + message("-- ${Red}Looking for starpu with fxt" + " - starpu_fxt_start_profiling() test fails in StarPU${ColourReset}") + message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}") + endif() endif() - endif() - if (CHAMELEON_USE_MPI AND STARPU_MPI_LIBRARIES) - # Check if a specific function exist - set(CMAKE_REQUIRED_LIBRARIES "${STARPU_MPI_LIBRARIES}") - unset(STARPU_MPI_DATA_REGISTER_FOUND CACHE) - check_function_exists(starpu_mpi_data_register_comm STARPU_MPI_DATA_REGISTER_FOUND) - if ( STARPU_MPI_DATA_REGISTER_FOUND ) - message("-- ${Blue}Add definition HAVE_STARPU_MPI_DATA_REGISTER - Activate" - "use of starpu_mpi_data_register() in Chameleon with StarPU${ColourReset}") - add_definitions(-DHAVE_STARPU_MPI_DATA_REGISTER) - else() - message("-- ${Red}Looking for starpu with starpu_mpi_data_register" - " - starpu_mpi_data_register() test fails in StarPU${ColourReset}") - message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}") + if (CHAMELEON_USE_MPI AND STARPU_MPI_LIBRARIES) + # Check if a specific function exist + set(CMAKE_REQUIRED_LIBRARIES "${STARPU_MPI_LIBRARIES}") + unset(STARPU_MPI_DATA_REGISTER_FOUND CACHE) + check_function_exists(starpu_mpi_data_register_comm STARPU_MPI_DATA_REGISTER_FOUND) + if ( STARPU_MPI_DATA_REGISTER_FOUND ) + message("-- ${Blue}Add definition HAVE_STARPU_MPI_DATA_REGISTER - Activate" + "use of starpu_mpi_data_register() in Chameleon with StarPU${ColourReset}") + add_definitions(-DHAVE_STARPU_MPI_DATA_REGISTER) + else() + message("-- ${Red}Looking for starpu with starpu_mpi_data_register" + " - starpu_mpi_data_register() test fails in StarPU${ColourReset}") + message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}") + endif() endif() - endif() - if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}") - endif() - if(FXT_FOUND AND FXT_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${FXT_LIBRARY_DIRS}") - endif() - if(STARPU_FOUND AND STARPU_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS}") - endif() - else ( STARPU_FOUND ) - if(MORSE_VERBOSE_FIND_PACKAGE) + if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}") + endif() + if(FXT_FOUND AND FXT_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${FXT_LIBRARY_DIRS}") + endif() + if(STARPU_FOUND AND STARPU_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS}") + endif() + else ( STARPU_FOUND ) + if(MORSE_VERBOSE_FIND_PACKAGE) + if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) + if (NOT HWLOC_hwloc.h_DIRS) + Print_Find_Header_Status(hwloc hwloc.h) + endif () + if (NOT HWLOC_hwloc_LIBRARY) + Print_Find_Library_Status(hwloc libhwloc) + endif () + endif() + if(CHAMELEON_USE_FXT AND (NOT FXT_FOUND OR NOT FXT_LIBRARIES)) + if (NOT FXT_fxt.h_DIRS) + Print_Find_Header_Status(fxt fxt.h) + endif () + if (NOT FXT_fxt_LIBRARY) + Print_Find_Library_Status(fxt libfxt) + endif () + endif() + if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR + ( STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) ) + ) + foreach(starpu_hdr ${STARPU_hdrs_to_find}) + if (NOT STARPU_${starpu_hdr}_INCLUDE_DIRS) + Print_Find_Header_Status(starpu ${starpu_hdr}) + endif () + endforeach() + if(STARPU_VERSION_STRING) + foreach(starpu_lib ${STARPU_libs_to_find}) + if (NOT STARPU_${starpu_lib}_LIBRARY) + Print_Find_Library_Status(starpu ${starpu_lib}) + endif () + endforeach() + endif() + endif() + else(MORSE_VERBOSE_FIND_PACKAGE) + message(WARNING "StarPU library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" + "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + endif(MORSE_VERBOSE_FIND_PACKAGE) if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) - if (NOT HWLOC_hwloc.h_DIRS) - Print_Find_Header_Status(hwloc hwloc.h) - endif () - if (NOT HWLOC_hwloc_LIBRARY) - Print_Find_Library_Status(hwloc libhwloc) - endif () + message(FATAL_ERROR "hwloc library is required but has not been found") endif() if(CHAMELEON_USE_FXT AND (NOT FXT_FOUND OR NOT FXT_LIBRARIES)) - if (NOT FXT_fxt.h_DIRS) - Print_Find_Header_Status(fxt fxt.h) - endif () - if (NOT FXT_fxt_LIBRARY) - Print_Find_Library_Status(fxt libfxt) - endif () + message(FATAL_ERROR "FxT library is required but has not been found") endif() if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR ( STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) ) ) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - if (NOT STARPU_${starpu_hdr}_INCLUDE_DIRS) - Print_Find_Header_Status(starpu ${starpu_hdr}) - endif () - endforeach() - if(STARPU_VERSION_STRING) - foreach(starpu_lib ${STARPU_libs_to_find}) - if (NOT STARPU_${starpu_lib}_LIBRARY) - Print_Find_Library_Status(starpu ${starpu_lib}) - endif () - endforeach() - endif() + message(FATAL_ERROR "StarPU library is required but has not been found") endif() - else(MORSE_VERBOSE_FIND_PACKAGE) - message(WARNING "StarPU library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" - "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") - endif(MORSE_VERBOSE_FIND_PACKAGE) - if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) - message(FATAL_ERROR "hwloc library is required but has not been found") - endif() - if(CHAMELEON_USE_FXT AND (NOT FXT_FOUND OR NOT FXT_LIBRARIES)) - message(FATAL_ERROR "FxT library is required but has not been found") - endif() - if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR - ( STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) ) - ) - message(FATAL_ERROR "StarPU library is required but has not been found") - endif() - endif ( STARPU_FOUND ) + endif ( STARPU_FOUND ) -endif( CHAMELEON_SCHED_STARPU ) + endif( CHAMELEON_SCHED_STARPU ) -# try to find quark runtime -if( CHAMELEON_SCHED_QUARK ) + # try to find quark runtime + if( CHAMELEON_SCHED_QUARK ) - find_package(QUARK COMPONENTS HWLOC) + find_package(QUARK COMPONENTS HWLOC) - # Add definition and include_dir if found - if(QUARK_FOUND) - message("-- ${Blue}Add definition CHAMELEON_SCHED_QUARK" - " - Activate QUARK in Chameleon${ColourReset}") - add_definitions(-DCHAMELEON_SCHED_QUARK) # TODO: remove that - include_directories(${QUARK_INCLUDE_DIRS}) - if(QUARK_LIBRARY_DIRS) - # the RPATH to be used when installing - list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS}") - endif() - else(QUARK_FOUND) - if(MORSE_VERBOSE_FIND_PACKAGE) - if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) - if (NOT HWLOC_hwloc.h_DIRS) - Print_Find_Header_Status(hwloc hwloc.h) + # Add definition and include_dir if found + if(QUARK_FOUND) + message("-- ${Blue}Add definition CHAMELEON_SCHED_QUARK" + " - Activate QUARK in Chameleon${ColourReset}") + add_definitions(-DCHAMELEON_SCHED_QUARK) # TODO: remove that + include_directories(${QUARK_INCLUDE_DIRS}) + if(QUARK_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS}") + endif() + else(QUARK_FOUND) + if(MORSE_VERBOSE_FIND_PACKAGE) + if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) + if (NOT HWLOC_hwloc.h_DIRS) + Print_Find_Header_Status(hwloc hwloc.h) + endif () + if (NOT HWLOC_hwloc_LIBRARY) + Print_Find_Library_Status(hwloc libhwloc) + endif () + endif() + if (NOT QUARK_quark.h_DIRS) + Print_Find_Header_Status(quark quark.h) endif () - if (NOT HWLOC_hwloc_LIBRARY) - Print_Find_Library_Status(hwloc libhwloc) + if (NOT QUARK_quark_LIBRARY) + Print_Find_Library_Status(quark libquark) endif () + else() + message(WARNING "QUARK library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" + "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") endif() - if (NOT QUARK_quark.h_DIRS) - Print_Find_Header_Status(quark quark.h) - endif () - if (NOT QUARK_quark_LIBRARY) - Print_Find_Library_Status(quark libquark) - endif () + if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) + message(FATAL_ERROR "hwloc library is required but has not been found") + endif() + message(FATAL_ERROR "QUARK library is required but has not been found") + endif(QUARK_FOUND) + + endif() + + # Add define for Fortran Mangling (should be defined somewhere else) + # ------------------------------------------------------------------ + message("-- ${Blue}Add definition ADD_" + " - For Fortran mangling${ColourReset}") + add_definitions(-DADD_) + + #------------------------------------------------------------------------------ + # Save all dependencies (all required links) + set(CHAMELEON_DEP -lchameleon) + if(CHAMELEON_SCHED_STARPU) + if ( CHAMELEON_USE_MPI ) + list(APPEND CHAMELEON_DEP + -lchameleon_starpu + ${STARPU_MPI_LIBRARIES} + ) else() - message(WARNING "QUARK library has not been found and MORSE_VERBOSE_FIND_PACKAGE is set to OFF" - "Try to activate MORSE_VERBOSE_FIND_PACKAGE option (-DMORSE_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection") + list(APPEND CHAMELEON_DEP + -lchameleon_starpu + ${STARPU_SHM_LIBRARIES} + ) + endif() + elseif(CHAMELEON_SCHED_QUARK) + list(APPEND CHAMELEON_DEP + -lchameleon_quark + ${QUARK_LIBRARIES} + ) + link_directories(${QUARK_LIBRARY_DIRS}) + endif() + if(NOT CHAMELEON_SIMULATION) + if(CHAMELEON_USE_CUDA) + list(APPEND CHAMELEON_DEP + ${CUDA_LIBRARIES} + ) + link_directories(${CUDA_LIBRARY_DIRS}) endif() - if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) - message(FATAL_ERROR "hwloc library is required but has not been found") + if(CHAMELEON_USE_MAGMA) + list(APPEND CHAMELEON_DEP + ${MAGMA_LIBRARIES} + ) + link_directories(${MAGMA_LIBRARY_DIRS}) endif() - message(FATAL_ERROR "QUARK library is required but has not been found") - endif(QUARK_FOUND) -endif() - -# Add define for Fortran Mangling (should be defined somewhere else) -# ------------------------------------------------------------------ -message("-- ${Blue}Add definition ADD_" - " - For Fortran mangling${ColourReset}") -add_definitions(-DADD_) - -#------------------------------------------------------------------------------ -# Save all dependencies (all required links) -set(CHAMELEON_DEP -lchameleon) -if(CHAMELEON_SCHED_STARPU) - if ( CHAMELEON_USE_MPI ) list(APPEND CHAMELEON_DEP - -lchameleon_starpu - ${STARPU_MPI_LIBRARIES} + -lcoreblas + ${LAPACKE_LIBRARIES} + ${CBLAS_LIBRARIES} + ${LAPACK_SEQ_LIBRARIES} + ${BLAS_SEQ_LIBRARIES} + ${HWLOC_LIBRARIES} + ${EXTRA_LIBRARIES} ) else() list(APPEND CHAMELEON_DEP - -lchameleon_starpu - ${STARPU_SHM_LIBRARIES} - ) - endif() -elseif(CHAMELEON_SCHED_QUARK) - list(APPEND CHAMELEON_DEP - -lchameleon_quark - ${QUARK_LIBRARIES} - ) - link_directories(${QUARK_LIBRARY_DIRS}) -endif() -if(NOT CHAMELEON_SIMULATION) - if(CHAMELEON_USE_CUDA) - list(APPEND CHAMELEON_DEP - ${CUDA_LIBRARIES} + -lcoreblas + -lsimulapacke + -lsimucblas + ${HWLOC_LIBRARIES} + ${EXTRA_LIBRARIES} ) - link_directories(${CUDA_LIBRARY_DIRS}) endif() - if(CHAMELEON_USE_MAGMA) - list(APPEND CHAMELEON_DEP - ${MAGMA_LIBRARIES} - ) - link_directories(${MAGMA_LIBRARY_DIRS}) + list(REMOVE_DUPLICATES CHAMELEON_DEP) + + # Check for the subdirectories + # ---------------------------- + + # include headers + # --------------- + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) + + ############################################################################### + # simucore libraries # + ###################### + + if ( CHAMELEON_SIMULATION ) + add_subdirectory(simucore) + message("-- ${Blue}Add definition CHAMELEON_SIMULATION" + " - Activate simulation mode in Chameleon (to use with StarPU+SimGrid)${ColourReset}") + add_definitions(-DCHAMELEON_SIMULATION) endif() + #------------------------------------------------------------------------------ - list(APPEND CHAMELEON_DEP - -lcoreblas - ${LAPACKE_LIBRARIES} - ${CBLAS_LIBRARIES} - ${LAPACK_SEQ_LIBRARIES} - ${BLAS_SEQ_LIBRARIES} - ${HWLOC_LIBRARIES} - ${EXTRA_LIBRARIES} - ) -else() - list(APPEND CHAMELEON_DEP - -lcoreblas - -lsimulapacke - -lsimucblas - ${HWLOC_LIBRARIES} - ${EXTRA_LIBRARIES} - ) -endif() -list(REMOVE_DUPLICATES CHAMELEON_DEP) - -# Check for the subdirectories -# ---------------------------- - -# include headers -# --------------- -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) - -############################################################################### -# simucore libraries # -###################### - -if ( CHAMELEON_SIMULATION ) - add_subdirectory(simucore) - message("-- ${Blue}Add definition CHAMELEON_SIMULATION" - " - Activate simulation mode in Chameleon (to use with StarPU+SimGrid)${ColourReset}") - add_definitions(-DCHAMELEON_SIMULATION) -endif() -#------------------------------------------------------------------------------ + ############################################################################### + # Coreblas library (kernels for CPUs) # + ####################################### -############################################################################### -# Coreblas library (kernels for CPUs) # -####################################### + add_subdirectory(coreblas) + #------------------------------------------------------------------------------ -add_subdirectory(coreblas) -#------------------------------------------------------------------------------ + ############################################################################### + # Main library # + ################ -############################################################################### -# Main library # -################ + add_subdirectory(include) + add_subdirectory(control) + add_subdirectory(compute) + #------------------------------------------------------------------------------ -add_subdirectory(include) -add_subdirectory(control) -add_subdirectory(compute) -#------------------------------------------------------------------------------ + ############################################################################### + # Runtime library # + ################### -############################################################################### -# Runtime library # -################### + add_subdirectory(runtime) + #------------------------------------------------------------------------------ -add_subdirectory(runtime) -#------------------------------------------------------------------------------ + ############################################################################### + # Executables and Tests # + ######################### -############################################################################### -# Executables and Tests # -######################### + enable_testing() + include(CTest) + #enable_testing() -enable_testing() -include(CTest) -#enable_testing() + # Necessary to compile executables (temporary) + # should use SystemDetection.cmake module? + string(REGEX MATCH ".*ifort$" _match_ifort ${CMAKE_Fortran_COMPILER}) + if(_match_ifort) + #message(STATUS "Add -nofor_main to the Fortran linker") + set(CMAKE_Fortran_FLAGS "-nofor_main") + endif(_match_ifort) -# Necessary to compile executables (temporary) -# should use SystemDetection.cmake module? -string(REGEX MATCH ".*ifort$" _match_ifort ${CMAKE_Fortran_COMPILER}) -if(_match_ifort) - #message(STATUS "Add -nofor_main to the Fortran linker") - set(CMAKE_Fortran_FLAGS "-nofor_main") -endif(_match_ifort) + # Testing executables + if(CHAMELEON_ENABLE_EXAMPLE) + add_subdirectory(example) + endif(CHAMELEON_ENABLE_EXAMPLE) -# Testing executables -if(CHAMELEON_ENABLE_EXAMPLE) - add_subdirectory(example) -endif(CHAMELEON_ENABLE_EXAMPLE) + # Testing executables + if(CHAMELEON_ENABLE_TESTING) + add_subdirectory(testing) + endif(CHAMELEON_ENABLE_TESTING) -# Testing executables -if(CHAMELEON_ENABLE_TESTING) - add_subdirectory(testing) -endif(CHAMELEON_ENABLE_TESTING) + # Timing executables + if(CHAMELEON_ENABLE_TIMING) + add_subdirectory(timing) + endif(CHAMELEON_ENABLE_TIMING) + #------------------------------------------------------------------------------ -# Timing executables -if(CHAMELEON_ENABLE_TIMING) - add_subdirectory(timing) -endif(CHAMELEON_ENABLE_TIMING) -#------------------------------------------------------------------------------ + ############################################################################### + # Documentation # + ################# -############################################################################### -# Documentation # -################# + if(CHAMELEON_ENABLE_DOCS) + add_subdirectory(docs) + endif() + #------------------------------------------------------------------------------ -if(CHAMELEON_ENABLE_DOCS) - add_subdirectory(docs) -endif() -#------------------------------------------------------------------------------ + ############################################################################### + # Config files (pkg_config) # + ############################# -############################################################################### -# Config files (pkg_config) # -############################# + # Create file morse_starpu.pc + # --------------------------- + if(CHAMELEON_SCHED_STARPU) + generate_pkgconfig_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/chameleon-starpu.pc.in") + endif() -# Create file morse_starpu.pc -# --------------------------- -if(CHAMELEON_SCHED_STARPU) - generate_pkgconfig_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/chameleon-starpu.pc.in") -endif() + # # Create file morse_quark.pc + # # -------------------------- + if(CHAMELEON_SCHED_QUARK) + generate_pkgconfig_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/chameleon-quark.pc.in") + endif() + #------------------------------------------------------------------------------ -# # Create file morse_quark.pc -# # -------------------------- -if(CHAMELEON_SCHED_QUARK) - generate_pkgconfig_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/chameleon-quark.pc.in") -endif() -#------------------------------------------------------------------------------ + ############################################################################### + # Print Options # + ################# + get_directory_property( CHAMELEON_DEFINITIONS_LIST DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) + include(PrintOpts) -############################################################################### -# Print Options # -################# -get_directory_property( CHAMELEON_DEFINITIONS_LIST DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) -include(PrintOpts) + if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local" OR ${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files") + message("-- ${Yellow}Your CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX} which is a default system path." + "You may want to change it: set the CMAKE_INSTALL_PREFIX variable to do so.${ColourReset}") + endif() -if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local" OR ${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files") - message("-- ${Yellow}Your CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX} which is a default system path." - "You may want to change it: set the CMAKE_INSTALL_PREFIX variable to do so.${ColourReset}") -endif() +else(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/") + + message(STATUS "MORSE_DISTRIB_DIR is not set") + message(STATUS "Please indicate where is located your MORSE distribution directory." + " This is necessary to find cmake_modules.") + message(STATUS "If you are a MORSE developer, you normally have access to the svn repository of the MORSE_DISTRIB_DIR: " + "svn checkout svn+ssh://yourlogin@scm.gforge.inria.fr/svnroot/morse/trunk/morse_distrib") + +endif(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/") ### ### END CMakeLists.txt diff --git a/cmake_modules/GenPkgConfig.cmake b/cmake_modules/GenPkgConfig.cmake deleted file mode 100644 index b8dde5bf7..000000000 --- a/cmake_modules/GenPkgConfig.cmake +++ /dev/null @@ -1,135 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file GenPkgConfig.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 10-11-2014 -# -### - -### -# -# GENERATE_PKGCONFIG_FILE: generate a file .pc according to the options -# -### -MACRO(GENERATE_PKGCONFIG_FILE _file) - - # The link flags specific to this package and any required libraries - # that don't support PkgConfig - set(CHAMELEON_PKGCONFIG_LIBS "") - # The link flags for private libraries required by this package but not - # exposed to applications - set(CHAMELEON_PKGCONFIG_LIBS_PRIVATE "") - # A list of packages required by this package - set(CHAMELEON_PKGCONFIG_REQUIRED "") - # A list of private packages required by this package but not exposed to - # applications - set(CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE "") - - list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon) - if(CHAMELEON_SCHED_STARPU) - list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon_starpu) - if ( CHAMELEON_USE_MPI ) - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED - starpumpi-${CHAMELEON_STARPU_VERSION}) - else() - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED - starpu-${CHAMELEON_STARPU_VERSION}) - endif() - elseif(CHAMELEON_SCHED_QUARK) - list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon_quark) - list(APPEND CHAMELEON_PKGCONFIG_LIBS "-l${QUARK_quark_LIBRARY}") - endif() - - - if(NOT CHAMELEON_SIMULATION) - - if(CHAMELEON_USE_CUDA) - list(APPEND CHAMELEON_PKGCONFIG_LIBS ${CUDA_LIBRARIES}) - endif() - - if(CHAMELEON_USE_MAGMA) - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED magma) - endif() - - list(APPEND CHAMELEON_PKGCONFIG_LIBS - -lcoreblas - ${LAPACKE_LIBRARIES} - ${CBLAS_LIBRARIES} - ${EXTRA_LIBRARIES} - ) - - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED hwloc) - - else(NOT CHAMELEON_SIMULATION) - - list(APPEND CHAMELEON_PKGCONFIG_LIBS - -lcoreblas - -lsimulapacke - -lsimucblas - ${EXTRA_LIBRARIES} - ) - - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED hwloc) - - endif(NOT CHAMELEON_SIMULATION) - - # Define required package - # ----------------------- - set(CHAMELEON_PKGCONFIG_LIBS_CPY "${CHAMELEON_PKGCONFIG_LIBS}") - set(CHAMELEON_PKGCONFIG_LIBS "") - foreach(_dep ${CHAMELEON_PKGCONFIG_LIBS_CPY}) - get_filename_component(dep_we ${_dep} NAME) - STRING(REPLACE "lib" "-l" dep_we "${dep_we}") - STRING(REPLACE ".so" "" dep_we "${dep_we}") - STRING(REPLACE ".a" "" dep_we "${dep_we}") - STRING(REPLACE ".dylib" "" dep_we "${dep_we}") - STRING(REPLACE ".dll" "" dep_we "${dep_we}") - list(APPEND CHAMELEON_PKGCONFIG_LIBS ${dep_we}) - endforeach() - - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_LIBS) - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_LIBS_PRIVATE) - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_REQUIRED) - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE) - - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_LIBS "${CHAMELEON_PKGCONFIG_LIBS}") - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_LIBS_PRIVATE "${CHAMELEON_PKGCONFIG_LIBS_PRIVATE}") - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_REQUIRED "${CHAMELEON_PKGCONFIG_REQUIRED}") - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE "${CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE}") - - # Create .pc file - # --------------- - SET(_output_file "${CMAKE_BINARY_DIR}/chameleon.pc") - # TODO: add url of MORSE releases in .pc file - CONFIGURE_FILE("${_file}" "${_output_file}" @ONLY) - - # installation - # ------------ - INSTALL(FILES ${_output_file} DESTINATION lib/pkgconfig) - -ENDMACRO(GENERATE_PKGCONFIG_FILE) - -## -## @end file GenPkgConfig.cmake -## diff --git a/cmake_modules/PrintOpts.cmake b/cmake_modules/PrintOpts.cmake deleted file mode 100644 index 4a096ec33..000000000 --- a/cmake_modules/PrintOpts.cmake +++ /dev/null @@ -1,85 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file PrintOpts.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Florent Pruvost -# @date 10-11-2014 -# -### -set(dep_message "\nConfiguration of Chameleon:\n" - " BUILDNAME ...........: ${BUILDNAME}\n" - " SITE ................: ${SITE}\n" - "\n" - " Compiler: C .........: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})\n" - " Compiler: Fortran ...: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID})\n") -if(CHAMELEON_USE_MPI) - set(dep_message "${dep_message}" - " Compiler: MPI .......: ${MPI_C_COMPILER}\n" - " compiler flags ......: ${MPI_C_COMPILE_FLAGS}\n") -endif() -set(dep_message "${dep_message}" -" Linker: .............: ${CMAKE_LINKER}\n" -"\n" -" Build type ..........: ${CMAKE_BUILD_TYPE}\n" -" Build shared ........: ${BUILD_SHARED_LIBS}\n" -" CFlags ..............: ${CMAKE_C_FLAGS}\n" -" LDFlags .............: ${CMAKE_C_LINK_FLAGS}\n" -"\n" -" Implementation paradigm\n" -" CUDA ................: ${CHAMELEON_USE_CUDA}\n" -" MPI .................: ${CHAMELEON_USE_MPI}\n" -"\n" -" Runtime specific\n" -" QUARK ...............: ${CHAMELEON_SCHED_QUARK}\n" -" StarPU ..............: ${CHAMELEON_SCHED_STARPU}\n" -" FxT .................: ${CHAMELEON_USE_FXT}\n" -"\n" -" Kernels specific\n" -" BLAS ................: ${BLA_VENDOR}\n" -" MAGMA ...............: ${CHAMELEON_USE_MAGMA}\n" -"\n" -" Simulation mode .....: ${CHAMELEON_SIMULATION}\n" -"\n" -" Binaries to build\n" -" documentation ........: ${CHAMELEON_ENABLE_DOCS}\n" -" example ..............: ${CHAMELEON_ENABLE_EXAMPLE}\n" -" testing ..............: ${CHAMELEON_ENABLE_TESTING}\n" -" timing ...............: ${CHAMELEON_ENABLE_TIMING}\n" -"\n" -" CHAMELEON dependencies :\n") -foreach (_dep ${CHAMELEON_DEP}) - set(dep_message "${dep_message}" - " ${_dep}\n") -endforeach () -set(dep_message "${dep_message}" -"\n" -" Definitions: ${CHAMELEON_DEFINITIONS_LIST}\n") -set(dep_message "${dep_message}" -"\n" -" INSTALL_PREFIX ......: ${CMAKE_INSTALL_PREFIX}\n\n") - -string(REPLACE ";" " " dep_message_wsc "${dep_message}") -#message(${dep_message}) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config.log "${dep_message_wsc}") -message(STATUS "Configuration is done - A summary of the current configuration" -"has been written in ${CMAKE_CURRENT_BINARY_DIR}/config.log") -# installation -# ------------ -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.log DESTINATION share/chameleon) diff --git a/cmake_modules/array2d.cmake b/cmake_modules/array2d.cmake deleted file mode 100644 index 251130b57..000000000 --- a/cmake_modules/array2d.cmake +++ /dev/null @@ -1,46 +0,0 @@ - -#------------------------------------------------------------------- - -macro( array2d_get_item out_value offset ) - math( EXPR _finalindex "${_array2d_index}+${offset}" ) - list( GET _array2d_array ${_finalindex} _item ) - set( ${out_value} "${_item}" ) -endmacro() - -#------------------------------------------------------------------- - -macro( array2d_begin_loop out_advanced array width var_names ) - set( _array2d_out_advanced ${out_advanced} ) - set( _array2d_index 0 ) - set( _array2d_array ${array} ) - set( _array2d_width ${width} ) - set( _array2d_var_names ${var_names} ) - array2d_advance() -endmacro() - -#------------------------------------------------------------------- - -macro( array2d_advance ) - if( NOT _array2d_array ) - set( ${_array2d_out_advanced} false ) - else() - list( LENGTH _array2d_array _size ) - math( EXPR _remaining "${_size}-${_array2d_index}" ) - - if( (_array2d_width LESS 1) OR (_size LESS _array2d_width) OR (_remaining LESS _array2d_width) ) - set( ${_array2d_out_advanced} false ) - else() - math( EXPR _adjusted_width "${_array2d_width}-1" ) - foreach( offset RANGE ${_adjusted_width} ) - list( GET _array2d_var_names ${offset} _var_name ) - array2d_get_item( ${_var_name} ${offset} ) - endforeach() - - math( EXPR _index "${_array2d_index}+${_array2d_width}" ) - set( _array2d_index ${_index} ) - set( ${_array2d_out_advanced} true ) - endif() - endif() -endmacro() - -#------------------------------------------------------------------- \ No newline at end of file diff --git a/cmake_modules/morse/AuxilaryFlags.cmake b/cmake_modules/morse/AuxilaryFlags.cmake deleted file mode 100644 index 60de26627..000000000 --- a/cmake_modules/morse/AuxilaryFlags.cmake +++ /dev/null @@ -1,35 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file AuxilaryFlags.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Xavier Lacoste -# @date 30-01-2015 -# -# Define auxilary variables: -# - CMAKE_Fortran_PREPROCESS_FLAGS : force C preprocessor. -# - CMAKE_Fortran_FREEFORM_FLAG : Force free format. -### - - -IF(CMAKE_Fortran_COMPILER_ID MATCHES GNU) - list(APPEND CMAKE_Fortran_FLAGS "-cpp -ffree-form") -ELSEIF(CMAKE_Fortran_COMPILER_ID MATCHES Intel) - list(APPEND CMAKE_Fortran_PREPROCESS_FLAG "-fpp") -ENDIF() diff --git a/cmake_modules/morse/ColorizeMessage.cmake b/cmake_modules/morse/ColorizeMessage.cmake deleted file mode 100644 index 6ec23d833..000000000 --- a/cmake_modules/morse/ColorizeMessage.cmake +++ /dev/null @@ -1,79 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file ColorizeMessage.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 13-07-2012 -# -### - -# Set some colors -if(NOT WIN32) - string(ASCII 27 Esc) - set(ColourReset "${Esc}[m") - set(ColourBold "${Esc}[1m") - set(Red "${Esc}[31m") - set(Green "${Esc}[32m") - set(Yellow "${Esc}[33m") - set(Blue "${Esc}[34m") - set(Magenta "${Esc}[35m") - set(Cyan "${Esc}[36m") - set(White "${Esc}[37m") - set(BoldRed "${Esc}[1;31m") - set(BoldGreen "${Esc}[1;32m") - set(BoldYellow "${Esc}[1;33m") - set(BoldBlue "${Esc}[1;34m") - set(BoldMagenta "${Esc}[1;35m") - set(BoldCyan "${Esc}[1;36m") - set(BoldWhite "${Esc}[1;37m") -endif() - -# Colorize cmake messages during configure -function(message) - list(GET ARGV 0 MessageType) - if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR) - list(REMOVE_AT ARGV 0) - string (REPLACE ";" " " ARGV_STR "${ARGV}") - _message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}") - elseif(MessageType STREQUAL WARNING) - list(REMOVE_AT ARGV 0) - string (REPLACE ";" " " ARGV_STR "${ARGV}") - _message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}") - elseif(MessageType STREQUAL AUTHOR_WARNING) - list(REMOVE_AT ARGV 0) - string (REPLACE ";" " " ARGV_STR "${ARGV}") - _message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}") - elseif(MessageType STREQUAL STATUS) - list(REMOVE_AT ARGV 0) - string (REPLACE ";" " " ARGV_STR "${ARGV}") - _message(${MessageType} "${Green}${ARGV_STR}${ColourReset}") - else() - string (REPLACE ";" " " ARGV_STR "${ARGV}") - string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}") - _message("${ARGV_STR}") - endif() -endfunction() - -## -## @end file ColorizeMessage.cmake -## diff --git a/cmake_modules/morse/FindHeadersAndLibs.cmake b/cmake_modules/morse/FindHeadersAndLibs.cmake deleted file mode 100644 index 0f5eadde7..000000000 --- a/cmake_modules/morse/FindHeadersAndLibs.cmake +++ /dev/null @@ -1,100 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file FindHeadersAndLibs.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 13-07-2012 -# -### - -# Add the path where we handle our FindFOO.cmake to seek for liraries -list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) - -# Some macros to print status when search for headers and libs -# PrintFindStatus.cmake is in cmake_modules/morse/find directory -include(PrintFindStatus) - - -function(FindHeader _libname _header_to_find) - - # save _libname upper and lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the _header_to_find in the given paths - # -------------------------------------------------- - # call cmake macro to find the header path - if(${LIBNAME}_INCDIR) - set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND") - find_path(${LIBNAME}_${_header_to_find}_DIRS - NAMES ${_header_to_find} - HINTS ${${LIBNAME}_INCDIR}) - elseif(${LIBNAME}_DIR) - set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND") - find_path(${LIBNAME}_${_header_to_find}_DIRS - NAMES ${_header_to_find} - HINTS ${${LIBNAME}_DIR} - PATH_SUFFIXES include) - else() - set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND") - find_path(${LIBNAME}_${_header_to_find}_DIRS - NAMES ${_header_to_find} - HINTS ${_inc_env}) - endif() - mark_as_advanced(${LIBNAME}_${_header_to_find}_DIRS) - - # Print status if not found - # ------------------------- - if (NOT ${LIBNAME}_${_header_to_find}_DIRS) - Print_Find_Header_Status(${libname} ${_header_to_find}) - endif () - -endfunction(FindHeader) - - -## -## @end file FindHeadersAndLibs.cmake -## diff --git a/cmake_modules/morse/MorseInit.cmake b/cmake_modules/morse/MorseInit.cmake deleted file mode 100644 index 84e9762ca..000000000 --- a/cmake_modules/morse/MorseInit.cmake +++ /dev/null @@ -1,55 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file MorseInit.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 13-07-2012 -# -### - -# This include is required to check symbols of libs in the main CMakeLists.txt -include(CheckFunctionExists) - -# To colorize messages -include(ColorizeMessage) - -# To find headers and libs -include(FindHeadersAndLibs) - -# Some macros to print status when search for headers and libs -# PrintFindStatus.cmake is in cmake_modules/morse/find directory -include(PrintFindStatus) - -# Define some auxilary flags -include(AuxilaryFlags) - -# Add the path where we handle our FindFOO.cmake to seek for liraries -list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) - -option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning no found packages" OFF) -message("-- ${BoldGreen}MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get" - "information about packages not found${ColourReset}") - -## -## @end file MorseInit.cmake -## diff --git a/cmake_modules/morse/ParseArguments.cmake b/cmake_modules/morse/ParseArguments.cmake deleted file mode 100644 index 1407ded47..000000000 --- a/cmake_modules/morse/ParseArguments.cmake +++ /dev/null @@ -1,71 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file ParseArguments.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @date 13-07-2012 -# -### - -MACRO(PARSE_ARGUMENTS prefix arg_names option_names) - set(DEFAULT_ARGS) - foreach(arg_name ${arg_names}) - set(${prefix}_${arg_name}) - endforeach(arg_name) - foreach(option ${option_names}) - set(${prefix}_${option} FALSE) - endforeach(option) - - set(current_arg_name DEFAULT_ARGS) - set(current_arg_list) - foreach(arg ${ARGN}) - set(larg_names ${arg_names}) - list(FIND larg_names "${arg}" is_arg_name) - if(is_arg_name GREATER -1) - set(${prefix}_${current_arg_name} ${current_arg_list}) - set(current_arg_name ${arg}) - set(current_arg_list) - else(is_arg_name GREATER -1) - set(loption_names ${option_names}) - list(FIND loption_names "${arg}" is_option) - if(is_option GREATER -1) - set(${prefix}_${arg} TRUE) - else(is_option GREATER -1) - set(current_arg_list ${current_arg_list} ${arg}) - endif(is_option GREATER -1) - endif(is_arg_name GREATER -1) - endforeach(arg) - set(${prefix}_${current_arg_name} ${current_arg_list}) - -ENDMACRO(PARSE_ARGUMENTS) - -MACRO(CAR var) - set(${var} ${ARGV1}) -ENDMACRO(CAR) - -MACRO(CDR var junk) - set(${var} ${ARGN}) -ENDMACRO(CDR) - -## -## @end file ParseArguments.cmake -## diff --git a/cmake_modules/morse/PrintFindStatus.cmake b/cmake_modules/morse/PrintFindStatus.cmake deleted file mode 100644 index 686f9575e..000000000 --- a/cmake_modules/morse/PrintFindStatus.cmake +++ /dev/null @@ -1,210 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Some macros to print status when search for headers and libs -# Main parameters of macros -# _libname: name of the lib you seek, foo for example -# _header_to_find: name of the header you seek, foo.h for example -# _lib_to_find: name of the library you seek, libfoo for example -# _pc_to_find: name of the pkg-config file zyou seek, foo.pc for example - - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. - -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -# Set some colors -if(NOT WIN32) - string(ASCII 27 Esc) - set(ColourReset "${Esc}[m") - set(ColourBold "${Esc}[1m") - set(Red "${Esc}[31m") - set(Green "${Esc}[32m") - set(Yellow "${Esc}[33m") - set(Blue "${Esc}[34m") - set(Magenta "${Esc}[35m") - set(Cyan "${Esc}[36m") - set(White "${Esc}[37m") - set(BoldRed "${Esc}[1;31m") - set(BoldGreen "${Esc}[1;32m") - set(BoldYellow "${Esc}[1;33m") - set(BoldBlue "${Esc}[1;34m") - set(BoldMagenta "${Esc}[1;35m") - set(BoldCyan "${Esc}[1;36m") - set(BoldWhite "${Esc}[1;37m") -endif() - - -# This macro informs why the _header_to_find file has not been found -macro(Print_Find_Header_Status _libname _header_to_find) - - # save _libname upper and lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_INCDIR) - message("${Blue}${LIBNAME}_INCDIR is defined but ${_header_to_find}" - "has not been found in ${${LIBNAME}_INCDIR}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Blue}${LIBNAME}_DIR is defined but" - "${_header_to_find} has not been found in" - "${${LIBNAME}_DIR}/include${ColourReset}") - else() - message("${Blue}${_header_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_INCDIR" - "are defined so that we looked for ${_header_to_find} in" - "system paths (INCLUDE, CPATH, C_INCLUDE_PATH," - "INCLUDE_PATH, CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES" - ", CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)${ColourReset}") - if(_inc_env) - message("${Blue}${_header_to_find} has not been found in" - "${_inc_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldBlue}Please indicate where to find ${_header_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the headers with cmake option: -D${LIBNAME}_INCDIR=your/path/to/${libname}/include/\n" - "- Option 3: Update your environment variable (INCLUDE or CPATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - #message(" ") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${${LIBNAME}_LIBDIR}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${${LIBNAME}_DIR}/lib(or /lib32 or" - "/lib64)${ColourReset}") - else() - message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we looked for ${_lib_to_find} in" - "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," - "Mac: DYLD_LIBRARY_PATH," - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," - "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we look for ${_lib_to_find} in" - "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," - "Mac: DYLD_LIBRARY_PATH," - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," - "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_CheckFunc_Status _name) - - # save _libname upper/lower case - string(TOUPPER ${_name} FUNCNAME) - string(TOLOWER ${_name} funcname) - - # print status - #message(" ") - message("${Red}Libs have been found but check of symbol ${_name} failed " - "with following libraries ${ARGN}${ColourReset}") - message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log" - "to figure out why it fails${ColourReset}") - #message(" ") - -endmacro() - -# This macro informs that _pc_to_find file has not been found in the list -# path you give as last argument (read in ${ARGN}) -# ex: Print_Find_Pkgconfig_Status(foo foo.pc ${PATHLIST} -macro(Print_Find_Pkgconfig_Status _libname _pc_to_find) - - # save _libname lower case - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - message("${Magenta}${_pc_to_find} has not been found in" - "${ARGN}${ColourReset}") - message("${BoldMagenta}If you really want to use the pkg-config file of" - "${libname}, please update your PKG_CONFIG_PATH with the path" - "where ${_pc_to_find} states${ColourReset}") - #message(" ") - -endmacro() diff --git a/cmake_modules/morse/RulesPrecisions.cmake b/cmake_modules/morse/RulesPrecisions.cmake deleted file mode 100644 index bef0c4418..000000000 --- a/cmake_modules/morse/RulesPrecisions.cmake +++ /dev/null @@ -1,257 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file RulesPrecisions.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Thomas Herault -# @author George Bosilca -# @author Aurelien Bouteiller -# @author Mathieu Faverge -# @author Florent Puvost -# @date 13-07-2012 -# -### -cmake_minimum_required(VERSION 2.8) -include(CMakeDependentOption) - -set(RP_GENDEPENDENCIES ${MORSE_CMAKE_MODULE_PATH}/precision_generator/genDependencies.py) -set(RP_CODEGEN ${MORSE_CMAKE_MODULE_PATH}/precision_generator/codegen.py) - -# Dictionnary -# ----------- -if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ) - message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_DICTIONNARY was defined (Default is used)" ) - set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py - CACHE INTERNAL "Dictionnary used for precision generation" ) -else() - set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY} - CACHE INTERNAL "Dictionnary used for precision generation" ) -endif() - -# Default Precisions -# ------------------ -if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_PRECISIONS ) - message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_PRECISIONS was defined (\"s;d;c;z\" is used)" ) - set(RP_${CMAKE_PROJECT_NAME}_PRECISIONS "s;d;c;z" - CACHE INTERNAL "Set of available precisions for the project" ) -else() - set(RP_${CMAKE_PROJECT_NAME}_PRECISIONS ${RP_${CMAKE_PROJECT_NAME}_PRECISIONS} - CACHE INTERNAL "Set of available precisions for the project" ) -endif() - -# Detect if compilation is done in or out of place -# ------------------------------------------------ -string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" __inplace) -set( ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ${__inplace} - CACHE INTERNAL "Defines if the project compilation is made inplace or not" ) - -# Detect default settings -# ----------------------- -set( _prec_S OFF ) -set( _prec_D OFF ) -set( _prec_DS OFF ) -set( _prec_C OFF ) -set( _prec_Z OFF ) -set( _prec_ZC OFF ) -foreach(_prec ${RP_${CMAKE_PROJECT_NAME}_PRECISIONS}) - if ( ${_prec} STREQUAL "zc" ) - set( _prec_S ON ) - set( _prec_D ON ) - set( _prec_C ON ) - set( _prec_Z ON ) - set( _prec_ZC ON ) - elseif( ${_prec} STREQUAL "z" ) - set( _prec_D ON ) - set( _prec_Z ON ) - elseif( ${_prec} STREQUAL "c" ) - set( _prec_S ON ) - set( _prec_C ON ) - elseif( ${_prec} STREQUAL "ds" ) - set( _prec_S ON ) - set( _prec_D ON ) - set( _prec_DS ON ) - elseif( ${_prec} STREQUAL "d" ) - set( _prec_S ON ) - elseif( ${_prec} STREQUAL "s" ) - set( _prec_S ON ) - endif() -endforeach() - -# set computed precisions -# ----------------------- -if( ${_prec_S} ) - option(${PROJECT_NAME}_PREC_S - "Build ${PROJECT_NAME} real single precision" ON) -endif() -if( ${_prec_D} ) - option(${PROJECT_NAME}_PREC_D - "Build ${PROJECT_NAME} real double precision" ON) -endif() - -if( ${_prec_C} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_C - "Build ${PROJECT_NAME} complex single precision" ON "${PROJECT_NAME}_PREC_S" OFF) -endif() -if( ${_prec_Z} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_Z - "Build ${PROJECT_NAME} complex double precision" ON "${PROJECT_NAME}_PREC_D" OFF) -endif() - -if( ${_prec_DS} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_DS - "Build ${PROJECT_NAME} real mixed precision" ON "${PROJECT_NAME}_PREC_S;${PROJECT_NAME}_PREC_D" OFF) -endif() -if( ${_prec_ZC} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_ZC - "Build ${PROJECT_NAME} complex mixed precision" ON "${PROJECT_NAME}_PREC_C;${PROJECT_NAME}_PREC_Z" OFF) -endif() - -# Define precision supported by the project -# ----------------------------------------- -set( ${CMAKE_PROJECT_NAME}_PRECISION "" ) -if(${CMAKE_PROJECT_NAME}_PREC_S) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "s") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_D) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "d") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_DS) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "ds") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_C) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "c") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_Z) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "z") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_ZC) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "zc") -endif() - -# -# Generates a rule for every SOURCES file, to create the precisions in PRECISIONS. If TARGETDIR -# is not empty then all generated files will be prepended with the $TARGETDIR/. -# A new file is created, from a copy by default -# If the first precision is "/", all occurences of the basename in the file are remplaced by -# "pbasename" where p is the selected precision. -# the target receives a -DPRECISION_p in its cflags. -# -include(ParseArguments) -find_package(PythonInterp REQUIRED) - -MACRO(precisions_rules_py) - PARSE_ARGUMENTS(PREC_RULE "TARGETDIR;PRECISIONS" "" ${ARGN}) - - message(STATUS "Generate precision dependencies in ${CMAKE_CURRENT_SOURCE_DIR}") - - # The first is the output variable list - CAR(OUTPUTLIST ${PREC_RULE_DEFAULT_ARGS}) - # Everything else should be source files. - CDR(SOURCES ${PREC_RULE_DEFAULT_ARGS}) - - if( NOT DEFINED ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ) - message( FATAL_ERROR "precisions_rules_init must be called before any call to precisions_rules_py" ) - endif() - - if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ) - message( FATAL_ERROR "precisions_rules_init must be called before any call to precisions_rules_py" ) - endif() - - # By default the TARGETDIR is the current binary directory - if( "${PREC_RULE_TARGETDIR}" STREQUAL "" ) - set(PREC_RULE_TARGETDIR "./") - set(PRECISIONPP_prefix "./") - set(PRECISIONPP_arg "-P") - else( "${PREC_RULE_TARGETDIR}" STREQUAL "" ) - if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR}) - else(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR}) - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR}) - endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR}) - set(PRECISIONPP_arg "-P") - set(PRECISIONPP_prefix "${PREC_RULE_TARGETDIR}") - endif( "${PREC_RULE_TARGETDIR}" STREQUAL "" ) - - set(options_list "") - foreach(prec_rules_PREC ${PREC_RULE_PRECISIONS}) - set(options_list "${options_list} ${prec_rules_PREC}") - endforeach() - - set(sources_list "") - foreach(_src ${SOURCES}) - set(sources_list "${sources_list} ${_src}") - endforeach() - - set(gencmd ${PYTHON_EXECUTABLE} ${RP_GENDEPENDENCIES} -f "${sources_list}" -p "${options_list}" -s "${CMAKE_CURRENT_SOURCE_DIR}" ${PRECISIONPP_arg} ${PRECISIONPP_prefix}) - EXECUTE_PROCESS(COMMAND ${gencmd} OUTPUT_VARIABLE dependencies_list) - - foreach(_dependency ${dependencies_list}) - - string(STRIP "${_dependency}" _dependency) - string(COMPARE NOTEQUAL "${_dependency}" "" not_empty) - if( not_empty ) - - string(REGEX REPLACE "^(.*),(.*),(.*)$" "\\1" _dependency_INPUT "${_dependency}") - set(_dependency_PREC "${CMAKE_MATCH_2}") - set(_dependency_OUTPUT "${CMAKE_MATCH_3}") - - set(pythoncmd ${PYTHON_EXECUTABLE} ${RP_CODEGEN} -f ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} -p ${_dependency_PREC} ${PRECISIONPP_arg} ${PRECISIONPP_prefix}) - - string(STRIP "${_dependency_OUTPUT}" _dependency_OUTPUT) - string(COMPARE NOTEQUAL "${_dependency_OUTPUT}" "" got_file) - - # Force the copy of the original files in the binary_dir - # for VPATH compilation - if( NOT ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ) - set(generate_out 1) - else( NOT ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ) - string(COMPARE NOTEQUAL "${_dependency_OUTPUT}" "${_dependency_INPUT}" generate_out ) - endif() - - # We generate a dependency only if a file will be generated - if( got_file ) - if( generate_out ) - # the custom command is executed in CMAKE_CURRENT_BINARY_DIR - ADD_CUSTOM_COMMAND( - OUTPUT ${_dependency_OUTPUT} - COMMAND ${CMAKE_COMMAND} -E remove -f ${_dependency_OUTPUT} && ${pythoncmd} && chmod a-w ${_dependency_OUTPUT} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} ${RP_CODEGEN} ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY}) - - set_SOURCE_FILES_PROPERTIES(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 1 IS_IN_BINARY_DIR 1 ) - - else( generate_out ) - set_SOURCE_FILES_PROPERTIES(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 0 ) - endif( generate_out ) - - list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT}) - endif( got_file ) - endif() - endforeach() - - message(STATUS "Generate precision dependencies in ${CMAKE_CURRENT_SOURCE_DIR} - Done") - -ENDMACRO(precisions_rules_py) - -## -## @end file RulesPrecisions.cmake -## diff --git a/cmake_modules/morse/find/FindBLAS.cmake b/cmake_modules/morse/find/FindBLAS.cmake deleted file mode 100644 index 8dc9c5645..000000000 --- a/cmake_modules/morse/find/FindBLAS.cmake +++ /dev/null @@ -1,918 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find BLAS library -# This module finds an installed fortran library that implements the BLAS -# linear-algebra interface (see http://www.netlib.org/blas/). -# The list of libraries searched for is taken -# from the autoconf macro file, acx_blas.m4 (distributed at -# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). -# -# This module sets the following variables: -# BLAS_FOUND - set to true if a library implementing the BLAS interface -# is found -# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l -# and -L). -# BLAS_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use BLAS -# BLAS95_LIBRARIES - uncached list of libraries (using full path name) -# to link against to use BLAS95 interface -# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface -# is found -# BLA_STATIC if set on this determines what kind of linkage we do (static) -# BLA_VENDOR if set checks only the specified vendor, if not set checks -# all the possibilities -# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DBLAS_DIR=path/to/blas): -# BLAS_DIR - Where to find the base directory of blas -# BLAS_INCDIR - Where to find the header files -# BLAS_LIBDIR - Where to find the library files -########## -### List of vendors (BLA_VENDOR) valid in this module -########## List of vendors (BLA_VENDOR) valid in this module -## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), -## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model), -## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic -# C/CXX should be enabled to use Intel mkl - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -# Set some colors -if(NOT WIN32) - string(ASCII 27 Esc) - set(ColourReset "${Esc}[m") - set(ColourBold "${Esc}[1m") - set(Red "${Esc}[31m") - set(Green "${Esc}[32m") - set(Yellow "${Esc}[33m") - set(Blue "${Esc}[34m") - set(Magenta "${Esc}[35m") - set(Cyan "${Esc}[36m") - set(White "${Esc}[37m") - set(BoldRed "${Esc}[1;31m") - set(BoldGreen "${Esc}[1;32m") - set(BoldYellow "${Esc}[1;33m") - set(BoldBlue "${Esc}[1;34m") - set(BoldMagenta "${Esc}[1;35m") - set(BoldCyan "${Esc}[1;36m") - set(BoldWhite "${Esc}[1;37m") -endif() - -## Some macros to print status when search for headers and libs -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we look for ${_lib_to_find} in" - "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," - "Mac: DYLD_LIBRARY_PATH," - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," - "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_CheckFunc_Status _name) - - # save _libname upper/lower case - string(TOUPPER ${_name} FUNCNAME) - string(TOLOWER ${_name} funcname) - - # print status - #message(" ") - message("${Red}Libs have been found but check of symbol ${_name} failed " - "with following libraries ${ARGN}${ColourReset}") - message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log" - "to figure out why it fails${ColourReset}") - #message(" ") - -endmacro() - -if (NOT BLAS_FOUND) - set(BLAS_DIR "" CACHE PATH "Root directory of BLAS library") - if (NOT BLAS_FIND_QUIETLY) - message(STATUS "A cache variable, namely BLAS_DIR, has been set to specify the install directory of BLAS") - endif() -endif() - -option(BLAS_VERBOSE "Print some additional information during BLAS -libraries detection" OFF) - -include(CheckFunctionExists) -include(CheckFortranFunctionExists) - -set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -# Check the language being used -get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) -if( _LANGUAGES_ MATCHES Fortran ) - set( _CHECK_FORTRAN TRUE ) -elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) - set( _CHECK_FORTRAN FALSE ) -else() - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") - else() - message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") - return() - endif() -endif() - -macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - - set(_libdir ${ARGN}) - - set(_libraries_work TRUE) - set(${LIBRARIES} ${_flags}) - set(_combined_name) - if (NOT _libdir) - if (BLAS_DIR) - list(APPEND _libdir "${BLAS_DIR}") - list(APPEND _libdir "${BLAS_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${BLAS_DIR}/lib64") - list(APPEND _libdir "${BLAS_DIR}/lib/intel64") - else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") - endif() - endif () - if (BLAS_LIBDIR) - list(APPEND _libdir "${BLAS_LIBDIR}") - endif () - if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${_libdir2}") - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif () - - if (BLAS_VERBOSE) - message("${Cyan}Try to find BLAS libraries: ${_list}") - endif () - - foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else () - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif () - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - HINTS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - # Print status if not found - # ------------------------- - if (NOT ${_prefix}_${_library}_LIBRARY AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE) - Print_Find_Library_Blas_Status(blas ${_library} ${_libdir}) - endif () - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) - endforeach(_library ${_list}) - - if(_libraries_work) - # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) - if (BLAS_VERBOSE) - message("${Cyan}BLAS libs found. Try to compile symbol ${_name} with" - "following libraries: ${CMAKE_REQUIRED_LIBRARIES}") - endif () - if(NOT BLAS_FOUND) - unset(${_prefix}${_combined_name}_WORKS CACHE) - endif() - if (_CHECK_FORTRAN) - check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) - else() - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - endif() - mark_as_advanced(${_prefix}${_combined_name}_WORKS) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) - # Print status if not found - # ------------------------- - if (NOT _libraries_work AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE) - Print_Find_Library_Blas_CheckFunc_Status(${_name} ${CMAKE_REQUIRED_LIBRARIES}) - endif () - set(CMAKE_REQUIRED_LIBRARIES) - endif() - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) - else() - set(${LIBRARIES} FALSE) - endif() - -# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") - -endmacro(Check_Fortran_Libraries) - - -set(BLAS_LINKER_FLAGS) -set(BLAS_LIBRARIES) -set(BLAS95_LIBRARIES) -if ($ENV{BLA_VENDOR} MATCHES ".+") - set(BLA_VENDOR $ENV{BLA_VENDOR}) -else () - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif() -endif () - -#BLAS in intel mkl 10 library? (em64t 64bit) -if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") - - if (NOT WIN32) - set(LM "-lm") - endif () - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) - find_package(Threads) - else() - find_package(Threads REQUIRED) - endif() - - set(BLAS_SEARCH_LIBS "") - - set(additional_flags) - if(NOT WIN32) - if (CMAKE_Fortran_COMPILER MATCHES ".+f95.*" OR - CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND additional_flags "-Wl,--no-as-needed") - endif () - endif() - - if(BLA_F95) - - set(BLAS_mkl_SEARCH_SYMBOL SGEMM) - set(_LIBRARIES BLAS95_LIBRARIES) - if (WIN32) - if (BLA_STATIC) - set(BLAS_mkl_DLL_SUFFIX "") - else() - set(BLAS_mkl_DLL_SUFFIX "_dll") - endif() - - # Find the main file (32-bit or 64-bit) - set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") - endif () - - # Add threading/sequential libs - set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - endif() - - # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) - list(APPEND BLAS_SEARCH_LIBS - "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") - endforeach() - endforeach() - else (WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") - # mkl >= 10.3 - get_filename_component(CMAKE_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME) - if (CMAKE_C_COMPILER_NAME STREQUAL "gcc" OR - CMAKE_C_COMPILER_NAME STREQUAL "cc") - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") - else () - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") - endif () - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_sequential mkl_core") - endif () - endif (WIN32) - - else (BLA_F95) - - set(BLAS_mkl_SEARCH_SYMBOL sgemm) - set(_LIBRARIES BLAS_LIBRARIES) - if (WIN32) - if (BLA_STATIC) - set(BLAS_mkl_DLL_SUFFIX "") - else() - set(BLAS_mkl_DLL_SUFFIX "_dll") - endif() - - # Find the main file (32-bit or 64-bit) - set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") - endif () - - # Add threading/sequential libs - set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - - # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) - list(APPEND BLAS_SEARCH_LIBS - "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") - endforeach() - endforeach() - else (WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel mkl_intel_thread mkl_core guide") - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_intel_thread mkl_core guide") - - # mkl >= 10.3 - get_filename_component(CMAKE_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME) - if (CMAKE_C_COMPILER_NAME STREQUAL "gcc" OR - CMAKE_C_COMPILER_NAME STREQUAL "cc") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") - else () - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_intel_thread mkl_core iomp5") - endif () - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_sequential mkl_core") - endif () - - #older vesions of intel mkl libs - if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl") - list(APPEND BLAS_SEARCH_LIBS - "mkl_ia32") - list(APPEND BLAS_SEARCH_LIBS - "mkl_em64t") - endif () - endif (WIN32) - - endif (BLA_F95) - - foreach (IT ${BLAS_SEARCH_LIBS}) - string(REPLACE " " ";" SEARCH_LIBS ${IT}) - if (${_LIBRARIES}) - else () - check_fortran_libraries( - ${_LIBRARIES} - BLAS - ${BLAS_mkl_SEARCH_SYMBOL} - "${additional_flags}" - "${SEARCH_LIBS}" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif() - endforeach () - - endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - -endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "goto2" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "f77blas;atlas" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "sgemm;dgemm;blas" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in Alpha CXML library? -if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "cxml" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in Alpha DXML library? (now called CXML, see above) -if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "dxml" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in Sun Performance library? -if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "-xlic_lib=sunperf" - "sunperf;sunmath" - "" - ) - if(BLAS_LIBRARIES) - set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") - endif() - endif() - -endif () - - -# BLAS in SCSL library? (SGI/Cray Scientific Library) -if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "scsl" - "" - ) - endif() - -endif () - - -# BLAS in SGIMATH library? -if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "complib.sgimath" - "" - ) - endif() - -endif () - - -# BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "essl;blas" - "" - ) - endif() - -endif () - - -#BLAS in acml library? -if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") - - if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR - ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR - ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))) - - # try to find acml in "standard" paths - if( WIN32 ) - file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) - else() - file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) - endif() - if( WIN32 ) - file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) - else() - file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) - endif() - list(GET _ACML_ROOT 0 _ACML_ROOT) - list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) - - if( _ACML_ROOT ) - - get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) - if( SIZEOF_INTEGER EQUAL 8 ) - set( _ACML_PATH_SUFFIX "_int64" ) - else() - set( _ACML_PATH_SUFFIX "" ) - endif() - if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) - set( _ACML_COMPILER32 "ifort32" ) - set( _ACML_COMPILER64 "ifort64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) - set( _ACML_COMPILER32 "sun32" ) - set( _ACML_COMPILER64 "sun64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) - set( _ACML_COMPILER32 "pgi32" ) - if( WIN32 ) - set( _ACML_COMPILER64 "win64" ) - else() - set( _ACML_COMPILER64 "pgi64" ) - endif() - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) - # 32 bit builds not supported on Open64 but for code simplicity - # We'll just use the same directory twice - set( _ACML_COMPILER32 "open64_64" ) - set( _ACML_COMPILER64 "open64_64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) - set( _ACML_COMPILER32 "nag32" ) - set( _ACML_COMPILER64 "nag64" ) - else() - set( _ACML_COMPILER32 "gfortran32" ) - set( _ACML_COMPILER64 "gfortran64" ) - endif() - - if( BLA_VENDOR STREQUAL "ACML_MP" ) - set(_ACML_MP_LIB_DIRS - "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) - else() - set(_ACML_LIB_DIRS - "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) - endif() - - endif(_ACML_ROOT) - - elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) - - set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) - - endif() - - if( BLA_VENDOR STREQUAL "ACML_MP" ) - foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() - elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) - foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() - else() - foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() - endif() - - # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml;acml_mv" - "" - ) - endif() - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml_mp;acml_mv" - "" - ) - endif() - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml;acml_mv;CALBLAS" - "" - ) - endif() - -endif (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") # ACML - - -# Apple BLAS library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "Accelerate" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - - if ( NOT BLAS_LIBRARIES ) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "vecLib" - "" - ) - endif () - -endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - - -# Generic BLAS library? -if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "blas" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") - - -if(BLA_F95) - - if(BLAS95_LIBRARIES) - set(BLAS95_FOUND TRUE) - else() - set(BLAS95_FOUND FALSE) - endif() - - if(NOT BLAS_FIND_QUIETLY) - if(BLAS95_FOUND) - message(STATUS "A library with BLAS95 API found.") - message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}") - else(BLAS95_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas 95 libraries could not be found or check of symbols failed." - "\nPlease indicate where to find blas libraries. You have three options:\n" - "- Option 1: Provide the root directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n" - "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure." - "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name." - "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with BLAS95 API not found. Please specify library location.") - else() - message(STATUS - "A library with BLAS95 API not found. Please specify library location.") - endif() - endif(BLAS95_FOUND) - endif(NOT BLAS_FIND_QUIETLY) - - set(BLAS_FOUND TRUE) - set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") - -else(BLA_F95) - - if(BLAS_LIBRARIES) - set(BLAS_FOUND TRUE) - else() - set(BLAS_FOUND FALSE) - endif() - - if(NOT BLAS_FIND_QUIETLY) - if(BLAS_FOUND) - message(STATUS "A library with BLAS API found.") - message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}") - else(BLAS_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas libraries could not be found or check of symbols failed." - "\nPlease indicate where to find blas libraries. You have three options:\n" - "- Option 1: Provide the root directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n" - "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure." - "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name." - "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with BLAS API not found. Please specify library location.") - else() - message(STATUS - "A library with BLAS API not found. Please specify library location.") - endif() - endif(BLAS_FOUND) - endif(NOT BLAS_FIND_QUIETLY) - -endif(BLA_F95) - -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/cmake_modules/morse/find/FindBLASEXT.cmake b/cmake_modules/morse/find/FindBLASEXT.cmake deleted file mode 100644 index 4838e5143..000000000 --- a/cmake_modules/morse/find/FindBLASEXT.cmake +++ /dev/null @@ -1,335 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find BLAS EXTENDED for MORSE projects: find include dirs and libraries -# -# This module allows to find BLAS libraries by calling the official FindBLAS module -# and handles the creation of different library lists whether the user wishes to link -# with a sequential BLAS or a multihreaded (BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES). -# BLAS is detected with a FindBLAS call then if the BLAS vendor is Intel10_64lp or ACML -# then the module tries to find the corresponding multithreaded libraries. -# -# The following variables have been added to manage links with sequential or multithreaded -# versions: -# BLAS_INCLUDE_DIRS - BLAS include directories -# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries -# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential) -# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -# add a cache variable to let the user specify the BLAS vendor -set(BLA_VENDOR "" CACHE STRING "list of possible BLAS vendor: - Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, - Intel10_32 (intel mkl v10 32 bit), - Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), - Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model), - Intel( older versions of mkl 32 and 64 bit), - ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - - -if (NOT BLAS_FOUND) - # First try to detect two cases: - # 1: only SEQ libs are handled - # 2: both SEQ and PAR libs are handled - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() -endif () - -# detect the cases where SEQ and PAR libs are handled -if(BLA_VENDOR STREQUAL "All" AND - (BLAS_mkl_core_LIBRARY OR BLAS_mkl_core_dll_LIBRARY) - ) - set(BLA_VENDOR "Intel") - if(BLAS_mkl_intel_LIBRARY) - set(BLA_VENDOR "Intel10_32") - endif() - if(BLAS_mkl_intel_lp64_LIBRARY) - set(BLA_VENDOR "Intel10_64lp") - endif() - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we" - "have also potentially detected some BLAS libraries from the MKL." - "We try to use this one.") - message(STATUS "If you want to force the use of one specific library, " - "please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name" - "at cmake configure.") - message(STATUS "List of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, " - "DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model)," - "Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit)," - "ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - endif() - set(BLAS_FOUND "") -elseif(BLA_VENDOR STREQUAL "All" AND BLAS_acml_LIBRARY) - set(BLA_VENDOR "ACML") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we" - "have also potentially detected some BLAS libraries from the ACML." - "We try to use this one.") - message(STATUS "If you want to force the use of one specific library, " - "please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name" - "at cmake configure.") - message(STATUS "List of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, " - "DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model)," - "Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit)," - "ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - endif() - set(BLAS_FOUND "") -endif() - -# Intel case -if(BLA_VENDOR MATCHES "Intel*") - - ### - # look for include path if the BLAS vendor is Intel - ### - - # gather system include paths - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # find mkl.h inside known include paths - set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND") - if(BLAS_INCDIR) - set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND") - find_path(BLAS_mkl.h_INCLUDE_DIRS - NAMES mkl.h - HINTS ${BLAS_INCDIR}) - else() - if(BLAS_DIR) - set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND") - find_path(BLAS_mkl.h_INCLUDE_DIRS - NAMES mkl.h - HINTS ${BLAS_DIR} - PATH_SUFFIXES include) - else() - set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND") - find_path(BLAS_mkl.h_INCLUDE_DIRS - NAMES mkl.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(BLAS_mkl.h_INCLUDE_DIRS) - ## Print status if not found - ## ------------------------- - #if (NOT BLAS_mkl.h_INCLUDE_DIRS AND MORSE_VERBOSE) - # Print_Find_Header_Status(blas mkl.h) - #endif () - set(BLAS_INCLUDE_DIRS "") - if(BLAS_mkl.h_INCLUDE_DIRS) - list(APPEND BLAS_INCLUDE_DIRS "${BLAS_mkl.h_INCLUDE_DIRS}" ) - endif() - - ### - # look for libs - ### - # if Intel 10 64 bit -> look for sequential and multithreaded versions - if(BLA_VENDOR MATCHES "Intel10_64lp*") - - ## look for the sequential version - set(BLA_VENDOR "Intel10_64lp_seq") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "Look for the sequential version Intel10_64lp_seq") - endif() -# if(NOT BLAS_FOUND AND BLASEXT_FIND_REQUIRED) - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() - if(BLAS_FOUND) - set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}") - endif() - - ## look for the multithreaded version - set(BLA_VENDOR "Intel10_64lp") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "Look for the multithreaded version Intel10_64lp") - endif() - find_package(BLAS) - if(BLAS_FOUND) - set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - endif() - - else() - - if(BLAS_FOUND) - set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}") - endif() - - endif() - -# ACML case -elseif(BLA_VENDOR MATCHES "ACML*") - - ## look for the sequential version - set(BLA_VENDOR "ACML") - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() - if(BLAS_FOUND) - set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}") - endif() - - ## look for the multithreaded version - set(BLA_VENDOR "ACML_MP") - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else(BLAS_FOUND) - find_package(BLAS) - endif() - if(BLAS_FOUND) - set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - endif() - -else() - - if(BLAS_FOUND) - # define the SEQ libs as the BLAS_LIBRARIES - set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}") - endif() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - -endif() - - -if(BLAS_SEQ_LIBRARIES) - set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}") -endif() -# message("DEBUG BLAS: ${BLAS_SEQ_LIBRARIES} ${BLAS_LIBRARIES}") - -# extract libs paths -# remark: because it is not given by find_package(BLAS) -set(BLAS_LIBRARY_DIRS "") -foreach(blas_lib ${BLAS_LIBRARIES}) - get_filename_component(a_blas_lib_dir "${blas_lib}" PATH) - list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" ) -endforeach() -if (BLAS_LIBRARY_DIRS) - list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS) -endif () - - -# message(STATUS "BLAS_FOUND: ${BLAS_FOUND}") -# message(STATUS "BLA_VENDOR: ${BLA_VENDOR}") -# message(STATUS "BLAS_LIBRARIES: ${BLAS_LIBRARIES}") -# message(STATUS "BLAS_SEQ_LIBRARIES: ${BLAS_SEQ_LIBRARIES}") -# message(STATUS "BLAS_PAR_LIBRARIES: ${BLAS_PAR_LIBRARIES}") -# message(STATUS "BLAS_INCLUDE_DIRS: ${BLAS_INCLUDE_DIRS}") -# message(STATUS "BLAS_LIBRARY_DIRS: ${BLAS_LIBRARY_DIRS}") - -# check that BLAS has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -if(BLA_VENDOR MATCHES "Intel*") - if(BLA_VENDOR MATCHES "Intel10_64lp*") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS found is Intel MKL:" - "we manage two lists of libs," - " one sequential and one parallel if found (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)") - message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(BLAS DEFAULT_MSG - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS - BLAS_INCLUDE_DIRS) - if(BLAS_PAR_LIBRARIES) - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES") - endif() - find_package_handle_standard_args(BLAS DEFAULT_MSG - BLAS_PAR_LIBRARIES) - endif() - else() - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(BLAS DEFAULT_MSG - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS - BLAS_INCLUDE_DIRS) - endif() -elseif(BLA_VENDOR MATCHES "ACML*") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS found is ACML:" - "we manage two lists of libs," - " one sequential and one parallel if found (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)") - message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(BLAS DEFAULT_MSG - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS - BLAS_INCLUDE_DIRS) - if(BLAS_PAR_LIBRARIES) - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES") - endif() - find_package_handle_standard_args(BLAS DEFAULT_MSG - BLAS_PAR_LIBRARIES) - endif() -else() - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(BLAS DEFAULT_MSG - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS) -endif() diff --git a/cmake_modules/morse/find/FindCBLAS.cmake b/cmake_modules/morse/find/FindCBLAS.cmake deleted file mode 100644 index 534effce8..000000000 --- a/cmake_modules/morse/find/FindCBLAS.cmake +++ /dev/null @@ -1,300 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find CBLAS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(CBLAS -# [REQUIRED] # Fail with error if cblas is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and cblas library. -# Results are reported in variables: -# CBLAS_FOUND - True if headers and requested libraries were found -# CBLAS_INCLUDE_DIRS - cblas include directories -# CBLAS_LIBRARY_DIRS - Link directories for cblas libraries -# CBLAS_LIBRARIES - cblas component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DCBLAS_DIR=path/to/cblas): -# CBLAS_DIR - Where to find the base directory of cblas -# CBLAS_INCDIR - Where to find the header files -# CBLAS_LIBDIR - Where to find the library files -# CBLAS could be directly embedded in BLAS library (ex: Intel MKL) so that -# we test a cblas function with the blas libraries found and set CBLAS -# variables to BLAS ones if test is successful. To skip this feature and -# look for a stand alone cblas, please add the following in your -# CMakeLists.txt before to call find_package(CBLAS): -# set(CBLAS_STANDALONE TRUE) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT CBLAS_FOUND) - set(CBLAS_DIR "" CACHE PATH "Root directory of CBLAS library") - if (NOT CBLAS_FIND_QUIETLY) - message(STATUS "A cache variable, namely CBLAS_DIR, has been set to specify the install directory of CBLAS") - endif() -endif() - - -# CBLAS may depend on BLASEXT -# try to find it specified as COMPONENTS during the call -if (CBLAS_FIND_COMPONENTS) - foreach( component ${CBLAS_FIND_COMPONENTS} ) - if(CBLAS_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(CBLAS_${component}_FOUND TRUE) - else() - set(CBLAS_${component}_FOUND FALSE) - endif() - endforeach() -endif () - - -# CBLAS depends on BLAS anyway, try to find it -if (NOT BLAS_FOUND) - if(CBLAS_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() -endif() - - -# find CBLAS -if (BLAS_FOUND) - - if (NOT CBLAS_STANDALONE) - # check if a cblas function exists in the BLAS lib - # this can be the case with libs such as MKL, ACML - include(CheckFunctionExists) - set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}") - unset(CBLAS_WORKS CACHE) - check_function_exists(cblas_dscal CBLAS_WORKS) - mark_as_advanced(CBLAS_WORKS) - set(CMAKE_REQUIRED_LIBRARIES) - - if(CBLAS_WORKS) - if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas: test with blas succeeds") - endif() - # test succeeds: CBLAS is in BLAS - set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}") - set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}") - if(BLAS_INCLUDE_DIRS) - set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}") - endif() - endif() - endif (NOT CBLAS_STANDALONE) - - if (CBLAS_STANDALONE OR NOT CBLAS_WORKS) - - if(NOT CBLAS_WORKS AND NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas : test with blas fails") - endif() - # test fails: try to find CBLAS lib exterior to BLAS - - # Try to find CBLAS lib - ####################### - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the cblas header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(CBLAS_INCDIR) - set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND") - find_path(CBLAS_cblas.h_DIRS - NAMES cblas.h - HINTS ${CBLAS_INCDIR}) - else() - if(CBLAS_DIR) - set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND") - find_path(CBLAS_cblas.h_DIRS - NAMES cblas.h - HINTS ${CBLAS_DIR} - PATH_SUFFIXES include) - else() - set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND") - find_path(CBLAS_cblas.h_DIRS - NAMES cblas.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(CBLAS_cblas.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (CBLAS_cblas.h_DIRS) - set(CBLAS_INCLUDE_DIRS "${CBLAS_cblas.h_DIRS}") - else () - set(CBLAS_INCLUDE_DIRS "CBLAS_INCLUDE_DIRS-NOTFOUND") - if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas -- cblas.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the cblas lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(CBLAS_LIBDIR) - set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") - find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${CBLAS_LIBDIR}) - else() - if(CBLAS_DIR) - set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") - find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${CBLAS_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") - find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(CBLAS_cblas_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (CBLAS_cblas_LIBRARY) - get_filename_component(cblas_lib_path "${CBLAS_cblas_LIBRARY}" PATH) - # set cmake variables - set(CBLAS_LIBRARIES "${CBLAS_cblas_LIBRARY}") - set(CBLAS_LIBRARY_DIRS "${cblas_lib_path}") - else () - set(CBLAS_LIBRARIES "CBLAS_LIBRARIES-NOTFOUND") - set(CBLAS_LIBRARY_DIRS "CBLAS_LIBRARY_DIRS-NOTFOUND") - if (NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas -- lib cblas not found") - endif() - endif () - - if(CBLAS_LIBRARIES) - # check a function to validate the find - if (CBLAS_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}") - endif() - if (BLAS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${CBLAS_LIBRARIES};${BLAS_LIBRARIES}") - if (CBLAS_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${CBLAS_LIBRARY_DIRS}") - endif() - if (BLAS_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${BLAS_LIBRARY_DIRS}") - endif() - - unset(CBLAS_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(cblas_dscal CBLAS_WORKS) - mark_as_advanced(CBLAS_WORKS) - - if(CBLAS_WORKS) - set(CBLAS_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - set(CBLAS_LIBRARY_DIRS "${CBLAS_LIBRARY_DIRS}" "${BLAS_LIBRARY_DIRS}") - set(CBLAS_INCLUDE_DIRS "${CMAKE_REQUIRED_INCLUDES}") - else() - if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails") - message(STATUS "CBLAS_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "CBLAS_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "CBLAS_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for cblas : set CBLAS_LIBRARIES to NOTFOUND") - endif() - set(CBLAS_LIBRARIES "CBLAS_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(CBLAS_LIBRARIES) - - endif (CBLAS_STANDALONE OR NOT CBLAS_WORKS) - -else(BLAS_FOUND) - - if (NOT CBLAS_FIND_QUIETLY) - message(STATUS "CBLAS requires BLAS but BLAS has not been found." - "Please look for BLAS first.") - endif() - -endif(BLAS_FOUND) - - -# check that CBLAS has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CBLAS DEFAULT_MSG - CBLAS_LIBRARIES) diff --git a/cmake_modules/morse/find/FindCHAMELEON.cmake b/cmake_modules/morse/find/FindCHAMELEON.cmake deleted file mode 100644 index 78607b2b5..000000000 --- a/cmake_modules/morse/find/FindCHAMELEON.cmake +++ /dev/null @@ -1,586 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find CHAMELEON include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(CHAMELEON -# [REQUIRED] # Fail with error if chameleon is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# Components available: -# STARPU (default) or QUARK (not both can be activated): choose one of these runtimes -# CUDA (comes with cuBLAS): for use of GPUs -# MAGMA: for linear algebra on GPUs -# MPI: for use of multiple nodes of distributed memory -# This module finds headers and chameleon library. -# Results are reported in variables: -# CHAMELEON_FOUND - True if headers and requested libraries were found -# CHAMELEON_INCLUDE_DIRS - chameleon include directories -# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DCHAMELEON_DIR=path/to/chameleon): -# CHAMELEON_DIR - Where to find the base directory of chameleon -# CHAMELEON_INCDIR - Where to find the header files -# CHAMELEON_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT CHAMELEON_FOUND) - set(CHAMELEON_DIR "" CACHE PATH "Root directory of CHAMELEON library") - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "A cache variable, namely CHAMELEON_DIR, has been set to specify the install directory of CHAMELEON") - endif() -endif() - -# Try to find CHAMELEON dependencies if specified as COMPONENTS during the call -if( CHAMELEON_FIND_COMPONENTS ) - foreach( component ${CHAMELEON_FIND_COMPONENTS} ) - if(CHAMELEON_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(CHAMELEON_${component}_FOUND TRUE) - # should we have these variables available in gui modes? - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() - if (CUDA_FOUND) - mark_as_advanced(CUDA_BUILD_CUBIN) - mark_as_advanced(CUDA_BUILD_EMULATION) - mark_as_advanced(CUDA_SDK_ROOT_DIR) - mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR) - mark_as_advanced(CUDA_VERBOSE_BUILD) - endif() - else() - set(CHAMELEON_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE) - - pkg_search_module(CHAMELEON chameleon) - if (NOT CHAMELEON_FIND_QUIETLY) - if (CHAMELEON_FOUND AND CHAMELEON_LIBRARIES) - message(STATUS "Looking for CHAMELEON - found using PkgConfig") - #if(NOT CHAMELEON_INCLUDE_DIRS) - # message("${Magenta}CHAMELEON_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to chameleon headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for CHAMELEON - not found using PkgConfig." - "Perhaps you should add the directory containing chameleon.pc" - "to the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - - if (CHAMELEON_FIND_VERSION_EXACT) - if( NOT (CHAMELEON_FIND_VERSION_MAJOR STREQUAL CHAMELEON_VERSION_MAJOR) OR - NOT (CHAMELEON_FIND_VERSION_MINOR STREQUAL CHAMELEON_VERSION_MINOR) ) - if(NOT CHAMELEON_FIND_QUIETLY) - message(FATAL_ERROR - "CHAMELEON version found is ${CHAMELEON_VERSION_STRING}" - "when required is ${CHAMELEON_FIND_VERSION}") - endif() - endif() - else() - # if the version found is older than the required then error - if( (CHAMELEON_FIND_VERSION_MAJOR STRGREATER CHAMELEON_VERSION_MAJOR) OR - (CHAMELEON_FIND_VERSION_MINOR STRGREATER CHAMELEON_VERSION_MINOR) ) - if(NOT CHAMELEON_FIND_QUIETLY) - message(FATAL_ERROR - "CHAMELEON version found is ${CHAMELEON_VERSION_STRING}" - "when required is ${CHAMELEON_FIND_VERSION} or newer") - endif() - endif() - endif() - -endif(PKG_CONFIG_EXECUTABLE) - -if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES) - - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - PkgConfig not used") - endif() - - # Dependencies detection - # ---------------------- - - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect pthread") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() - set(CHAMELEON_EXTRA_LIBRARIES "") - if( THREADS_FOUND ) - list(APPEND CHAMELEON_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - endif () - - # Add math library to the list of extra - # it normally exists on all common systems provided with a C compiler - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect libm") - endif() - set(CHAMELEON_M_LIBRARIES "") - if(UNIX OR WIN32) - find_library( - CHAMELEON_M_m_LIBRARY - NAMES m - ) - mark_as_advanced(CHAMELEON_M_m_LIBRARY) - if (CHAMELEON_M_m_LIBRARY) - list(APPEND CHAMELEON_M_LIBRARIES "${CHAMELEON_M_m_LIBRARY}") - list(APPEND CHAMELEON_EXTRA_LIBRARIES "${CHAMELEON_M_m_LIBRARY}") - else() - if (CHAMELEON_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find libm on your system." - "Are you sure to a have a C compiler installed?") - endif() - endif() - endif() - - # Try to find librt (libposix4 - POSIX.1b Realtime Extensions library) - # on Unix systems except Apple ones because it does not exist on it - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect librt") - endif() - set(CHAMELEON_RT_LIBRARIES "") - if(UNIX AND NOT APPLE) - find_library( - CHAMELEON_RT_rt_LIBRARY - NAMES rt - ) - mark_as_advanced(CHAMELEON_RT_rt_LIBRARY) - if (CHAMELEON_RT_rt_LIBRARY) - list(APPEND CHAMELEON_RT_LIBRARIES "${CHAMELEON_RT_rt_LIBRARY}") - list(APPEND CHAMELEON_EXTRA_LIBRARIES "${CHAMELEON_RT_rt_LIBRARY}") - else() - if (CHAMELEON_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find librt on your system") - endif() - endif() - endif() - - # CHAMELEON depends on CBLAS - #--------------------------- - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect CBLAS (depends on BLAS)") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(CBLAS REQUIRED COMPONENTS BLASEXT) - else() - find_package(CBLAS COMPONENTS BLASEXT) - endif() - - # CHAMELEON depends on LAPACKE - #----------------------------- - - # standalone version of lapacke seems useless for now - # let the comment in case we meet some problems of non existing lapacke - # functions in lapack library such as mkl, acml, ... - #set(LAPACKE_STANDALONE TRUE) - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect LAPACKE (depends on LAPACK)") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(LAPACKE REQUIRED COMPONENTS LAPACKEXT) - else() - find_package(LAPACKE COMPONENTS LAPACKEXT) - endif() - - # CHAMELEON depends on TMG - #------------------------- - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect TMG (depends on LAPACK)") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(TMG REQUIRED) - else() - find_package(TMG) - endif() - - # CHAMELEON may depend on CUDA/CUBLAS - #------------------------------------ - if (NOT CUDA_FOUND) - find_package(CUDA) - endif() - - # CHAMELEON may depend on MAGMA gpu kernels - # call our cmake module to test (in cmake_modules) - # change this call position if not appropriated - #------------------------------------------------- - if ( CUDA_FOUND ) - set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired") - find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} COMPONENTS CBLAS LAPACK CUDA) - endif() - - # CHAMELEON depends on MPI - #------------------------- - if (NOT MPI_FOUND) - - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - find_package(MPI) - - endif (NOT MPI_FOUND) - - if( NOT STARPU_FOUND AND NOT QUARK_FOUND ) - - set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired") - - # create list of components in order to make a single call to find_package(starpu...) - # we explicitly need a StarPU version built with hwloc - set(STARPU_COMPONENT_LIST "HWLOC") - - # StarPU may depend on MPI - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (CHAMELEON_FIND_REQUIRED_MPI) - if(CHAMELEON_FIND_REQUIRED_MPI) - list(APPEND STARPU_COMPONENT_LIST "MPI") - endif() - endif() - if (CHAMELEON_FIND_REQUIRED_CUDA) - if(CHAMELEON_FIND_REQUIRED_CUDA) - list(APPEND STARPU_COMPONENT_LIST "CUDA") - endif() - endif() - # set the list of optional dependencies we may discover - set(STARPU_OPTIONAL_COMPONENT_LIST "MPI" "CUDA" "MAGMA") - find_package(STARPU ${CHAMELEON_STARPU_VERSION} - COMPONENTS ${STARPU_COMPONENT_LIST} - OPTIONAL_COMPONENTS ${STARPU_OPTIONAL_COMPONENT_LIST}) - - endif() - - if( NOT STARPU_FOUND AND NOT QUARK_FOUND ) - - # try to find quark runtime - find_package(QUARK COMPONENTS HWLOC) - - if (NOT QUARK_FOUND) - message(FATAL_ERROR "Nor StarPU (default runtime) neither QUARK" - "runtimes have been found while at least one of them should be installed") - endif() - - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the chameleon header in the given paths - # --------------------------------------------------- - # call cmake macro to find the header path - if(CHAMELEON_INCDIR) - set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND") - find_path(CHAMELEON_morse.h_DIRS - NAMES morse.h - HINTS ${CHAMELEON_INCDIR}) - else() - if(CHAMELEON_DIR) - set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND") - find_path(CHAMELEON_morse.h_DIRS - NAMES morse.h - HINTS ${CHAMELEON_DIR} - PATH_SUFFIXES "include" "include/chameleon") - else() - set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND") - find_path(CHAMELEON_morse.h_DIRS - NAMES morse.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(CHAMELEON_morse.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (CHAMELEON_morse.h_DIRS) - set(CHAMELEON_INCLUDE_DIRS "${CHAMELEON_morse.h_DIRS}") - else () - set(CHAMELEON_INCLUDE_DIRS "CHAMELEON_INCLUDE_DIRS-NOTFOUND") - if(NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for chameleon -- morse.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the chameleon lib in the given paths - # ------------------------------------------------ - - # create list of libs to find - set(CHAMELEON_libs_to_find "chameleon") - if (STARPU_FOUND) - list(APPEND CHAMELEON_libs_to_find "chameleon_starpu") - elseif (QUARK_FOUND) - list(APPEND CHAMELEON_libs_to_find "chameleon_quark") - endif() - list(APPEND CHAMELEON_libs_to_find "coreblas") - - # call cmake macro to find the lib path - if(CHAMELEON_LIBDIR) - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - set(CHAMELEON_${chameleon_lib}_LIBRARY "CHAMELEON_${chameleon_lib}_LIBRARY-NOTFOUND") - find_library(CHAMELEON_${chameleon_lib}_LIBRARY - NAMES ${chameleon_lib} - HINTS ${CHAMELEON_LIBDIR}) - endforeach() - else() - if(CHAMELEON_DIR) - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - set(CHAMELEON_${chameleon_lib}_LIBRARY "CHAMELEON_${chameleon_lib}_LIBRARY-NOTFOUND") - find_library(CHAMELEON_${chameleon_lib}_LIBRARY - NAMES ${chameleon_lib} - HINTS ${CHAMELEON_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - set(CHAMELEON_${chameleon_lib}_LIBRARY "CHAMELEON_${chameleon_lib}_LIBRARY-NOTFOUND") - find_library(CHAMELEON_${chameleon_lib}_LIBRARY - NAMES ${chameleon_lib} - HINTS ${_lib_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - - get_filename_component(${chameleon_lib}_lib_path ${CHAMELEON_${chameleon_lib}_LIBRARY} PATH) - # set cmake variables (respects naming convention) - if (CHAMELEON_LIBRARIES) - list(APPEND CHAMELEON_LIBRARIES "${CHAMELEON_${chameleon_lib}_LIBRARY}") - else() - set(CHAMELEON_LIBRARIES "${CHAMELEON_${chameleon_lib}_LIBRARY}") - endif() - if (CHAMELEON_LIBRARY_DIRS) - list(APPEND CHAMELEON_LIBRARY_DIRS "${${chameleon_lib}_lib_path}") - else() - set(CHAMELEON_LIBRARY_DIRS "${${chameleon_lib}_lib_path}") - endif() - mark_as_advanced(CHAMELEON_${chameleon_lib}_LIBRARY) - - endforeach(chameleon_lib ${CHAMELEON_libs_to_find}) - - if(CHAMELEON_LIBRARIES) - # check a function to validate the find - if (CHAMELEON_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${CHAMELEON_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_FLAGS) - foreach(libdir ${CHAMELEON_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - set(CMAKE_REQUIRED_LIBRARIES "${CHAMELEON_LIBRARIES}") - if (STARPU_FOUND) - if (STARPU_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}") - endif() - foreach(libdir ${STARPU_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES}") - endif() - if (QUARK_FOUND) - if (QUARK_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "$QUARK_INCLUDE_DIRS}") - endif() - if(QUARK_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${QUARK_LIBRARY_DIRS}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${QUARK_LIBRARIES}") - endif() - if (CUDA_FOUND) - if (CUDA_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}") - endif() - foreach(libdir ${CUDA_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - endif() - if (MAGMA_FOUND) - if (EXISTS MAGMA_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}") - endif() - foreach(libdir ${MAGMA_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${${MAGMA_LIBRARIES}}") - endif() - if (MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}") - endif() - if (HWLOC_FOUND) - if (HWLOC_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}") - endif() - foreach(libdir ${HWLOC_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}") - endif() - if (TMG_FOUND) - if (TMG_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${TMG_INCLUDE_DIRS}") - endif() - foreach(libdir ${TMG_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${TMG_LIBRARIES}") - endif() - if (LAPACKE_FOUND) - if (LAPACKE_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACKE_INCLUDE_DIRS}") - endif() - foreach(libdir ${LAPACKE_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${LAPACKE_LIBRARIES}") - endif() - if (CBLAS_FOUND) - if (CBLAS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}") - endif() - foreach(libdir ${CBLAS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${CBLAS_LIBRARIES}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES ${CHAMELEON_EXTRA_LIBRARIES}) - - unset(CHAMELEON_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(MORSE_Init CHAMELEON_WORKS) - mark_as_advanced(CHAMELEON_WORKS) - - if(CHAMELEON_WORKS) - string(REPLACE " -L" ";" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CHAMELEON_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - set(CHAMELEON_LIBRARY_DIRS "${CMAKE_REQUIRED_FLAGS}") - set(CHAMELEON_INCLUDE_DIRS "${CMAKE_REQUIRED_INCLUDES}") - else() - if(NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for chameleon : test of MORSE_Init fails") - message(STATUS "CHAMELEON_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "CHAMELEON_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "CHAMELEON_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for chameleon : set CHAMELEON_LIBRARIES to NOTFOUND") - endif() - set(CHAMELEON_LIBRARIES "CHAMELEON_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(CHAMELEON_LIBRARIES) - -endif(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES) - - -# check that CHAMELEON has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CHAMELEON DEFAULT_MSG - CHAMELEON_LIBRARIES) diff --git a/cmake_modules/morse/find/FindFXT.cmake b/cmake_modules/morse/find/FindFXT.cmake deleted file mode 100644 index 3bd1f86e7..000000000 --- a/cmake_modules/morse/find/FindFXT.cmake +++ /dev/null @@ -1,244 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find FXT include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(FXT -# [REQUIRED]) # Fail with error if fxt is not found -# This module finds headers and fxt library. -# Results are reported in variables: -# FXT_FOUND - True if headers and requested libraries were found -# FXT_INCLUDE_DIRS - fxt include directories -# FXT_LIBRARY_DIRS - Link directories for fxt libraries -# FXT_LIBRARIES - fxt component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DFXT_DIR=path/to/fxt): -# FXT_DIR - Where to find the base directory of fxt -# FXT_INCDIR - Where to find the header files -# FXT_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT FXT_FOUND) - set(FXT_DIR "" CACHE PATH "Root directory of FXT library") - if (NOT FXT_FIND_QUIETLY) - message(STATUS "A cache variable, namely FXT_DIR, has been set to specify the install directory of FXT") - endif() -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE) - - pkg_search_module(FXT fxt) - if (NOT FXT_FIND_QUIETLY) - if (FXT_FOUND AND FXT_LIBRARIES) - message(STATUS "Looking for FXT - found using PkgConfig") - #if(NOT FXT_INCLUDE_DIRS) - # message("${Magenta}FXT_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to fxt headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for FXT - not found using PkgConfig." - "Perhaps you should add the directory containing fxt.pc to the" - "PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - -endif(PKG_CONFIG_EXECUTABLE) - -if(NOT FXT_FOUND OR NOT FXT_LIBRARIES) - - if (NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for FXT - PkgConfig not used") - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # Try to find the fxt header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(FXT_INCDIR) - set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") - find_path(FXT_fxt.h_DIRS - NAMES fxt.h - HINTS ${FXT_INCDIR}) - else() - if(FXT_DIR) - set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") - find_path(FXT_fxt.h_DIRS - NAMES fxt.h - HINTS ${FXT_DIR} - PATH_SUFFIXES include) - else() - set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") - find_path(FXT_fxt.h_DIRS - NAMES fxt.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(FXT_fxt.h_DIRS) - - # Add path to cmake variable - # ------------------------------------ - if (FXT_fxt.h_DIRS) - set(FXT_INCLUDE_DIRS "${FXT_fxt.h_DIRS}") - else () - set(FXT_INCLUDE_DIRS "FXT_INCLUDE_DIRS-NOTFOUND") - if(NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for fxt -- fxt.h not found") - endif() - endif () - - if (FXT_INCLUDE_DIRS) - list(REMOVE_DUPLICATES FXT_INCLUDE_DIRS) - endif () - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the fxt lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(FXT_LIBDIR) - set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") - find_library(FXT_fxt_LIBRARY - NAMES fxt - HINTS ${FXT_LIBDIR}) - else() - if(FXT_DIR) - set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") - find_library(FXT_fxt_LIBRARY - NAMES fxt - HINTS ${FXT_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") - find_library(FXT_fxt_LIBRARY - NAMES fxt - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(FXT_fxt_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (FXT_fxt_LIBRARY) - get_filename_component(fxt_lib_path ${FXT_fxt_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(FXT_LIBRARIES "${FXT_fxt_LIBRARY}") - set(FXT_LIBRARY_DIRS "${fxt_lib_path}") - else () - set(FXT_LIBRARIES "FXT_LIBRARIES-NOTFOUND") - set(FXT_LIBRARY_DIRS "FXT_LIBRARY_DIRS-NOTFOUND") - if(NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for fxt -- lib fxt not found") - endif() - endif () - - if (FXT_LIBRARY_DIRS) - list(REMOVE_DUPLICATES FXT_LIBRARY_DIRS) - endif () - - if(FXT_LIBRARIES) - # check a function to validate the find - if (FXT_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${FXT_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${FXT_LIBRARIES}") - if (FXT_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${FXT_LIBRARY_DIRS}") - endif() - - unset(FXT_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(fut_keychange FXT_WORKS) - mark_as_advanced(FXT_WORKS) - - if(NOT FXT_WORKS) - if(NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for fxt : test of fut_keychange with fxt library fails") - message(STATUS "FXT_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "FXT_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "FXT_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for fxt : set FXT_LIBRARIES to NOTFOUND") - endif() - set(FXT_LIBRARIES "FXT_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(FXT_LIBRARIES) - -endif(NOT FXT_FOUND OR NOT FXT_LIBRARIES) - - -# check that FXT has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FXT DEFAULT_MSG - FXT_LIBRARIES) diff --git a/cmake_modules/morse/find/FindHWLOC.cmake b/cmake_modules/morse/find/FindHWLOC.cmake deleted file mode 100644 index 7038e1ca7..000000000 --- a/cmake_modules/morse/find/FindHWLOC.cmake +++ /dev/null @@ -1,251 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find HWLOC include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(HWLOC -# [REQUIRED]) # Fail with error if hwloc is not found -# This module finds headers and hwloc library. -# Results are reported in variables: -# HWLOC_FOUND - True if headers and requested libraries were found -# HWLOC_INCLUDE_DIRS - hwloc include directories -# HWLOC_LIBRARY_DIRS - Link directories for hwloc libraries -# HWLOC_LIBRARIES - hwloc component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DHWLOC_DIR=path/to/hwloc): -# HWLOC_DIR - Where to find the base directory of hwloc -# HWLOC_INCDIR - Where to find the header files -# HWLOC_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT HWLOC_FOUND) - set(HWLOC_DIR "" CACHE PATH "Root directory of HWLOC library") - if (NOT HWLOC_FIND_QUIETLY) - message(STATUS "A cache variable, namely HWLOC_DIR, has been set to specify the install directory of HWLOC") - endif() -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE) - - pkg_search_module(HWLOC hwloc) - if (NOT HWLOC_FIND_QUIETLY) - if (HWLOC_FOUND AND HWLOC_LIBRARIES) - message(STATUS "Looking for HWLOC - found using PkgConfig") - #if(NOT HWLOC_INCLUDE_DIRS) - # message("${Magenta}HWLOC_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to hwloc headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for HWLOC - not found using PkgConfig." - "Perhaps you should add the directory containing hwloc.pc to" - "the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - -endif(PKG_CONFIG_EXECUTABLE) - -if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) - - if (NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for HWLOC - PkgConfig not used") - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_inc_env}") - - # Try to find the hwloc header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(HWLOC_INCDIR) - set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND") - find_path(HWLOC_hwloc.h_DIRS - NAMES hwloc.h - HINTS ${HWLOC_INCDIR}) - else() - if(HWLOC_DIR) - set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND") - find_path(HWLOC_hwloc.h_DIRS - NAMES hwloc.h - HINTS ${HWLOC_DIR} - PATH_SUFFIXES include) - else() - set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND") - find_path(HWLOC_hwloc.h_DIRS - NAMES hwloc.h - HINTS ${PATH_TO_LOOK_FOR}) - endif() - endif() - mark_as_advanced(HWLOC_hwloc.h_DIRS) - - # Add path to cmake variable - # ------------------------------------ - if (HWLOC_hwloc.h_DIRS) - set(HWLOC_INCLUDE_DIRS "${HWLOC_hwloc.h_DIRS}") - else () - set(HWLOC_INCLUDE_DIRS "HWLOC_INCLUDE_DIRS-NOTFOUND") - if(NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for hwloc -- hwloc.h not found") - endif() - endif () - - if (HWLOC_INCLUDE_DIRS) - list(REMOVE_DUPLICATES HWLOC_INCLUDE_DIRS) - endif () - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_lib_env}") - - # Try to find the hwloc lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(HWLOC_LIBDIR) - set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND") - find_library(HWLOC_hwloc_LIBRARY - NAMES hwloc - HINTS ${HWLOC_LIBDIR}) - else() - if(HWLOC_DIR) - set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND") - find_library(HWLOC_hwloc_LIBRARY - NAMES hwloc - HINTS ${HWLOC_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND") - find_library(HWLOC_hwloc_LIBRARY - NAMES hwloc - HINTS ${PATH_TO_LOOK_FOR}) - endif() - endif() - mark_as_advanced(HWLOC_hwloc_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (HWLOC_hwloc_LIBRARY) - get_filename_component(hwloc_lib_path ${HWLOC_hwloc_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(HWLOC_LIBRARIES "${HWLOC_hwloc_LIBRARY}") - set(HWLOC_LIBRARY_DIRS "${hwloc_lib_path}") - else () - set(HWLOC_LIBRARIES "HWLOC_LIBRARIES-NOTFOUND") - set(HWLOC_LIBRARY_DIRS "HWLOC_LIBRARY_DIRS-NOTFOUND") - if(NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for hwloc -- lib hwloc not found") - endif() - endif () - - if (HWLOC_LIBRARY_DIRS) - list(REMOVE_DUPLICATES HWLOC_LIBRARY_DIRS) - endif () - - if(HWLOC_LIBRARIES) - # check a function to validate the find - if (HWLOC_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}") - if (HWLOC_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${HWLOC_LIBRARY_DIRS}") - endif() - - unset(HWLOC_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(hwloc_topology_init HWLOC_WORKS) - mark_as_advanced(HWLOC_WORKS) - - if(NOT HWLOC_WORKS) - if(NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for hwloc : test of hwloc_topology_init with hwloc library fails") - message(STATUS "HWLOC_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "HWLOC_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "HWLOC_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for hwloc : set HWLOC_LIBRARIES to NOTFOUND") - endif() - set(HWLOC_LIBRARIES "HWLOC_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(HWLOC_LIBRARIES) - -endif(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES) - - -# check that HWLOC has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(HWLOC DEFAULT_MSG - HWLOC_LIBRARIES) diff --git a/cmake_modules/morse/find/FindLAPACK.cmake b/cmake_modules/morse/find/FindLAPACK.cmake deleted file mode 100644 index 93f89b27d..000000000 --- a/cmake_modules/morse/find/FindLAPACK.cmake +++ /dev/null @@ -1,497 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find LAPACK library -# This module finds an installed fortran library that implements the LAPACK -# linear-algebra interface (see http://www.netlib.org/lapack/). -# -# The approach follows that taken for the autoconf macro file, acx_lapack.m4 -# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). -# -# This module sets the following variables: -# LAPACK_FOUND - set to true if a library implementing the LAPACK interface -# is found -# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l -# and -L). -# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use LAPACK -# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use LAPACK95 -# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 -# interface is found -# BLA_STATIC if set on this determines what kind of linkage we do (static) -# BLA_VENDOR if set checks only the specified vendor, if not set checks -# all the possibilities -# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DLAPACK_DIR=path/to/lapack): -# LAPACK_DIR - Where to find the base directory of lapack -# LAPACK_INCDIR - Where to find the header files -# LAPACK_LIBDIR - Where to find the library files -# Note that if BLAS_DIR is set, it will also look for lapack in it -### List of vendors (BLA_VENDOR) valid in this module -## Intel(mkl), ACML,Apple, NAS, Generic - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -# Set some colors -if(NOT WIN32) - string(ASCII 27 Esc) - set(ColourReset "${Esc}[m") - set(ColourBold "${Esc}[1m") - set(Red "${Esc}[31m") - set(Green "${Esc}[32m") - set(Yellow "${Esc}[33m") - set(Blue "${Esc}[34m") - set(Magenta "${Esc}[35m") - set(Cyan "${Esc}[36m") - set(White "${Esc}[37m") - set(BoldRed "${Esc}[1;31m") - set(BoldGreen "${Esc}[1;32m") - set(BoldYellow "${Esc}[1;33m") - set(BoldBlue "${Esc}[1;34m") - set(BoldMagenta "${Esc}[1;35m") - set(BoldCyan "${Esc}[1;36m") - set(BoldWhite "${Esc}[1;37m") -endif() - -## Some macros to print status when search for headers and libs -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we look for ${_lib_to_find} in" - "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," - "Mac: DYLD_LIBRARY_PATH," - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," - "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -if (NOT LAPACK_FOUND) - set(LAPACK_DIR "" CACHE PATH "Root directory of LAPACK library") - if (NOT LAPACK_FIND_QUIETLY) - message(STATUS "A cache variable, namely LAPACK_DIR, has been set to specify the install directory of LAPACK") - endif() -endif (NOT LAPACK_FOUND) - -option(LAPACK_VERBOSE "Print some additional information during LAPACK -libraries detection" OFF) -if (BLAS_VERBOSE) - set(LAPACK_VERBOSE ON) -endif () -set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) - -set(LAPACK_FOUND FALSE) -set(LAPACK95_FOUND FALSE) - -# TODO: move this stuff to separate module - -macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - -set(_libraries_work TRUE) -set(${LIBRARIES}) -set(_combined_name) -if (NOT _libdir) - if (BLAS_DIR) - list(APPEND _libdir "${BLAS_DIR}") - list(APPEND _libdir "${BLAS_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${BLAS_DIR}/lib64") - list(APPEND _libdir "${BLAS_DIR}/lib/intel64") - else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") - endif() - endif () - if (BLAS_LIBDIR) - list(APPEND _libdir "${BLAS_LIBDIR}") - endif () - if (LAPACK_DIR) - list(APPEND _libdir "${LAPACK_DIR}") - list(APPEND _libdir "${LAPACK_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${LAPACK_DIR}/lib64") - list(APPEND _libdir "${LAPACK_DIR}/lib/intel64") - else() - list(APPEND _libdir "${LAPACK_DIR}/lib32") - list(APPEND _libdir "${LAPACK_DIR}/lib/ia32") - endif() - endif () - if (LAPACK_LIBDIR) - list(APPEND _libdir "${LAPACK_LIBDIR}") - endif () - if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${_libdir2}") - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif () - -if (LAPACK_VERBOSE) - message("${Cyan}Try to find LAPACK libraries: ${_list}") -endif () - -foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif ( WIN32 ) - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif (APPLE) - else (BLA_STATIC) - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif (BLA_STATIC) - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - HINTS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - # Print status if not found - # ------------------------- - if (NOT ${_prefix}_${_library}_LIBRARY AND NOT LAPACK_FIND_QUIETLY AND LAPACK_VERBOSE) - Print_Find_Library_Blas_Status(lapack ${_library} ${_libdir}) - endif () - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) -endforeach(_library ${_list}) - -if(_libraries_work) - # Test this combination of libraries. - if(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) - else(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) - endif(UNIX AND BLA_STATIC) - if (LAPACK_VERBOSE) - message("${Cyan}LAPACK libs found. Try to compile symbol ${_name} with" - "following libraries: ${CMAKE_REQUIRED_LIBRARIES}") - endif () - if(NOT LAPACK_FOUND) - unset(${_prefix}${_combined_name}_WORKS CACHE) - endif() - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -endif(_libraries_work) - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) - else(_libraries_work) - set(${LIBRARIES} FALSE) - endif(_libraries_work) - -endmacro(Check_Lapack_Libraries) - - -set(LAPACK_LINKER_FLAGS) -set(LAPACK_LIBRARIES) -set(LAPACK95_LIBRARIES) - -if (NOT BLAS_FOUND) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(BLAS) - else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(BLAS REQUIRED) - endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) -endif () - -if(BLAS_FOUND) - set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if ($ENV{BLA_VENDOR} MATCHES ".+") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - else ($ENV{BLA_VENDOR} MATCHES ".+") - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif(NOT BLA_VENDOR) - endif ($ENV{BLA_VENDOR} MATCHES ".+") - -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "goto2" - "${BLAS_LIBRARIES}" - "" - ) - endif(NOT LAPACK_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - - -#acml lapack - if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") - if (BLAS_LIBRARIES MATCHES ".+acml.+") - set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - endif () - endif () - -# Apple LAPACK library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "${BLAS_LIBRARIES}" - "" - ) - endif(NOT LAPACK_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "${BLAS_LIBRARIES}" - "" - ) - endif ( NOT LAPACK_LIBRARIES ) -endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") -# Generic LAPACK library? -if (BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "ATLAS" OR - BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack" - "${BLAS_LIBRARIES}" - "" - ) - endif ( NOT LAPACK_LIBRARIES ) -endif () -#intel lapack -if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if (NOT WIN32) - set(LM "-lm") - endif () - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_PACKAGE(Threads) - else() - find_package(Threads REQUIRED) - endif() - - set(LAPACK_SEARCH_LIBS "") - - if (BLA_F95) - set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV") - set(_LIBRARIES LAPACK95_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_c") - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_lp64") - else() - set(LAPACK_mkl_SEARCH_SYMBOL "cheev") - set(_LIBRARIES LAPACK_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_gf_lp64") - endif() - - # First try empty lapack libs - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - BLAS - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "" - "${_BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif () - # Then try the search libs - foreach (IT ${LAPACK_SEARCH_LIBS}) - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - BLAS - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "${IT}" - "${_BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - endif () - endforeach () - endif () -endif() -else(BLAS_FOUND) - message(STATUS "LAPACK requires BLAS") -endif(BLAS_FOUND) - -if(BLA_F95) - if(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND TRUE) - else(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND FALSE) - endif(LAPACK95_LIBRARIES) - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK95_FOUND) - message(STATUS "A library with LAPACK95 API found.") - message(STATUS "LAPACK_LIBRARIES ${LAPACK_LIBRARIES}") - else(LAPACK95_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK 95 libraries could not be found or check of symbols failed." - "\nPlease indicate where to find LAPACK libraries. You have three options:\n" - "- Option 1: Provide the root directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n" - "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "\nTo follow libraries detection more precisely you can activate a verbose mode with -DLAPACK_VERBOSE=ON at cmake configure." - "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name." - "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK95 API not found. Please specify library location." - ) - else(LAPACK_FIND_REQUIRED) - message(STATUS - "A library with LAPACK95 API not found. Please specify library location." - ) - endif(LAPACK_FIND_REQUIRED) - endif(LAPACK95_FOUND) - endif(NOT LAPACK_FIND_QUIETLY) - set(LAPACK_FOUND "${LAPACK95_FOUND}") - set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") -else(BLA_F95) - if(LAPACK_LIBRARIES) - set(LAPACK_FOUND TRUE) - else(LAPACK_LIBRARIES) - set(LAPACK_FOUND FALSE) - endif(LAPACK_LIBRARIES) - - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_FOUND) - message(STATUS "A library with LAPACK API found.") - message(STATUS "LAPACK_LIBRARIES ${LAPACK_LIBRARIES}") - else(LAPACK_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK libraries could not be found or check of symbols failed." - "\nPlease indicate where to find LAPACK libraries. You have three options:\n" - "- Option 1: Provide the root directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n" - "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "\nTo follow libraries detection more precisely you can activate a verbose mode with -DLAPACK_VERBOSE=ON at cmake configure." - "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name." - "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK API not found. Please specify library location." - ) - else(LAPACK_FIND_REQUIRED) - message(STATUS - "A library with LAPACK API not found. Please specify library location." - ) - endif(LAPACK_FIND_REQUIRED) - endif(LAPACK_FOUND) - endif(NOT LAPACK_FIND_QUIETLY) -endif(BLA_F95) - -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/cmake_modules/morse/find/FindLAPACKE.cmake b/cmake_modules/morse/find/FindLAPACKE.cmake deleted file mode 100644 index 3a4a29c96..000000000 --- a/cmake_modules/morse/find/FindLAPACKE.cmake +++ /dev/null @@ -1,300 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find LAPACKE include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(LAPACKE -# [REQUIRED] # Fail with error if lapacke is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and lapacke library. -# Results are reported in variables: -# LAPACKE_FOUND - True if headers and requested libraries were found -# LAPACKE_INCLUDE_DIRS - lapacke include directories -# LAPACKE_LIBRARY_DIRS - Link directories for lapacke libraries -# LAPACKE_LIBRARIES - lapacke component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DLAPACKE_DIR=path/to/lapacke): -# LAPACKE_DIR - Where to find the base directory of lapacke -# LAPACKE_INCDIR - Where to find the header files -# LAPACKE_LIBDIR - Where to find the library files -# LAPACKE could be directly embedded in LAPACK library (ex: Intel MKL) so that -# we test a lapacke function with the lapack libraries found and set LAPACKE -# variables to LAPACK ones if test is successful. To skip this feature and -# look for a stand alone lapacke, please add the following in your -# CMakeLists.txt before to call find_package(LAPACKE): -# set(LAPACKE_STANDALONE TRUE) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT LAPACKE_FOUND) - set(LAPACKE_DIR "" CACHE PATH "Root directory of LAPACKE library") - if (NOT LAPACKE_FIND_QUIETLY) - message(STATUS "A cache variable, namely LAPACKE_DIR, has been set to specify the install directory of LAPACKE") - endif() -endif() - -# LAPACKE depends on LAPACK -# try to find it specified as COMPONENTS during the call -if (LAPACKE_FIND_COMPONENTS) - foreach( component ${LAPACKE_FIND_COMPONENTS} ) - if(LAPACKE_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(LAPACKE_${component}_FOUND TRUE) - else() - set(LAPACKE_${component}_FOUND FALSE) - endif() - endforeach() -endif () - -# LAPACKE depends on LAPACK anyway, try to find it -if (NOT LAPACK_FOUND) - if(LAPACKE_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() -endif() - -# LAPACKE depends on LAPACK -if (LAPACK_FOUND) - - if (NOT LAPACKE_STANDALONE) - # check if a lapacke function exists in the LAPACK lib - include(CheckFunctionExists) - set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}") - unset(LAPACKE_WORKS CACHE) - check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS) - mark_as_advanced(LAPACKE_WORKS) - set(CMAKE_REQUIRED_LIBRARIES) - - if(LAPACKE_WORKS) - if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke: test with lapack succeeds") - endif() - # test succeeds: LAPACKE is in LAPACK - set(LAPACKE_LIBRARIES "${LAPACK_LIBRARIES}") - set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}") - if(LAPACK_INCLUDE_DIRS) - set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}") - endif() - endif() - endif (NOT LAPACKE_STANDALONE) - - if (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS) - - if(NOT LAPACKE_WORKS AND NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke : test with lapack fails") - endif() - # test fails: try to find LAPACKE lib exterior to LAPACK - - # Try to find LAPACKE lib - ####################### - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the lapacke header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(LAPACKE_INCDIR) - set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND") - find_path(LAPACKE_lapacke.h_DIRS - NAMES lapacke.h - HINTS ${LAPACKE_INCDIR}) - else() - if(LAPACKE_DIR) - set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND") - find_path(LAPACKE_lapacke.h_DIRS - NAMES lapacke.h - HINTS ${LAPACKE_DIR} - PATH_SUFFIXES include) - else() - set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND") - find_path(LAPACKE_lapacke.h_DIRS - NAMES lapacke.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(LAPACKE_lapacke.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (LAPACKE_lapacke.h_DIRS) - set(LAPACKE_INCLUDE_DIRS "${LAPACKE_lapacke.h_DIRS}") - else () - set(LAPACKE_INCLUDE_DIRS "LAPACKE_INCLUDE_DIRS-NOTFOUND") - if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke -- lapacke.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the lapacke lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(LAPACKE_LIBDIR) - set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") - find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${LAPACKE_LIBDIR}) - else() - if(LAPACKE_DIR) - set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") - find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${LAPACKE_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") - find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(LAPACKE_lapacke_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (LAPACKE_lapacke_LIBRARY) - get_filename_component(lapacke_lib_path "${LAPACKE_lapacke_LIBRARY}" PATH) - # set cmake variables - set(LAPACKE_LIBRARIES "${LAPACKE_lapacke_LIBRARY}") - set(LAPACKE_LIBRARY_DIRS "${lapacke_lib_path}") - else () - set(LAPACKE_LIBRARIES "LAPACKE_LIBRARIES-NOTFOUND") - set(LAPACKE_LIBRARY_DIRS "LAPACKE_LIBRARY_DIRS-NOTFOUND") - if (NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke -- lib lapacke not found") - endif() - endif () - - if(LAPACKE_LIBRARIES) - # check a function to validate the find - if (LAPACKE_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${LAPACKE_INCLUDE_DIRS}") - endif() - if (LAPACK_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACK_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${LAPACKE_LIBRARIES};${LAPACK_LIBRARIES};-lm") - if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND CMAKE_REQUIRED_LIBRARIES "-lgfortran") - elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*") - list(APPEND CMAKE_REQUIRED_LIBRARIES "-lifcore") - endif() - if (LAPACKE_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${LAPACKE_LIBRARY_DIRS}") - endif() - if (LAPACK_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}") - endif() - - unset(LAPACKE_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS) - mark_as_advanced(LAPACKE_WORKS) - - if(LAPACKE_WORKS) - set(LAPACKE_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) - set(LAPACKE_LIBRARY_DIRS "${LAPACKE_LIBRARY_DIRS}" "${LAPACK_LIBRARY_DIRS}") - set(LAPACKE_INCLUDE_DIRS ${CMAKE_REQUIRED_INCLUDES}) - else() - if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails") - message(STATUS "LAPACKE_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "LAPACKE_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "LAPACKE_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for lapacke : set LAPACKE_LIBRARIES to NOTFOUND") - endif() - set(LAPACKE_LIBRARIES "LAPACKE_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(LAPACKE_LIBRARIES) - - endif (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS) - -else(LAPACK_FOUND) - - if (NOT LAPACKE_FIND_QUIETLY) - message(STATUS "LAPACKE requires LAPACK but LAPACK has not been found." - "Please look for LAPACK first.") - endif() - -endif(LAPACK_FOUND) - - -# check that LAPACKE has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LAPACKE DEFAULT_MSG - LAPACKE_LIBRARIES) diff --git a/cmake_modules/morse/find/FindLAPACKEXT.cmake b/cmake_modules/morse/find/FindLAPACKEXT.cmake deleted file mode 100644 index dc608cc74..000000000 --- a/cmake_modules/morse/find/FindLAPACKEXT.cmake +++ /dev/null @@ -1,296 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find LAPACK EXTENDED for MORSE projects: find include dirs and libraries -# -# This module allows to find LAPACK libraries by calling the official FindLAPACK module -# and handles the creation of different library lists whether the user wishes to link -# with a sequential LAPACK or a multihreaded (LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES). -# LAPACK is detected with a FindLAPACK call then if the LAPACK vendor is in the following list, -# Intel mkl, Goto, Openlapack, ACML, IBMESSL -# then the module tries find the corresponding multithreaded libraries -# LAPACK_LIBRARIES does not exists anymore. -# -# The following variables have been added to manage links with sequential or multithreaded -# versions: -# LAPACK_INCLUDE_DIRS - LAPACK include directories -# LAPACK_LIBRARY_DIRS - Link directories for LAPACK libraries -# LAPACK_SEQ_LIBRARIES - LAPACK component libraries to be linked (sequential) -# LAPACK_PAR_LIBRARIES - LAPACK component libraries to be linked (multithreaded) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -# LAPACKEXT depends on BLASEXT -# call our extended module for BLAS -#---------------------------------- -if (NOT BLAS_FOUND) - if(LAPACKEXT_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) - else() - find_package(BLASEXT) - endif() -endif () - - -if(BLA_VENDOR MATCHES "Intel*") - - ### - # look for include path if the LAPACK vendor is Intel - ### - - # gather system include paths - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - if (BLAS_DIR) - set(LAPACK_DIR ${BLAS_DIR}) - endif () - if (BLAS_INCDIR) - set(LAPACK_INCDIR ${BLAS_INCDIR}) - endif () - # find mkl.h inside known include paths - set(LAPACK_mkl_lapack.h_INCLUDE_DIRS "LAPACK_mkl_lapack.h_INCLUDE_DIRS-NOTFOUND") - if(LAPACK_INCDIR) - find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS - NAMES mkl_lapack.h - HINTS ${LAPACK_INCDIR}) - else() - if(LAPACK_DIR) - find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS - NAMES mkl_lapack.h - HINTS ${LAPACK_DIR} - PATH_SUFFIXES include) - else() - find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS - NAMES mkl_lapack.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(LAPACK_mkl_lapack.h_INCLUDE_DIRS) - ## Print status if not found - ## ------------------------- - #if (NOT LAPACK_mkl_lapack.h_INCLUDE_DIRS) - # Print_Find_Header_Status(lapack mkl_lapack.h) - #endif () - set(LAPACK_INCLUDE_DIRS "") - if(LAPACK_mkl_lapack.h_INCLUDE_DIRS) - list(APPEND LAPACK_INCLUDE_DIRS "${LAPACK_mkl_lapack.h_INCLUDE_DIRS}" ) - endif() - - ### - # look for libs - ### - - if (BLA_VENDOR MATCHES "Intel10_64lp*") - ## look for the sequential version - set(BLA_VENDOR "Intel10_64lp_seq") - endif() - - if(LAPACKEXT_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() - - if (LAPACK_FOUND) - if(BLAS_SEQ_LIBRARIES) - set(LAPACK_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES}") - else() - set(LAPACK_SEQ_LIBRARIES "${LAPACK_SEQ_LIBRARIES-NOTFOUND}") - endif() - # if BLAS Intel 10 64 bit -> save sequential and multithreaded versions - if(BLA_VENDOR MATCHES "Intel10_64lp*") - if(BLAS_PAR_LIBRARIES) - set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}") - else() - set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}") - endif() - endif() - endif() - -elseif(BLA_VENDOR MATCHES "ACML*") - - ### - # look for libs - ### - if(LAPACKEXT_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() - - if (LAPACK_FOUND) - if(BLAS_SEQ_LIBRARIES) - set(LAPACK_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES}") - else() - set(LAPACK_SEQ_LIBRARIES "${LAPACK_SEQ_LIBRARIES-NOTFOUND}") - endif() - if(BLAS_PAR_LIBRARIES) - set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}") - else() - set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}") - endif() - endif() - -else() - - ## look for a sequential version - # call to the cmake official FindLAPACK module - # This module sets the following variables: - # LAPACK_FOUND - set to true if a library implementing the LAPACK interface - # is found - # LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l - # and -L). - # LAPACK_LIBRARIES - uncached list of libraries (using full path name) to - # link against to use LAPACK - # LAPACK95_LIBRARIES - uncached list of libraries (using full path name) - # to link against to use LAPACK95 interface - # LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 interface - # is found - # BLA_STATIC if set on this determines what kind of linkage we do (static) - # BLA_VENDOR if set checks only the specified vendor, if not set checks - # all the possibilities - # BLA_F95 if set on tries to find the f95 interfaces for LAPACK/LAPACK - # Remark: it looks only into paths contained in the system environment variables - if(LAPACKEXT_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() - - if(LAPACK_FOUND) - set(LAPACK_SEQ_LIBRARIES "${LAPACK_LIBRARIES}") - else() - set(LAPACK_SEQ_LIBRARIES "${LAPACK_SEQ_LIBRARIES-NOTFOUND}") - endif() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - -endif() - -if (LAPACK_SEQ_LIBRARIES) - set(LAPACK_LIBRARIES "${LAPACK_SEQ_LIBRARIES}") -endif() - -# extract libs paths -# remark: because it is not given by find_package(LAPACK) -set(LAPACK_LIBRARY_DIRS "") -foreach(lapack_lib ${LAPACK_LIBRARIES}) - get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH) - list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" ) -endforeach() -if (LAPACK_LIBRARY_DIRS) - list(REMOVE_DUPLICATES LAPACK_LIBRARY_DIRS) -endif () - - -# message(STATUS "LAPACK_FOUND: ${LAPACK_FOUND}") -# message(STATUS "LAPACK_VENDOR: ${LAPACK_VENDOR}") -# message(STATUS "LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}") -# message(STATUS "LAPACK_SEQ_LIBRARIES: ${LAPACK_SEQ_LIBRARIES}") -# message(STATUS "LAPACK_PAR_LIBRARIES: ${LAPACK_PAR_LIBRARIES}") -# message(STATUS "LAPACK_INCLUDE_DIRS: ${LAPACK_INCLUDE_DIRS}") -# message(STATUS "LAPACK_LIBRARY_DIRS: ${LAPACK_LIBRARY_DIRS}") - -# check that LAPACK has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -if(BLA_VENDOR MATCHES "Intel*") - if(BLA_VENDOR MATCHES "Intel10_64lp*") - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK found is Intel MKL:" - "we manage two lists of libs," - " one sequential and one parallel (see" - "LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)") - message(STATUS "LAPACK sequential libraries stored in" - "LAPACK_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS - LAPACK_INCLUDE_DIRS) - if(LAPACK_PAR_LIBRARIES) - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK parallel libraries stored in" - "LAPACK_PAR_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_PAR_LIBRARIES) - endif() - - else() - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK sequential libraries stored in" - "LAPACK_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS - LAPACK_INCLUDE_DIRS) - endif() -elseif(BLA_VENDOR MATCHES "ACML*") - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK found is ACML:" - "we manage two lists of libs," - " one sequential and one parallel (see" - "LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)") - message(STATUS "LAPACK sequential libraries stored in" - "LAPACK_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS - LAPACK_INCLUDE_DIRS) - if(LAPACK_PAR_LIBRARIES) - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK parallel libraries stored in" - "LAPACK_PAR_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_PAR_LIBRARIES) - endif() -else() - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK sequential libraries stored in" - "LAPACK_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS) -endif() diff --git a/cmake_modules/morse/find/FindMAGMA.cmake b/cmake_modules/morse/find/FindMAGMA.cmake deleted file mode 100644 index d1bcddcc8..000000000 --- a/cmake_modules/morse/find/FindMAGMA.cmake +++ /dev/null @@ -1,338 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find MAGMA include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(MAGMA -# [REQUIRED] # Fail with error if magma is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and magma library. -# Results are reported in variables: -# MAGMA_FOUND - True if headers and requested libraries were found -# MAGMA_INCLUDE_DIRS - magma include directories -# MAGMA_LIBRARY_DIRS - Link directories for magma libraries -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DMAGMA_DIR=path/to/magma): -# MAGMA_DIR - Where to find the base directory of magma -# MAGMA_INCDIR - Where to find the header files -# MAGMA_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if(NOT MAGMA_FOUND) - set(MAGMA_DIR "" CACHE PATH "Root directory of MAGMA library") - if (NOT MAGMA_FIND_QUIETLY) - message(STATUS "A cache variable, namely MAGMA_DIR, has been set to specify the install directory of MAGMA") - endif() -endif(NOT MAGMA_FOUND) - - -# MAGMA may depend on CUDA -# try to find it specified as COMPONENTS during the call -if( MAGMA_FIND_COMPONENTS ) - foreach( component ${MAGMA_FIND_COMPONENTS} ) - if(MAGMA_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(MAGMA_${component}_FOUND TRUE) - # should we have these variables available in gui modes? - if (CUDA_FOUND) - mark_as_advanced(CUDA_BUILD_CUBIN) - mark_as_advanced(CUDA_BUILD_EMULATION) - mark_as_advanced(CUDA_SDK_ROOT_DIR) - mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR) - mark_as_advanced(CUDA_VERBOSE_BUILD) - endif() - else() - set(MAGMA_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# MAGMA depends on CUDA anyway, try to find it -if (NOT CUDA_FOUND) - if(MAGMA_FIND_REQUIRED) - find_package(CUDA REQUIRED) - else() - find_package(CUDA) - endif() -endif() -# MAGMA depends on cuBLAS which should come with CUDA, if not found -> error -if (NOT CUDA_CUBLAS_LIBRARIES) - if(MAGMA_FIND_REQUIRED) - message(FATAL_ERROR "Looking for MAGMA - MAGMA depends on cuBLAS which has - not been found (should come with cuda install)") - endif() -endif() -# MAGMA depends on LAPACK anyway, try to find it -if (NOT LAPACK_FOUND) - if(MAGMA_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() -endif() -# MAGMA depends on CBLAS anyway, try to find it -if (NOT CBLAS_FOUND) - if(MAGMA_FIND_REQUIRED) - find_package(CBLAS REQUIRED) - else() - find_package(CBLAS) - endif() -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE) - - pkg_search_module(MAGMA magma) - if (NOT MAGMA_FIND_QUIETLY) - if (MAGMA_FOUND AND MAGMA_LIBRARIES) - message(STATUS "Looking for MAGMA - found using PkgConfig") - #if(NOT MAGMA_INCLUDE_DIRS) - # message("${Magenta}MAGMA_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to magma headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for MAGMA - not found using PkgConfig." - "Perhaps you should add the directory containing magma.pc" - "to the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - - if (MAGMA_FIND_VERSION_EXACT) - if( NOT (MAGMA_FIND_VERSION_MAJOR STREQUAL MAGMA_VERSION_MAJOR) OR - NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) ) - if(NOT MAGMA_FIND_QUIETLY) - message(FATAL_ERROR - "MAGMA version found is ${MAGMA_VERSION_STRING}" - "when required is ${MAGMA_FIND_VERSION}") - endif() - endif() - else() - # if the version found is older than the required then error - if( (MAGMA_FIND_VERSION_MAJOR STRGREATER MAGMA_VERSION_MAJOR) OR - (MAGMA_FIND_VERSION_MINOR STRGREATER MAGMA_VERSION_MINOR) ) - if(NOT MAGMA_FIND_QUIETLY) - message(FATAL_ERROR - "MAGMA version found is ${MAGMA_VERSION_STRING}" - "when required is ${MAGMA_FIND_VERSION} or newer") - endif() - endif() - endif() - -endif(PKG_CONFIG_EXECUTABLE) - -if(NOT MAGMA_FOUND OR NOT MAGMA_LIBRARIES) - - if (NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for MAGMA - PkgConfig not used") - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the magma header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(MAGMA_INCDIR) - set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND") - find_path(MAGMA_magma.h_DIRS - NAMES magma.h - HINTS ${MAGMA_INCDIR}) - else() - if(MAGMA_DIR) - set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND") - find_path(MAGMA_magma.h_DIRS - NAMES magma.h - HINTS ${MAGMA_DIR} - PATH_SUFFIXES include) - else() - set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND") - find_path(MAGMA_magma.h_DIRS - NAMES magma.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(MAGMA_magma.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (MAGMA_magma.h_DIRS) - set(MAGMA_INCLUDE_DIRS "${MAGMA_magma.h_DIRS}") - else () - set(MAGMA_INCLUDE_DIRS "MAGMA_INCLUDE_DIRS-NOTFOUND") - if(NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for magma -- magma.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the magma lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(MAGMA_LIBDIR) - set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND") - find_library(MAGMA_magma_LIBRARY - NAMES magma - HINTS ${MAGMA_LIBDIR}) - else() - if(MAGMA_DIR) - set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND") - find_library(MAGMA_magma_LIBRARY - NAMES magma - HINTS ${MAGMA_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND") - find_library(MAGMA_magma_LIBRARY - NAMES magma - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(MAGMA_magma_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (MAGMA_magma_LIBRARY) - get_filename_component(magma_lib_path "${MAGMA_magma_LIBRARY}" PATH) - # set cmake variables - set(MAGMA_LIBRARIES "${MAGMA_magma_LIBRARY}") - set(MAGMA_LIBRARY_DIRS "${magma_lib_path}") - else () - set(MAGMA_LIBRARIES "MAGMA_LIBRARIES-NOTFOUND") - set(MAGMA_LIBRARY_DIRS "MAGMA_LIBRARY_DIRS-NOTFOUND") - if(NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for magma -- lib magma not found") - endif() - endif () - - if (MAGMA_LIBRARIES) - # check a function to validate the find - if (MAGMA_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}") - endif() - if (CBLAS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}") - endif() - if (CUDA_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${MAGMA_LIBRARIES};${CBLAS_LIBRARIES};${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES};${LAPACK_LIBRARIES}") - if (MAGMA_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${MAGMA_LIBRARY_DIRS}") - endif() - if (CBLAS_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CBLAS_LIBRARY_DIRS}") - endif() - if(CUDA_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CUDA_LIBRARY_DIRS}") - endif() - if(LAPACK_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}") - endif() - - unset(MAGMA_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(magma_dgetrf MAGMA_WORKS) - mark_as_advanced(MAGMA_WORKS) - - if(MAGMA_WORKS) - set(MAGMA_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - set(MAGMA_LIBRARY_DIRS "${MAGMA_LIBRARY_DIRS}" "${CBLAS_LIBRARY_DIRS}" "${CUDA_LIBRARY_DIRS}" "${LAPACK_LIBRARY_DIRS}") - set(MAGMA_INCLUDE_DIRS "${CMAKE_REQUIRED_INCLUDES}") - else() - if(NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for magma : test of magma_dgetrf with - magma, cblas, cuda and lapack libraries fails") - message(STATUS "MAGMA_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "MAGMA_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "MAGMA_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for magma : set MAGMA_LIBRARIES to NOTFOUND") - endif() - set(MAGMA_LIBRARIES "MAGMA_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(MAGMA_LIBRARIES) - -endif(NOT MAGMA_FOUND OR NOT MAGMA_LIBRARIES) - - -# check that MAGMA has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MAGMA DEFAULT_MSG - MAGMA_LIBRARIES) diff --git a/cmake_modules/morse/find/FindMETIS.cmake b/cmake_modules/morse/find/FindMETIS.cmake deleted file mode 100644 index bee2f5753..000000000 --- a/cmake_modules/morse/find/FindMETIS.cmake +++ /dev/null @@ -1,214 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find METIS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(METIS -# [REQUIRED] # Fail with error if metis is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and metis library. -# Results are reported in variables: -# METIS_FOUND - True if headers and requested libraries were found -# METIS_INCLUDE_DIRS - metis include directories -# METIS_LIBRARY_DIRS - Link directories for metis libraries -# METIS_LIBRARIES - metis component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DMETIS_DIR=path/to/metis): -# METIS_DIR - Where to find the base directory of metis -# METIS_INCDIR - Where to find the header files -# METIS_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT METIS_FOUND) - set(METIS_DIR "" CACHE PATH "Root directory of METIS library") - if (NOT METIS_FIND_QUIETLY) - message(STATUS "A cache variable, namely METIS_DIR, has been set to specify the install directory of METIS") - endif() -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") -else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the metis header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(METIS_INCDIR) - set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND") - find_path(METIS_metis.h_DIRS - NAMES metis.h - HINTS ${METIS_INCDIR}) -else() - if(METIS_DIR) - set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND") - find_path(METIS_metis.h_DIRS - NAMES metis.h - HINTS ${METIS_DIR} - PATH_SUFFIXES include) - else() - set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND") - find_path(METIS_metis.h_DIRS - NAMES metis.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(METIS_metis.h_DIRS) - - -# If found, add path to cmake variable -# ------------------------------------ -if (METIS_metis.h_DIRS) - set(METIS_INCLUDE_DIRS "${METIS_metis.h_DIRS}") -else () - set(METIS_INCLUDE_DIRS "METIS_INCLUDE_DIRS-NOTFOUND") - if(NOT METIS_FIND_QUIETLY) - message(STATUS "Looking for metis -- metis.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") -else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the metis lib in the given paths -# ---------------------------------------------- -# call cmake macro to find the lib path -if(METIS_LIBDIR) - set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND") - find_library(METIS_metis_LIBRARY - NAMES metis - HINTS ${METIS_LIBDIR}) -else() - if(METIS_DIR) - set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND") - find_library(METIS_metis_LIBRARY - NAMES metis - HINTS ${METIS_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND") - find_library(METIS_metis_LIBRARY - NAMES metis - HINTS ${_lib_env}) - endif() -endif() -mark_as_advanced(METIS_metis_LIBRARY) - - -# If found, add path to cmake variable -# ------------------------------------ -if (METIS_metis_LIBRARY) - get_filename_component(metis_lib_path "${METIS_metis_LIBRARY}" PATH) - # set cmake variables - set(METIS_LIBRARIES "${METIS_metis_LIBRARY}") - set(METIS_LIBRARY_DIRS "${metis_lib_path}") -else () - set(METIS_LIBRARIES "METIS_LIBRARIES-NOTFOUND") - set(METIS_LIBRARY_DIRS "METIS_LIBRARY_DIRS-NOTFOUND") - if(NOT METIS_FIND_QUIETLY) - message(STATUS "Looking for metis -- lib metis not found") - endif() -endif () - -if(METIS_LIBRARIES) - # check a function to validate the find - if (METIS_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${METIS_LIBRARIES}") - if (METIS_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${METIS_LIBRARY_DIRS}") - endif() - - unset(METIS_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(METIS_NodeND METIS_WORKS) - mark_as_advanced(METIS_WORKS) - - if(METIS_WORKS) - set(METIS_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - else() - if(NOT METIS_FIND_QUIETLY) - message(STATUS "Looking for METIS : test of METIS_NodeND with METIS library fails") - message(STATUS "METIS_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "METIS_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "METIS_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for METIS : set METIS_LIBRARIES to NOTFOUND") - endif() - set(METIS_LIBRARIES "METIS_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(METIS_LIBRARIES) - -# check that METIS has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(METIS DEFAULT_MSG - METIS_LIBRARIES - METIS_INCLUDE_DIRS - METIS_LIBRARY_DIRS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindMPIEXT.cmake b/cmake_modules/morse/find/FindMPIEXT.cmake deleted file mode 100644 index 68520a478..000000000 --- a/cmake_modules/morse/find/FindMPIEXT.cmake +++ /dev/null @@ -1,120 +0,0 @@ -# - Find MPI EXTENDED for MORSE projects: -# -# This module allows to find MPI libraries by calling the official FindMPI module -# and adds an additional variable indicating the level of thread supported: -# MPI_THREAD_SUPPORTED_LEVEL - MPI_THREAD_MULTIPLE, MPI_THREAD_SERIALIZED, MPI_THREAD_FUNNELED, or MPI_THREAD_SINGLE - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -# add a cache variable to let the user specify the BLAS vendor -if (NOT MPI_FOUND) - if(MPIEXT_FIND_REQUIRED) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() -endif () - -if (MPI_FOUND) - set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) - set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - # Set flags for building test program - set(CMAKE_REQUIRED_INCLUDES ${MPI_INCLUDE_PATH}) - set(CMAKE_REQUIRED_LIBRARIES ${MPI_LIBRARIES}) - set(CMAKE_REQUIRED_FLAGS ${MPI_COMPILE_FLAGS}) - - include(CheckCSourceRuns) - set(MPI_C_TEST_MULTIPLE_SOURCE " -#include <stdio.h> -#include <mpi.h> - -int main(int argc, char **argv) { - int provided; - - MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); - - if (MPI_THREAD_MULTIPLE > provided) { - fprintf(stderr,\"MPI implementation is not supporting MPI_THREAD_MULTIPLE\"); - MPI_Finalize(); - return 1000+MPI_THREAD_MULTIPLE-provided; - } - MPI_Finalize(); - return 0; -} -") - - set(MPI_C_TEST_SERIALIZED_SOURCE " -#include <stdio.h> -#include <mpi.h> - -int main(int argc, char **argv) { - int provided; - - MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &provided); - - if (MPI_THREAD_SERIALIZED > provided) { - printf(\"MPI implementation is not supporting MPI_THREAD_SERIALIZED\"); - MPI_Finalize(); - return 1; - } - MPI_Finalize(); - return 0; -} -") - - set(MPI_C_TEST_FUNNELED_SOURCE " -#include <stdio.h> -#include <mpi.h> - -int main(int argc, char **argv) { - int provided; - - MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided); - - if (MPI_THREAD_FUNNELED > provided) { - printf(\"MPI implementation is not supporting MPI_THREAD_FUNNELED\"); - MPI_Finalize(); - return 1; - } - MPI_Finalize(); - return 0; -} -") - - check_c_source_runs("${MPI_C_TEST_MULTIPLE_SOURCE}" MULTIPLE_TEST_RUNS) - if(NOT MULTIPLE_TEST_RUNS) - check_c_source_runs("${MPI_C_TEST_SERIALIZED_SOURCE}" SERIALIZED_TEST_RUNS) - if(NOT SERIALIZED_TEST_RUNS) - check_c_source_runs("${MPI_C_TEST_FUNNELED_SOURCE}" FUNNELED_TEST_RUNS) - if(NOT FUNNELED_TEST_RUNS) - set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SINGLE") - else(NOT FUNNELED_TEST_RUNS) - set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_FUNNELED") - endif(NOT FUNNELED_TEST_RUNS) - else(NOT SERIALIZED_TEST_RUNS) - set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SERIALIZED") - endif(NOT SERIALIZED_TEST_RUNS) - else(NOT MULTIPLE_TEST_RUNS) - set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_MULTIPLE") - endif(NOT MULTIPLE_TEST_RUNS) - # Set flags for building test program - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) -endif(MPI_FOUND) \ No newline at end of file diff --git a/cmake_modules/morse/find/FindMUMPS.cmake b/cmake_modules/morse/find/FindMUMPS.cmake deleted file mode 100644 index ca6a92f62..000000000 --- a/cmake_modules/morse/find/FindMUMPS.cmake +++ /dev/null @@ -1,621 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find MUMPS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(MUMPS -# [REQUIRED] # Fail with error if mumps is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# COMPONENTS can be one of the following: -# MPI: to activate detection of the parallel MPI version (default behaviour) -# SEQ: to activate detection of sequential version (exclude MPI version) -# SCOTCH: to activate detection of MUMPS linked with SCOTCH -# METIS: to activate detection of MUMPS linked with METIS -# This module finds headers and mumps library. -# Results are reported in variables: -# MUMPS_FOUND - True if headers and requested libraries were found -# MUMPS_INCLUDE_DIRS - mumps include directories -# MUMPS_LIBRARY_DIRS - Link directories for mumps libraries -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DMUMPS_DIR=path/to/mumps): -# MUMPS_DIR - Where to find the base directory of mumps -# MUMPS_INCDIR - Where to find the header files -# MUMPS_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT MUMPS_FOUND) - set(MUMPS_DIR "" CACHE PATH "Root directory of MUMPS library") - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "A cache variable, namely MUMPS_DIR, has been set to specify the install directory of MUMPS") - endif() -endif() - -# Try to find MUMPS dependencies if specified as COMPONENTS during the call -set(MUMPS_LOOK_FOR_SEQ OFF) -set(MUMPS_LOOK_FOR_MPI ON) -if( MUMPS_FIND_COMPONENTS ) - foreach( component ${MUMPS_FIND_COMPONENTS} ) - if (${component} STREQUAL "SEQ") - # means we look for the sequential version of MUMPS (without MPI) - set(MUMPS_LOOK_FOR_SEQ ON) - set(MUMPS_LOOK_FOR_MPI OFF) - endif() - if (${component} STREQUAL "MPI") - # means we look for the sequential version of MUMPS (without MPI) - set(MUMPS_LOOK_FOR_MPI ON) - set(MUMPS_LOOK_FOR_SEQ OFF) - endif() - if (NOT ${component} STREQUAL "SEQ") - if(MUMPS_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - endif() - if(${component}_FOUND) - set(MUMPS_${component}_FOUND TRUE) - # should we have these variables available in gui modes? - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() - else() - set(MUMPS_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -if (NOT MUMPS_FIND_QUIETLY) - if (MUMPS_LOOK_FOR_SEQ) - message(STATUS "Looking for MUMPS - sequential version (without MPI)") - else() - message(STATUS "Looking for MUMPS - MPI version -" - " if you want to force detection of a sequential " - "version use find_package(MUMPS [REQUIRED] COMPONENTS SEQ [...])") - endif() -endif() - -if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - PkgConfig not used") -endif() - -# Dependencies detection -# ---------------------- - - -# Required dependencies -# --------------------- - -if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect pthread") -endif() -if (MUMPS_FIND_REQUIRED) - find_package(Threads REQUIRED) -else() - find_package(Threads) -endif() -set(MUMPS_EXTRA_LIBRARIES "") -if( THREADS_FOUND ) - list(APPEND MUMPS_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -endif () - -# MUMPS depends on BLAS -#---------------------- -if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect BLAS") -endif() -if (MUMPS_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) -else() - find_package(BLASEXT) -endif() - -# Optional dependencies -# --------------------- - -# MUMPS may depend on MPI -#------------------------ -if (NOT MPI_FOUND AND NOT MUMPS_LOOK_FOR_SEQ) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect MPI") - endif() - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (MUMPS_FIND_REQUIRED AND MUMPS_LOOK_FOR_MPI) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() -endif (NOT MPI_FOUND AND NOT MUMPS_LOOK_FOR_SEQ) - -# MUMPS may depend on ScaLAPACK (if MPI version) -#----------------------------------------------- -if (NOT SCALAPACK_FOUND AND NOT MUMPS_LOOK_FOR_SEQ) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect SCALAPACK") - endif() - # SCALAPACK is a required dependency if MPI is used - if (MUMPS_FIND_REQUIRED AND MUMPS_LOOK_FOR_MPI) - find_package(SCALAPACK REQUIRED) - else() - find_package(SCALAPACK) - endif() -endif (NOT SCALAPACK_FOUND AND NOT MUMPS_LOOK_FOR_SEQ) - -# MUMPS may depends on SCOTCH -#---------------------------- -if (NOT SCOTCH_FOUND) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect SCOTCH") - endif() - if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_SCOTCH) - find_package(SCOTCH REQUIRED) - else() - find_package(SCOTCH) - endif() -endif() - -# MUMPS may depends on METIS -#--------------------------- -if (NOT METIS_FOUND) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect METIS") - endif() - if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_METIS) - find_package(METIS REQUIRED) - else() - find_package(METIS) - endif() -endif() - - -# Looking for MUMPS -# ----------------- - -# Looking for include -# ------------------- - -# Try to find the mumps header in the given path -# ---------------------------------------------- -# call cmake macro to find the header path -if(MUMPS_DIR) - set(MUMPS_smumps_c.h_DIRS "MUMPS_smumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_smumps_c.h_DIRS - NAMES smumps_c.h - HINTS ${MUMPS_DIR} - PATH_SUFFIXES "include") - set(MUMPS_dmumps_c.h_DIRS "MUMPS_dmumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_dmumps_c.h_DIRS - NAMES dmumps_c.h - HINTS ${MUMPS_DIR} - PATH_SUFFIXES "include") - set(MUMPS_cmumps_c.h_DIRS "MUMPS_cmumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_cmumps_c.h_DIRS - NAMES cmumps_c.h - HINTS ${MUMPS_DIR} - PATH_SUFFIXES "include") - set(MUMPS_zmumps_c.h_DIRS "MUMPS_zmumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_zmumps_c.h_DIRS - NAMES zmumps_c.h - HINTS ${MUMPS_DIR} - PATH_SUFFIXES "include") -else() - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - endif() - endif() -endif() - -# If found, add path to cmake variable -# ------------------------------------ -# detect which precisions are available -if (MUMPS_smumps_c.h_DIRS) - mark_as_advanced(MUMPS_smumps_c.h_DIRS) - set(MUMPS_PREC_S ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_smumps_c.h_DIRS}") -else () - set(MUMPS_PREC_S OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- smumps_c.h not found") - endif() -endif() -if (MUMPS_dmumps_c.h_DIRS) - mark_as_advanced(MUMPS_dmumps_c.h_DIRS) - set(MUMPS_PREC_D ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_dmumps_c.h_DIRS}") -else () - set(MUMPS_PREC_D OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- dmumps_c.h not found") - endif() -endif() -if (MUMPS_cmumps_c.h_DIRS) - mark_as_advanced(MUMPS_cmumps_c.h_DIRS) - set(MUMPS_PREC_C ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_cmumps_c.h_DIRS}") -else () - set(MUMPS_PREC_C OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- cmumps_c.h not found") - endif() -endif() -if (MUMPS_zmumps_c.h_DIRS) - mark_as_advanced(MUMPS_zmumps_c.h_DIRS) - set(MUMPS_PREC_Z ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_zmumps_c.h_DIRS}") -else () - set(MUMPS_PREC_Z OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- zmumps_c.h not found") - endif() -endif() - -# Looking for lib -# --------------- - -# Try to find the mumps lib in the given paths -# -------------------------------------------- - -# call cmake macro to find the lib path -if(MUMPS_DIR) - set(MUMPS_smumps_LIBRARY "MUMPS_smumps_LIBRARY-NOTFOUND") - find_library(MUMPS_smumps_LIBRARY - NAMES smumps - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib) - set(MUMPS_dmumps_LIBRARY "MUMPS_dmumps_LIBRARY-NOTFOUND") - find_library(MUMPS_dmumps_LIBRARY - NAMES dmumps - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib) - set(MUMPS_cmumps_LIBRARY "MUMPS_cmumps_LIBRARY-NOTFOUND") - find_library(MUMPS_cmumps_LIBRARY - NAMES cmumps - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib) - set(MUMPS_zmumps_LIBRARY "MUMPS_zmumps_LIBRARY-NOTFOUND") - find_library(MUMPS_zmumps_LIBRARY - NAMES zmumps - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib) - set(MUMPS_mumps_common_LIBRARY "MUMPS_mumps_common_LIBRARY-NOTFOUND") - find_library(MUMPS_mumps_common_LIBRARY - NAMES mumps_common - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib) - set(MUMPS_mpiseq_LIBRARY "MUMPS_mpiseq_LIBRARY-NOTFOUND") - find_library(MUMPS_mpiseq_LIBRARY - NAMES mpiseq - HINTS ${MUMPS_DIR} - PATH_SUFFIXES libseq) - set(MUMPS_pord_LIBRARY "MUMPS_pord_LIBRARY-NOTFOUND") - find_library(MUMPS_pord_LIBRARY - NAMES pord - HINTS ${MUMPS_DIR} - PATH_SUFFIXES lib) -else() - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - endif() - endif() -endif() - -# If found, add path to cmake variable -# ------------------------------------ -set(MUMPS_LIBRARIES "") -set(MUMPS_LIBRARY_DIRS "") -# detect which precisions are available -if (MUMPS_smumps_LIBRARY) - mark_as_advanced(MUMPS_smumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_smumps_LIBRARY}") - get_filename_component(smumps_lib_path ${MUMPS_smumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${smumps_lib_path}") -else () - set(MUMPS_PREC_S OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libsmumps.a not found") - endif() -endif() -if (MUMPS_dmumps_LIBRARY) - mark_as_advanced(MUMPS_dmumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_dmumps_LIBRARY}") - get_filename_component(dmumps_lib_path ${MUMPS_dmumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${dmumps_lib_path}") -else () - set(MUMPS_PREC_D OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libdmumps.a not found") - endif() -endif() -if (MUMPS_cmumps_LIBRARY) - mark_as_advanced(MUMPS_cmumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_cmumps_LIBRARY}") - get_filename_component(cmumps_lib_path ${MUMPS_cmumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${cmumps_lib_path}") -else () - set(MUMPS_PREC_C OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libcmumps.a not found") - endif() -endif() -if (MUMPS_zmumps_LIBRARY) - mark_as_advanced(MUMPS_zmumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_zmumps_LIBRARY}") - get_filename_component(zmumps_lib_path ${MUMPS_zmumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${zmumps_lib_path}") -else () - set(MUMPS_PREC_Z OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libzmumps.a not found") - endif() -endif() -list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS) -# check that one precision arithmetic at least has been discovered -if (NOT MUMPS_PREC_S AND NOT MUMPS_PREC_D AND NOT MUMPS_PREC_C AND NOT MUMPS_PREC_S) - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- " - "no lib[sdcz]mumps.a have been found in ${MUMPS_DIR}/lib when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- no lib[sdcz]mumps.a have been found") - endif() - endif() -endif() -# other MUMPS libraries -if (MUMPS_mumps_common_LIBRARY) - mark_as_advanced(MUMPS_mumps_common_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_mumps_common_LIBRARY}") - get_filename_component(mumps_common_lib_path ${MUMPS_mumps_common_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${mumps_common_lib_path}") -else () - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- " - "libmumps_common.a not found in ${MUMPS_DIR}/lib when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libmumps_common.a not found") - endif() - endif() -endif() -if (MUMPS_mpiseq_LIBRARY) - mark_as_advanced(MUMPS_mpiseq_LIBRARY) - if (MUMPS_LOOK_FOR_SEQ) - list(APPEND MUMPS_LIBRARIES "${MUMPS_mpiseq_LIBRARY}") - get_filename_component(mpiseq_lib_path ${MUMPS_mpiseq_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${mpiseq_lib_path}") - endif() -else () - if (MUMPS_FIND_REQUIRED AND MUMPS_LOOK_FOR_SEQ) - message(FATAL_ERROR "Looking for mumps -- " - "libmpiseq.a not found in ${MUMPS_DIR}/libseq when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libmpiseq.a not found") - endif() - endif() -endif() -if (MUMPS_pord_LIBRARY) - mark_as_advanced(MUMPS_pord_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_pord_LIBRARY}") - get_filename_component(pord_lib_path ${MUMPS_pord_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${pord_lib_path}") -else () - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- " - "libpord.a not found in ${MUMPS_DIR}/lib when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libpord.a not found") - endif() - endif() -endif() - - -if(MUMPS_LIBRARIES) - # check a function to validate the find - if (MUMPS_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${MUMPS_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_FLAGS) - foreach(libdir ${MUMPS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - set(CMAKE_REQUIRED_LIBRARIES "${MUMPS_LIBRARIES}") - if (BLAS_FOUND) - if (BLAS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}") - endif() - foreach(libdir ${BLAS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}") - endif() - if (SCALAPACK_FOUND AND MUMPS_LOOK_FOR_MPI OR MUMPS_FIND_REQUIRED_MPI) - if (SCALAPACK_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${SCALAPACK_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCALAPACK_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${SCALAPACK_LIBRARIES}") - endif() - if (MPI_FOUND AND MUMPS_LOOK_FOR_MPI OR MUMPS_FIND_REQUIRED_MPI) - if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}") - endif() - if (MUMPS_FIND_REQUIRED_SCOTCH) - if (SCOTCH_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCOTCH_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${SCOTCH_LIBRARIES}") - endif() - if (MUMPS_FIND_REQUIRED_METIS) - if (METIS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}") - endif() - foreach(libdir ${METIS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${METIS_LIBRARIES}") - endif() - if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND CMAKE_REQUIRED_LIBRARIES "-lgfortran") - elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*") - list(APPEND CMAKE_REQUIRED_LIBRARIES "-lifcore") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES ${MUMPS_EXTRA_LIBRARIES}) - - include(CheckFortranFunctionExists) - unset(MUMPS_PREC_S_WORKS CACHE) - check_fortran_function_exists(smumps MUMPS_PREC_S_WORKS) - mark_as_advanced(MUMPS_PREC_S_WORKS) - unset(MUMPS_PREC_D_WORKS CACHE) - check_fortran_function_exists(dmumps MUMPS_PREC_D_WORKS) - mark_as_advanced(MUMPS_PREC_D_WORKS) - unset(MUMPS_PREC_C_WORKS CACHE) - check_fortran_function_exists(cmumps MUMPS_PREC_C_WORKS) - mark_as_advanced(MUMPS_PREC_C_WORKS) - unset(MUMPS_PREC_Z_WORKS CACHE) - check_fortran_function_exists(zmumps MUMPS_PREC_Z_WORKS) - mark_as_advanced(MUMPS_PREC_Z_WORKS) - - set(MUMPS_WORKS FALSE) - if(MUMPS_PREC_S_WORKS OR MUMPS_PREC_D_WORKS OR MUMPS_PREC_C_WORKS OR MUMPS_PREC_Z_WORKS) - set(MUMPS_WORKS TRUE) - endif() - - if (NOT MUMPS_WORKS) - if (SCOTCH_FOUND AND NOT MUMPS_FIND_REQUIRED_SCOTCH) - if (SCOTCH_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCOTCH_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${SCOTCH_LIBRARIES}") - endif() - check_fortran_function_exists(smumps MUMPS_PREC_S_WORKS) - check_fortran_function_exists(dmumps MUMPS_PREC_D_WORKS) - check_fortran_function_exists(cmumps MUMPS_PREC_C_WORKS) - check_fortran_function_exists(zmumps MUMPS_PREC_Z_WORKS) - endif() - - set(MUMPS_WORKS FALSE) - if(MUMPS_PREC_S_WORKS OR MUMPS_PREC_D_WORKS OR MUMPS_PREC_C_WORKS OR MUMPS_PREC_Z_WORKS) - set(MUMPS_WORKS TRUE) - endif() - - if (NOT MUMPS_WORKS) - if (METIS_FOUND AND NOT MUMPS_FIND_REQUIRED_METIS) - if (METIS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}") - endif() - foreach(libdir ${METIS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${METIS_LIBRARIES}") - endif() - check_fortran_function_exists(smumps MUMPS_PREC_S_WORKS) - check_fortran_function_exists(dmumps MUMPS_PREC_D_WORKS) - check_fortran_function_exists(cmumps MUMPS_PREC_C_WORKS) - check_fortran_function_exists(zmumps MUMPS_PREC_Z_WORKS) - endif() - - set(MUMPS_WORKS FALSE) - if(MUMPS_PREC_S_WORKS OR MUMPS_PREC_D_WORKS OR MUMPS_PREC_C_WORKS OR MUMPS_PREC_Z_WORKS) - set(MUMPS_WORKS TRUE) - endif() - - if(MUMPS_WORKS) - string(REPLACE " -L" ";" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(MUMPS_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - set(MUMPS_LIBRARY_DIRS "${CMAKE_REQUIRED_FLAGS}") - set(MUMPS_INCLUDE_DIRS "${CMAKE_REQUIRED_INCLUDES}") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS : test of [sdcz]mumps() fails") - message(STATUS "MUMPS_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "MUMPS_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "MUMPS_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for mumps : set MUMPS_LIBRARIES to NOTFOUND") - endif() - set(MUMPS_LIBRARIES "MUMPS_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(MUMPS_LIBRARIES) - - -# check that MUMPS has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MUMPS DEFAULT_MSG - MUMPS_LIBRARIES) diff --git a/cmake_modules/morse/find/FindPARMETIS.cmake b/cmake_modules/morse/find/FindPARMETIS.cmake deleted file mode 100644 index 44a6f847e..000000000 --- a/cmake_modules/morse/find/FindPARMETIS.cmake +++ /dev/null @@ -1,237 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find PARMETIS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(PARMETIS -# [REQUIRED] # Fail with error if parmetis is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and parmetis library. -# Results are reported in variables: -# PARMETIS_FOUND - True if headers and requested libraries were found -# PARMETIS_INCLUDE_DIRS - parmetis include directories -# PARMETIS_LIBRARY_DIRS - Link directories for parmetis libraries -# PARMETIS_LIBRARIES - parmetis component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DPARMETIS_DIR=path/to/parmetis): -# PARMETIS_DIR - Where to find the base directory of parmetis -# PARMETIS_INCDIR - Where to find the header files -# PARMETIS_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT PARMETIS_FOUND) - set(PARMETIS_DIR "" CACHE PATH "Root directory of PARMETIS library") - if (NOT PARMETIS_FIND_QUIETLY) - message(STATUS "A cache variable, namely PARMETIS_DIR, has been set to specify the install directory of PARMETIS") - endif() -endif() - -# PARMETIS depends on MPI -# try to find it specified as COMPONENTS during the call -if( PARMETIS_FIND_COMPONENTS ) - foreach( component ${PARMETIS_FIND_COMPONENTS} ) - if(PARMETIS_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(PARMETIS_${component}_FOUND TRUE) - # should we have these variables available in gui modes? - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() - else() - set(PARMETIS_${component}_FOUND FALSE) - endif() - endforeach() -endif() - - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") -else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the parmetis header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(PARMETIS_INCDIR) - set(PARMETIS_parmetis.h_DIRS "PARMETIS_parmetis.h_DIRS-NOTFOUND") - find_path(PARMETIS_parmetis.h_DIRS - NAMES parmetis.h - HINTS ${PARMETIS_INCDIR}) -else() - if(PARMETIS_DIR) - set(PARMETIS_parmetis.h_DIRS "PARMETIS_parmetis.h_DIRS-NOTFOUND") - find_path(PARMETIS_parmetis.h_DIRS - NAMES parmetis.h - HINTS ${PARMETIS_DIR} - PATH_SUFFIXES include) - else() - set(PARMETIS_parmetis.h_DIRS "PARMETIS_parmetis.h_DIRS-NOTFOUND") - find_path(PARMETIS_parmetis.h_DIRS - NAMES parmetis.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(PARMETIS_parmetis.h_DIRS) - - -# If found, add path to cmake variable -# ------------------------------------ -if (PARMETIS_parmetis.h_DIRS AND NOT PARMETIS_FIND_QUIETLY) - set(PARMETIS_INCLUDE_DIRS "${PARMETIS_parmetis.h_DIRS}") -else () - set(PARMETIS_INCLUDE_DIRS "PARMETIS_INCLUDE_DIRS-NOTFOUND") - if(NOT PARMETIS_FIND_QUIETLY) - message(STATUS "Looking for parmetis -- parmetis.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") -else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the parmetis lib in the given paths -# ---------------------------------------------- -# call cmake macro to find the lib path -if(PARMETIS_LIBDIR) - set(PARMETIS_parmetis_LIBRARY "PARMETIS_parmetis_LIBRARY-NOTFOUND") - find_library(PARMETIS_parmetis_LIBRARY - NAMES parmetis - HINTS ${PARMETIS_LIBDIR}) -else() - if(PARMETIS_DIR) - set(PARMETIS_parmetis_LIBRARY "PARMETIS_parmetis_LIBRARY-NOTFOUND") - find_library(PARMETIS_parmetis_LIBRARY - NAMES parmetis - HINTS ${PARMETIS_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(PARMETIS_parmetis_LIBRARY "PARMETIS_parmetis_LIBRARY-NOTFOUND") - find_library(PARMETIS_parmetis_LIBRARY - NAMES parmetis - HINTS ${_lib_env}) - endif() -endif() -mark_as_advanced(PARMETIS_parmetis_LIBRARY) - -# If found, add path to cmake variable -# ------------------------------------ -if (PARMETIS_parmetis_LIBRARY) - get_filename_component(parmetis_lib_path "${PARMETIS_parmetis_LIBRARY}" PATH) - # set cmake variables - set(PARMETIS_LIBRARIES "${PARMETIS_parmetis_LIBRARY}") - set(PARMETIS_LIBRARY_DIRS "${parmetis_lib_path}") -else () - set(PARMETIS_LIBRARIES "PARMETIS_LIBRARIES-NOTFOUND") - set(PARMETIS_LIBRARY_DIRS "PARMETIS_LIBRARY_DIRS-NOTFOUND") - if (NOT PARMETIS_FIND_QUIETLY) - message(STATUS "Looking for parmetis -- lib parmetis not found") - endif() -endif () - -if(PARMETIS_LIBRARIES) - # check a function to validate the find - if (PARMETIS_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${PARMETIS_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${PARMETIS_LIBRARIES}") - if (PARMETIS_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${PARMETIS_LIBRARY_DIRS}") - endif() - - unset(PARMETIS_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(ParMETIS_V3_NodeND PARMETIS_WORKS) - mark_as_advanced(PARMETIS_WORKS) - - if(PARMETIS_WORKS) - set(PARMETIS_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - else() - if(NOT PARMETIS_FIND_QUIETLY) - message(STATUS "Looking for PARMETIS : test of ParMETIS_V3_NodeND with PARMETIS library fails") - message(STATUS "PARMETIS_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "PARMETIS_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "PARMETIS_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for PARMETIS : set PARMETIS_LIBRARIES to NOTFOUND") - endif() - set(PARMETIS_LIBRARIES "PARMETIS_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(PARMETIS_LIBRARIES) - - -# check that PARMETIS has been found -# ---------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PARMETIS DEFAULT_MSG - PARMETIS_LIBRARIES - PARMETIS_INCLUDE_DIRS - PARMETIS_LIBRARY_DIRS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindPASTIX.cmake b/cmake_modules/morse/find/FindPASTIX.cmake deleted file mode 100644 index 00eab7efd..000000000 --- a/cmake_modules/morse/find/FindPASTIX.cmake +++ /dev/null @@ -1,608 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find PASTIX include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(PASTIX -# [REQUIRED] # Fail with error if pastix is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# Components available: -# STARPU -# CUDA (comes with cuBLAS): for use of GPUs -# MPI: for use of multiple nodes of distributed memory -# SCOTCH -# PTSCOTCH -# METIS -# This module finds headers and pastix library. -# Results are reported in variables: -# PASTIX_FOUND - True if headers and requested libraries were found -# PASTIX_INCLUDE_DIRS - pastix include directories -# PASTIX_LIBRARY_DIRS - Link directories for pastix libraries -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DPASTIX_DIR=path/to/pastix): -# PASTIX_DIR - Where to find the base directory of pastix -# PASTIX_INCDIR - Where to find the header files -# PASTIX_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT PASTIX_FOUND) - set(PASTIX_DIR "" CACHE PATH "Root directory of PASTIX library") - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "A cache variable, namely PASTIX_DIR, has been set to specify the install directory of PASTIX") - endif() -endif() - -# Try to find PASTIX dependencies if specified as COMPONENTS during the call -if( PASTIX_FIND_COMPONENTS ) - foreach( component ${PASTIX_FIND_COMPONENTS} ) - if(PASTIX_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(PASTIX_${component}_FOUND TRUE) - # should we have these variables available in gui modes? - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() - if (CUDA_FOUND) - mark_as_advanced(CUDA_BUILD_CUBIN) - mark_as_advanced(CUDA_BUILD_EMULATION) - mark_as_advanced(CUDA_SDK_ROOT_DIR) - mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR) - mark_as_advanced(CUDA_VERBOSE_BUILD) - endif() - else() - set(PASTIX_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE) - - pkg_search_module(PASTIX pastix) - if (NOT PASTIX_FIND_QUIETLY) - if (PASTIX_FOUND AND PASTIX_LIBRARIES) - message(STATUS "Looking for PASTIX - found using PkgConfig") - #if(NOT PASTIX_INCLUDE_DIRS) - # message("${Magenta}PASTIX_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to pastix headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for PASTIX - not found using PkgConfig." - "Perhaps you should add the directory containing pastix.pc" - "to the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - - if (PASTIX_FIND_VERSION_EXACT) - if( NOT (PASTIX_FIND_VERSION_MAJOR STREQUAL PASTIX_VERSION_MAJOR) OR - NOT (PASTIX_FIND_VERSION_MINOR STREQUAL PASTIX_VERSION_MINOR) ) - if(NOT PASTIX_FIND_QUIETLY) - message(FATAL_ERROR - "PASTIX version found is ${PASTIX_VERSION_STRING}" - "when required is ${PASTIX_FIND_VERSION}") - endif() - endif() - else() - # if the version found is older than the required then error - if( (PASTIX_FIND_VERSION_MAJOR STRGREATER PASTIX_VERSION_MAJOR) OR - (PASTIX_FIND_VERSION_MINOR STRGREATER PASTIX_VERSION_MINOR) ) - if(NOT PASTIX_FIND_QUIETLY) - message(FATAL_ERROR - "PASTIX version found is ${PASTIX_VERSION_STRING}" - "when required is ${PASTIX_FIND_VERSION} or newer") - endif() - endif() - endif() - -endif(PKG_CONFIG_EXECUTABLE) - -if(NOT PASTIX_FOUND OR NOT PASTIX_LIBRARIES) - - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - PkgConfig not used") - endif() - - # Dependencies detection - # ---------------------- - - - # Required dependencies - # --------------------- - - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect pthread") - endif() - if (PASTIX_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() - set(PASTIX_EXTRA_LIBRARIES "") - if( THREADS_FOUND ) - list(APPEND PASTIX_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - endif () - - # Add math library to the list of extra - # it normally exists on all common systems provided with a C compiler - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect libm") - endif() - set(PASTIX_M_LIBRARIES "") - if(UNIX OR WIN32) - find_library( - PASTIX_M_m_LIBRARY - NAMES m - ) - mark_as_advanced(PASTIX_M_m_LIBRARY) - if (PASTIX_M_m_LIBRARY) - list(APPEND PASTIX_M_LIBRARIES "${PASTIX_M_m_LIBRARY}") - list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_M_m_LIBRARY}") - else() - if (PASTIX_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find libm on your system." - "Are you sure to a have a C compiler installed?") - endif() - endif() - endif() - - # Try to find librt (libposix4 - POSIX.1b Realtime Extensions library) - # on Unix systems except Apple ones because it does not exist on it - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect librt") - endif() - set(PASTIX_RT_LIBRARIES "") - if(UNIX AND NOT APPLE) - find_library( - PASTIX_RT_rt_LIBRARY - NAMES rt - ) - mark_as_advanced(PASTIX_RT_rt_LIBRARY) - if (PASTIX_RT_rt_LIBRARY) - list(APPEND PASTIX_RT_LIBRARIES "${PASTIX_RT_rt_LIBRARY}") - list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_RT_rt_LIBRARY}") - else() - if (PASTIX_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find librt on your system") - endif() - endif() - endif() - - # PASTIX depends on BLAS - #----------------------- - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect BLAS") - endif() - if (PASTIX_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) - else() - find_package(BLASEXT) - endif() - - # PASTIX depends on HWLOC - #------------------------ - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect HWLOC") - endif() - if (PASTIX_FIND_REQUIRED) - find_package(HWLOC REQUIRED) - else() - find_package(HWLOC) - endif() - - # Optional dependencies - # --------------------- - - # PASTIX may depend on CUDA/CUBLAS - #--------------------------------- - if (NOT CUDA_FOUND) - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect CUDA/cuBLAS") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_CUDA) - find_package(CUDA REQUIRED) - else() - find_package(CUDA) - endif() - endif() - - # PASTIX may depend on MPI - #------------------------- - if (NOT MPI_FOUND) - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect MPI") - endif() - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_MPI) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() - endif (NOT MPI_FOUND) - - if( NOT STARPU_FOUND ) - - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect StarPU") - endif() - - set(PASTIX_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired") - - # create list of components in order to make a single call to find_package(starpu...) - # we explicitly need a StarPU version built with hwloc - set(STARPU_COMPONENT_LIST "HWLOC") - - # StarPU may depend on MPI - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (PASTIX_FIND_REQUIRED_MPI) - if(PASTIX_FIND_REQUIRED_MPI) - list(APPEND STARPU_COMPONENT_LIST "MPI") - endif() - endif() - if (PASTIX_FIND_REQUIRED_CUDA) - if(PASTIX_FIND_REQUIRED_CUDA) - list(APPEND STARPU_COMPONENT_LIST "CUDA") - endif() - endif() - # set the list of optional dependencies we may discover - set(STARPU_OPTIONAL_COMPONENT_LIST "MPI" "CUDA" "MAGMA") - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_STARPU) - find_package(STARPU ${PASTIX_STARPU_VERSION} REQUIRED - COMPONENTS ${STARPU_COMPONENT_LIST} - OPTIONAL_COMPONENTS ${STARPU_OPTIONAL_COMPONENT_LIST}) - else() - find_package(STARPU ${PASTIX_STARPU_VERSION} - COMPONENTS ${STARPU_COMPONENT_LIST} - OPTIONAL_COMPONENTS ${STARPU_OPTIONAL_COMPONENT_LIST}) - endif() - - endif() - - # PASTIX may depends on SCOTCH - #----------------------------- - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect SCOTCH") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_SCOTCH) - find_package(SCOTCH REQUIRED) - else() - find_package(SCOTCH) - endif() - - # PASTIX may depends on PTSCOTCH - #------------------------------- - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect PTSCOTCH") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_PTSCOTCH) - find_package(PTSCOTCH REQUIRED) - else() - find_package(PTSCOTCH) - endif() - - # PASTIX may depends on METIS - #---------------------------- - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect METIS") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_METIS) - find_package(METIS REQUIRED) - else() - find_package(METIS) - endif() - - # Error if pastix required and no partitioning lib found - if (PASTIX_FIND_REQUIRED AND NOT SCOTCH_FOUND AND NOT PTSCOTCH_FOUND AND NOT METIS_FOUND) - message(FATAL_ERROR "Could NOT find any partitioning library on your system" - " (install scotch, ptscotch or metis)") - endif() - - - # Looking for PaStiX - # ------------------ - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the pastix header in the given paths - # --------------------------------------------------- - # call cmake macro to find the header path - if(PASTIX_INCDIR) - set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND") - find_path(PASTIX_pastix.h_DIRS - NAMES pastix.h - HINTS ${PASTIX_INCDIR}) - else() - if(PASTIX_DIR) - set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND") - find_path(PASTIX_pastix.h_DIRS - NAMES pastix.h - HINTS ${PASTIX_DIR} - PATH_SUFFIXES "include" "include/pastix") - else() - set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND") - find_path(PASTIX_pastix.h_DIRS - NAMES pastix.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(PASTIX_pastix.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (PASTIX_pastix.h_DIRS) - set(PASTIX_INCLUDE_DIRS "${PASTIX_pastix.h_DIRS}") - else () - set(PASTIX_INCLUDE_DIRS "PASTIX_INCLUDE_DIRS-NOTFOUND") - if(NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for pastix -- pastix.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the pastix lib in the given paths - # ------------------------------------------------ - - # create list of libs to find - set(PASTIX_libs_to_find "pastix_murge;pastix") - - # call cmake macro to find the lib path - if(PASTIX_LIBDIR) - foreach(pastix_lib ${PASTIX_libs_to_find}) - set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND") - find_library(PASTIX_${pastix_lib}_LIBRARY - NAMES ${pastix_lib} - HINTS ${PASTIX_LIBDIR}) - endforeach() - else() - if(PASTIX_DIR) - foreach(pastix_lib ${PASTIX_libs_to_find}) - set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND") - find_library(PASTIX_${pastix_lib}_LIBRARY - NAMES ${pastix_lib} - HINTS ${PASTIX_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(pastix_lib ${PASTIX_libs_to_find}) - set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND") - find_library(PASTIX_${pastix_lib}_LIBRARY - NAMES ${pastix_lib} - HINTS ${_lib_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - foreach(pastix_lib ${PASTIX_libs_to_find}) - - get_filename_component(${pastix_lib}_lib_path ${PASTIX_${pastix_lib}_LIBRARY} PATH) - # set cmake variables (respects naming convention) - if (PASTIX_LIBRARIES) - list(APPEND PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}") - else() - set(PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}") - endif() - if (PASTIX_LIBRARY_DIRS) - list(APPEND PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}") - else() - set(PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}") - endif() - mark_as_advanced(PASTIX_${pastix_lib}_LIBRARY) - - endforeach(pastix_lib ${PASTIX_libs_to_find}) - - if(PASTIX_LIBRARIES) - # check a function to validate the find - if (PASTIX_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${PASTIX_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_FLAGS) - foreach(libdir ${PASTIX_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - set(CMAKE_REQUIRED_LIBRARIES "${PASTIX_LIBRARIES}") - if (STARPU_FOUND) - if (STARPU_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}") - endif() - foreach(libdir ${STARPU_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES}") - endif() - if (CUDA_FOUND) - if (CUDA_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}") - endif() - foreach(libdir ${CUDA_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - endif() - if (MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}") - endif() - if (HWLOC_FOUND) - if (HWLOC_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}") - endif() - foreach(libdir ${HWLOC_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}") - endif() - if (BLAS_FOUND) - if (BLAS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}") - endif() - foreach(libdir ${BLAS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}") - endif() - if (SCOTCH_FOUND) - if (SCOTCH_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCOTCH_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${SCOTCH_LIBRARIES}") - endif() - if (PTSCOTCH_FOUND) - if (PTSCOTCH_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${PTSCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${PTSCOTCH_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${PTSCOTCH_LIBRARIES}") - endif() - if (METIS_FOUND) - if (METIS_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}") - endif() - foreach(libdir ${METIS_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${METIS_LIBRARIES}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES ${PASTIX_EXTRA_LIBRARIES}) - - unset(PASTIX_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(pastix PASTIX_WORKS) - mark_as_advanced(PASTIX_WORKS) - - if(PASTIX_WORKS) - string(REPLACE " -L" ";" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(PASTIX_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - set(PASTIX_LIBRARY_DIRS "${CMAKE_REQUIRED_FLAGS}") - set(PASTIX_INCLUDE_DIRS "${CMAKE_REQUIRED_INCLUDES}") - else() - if(NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX : test of pastix() fails") - message(STATUS "PASTIX_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "PASTIX_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "PASTIX_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for pastix : set PASTIX_LIBRARIES to NOTFOUND") - endif() - set(PASTIX_LIBRARIES "PASTIX_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(PASTIX_LIBRARIES) - -endif(NOT PASTIX_FOUND OR NOT PASTIX_LIBRARIES) - - -# check that PASTIX has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PASTIX DEFAULT_MSG - PASTIX_LIBRARIES) diff --git a/cmake_modules/morse/find/FindPTSCOTCH.cmake b/cmake_modules/morse/find/FindPTSCOTCH.cmake deleted file mode 100644 index 10ab86564..000000000 --- a/cmake_modules/morse/find/FindPTSCOTCH.cmake +++ /dev/null @@ -1,315 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find PTSCOTCH include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(PTSCOTCH -# [REQUIRED] # Fail with error if ptscotch is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and ptscotch library. -# Results are reported in variables: -# PTSCOTCH_FOUND - True if headers and requested libraries were found -# PTSCOTCH_INCLUDE_DIRS - ptscotch include directories -# PTSCOTCH_LIBRARY_DIRS - Link directories for ptscotch libraries -# PTSCOTCH_LIBRARIES - ptscotch component libraries to be linked -# PTSCOTCH_INTSIZE - Number of octets occupied by a SCOTCH_Num -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DPTSCOTCH=path/to/ptscotch): -# PTSCOTCH_DIR - Where to find the base directory of ptscotch -# PTSCOTCH_INCDIR - Where to find the header files -# PTSCOTCH_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT PTSCOTCH_FOUND) - set(PTSCOTCH_DIR "" CACHE PATH "Root directory of PTSCOTCH library") - if (NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "A cache variable, namely PTSCOTCH_DIR, has been set to specify the install directory of PTSCOTCH") - endif() -endif() - -# PTSCOTCH may depend on MPI and Threads -# try to find it specified as COMPONENTS during the call -if( PTSCOTCH_FIND_COMPONENTS ) - foreach( component ${PTSCOTCH_FIND_COMPONENTS} ) - if(PTSCOTCH_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(PTSCOTCH_${component}_FOUND TRUE) - if( THREADS_FOUND ) - list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - endif () - if (MPI_FOUND) - # should we have these variables available in gui modes? - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES} ) - include_directories( ${MPI_C_INCLUDE_PATH} ) - endif() - else() - set(PTSCOTCH_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# PTSCOTCH may depend on Threads, try to find it -if (NOT THREADS_FOUND) - find_package(Threads) -endif() - -# PTSCOTCH may depend on MPI, try to find it -if (NOT MPI_FOUND) - find_package(MPI) -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") -else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the ptscotch header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(PTSCOTCH_INCDIR) - set(PTSCOTCH_ptscotch.h_DIRS "PTSCOTCH_ptscotch.h_DIRS-NOTFOUND") - find_path(PTSCOTCH_ptscotch.h_DIRS - NAMES ptscotch.h - HINTS ${PTSCOTCH_INCDIR}) -else() - if(PTSCOTCH_DIR) - set(PTSCOTCH_ptscotch.h_DIRS "PTSCOTCH_ptscotch.h_DIRS-NOTFOUND") - find_path(PTSCOTCH_ptscotch.h_DIRS - NAMES ptscotch.h - HINTS ${PTSCOTCH_DIR} - PATH_SUFFIXES include) - else() - set(PTSCOTCH_ptscotch.h_DIRS "PTSCOTCH_ptscotch.h_DIRS-NOTFOUND") - find_path(PTSCOTCH_ptscotch.h_DIRS - NAMES ptscotch.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(PTSCOTCH_ptscotch.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (PTSCOTCH_ptscotch.h_DIRS) - set(PTSCOTCH_INCLUDE_DIRS "${PTSCOTCH_ptscotch.h_DIRS}") -else () - set(PTSCOTCH_INCLUDE_DIRS "PTSCOTCH_INCLUDE_DIRS-NOTFOUND") - if (NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "Looking for ptscotch -- ptscotch.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") -else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the ptscotch lib in the given paths -# ---------------------------------------------- - -set(PTSCOTCH_libs_to_find "ptscotch;scotch;scotcherrexit") - -# call cmake macro to find the lib path -if(PTSCOTCH_LIBDIR) - foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") - find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY - NAMES ${ptscotch_lib} - HINTS ${PTSCOTCH_LIBDIR}) - endforeach() -else() - if(PTSCOTCH_DIR) - foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") - find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY - NAMES ${ptscotch_lib} - HINTS ${PTSCOTCH_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") - find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY - NAMES ${ptscotch_lib} - HINTS ${_lib_env}) - endforeach() - endif() -endif() - -set(PTSCOTCH_LIBRARIES "") -set(PTSCOTCH_LIBRARY_DIRS "") -# If found, add path to cmake variable -# ------------------------------------ -foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - - if (PTSCOTCH_${ptscotch_lib}_LIBRARY) - get_filename_component(${ptscotch_lib}_lib_path "${PTSCOTCH_${ptscotch_lib}_LIBRARY}" PATH) - # set cmake variables - list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}") - list(APPEND PTSCOTCH_LIBRARY_DIRS "${${ptscotch_lib}_lib_path}") - else () - list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}") - if (NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "Looking for ptscotch -- lib ${ptscotch_lib} not found") - endif() - endif () - - mark_as_advanced(PTSCOTCH_${ptscotch_lib}_LIBRARY) - -endforeach() - - -if(PTSCOTCH_LIBRARIES) - # check a function to validate the find - if (PTSCOTCH_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${PTSCOTCH_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${PTSCOTCH_LIBRARIES}") - if(CMAKE_THREAD_LIBS_INIT) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") - endif() - if (PTSCOTCH_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${PTSCOTCH_LIBRARY_DIRS}") - endif() - if (MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}") - endif() - - unset(PTSCOTCH_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(SCOTCH_dgraphInit PTSCOTCH_WORKS) - mark_as_advanced(PTSCOTCH_WORKS) - - if(PTSCOTCH_WORKS) - set(PTSCOTCH_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - else() - if(NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH library fails") - message(STATUS "PTSCOTCH_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "PTSCOTCH_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "PTSCOTCH_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for PTSCOTCH : set PTSCOTCH_LIBRARIES to NOTFOUND") - endif() - set(PTSCOTCH_LIBRARIES "PTSCOTCH_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(PTSCOTCH_LIBRARIES) - - -# Check the size of SCOTCH_Num -# --------------------------------- -set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS}) - -include(CheckCSourceRuns) -set(PTSCOTCH_C_TEST_SCOTCH_Num_4 " -#include <stdio.h> -#include <ptscotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 4) - return 0; - else - return 1; -} -") - -set(PTSCOTCH_C_TEST_SCOTCH_Num_8 " -#include <stdio.h> -#include <ptscotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 8) - return 0; - else - return 1; -} -") -set(CMAKE_REQUIRED_INCLUDES "") -check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_4}" PTSCOTCH_Num_4) -if(NOT PTSCOTCH_Num_4) - check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8) - if(NOT PTSCOTCH_Num_8) - set(PTSCOTCH_INTSIZE -1) - else() - set(PTSCOTCH_INTSIZE 8) - endif() -else() - set(PTSCOTCH_INTSIZE 4) -endif() - -# check that PTSCOTCH has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG - PTSCOTCH_LIBRARIES - PTSCOTCH_INCLUDE_DIRS - PTSCOTCH_LIBRARY_DIRS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake deleted file mode 100644 index 379c52ad6..000000000 --- a/cmake_modules/morse/find/FindQUARK.cmake +++ /dev/null @@ -1,248 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find QUARK include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(QUARK -# [REQUIRED] # Fail with error if quark is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and quark library. -# Results are reported in variables: -# QUARK_FOUND - True if headers and requested libraries were found -# QUARK_INCLUDE_DIRS - quark include directories -# QUARK_LIBRARY_DIRS - Link directories for quark libraries -# QUARK_LIBRARIES - quark component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DQUARK=path/to/quark): -# QUARK_DIR - Where to find the base directory of quark -# QUARK_INCDIR - Where to find the header files -# QUARK_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT QUARK_FOUND) - set(QUARK_DIR "" CACHE PATH "Root directory of QUARK library") - if (NOT QUARK_FIND_QUIETLY) - message(STATUS "A cache variable, namely QUARK_DIR, has been set to specify the install directory of QUARK") - endif() -endif() - -# QUARK may depend on HWLOC -# try to find it specified as COMPONENTS during the call -if( QUARK_FIND_COMPONENTS ) - foreach( component ${QUARK_FIND_COMPONENTS} ) - if(QUARK_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(QUARK_${component}_FOUND TRUE) - else() - set(QUARK_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# QUARK may depend on Threads, try to find it -if (NOT Threads_FOUND) - find_package(Threads REQUIRED) -endif() - -# QUARK may depend on HWLOC, try to find it -if (NOT HWLOC_FOUND) - find_package(HWLOC) -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") -else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the quark header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(QUARK_INCDIR) - set(QUARK_quark.h_DIRS "QUARK_quark.h_DIRS-NOTFOUND") - find_path(QUARK_quark.h_DIRS - NAMES quark.h - HINTS ${QUARK_INCDIR}) -else() - if(QUARK_DIR) - set(QUARK_quark.h_DIRS "QUARK_quark.h_DIRS-NOTFOUND") - find_path(QUARK_quark.h_DIRS - NAMES quark.h - HINTS ${QUARK_DIR} - PATH_SUFFIXES include) - else() - set(QUARK_quark.h_DIRS "QUARK_quark.h_DIRS-NOTFOUND") - find_path(QUARK_quark.h_DIRS - NAMES quark.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(QUARK_quark.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (QUARK_quark.h_DIRS) - set(QUARK_INCLUDE_DIRS "${QUARK_quark.h_DIRS}") -else () - set(QUARK_INCLUDE_DIRS "QUARK_INCLUDE_DIRS-NOTFOUND") - if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for quark -- quark.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") -else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the quark lib in the given paths -# ---------------------------------------------- - -# call cmake macro to find the lib path -if(QUARK_LIBDIR) - set(QUARK_quark_LIBRARY "QUARK_quark_LIBRARY-NOTFOUND") - find_library(QUARK_quark_LIBRARY - NAMES quark - HINTS ${QUARK_LIBDIR}) -else() - if(QUARK_DIR) - set(QUARK_quark_LIBRARY "QUARK_quark_LIBRARY-NOTFOUND") - find_library(QUARK_quark_LIBRARY - NAMES quark - HINTS ${QUARK_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(QUARK_quark_LIBRARY "QUARK_quark_LIBRARY-NOTFOUND") - find_library(QUARK_quark_LIBRARY - NAMES quark - HINTS ${_lib_env}) - endif() -endif() -mark_as_advanced(QUARK_quark_LIBRARY) - -# If found, add path to cmake variable -# ------------------------------------ -if (QUARK_quark_LIBRARY) - get_filename_component(quark_lib_path "${QUARK_quark_LIBRARY}" PATH) - # set cmake variables - set(QUARK_LIBRARIES "${QUARK_quark_LIBRARY}") - set(QUARK_LIBRARY_DIRS "${quark_lib_path}") -else () - set(QUARK_LIBRARIES "QUARK_LIBRARIES-NOTFOUND") - set(QUARK_LIBRARY_DIRS "QUARK_LIBRARY_DIRS-NOTFOUND") - if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for quark -- lib quark not found") - endif() -endif () - -if(QUARK_LIBRARIES) - # check a function to validate the find - if (QUARK_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${QUARK_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${QUARK_LIBRARIES};${CMAKE_THREAD_LIBS_INIT}") - if (QUARK_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${QUARK_LIBRARY_DIRS}") - endif() - if (HWLOC_FOUND) - if (HWLOC_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}") - if (HWLOC_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${HWLOC_LIBRARY_DIRS}") - endif() - endif() - - unset(QUARK_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(QUARK_New QUARK_WORKS) - mark_as_advanced(QUARK_WORKS) - - if(QUARK_WORKS) - set(QUARK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - else() - if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for QUARK : test of QUARK_New with QUARK library fails") - message(STATUS "QUARK_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "QUARK_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "QUARK_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for QUARK : set QUARK_LIBRARIES to NOTFOUND") - endif() - set(QUARK_LIBRARIES "QUARK_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(QUARK_LIBRARIES) - - -# check that QUARK has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(QUARK DEFAULT_MSG - QUARK_LIBRARIES - QUARK_INCLUDE_DIRS - QUARK_LIBRARY_DIRS) diff --git a/cmake_modules/morse/find/FindSCALAPACK.cmake b/cmake_modules/morse/find/FindSCALAPACK.cmake deleted file mode 100644 index 4d9151880..000000000 --- a/cmake_modules/morse/find/FindSCALAPACK.cmake +++ /dev/null @@ -1,450 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find SCALAPACK library -# This module finds an installed fortran library that implements the SCALAPACK -# linear-algebra interface. -# -# This module sets the following variables: -# SCALAPACK_FOUND - set to true if a library implementing the SCALAPACK interface -# is found -# SCALAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l -# and -L). -# SCALAPACK_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use SCALAPACK -# SCALAPACK95_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use SCALAPACK95 -# SCALAPACK95_FOUND - set to true if a library implementing the SCALAPACK f95 -# interface is found -# BLA_STATIC if set on this determines what kind of linkage we do (static) -# BLA_VENDOR if set checks only the specified vendor, if not set checks -# all the possibilities -# BLA_F95 if set on tries to find the f95 interfaces for BLAS/SCALAPACK -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DSCALAPACK_DIR=path/to/scalapack): -# SCALAPACK_DIR - Where to find the base directory of scalapack -# SCALAPACK_INCDIR - Where to find the header files -# SCALAPACK_LIBDIR - Where to find the library files -# Note that if BLAS_DIR is set, it will also look for scalapack in it -### List of vendors (BLA_VENDOR) valid in this module -## Intel(mkl), ACML, Apple, NAS, Generic - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -# Set some colors -if(NOT WIN32) - string(ASCII 27 Esc) - set(ColourReset "${Esc}[m") - set(ColourBold "${Esc}[1m") - set(Red "${Esc}[31m") - set(Green "${Esc}[32m") - set(Yellow "${Esc}[33m") - set(Blue "${Esc}[34m") - set(Magenta "${Esc}[35m") - set(Cyan "${Esc}[36m") - set(White "${Esc}[37m") - set(BoldRed "${Esc}[1;31m") - set(BoldGreen "${Esc}[1;32m") - set(BoldYellow "${Esc}[1;33m") - set(BoldBlue "${Esc}[1;34m") - set(BoldMagenta "${Esc}[1;35m") - set(BoldCyan "${Esc}[1;36m") - set(BoldWhite "${Esc}[1;37m") -endif() - -## Some macros to print status when search for headers and libs -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we look for ${_lib_to_find} in" - "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," - "Mac: DYLD_LIBRARY_PATH," - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," - "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -if (NOT SCALAPACK_FOUND) - set(SCALAPACK_DIR "" CACHE PATH "Root directory of SCALAPACK library") - if (NOT SCALAPACK_FIND_QUIETLY) - message(STATUS "A cache variable, namely SCALAPACK_DIR, has been set to specify the install directory of SCALAPACK") - endif() -endif (NOT SCALAPACK_FOUND) - -option(SCALAPACK_VERBOSE "Print some additional information during SCALAPACK -libraries detection" OFF) -if (BLAS_VERBOSE) - set(SCALAPACK_VERBOSE ON) -endif () -set(_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) - -set(SCALAPACK_FOUND FALSE) -set(SCALAPACK95_FOUND FALSE) - -# TODO: move this stuff to separate module - -macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack _mpi _threads) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - -set(_libraries_work TRUE) -set(${LIBRARIES}) -set(_combined_name) -if (NOT _libdir) - if (BLAS_DIR) - list(APPEND _libdir "${BLAS_DIR}") - list(APPEND _libdir "${BLAS_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${BLAS_DIR}/lib64") - list(APPEND _libdir "${BLAS_DIR}/lib/intel64") - else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") - endif() - endif () - if (BLAS_LIBDIR) - list(APPEND _libdir "${BLAS_LIBDIR}") - endif () - if (SCALAPACK_DIR) - list(APPEND _libdir "${SCALAPACK_DIR}") - list(APPEND _libdir "${SCALAPACK_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${SCALAPACK_DIR}/lib64") - list(APPEND _libdir "${SCALAPACK_DIR}/lib/intel64") - else() - list(APPEND _libdir "${SCALAPACK_DIR}/lib32") - list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32") - endif() - endif () - if (SCALAPACK_LIBDIR) - list(APPEND _libdir "${SCALAPACK_LIBDIR}") - endif () - if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${_libdir2}") - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif () - -if (SCALAPACK_VERBOSE) - message("${Cyan}Try to find SCALAPACK libraries: ${_list}") -endif () - -foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif ( WIN32 ) - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif (APPLE) - else (BLA_STATIC) - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and libscalapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif (BLA_STATIC) - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - HINTS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - # Print status if not found - # ------------------------- - if (NOT ${_prefix}_${_library}_LIBRARY AND NOT SCALAPACK_FIND_QUIETLY AND SCALAPACK_VERBOSE) - Print_Find_Library_Blas_Status(scalapack ${_library} ${_libdir}) - endif () - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) -endforeach(_library ${_list}) - -if(_libraries_work) - # Test this combination of libraries. - if(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blaslapack} "-Wl,--end-group" ${_mpi} ${_threads}) - else(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blaslapack} ${_mpi} ${_threads}) - endif(UNIX AND BLA_STATIC) - if (SCALAPACK_VERBOSE) - message("${Cyan}SCALAPACK libs found. Try to compile symbol ${_name} with" - "following libraries: ${CMAKE_REQUIRED_LIBRARIES}") - endif () - if(NOT SCALAPACK_FOUND) - unset(${_prefix}${_combined_name}_WORKS CACHE) - endif() - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -endif(_libraries_work) - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_blaslapack} ${_mpi} ${_threads}) - else(_libraries_work) - set(${LIBRARIES} FALSE) - endif(_libraries_work) - -endmacro(Check_Scalapack_Libraries) - - -set(SCALAPACK_LINKER_FLAGS) -set(SCALAPACK_LIBRARIES) -set(SCALAPACK95_LIBRARIES) - -if (NOT BLAS_FOUND) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_package(BLAS) - else() - find_package(BLAS REQUIRED) - endif() -endif () - -if (NOT LAPACK_FOUND) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_package(LAPACK) - else() - find_package(LAPACK REQUIRED) - endif() -endif () - -if (NOT MPI_FOUND) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_package(MPI) - else() - find_package(MPI REQUIRED) - endif() -endif () - -if(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND) - set(SCALAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - list(APPEND SCALAPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) - if ($ENV{BLA_VENDOR} MATCHES ".+") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - else ($ENV{BLA_VENDOR} MATCHES ".+") - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif(NOT BLA_VENDOR) - endif ($ENV{BLA_VENDOR} MATCHES ".+") - -# Generic SCALAPACK library -if (BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "All") - if ( NOT SCALAPACK_LIBRARIES ) - check_scalapack_libraries( - SCALAPACK_LIBRARIES - SCALAPACK - pdgemm - "" - "scalapack" # scalapack lib to look for - "${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs - "${MPI_Fortran_LIBRARIES}" # mpi libs - "" # threads libs - ) - endif ( NOT SCALAPACK_LIBRARIES ) -endif () -#intel scalapack -#if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") -# if (NOT WIN32) -# set(LM "-lm") -# endif () -# if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) -# if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) -# find_PACKAGE(Threads) -# else() -# find_package(Threads REQUIRED) -# endif() -# -# set(SCALAPACK_SEARCH_LIBS "") -# -# if (BLA_F95) -# set(SCALAPACK_mkl_SEARCH_SYMBOL "PDGEMM") -# set(_LIBRARIES SCALAPACK95_LIBRARIES) -# set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) -# list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64") -# else() -# set(SCALAPACK_mkl_SEARCH_SYMBOL "pdgemm") -# set(_LIBRARIES SCALAPACK_LIBRARIES) -# set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) -# list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64") -# endif() -# - # First try empty scalapack libs -# if (NOT ${_LIBRARIES}) -# check_scalapack_libraries( -# ${_LIBRARIES} -# BLAS -# ${SCALAPACK_mkl_SEARCH_SYMBOL} -# "" -# "" -# "${_BLAS_LIBRARIES}" -# "mkl_blacs_intelmpi_lp64" -# "${CMAKE_THREAD_LIBS_INIT};${LM}" -# ) -# endif () - # Then try the search libs -# foreach (IT ${SCALAPACK_SEARCH_LIBS}) -# if (NOT ${_LIBRARIES}) -# check_scalapack_libraries( -# ${_LIBRARIES} -# BLAS -# ${SCALAPACK_mkl_SEARCH_SYMBOL} -# "" -# "${IT}" -# "${_BLAS_LIBRARIES}" -# "mkl_blacs_intelmpi_lp64" -# "${CMAKE_THREAD_LIBS_INIT};${LM}" -# ) -# endif () -# endforeach () -# endif () -#endif() -else(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND) - message(STATUS "SCALAPACK requires BLAS, LAPACK, and MPI") -endif(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND) - -if(BLA_F95) - if(SCALAPACK95_LIBRARIES) - set(SCALAPACK95_FOUND TRUE) - else(SCALAPACK95_LIBRARIES) - set(SCALAPACK95_FOUND FALSE) - endif(SCALAPACK95_LIBRARIES) - if(NOT SCALAPACK_FIND_QUIETLY) - if(SCALAPACK95_FOUND) - message(STATUS "A library with SCALAPACK95 API found.") - message(STATUS "SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARIES}") - else(SCALAPACK95_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but SCALAPACK 95 libraries could not be found or check of symbols failed." - "\nPlease indicate where to find SCALAPACK libraries. You have three options:\n" - "- Option 1: Provide the root directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n" - "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure." - "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name." - "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - if(SCALAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with SCALAPACK95 API not found. Please specify library location." - ) - else(SCALAPACK_FIND_REQUIRED) - message(STATUS - "A library with SCALAPACK95 API not found. Please specify library location." - ) - endif(SCALAPACK_FIND_REQUIRED) - endif(SCALAPACK95_FOUND) - endif(NOT SCALAPACK_FIND_QUIETLY) - set(SCALAPACK_FOUND "${SCALAPACK95_FOUND}") - set(SCALAPACK_LIBRARIES "${SCALAPACK95_LIBRARIES}") -else(BLA_F95) - if(SCALAPACK_LIBRARIES) - set(SCALAPACK_FOUND TRUE) - else(SCALAPACK_LIBRARIES) - set(SCALAPACK_FOUND FALSE) - endif(SCALAPACK_LIBRARIES) - - if(NOT SCALAPACK_FIND_QUIETLY) - if(SCALAPACK_FOUND) - message(STATUS "A library with SCALAPACK API found.") - message(STATUS "SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARIES}") - else(SCALAPACK_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but SCALAPACK libraries could not be found or check of symbols failed." - "\nPlease indicate where to find SCALAPACK libraries. You have three options:\n" - "- Option 1: Provide the root directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n" - "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure." - "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name." - "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit)," - "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model)," - "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic") - if(SCALAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with SCALAPACK API not found. Please specify library location." - ) - else(SCALAPACK_FIND_REQUIRED) - message(STATUS - "A library with SCALAPACK API not found. Please specify library location." - ) - endif(SCALAPACK_FIND_REQUIRED) - endif(SCALAPACK_FOUND) - endif(NOT SCALAPACK_FIND_QUIETLY) -endif(BLA_F95) - -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/cmake_modules/morse/find/FindSCOTCH.cmake b/cmake_modules/morse/find/FindSCOTCH.cmake deleted file mode 100644 index 0a6af6c1f..000000000 --- a/cmake_modules/morse/find/FindSCOTCH.cmake +++ /dev/null @@ -1,297 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find SCOTCH include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(SCOTCH -# [REQUIRED] # Fail with error if scotch is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and scotch library. -# Results are reported in variables: -# SCOTCH_FOUND - True if headers and requested libraries were found -# SCOTCH_INCLUDE_DIRS - scotch include directories -# SCOTCH_LIBRARY_DIRS - Link directories for scotch libraries -# SCOTCH_LIBRARIES - scotch component libraries to be linked -# SCOTCH_INTSIZE - Number of octets occupied by a SCOTCH_Num -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DSCOTCH=path/to/scotch): -# SCOTCH_DIR - Where to find the base directory of scotch -# SCOTCH_INCDIR - Where to find the header files -# SCOTCH_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT SCOTCH_FOUND) - set(SCOTCH_DIR "" CACHE PATH "Root directory of SCOTCH library") - if (NOT SCOTCH_FIND_QUIETLY) - message(STATUS "A cache variable, namely SCOTCH_DIR, has been set to specify the install directory of SCOTCH") - endif() -endif() - -# SCOTCH may depend on Threads -# try to find it specified as COMPONENTS during the call -if( SCOTCH_FIND_COMPONENTS ) - foreach( component ${SCOTCH_FIND_COMPONENTS} ) - if(SCOTCH_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(SCOTCH_${component}_FOUND TRUE) - if( THREADS_FOUND ) - list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - endif () - else() - set(SCOTCH_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# PTSCOTCH may depend on Threads, try to find it -if (NOT THREADS_FOUND) - find_package(Threads) -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") -else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the scotch header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(SCOTCH_INCDIR) - set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND") - find_path(SCOTCH_scotch.h_DIRS - NAMES scotch.h - HINTS ${SCOTCH_INCDIR}) -else() - if(SCOTCH_DIR) - set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND") - find_path(SCOTCH_scotch.h_DIRS - NAMES scotch.h - HINTS ${SCOTCH_DIR} - PATH_SUFFIXES include) - else() - set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND") - find_path(SCOTCH_scotch.h_DIRS - NAMES scotch.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(SCOTCH_scotch.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (SCOTCH_scotch.h_DIRS) - set(SCOTCH_INCLUDE_DIRS "${SCOTCH_scotch.h_DIRS}") -else () - set(SCOTCH_INCLUDE_DIRS "SCOTCH_INCLUDE_DIRS-NOTFOUND") - if (NOT SCOTCH_FIND_QUIETLY) - message(STATUS "Looking for scotch -- scotch.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") -else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the scotch lib in the given paths -# ---------------------------------------------- - -set(SCOTCH_libs_to_find "scotch;scotcherrexit") - -# call cmake macro to find the lib path -if(SCOTCH_LIBDIR) - foreach(scotch_lib ${SCOTCH_libs_to_find}) - set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND") - find_library(SCOTCH_${scotch_lib}_LIBRARY - NAMES ${scotch_lib} - HINTS ${SCOTCH_LIBDIR}) - endforeach() -else() - if(SCOTCH_DIR) - foreach(scotch_lib ${SCOTCH_libs_to_find}) - set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND") - find_library(SCOTCH_${scotch_lib}_LIBRARY - NAMES ${scotch_lib} - HINTS ${SCOTCH_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(scotch_lib ${SCOTCH_libs_to_find}) - set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND") - find_library(SCOTCH_${scotch_lib}_LIBRARY - NAMES ${scotch_lib} - HINTS ${_lib_env}) - endforeach() - endif() -endif() - -set(SCOTCH_LIBRARIES "") -set(SCOTCH_LIBRARY_DIRS "") -# If found, add path to cmake variable -# ------------------------------------ -foreach(scotch_lib ${SCOTCH_libs_to_find}) - - if (SCOTCH_${scotch_lib}_LIBRARY) - get_filename_component(${scotch_lib}_lib_path "${SCOTCH_${scotch_lib}_LIBRARY}" PATH) - # set cmake variables - list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}") - list(APPEND SCOTCH_LIBRARY_DIRS "${${scotch_lib}_lib_path}") - else () - list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}") - if (NOT SCOTCH_FIND_QUIETLY) - message(STATUS "Looking for scotch -- lib ${scotch_lib} not found") - endif() - endif () - - mark_as_advanced(SCOTCH_${scotch_lib}_LIBRARY) - -endforeach() - - -if(SCOTCH_LIBRARIES) - # check a function to validate the find - if (SCOTCH_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${SCOTCH_LIBRARIES}") - if(CMAKE_THREAD_LIBS_INIT) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") - endif() - if (SCOTCH_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${SCOTCH_LIBRARY_DIRS}") - endif() - - unset(SCOTCH_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(SCOTCH_graphInit SCOTCH_WORKS) - mark_as_advanced(SCOTCH_WORKS) - - if(SCOTCH_WORKS) - set(SCOTCH_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - else() - if(NOT SCOTCH_FIND_QUIETLY) - message(STATUS "Looking for SCOTCH : test of SCOTCH_graphInit with SCOTCH library fails") - message(STATUS "SCOTCH_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "SCOTCH_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "SCOTCH_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for SCOTCH : set SCOTCH_LIBRARIES to NOTFOUND") - endif() - set(SCOTCH_LIBRARIES "SCOTCH_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(SCOTCH_LIBRARIES) - - -# Check the size of SCOTCH_Num -# --------------------------------- -set(CMAKE_REQUIRED_INCLUDES ${SCOTCH_INCLUDE_DIRS}) - -include(CheckCSourceRuns) -set(SCOTCH_C_TEST_SCOTCH_Num_4 " -#include <stdio.h> -#include <scotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 4) - return 0; - else - return 1; -} -") - -set(SCOTCH_C_TEST_SCOTCH_Num_8 " -#include <stdio.h> -#include <scotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 8) - return 0; - else - return 1; -} -") -set(CMAKE_REQUIRED_INCLUDES "") -check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_4}" SCOTCH_Num_4) -if(NOT SCOTCH_Num_4) - check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8) - if(NOT SCOTCH_Num_8) - set(SCOTCH_INTSIZE -1) - else() - set(SCOTCH_INTSIZE 8) - endif() -else() - set(SCOTCH_INTSIZE 4) -endif() - -# check that SCOTCH has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SCOTCH DEFAULT_MSG - SCOTCH_LIBRARIES - SCOTCH_INCLUDE_DIRS - SCOTCH_LIBRARY_DIRS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindSTARPU.cmake b/cmake_modules/morse/find/FindSTARPU.cmake deleted file mode 100644 index 5b7b184d8..000000000 --- a/cmake_modules/morse/find/FindSTARPU.cmake +++ /dev/null @@ -1,658 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find STARPU include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(STARPU -# [version] [EXACT] # Minimum or EXACT version e.g. 1.1 -# [REQUIRED] # Fail with error if starpu is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and starpu libraries. -# Results are reported in variables: -# STARPU_FOUND - True if headers and requested libraries were found -# STARPU_INCLUDE_DIRS - starpu include directories -# STARPU_LIBRARY_DIRS - Link directories for starpu libraries -# STARPU_SHM_LIBRARIES - starpu component libraries to be linked (without mpi) -# STARPU_MPI_LIBRARIES - starpu component libraries to be linked (with mpi) -# STARPU_${component}_FOUND - TRUE if component has been found -# STARPU_VERSION_STRING - A human-readable string containing the version of the package found -# STARPU_VERSION_MAJOR - The major version of the package found -# STARPU_VERSION_MINOR - The minor version of the package found -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DSTARPU=path/to/starpu): -# STARPU_DIR - Where to find the base directory of starpu -# STARPU_INCDIR - Where to find the header files -# STARPU_LIBDIR - Where to find the library files - - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - -if (NOT STARPU_FOUND) - set(STARPU_DIR "" CACHE PATH "Root directory of STARPU library") - if (NOT STARPU_FIND_QUIETLY) - message(STATUS "A cache variable, namely STARPU_DIR, has been set to specify the install directory of STARPU") - endif() -endif() - -# STARPU may depend on other packages (HWLOC, MPI, CUDA, MAGMA, ...) -# try to find them if specified as COMPONENTS during the call -set(STARPU_LOOK_FOR_HWLOC FALSE) -set(STARPU_LOOK_FOR_MPI FALSE) -set(STARPU_LOOK_FOR_CUDA FALSE) -set(STARPU_LOOK_FOR_MAGMA FALSE) -if( STARPU_FIND_COMPONENTS ) - foreach( component ${STARPU_FIND_COMPONENTS} ) - if(${component} STREQUAL "HWLOC") - set(STARPU_LOOK_FOR_HWLOC TRUE) - elseif(${component} STREQUAL "MPI") - set(STARPU_LOOK_FOR_MPI TRUE) - elseif(${component} STREQUAL "CUDA") - set(STARPU_LOOK_FOR_CUDA TRUE) - elseif(${component} STREQUAL "MAGMA") - set(STARPU_LOOK_FOR_MAGMA TRUE) - endif() - if(STARPU_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(STARPU_${component}_FOUND TRUE) - # should we have these variables available in gui modes? - # lets hide them - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() - if (CUDA_FOUND) - mark_as_advanced(CUDA_BUILD_CUBIN) - mark_as_advanced(CUDA_BUILD_EMULATION) - mark_as_advanced(CUDA_SDK_ROOT_DIR) - mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR) - mark_as_advanced(CUDA_VERBOSE_BUILD) - endif() - else() - set(STARPU_${component}_FOUND FALSE) - endif() - endforeach() -endif() - -# STARPU may depend on CUDA, try to find it -if (NOT CUDA_FOUND) - find_package(CUDA) -endif() - -# STARPU may depend on MPI, try to find it -if (NOT MPI_FOUND) - find_package(MPI) -endif() - -# STARPU may depend on HWLOC, try to find it -if (NOT HWLOC_FOUND) - find_package(HWLOC) -endif() - -# STARPU may depend on MAGMA, try to find it -if (NOT MAGMA_FOUND) - find_package(MAGMA) -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) - -if(PKG_CONFIG_EXECUTABLE) - - pkg_search_module(STARPU_SHM libstarpu) - set(STARPU_INCLUDE_DIRS "${STARPU_SHM_INCLUDE_DIRS}") - set(STARPU_LIBRARY_DIRS "${STARPU_SHM_LIBRARY_DIRS}") - if(STARPU_LOOK_FOR_MPI OR MPI_FOUND) - pkg_search_module(STARPU_MPI libstarpumpi) - endif() - if (NOT STARPU_FIND_QUIETLY) - if (STARPU_SHM_FOUND AND STARPU_SHM_LIBRARIES) - message(STATUS "Looking for STARPU - found using PkgConfig") - #if(NOT STARPU_SHM_INCLUDE_DIRS) - # message("${Magenta}STARPU_SHM_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to starpu headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for STARPU - not found using PkgConfig." - "Perhaps you should add the directory containing libstarpu.pc" - "to the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - if (STARPU_LOOK_FOR_MPI) - if (STARPU_MPI_FOUND AND STARPU_MPI_LIBRARIES) - message(STATUS "Looking for STARPU MPI - found using PkgConfig") - else() - message("${Magenta}Looking for STARPU MPI - not found using PkgConfig." - "Perhaps you should add the directory containing libstarpumpi.pc to" - "the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - endif() - - if (STARPU_FIND_VERSION_EXACT) - if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR - NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING}" - "when required is ${STARPU_FIND_VERSION}") - endif() - endif() - else() - # if the version found is older than the required then error - if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR - (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING}" - "when required is ${STARPU_FIND_VERSION} or newer") - endif() - endif() - endif() - - if(STARPU_MPI_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_MPI_LIBRARIES}") - elseif(STARPU_SHM_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_SHM_LIBRARIES}") - else() - set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND") - endif() - -endif(PKG_CONFIG_EXECUTABLE) - - -if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR - ( MPI_FOUND AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) ) - ) - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") - else() - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{CPATH}") - list(APPEND _inc_env "${_path_env}") - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}") - list(APPEND _inc_env "${_path_env}") - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # Try to find the version of StarPU in starpu_config.h file - set(STARPU_hdrs_to_find "starpu_config.h") - - # call cmake macro to find the header path - if(STARPU_INCDIR) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_INCDIR}) - endforeach() - else() - if(STARPU_DIR) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_DIR} - PATH_SUFFIXES "include" - "include/starpu/1.0" - "include/starpu/1.1" - "include/starpu/1.2" - "include/starpu/1.3") - endforeach() - else() - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${_inc_env}) - endforeach() - endif() - endif() - mark_as_advanced(STARPU_starpu_config.h_INCLUDE_DIRS) - - ### - # - # GET_VERSION: Get the version of the software by parsing a file - # - ### - MACRO(GET_VERSION _PACKAGE _filepath) - - #message(STATUS "Looking for ${_PACKAGE} version in the file ${_filepath}") - file(READ "${_filepath}" _file) - string(REGEX REPLACE - "(.*)define([ \t]*)${_PACKAGE}_MAJOR_VERSION([ \t]*)([0-9]+)(.*)" - "\\4" ${_PACKAGE}_VERSION_MAJOR "${_file}") - string(REGEX REPLACE - "(.*)define([ \t]*)${_PACKAGE}_MINOR_VERSION([ \t]*)([0-9]+)(.*)" - "\\4" ${_PACKAGE}_VERSION_MINOR "${_file}") - set(${_PACKAGE}_VERSION_STRING - "${${_PACKAGE}_VERSION_MAJOR}.${${_PACKAGE}_VERSION_MINOR}") - #message(STATUS "${_PACKAGE}_VERSION_MAJOR = -${${_PACKAGE}_VERSION_MAJOR}-") - #message(STATUS "${_PACKAGE}_VERSION_MINOR = -${${_PACKAGE}_VERSION_MINOR}-") - - ENDMACRO(GET_VERSION) - - # Find the version of StarPU in starpu_config.h file - # remark: the version is defined in this file since the STARPU 1.0 version - if (STARPU_starpu_config.h_INCLUDE_DIRS) - GET_VERSION("STARPU" "${STARPU_starpu_config.h_INCLUDE_DIRS}/starpu_config.h") - if (STARPU_VERSION_MAJOR AND STARPU_VERSION_MINOR) - if (STARPU_FIND_VERSION_EXACT) - if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR) - if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR - NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING} " - "when required is ${STARPU_FIND_VERSION}") - endif() - endif() - endif() - else() - if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR) - # if the version found is older than the required then error - if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR - (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING} " - "when required is ${STARPU_FIND_VERSION} or newer") - endif() - endif() - endif() - endif() - else() - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version has not been found using starpu_config.h" - "located in ${STARPU_starpu_config.h_INCLUDE_DIRS}") - endif() - endif() - else() - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "starpu_config.h has not been found while required to get StarPU version") - endif() - endif() - - - # Try to find the starpu headers in the given paths - # ------------------------------------------------- - - # create list of headers to find - list(APPEND STARPU_hdrs_to_find "starpu.h;starpu_profiling.h") - if(STARPU_LOOK_FOR_MPI OR MPI_FOUND) - list(APPEND STARPU_hdrs_to_find "starpu_mpi.h") - endif() - if(STARPU_LOOK_FOR_CUDA OR CUDA_FOUND) - list(APPEND STARPU_hdrs_to_find "starpu_cuda.h;starpu_scheduler.h") - endif() - - # call cmake macro to find the header path - if(STARPU_INCDIR) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_INCDIR}) - endforeach() - else() - if(STARPU_DIR) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_DIR} - PATH_SUFFIXES "include/starpu/${STARPU_VERSION_STRING}") - endforeach() - else() - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${_inc_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - set(STARPU_INCLUDE_DIRS "") - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - - if (STARPU_${starpu_hdr}_INCLUDE_DIRS) - # set cmake variables using the pkg-config naming convention - list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) - else () - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- ${starpu_hdr} not found") - endif() - if(starpu_hdr STREQUAL "starpu_mpi.h") - if(NOT STARPU_FIND_REQUIRED_MPI) - if (NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- ${starpu_hdr} not required") - endif() - else() - list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) - endif() - elseif( (starpu_hdr STREQUAL "starpu_cuda.h") OR (starpu_hdr STREQUAL "starpu_scheduler.h") ) - if(NOT STARPU_FIND_REQUIRED_CUDA) - if (NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- ${starpu_hdr} not required") - endif() - else() - list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) - endif() - endif() - endif () - mark_as_advanced(STARPU_${starpu_hdr}_INCLUDE_DIRS) - - endforeach(starpu_hdr ${STARPU_hdrs_to_find}) - - if (STARPU_INCLUDE_DIRS) - list(REMOVE_DUPLICATES STARPU_INCLUDE_DIRS) - endif () - - if (STARPU_starpu_config.h_INCLUDE_DIRS) - # Looking for lib - # --------------- - - set(STARPU_SHM_LIBRARIES "") - set(STARPU_MPI_LIBRARIES "") - set(STARPU_LIBRARY_DIRS "") - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the starpu libs in the given paths - # ---------------------------------------------- - - # create list of libs to find - set(STARPU_libs_to_find "starpu-${STARPU_VERSION_STRING}") - set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION_STRING}") - if (STARPU_LOOK_FOR_MPI OR MPI_FOUND) - list(APPEND STARPU_libs_to_find "starpumpi-${STARPU_VERSION_STRING}") - set(STARPU_MPI_libs_to_find "${STARPU_libs_to_find}") - endif() - - # call cmake macro to find the lib path - if(STARPU_LIBDIR) - foreach(starpu_lib ${STARPU_libs_to_find}) - set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND") - find_library(STARPU_${starpu_lib}_LIBRARY - NAMES ${starpu_lib} - HINTS ${STARPU_LIBDIR}) - endforeach() - else() - if(STARPU_DIR) - foreach(starpu_lib ${STARPU_libs_to_find}) - set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND") - find_library(STARPU_${starpu_lib}_LIBRARY - NAMES ${starpu_lib} - HINTS ${STARPU_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(starpu_lib ${STARPU_libs_to_find}) - set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND") - find_library(STARPU_${starpu_lib}_LIBRARY - NAMES ${starpu_lib} - HINTS ${_lib_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - foreach(starpu_lib ${STARPU_libs_to_find}) - - if (STARPU_${starpu_lib}_LIBRARY) - - get_filename_component(${starpu_lib}_lib_path ${STARPU_${starpu_lib}_LIBRARY} PATH) - # set cmake variables (respects naming convention) - - foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find}) - if(starpu_shm_lib STREQUAL starpu_lib) - if (STARPU_SHM_LIBRARIES) - list(APPEND STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - else() - set(STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endif() - endforeach() - if (STARPU_LOOK_FOR_MPI OR MPI_FOUND) - foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find}) - if(starpu_mpi_lib STREQUAL starpu_lib) - if (STARPU_MPI_LIBRARIES) - list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - else() - set(STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endif() - endforeach() - endif () - if (STARPU_LIBRARY_DIRS) - list(APPEND STARPU_LIBRARY_DIRS "${${starpu_lib}_lib_path}") - else() - set(STARPU_LIBRARY_DIRS "${${starpu_lib}_lib_path}") - endif() - - else (STARPU_${starpu_lib}_LIBRARY) - - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- lib ${starpu_lib} not found") - endif() - if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION_STRING}" AND - NOT STARPU_FIND_REQUIRED_MPI) - # if MPI optional, not a problem: no NOTFOUND in list of MPI LIBRARIES - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- lib ${starpu_lib} not required") - endif() - else() - # for any other lib, add NOTFOUND in the proper list of LIBRARIES - foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find}) - if(starpu_shm_lib STREQUAL starpu_lib) - if (STARPU_SHM_LIBRARIES) - list(APPEND STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - else() - set(STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endif() - endforeach() - if (STARPU_LOOK_FOR_MPI OR MPI_FOUND) - foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find}) - if(starpu_mpi_lib STREQUAL starpu_lib) - if (STARPU_MPI_LIBRARIES) - list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - else() - set(STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endif() - endforeach() - endif () - endif() - - endif (STARPU_${starpu_lib}_LIBRARY) - - mark_as_advanced(STARPU_${starpu_lib}_LIBRARY) - - endforeach(starpu_lib ${STARPU_libs_to_find}) - - if (STARPU_LIBRARY_DIRS) - list(REMOVE_DUPLICATES STARPU_SHM_LIBRARIES) - list(REMOVE_DUPLICATES STARPU_MPI_LIBRARIES) - list(REMOVE_DUPLICATES STARPU_LIBRARY_DIRS) - endif () - - if (STARPU_SHM_LIBRARIES AND STARPU_LIBRARY_DIRS AND STARPU_INCLUDE_DIRS) - set(STARPU_SHM_FOUND TRUE) - if(STARPU_MPI_LIBRARIES) - set(STARPU_MPI_FOUND TRUE) - endif() - endif() - - else(STARPU_starpu_config.h_INCLUDE_DIRS) - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "The version of StarPU is not known so that we do not search libraries") - endif() - endif(STARPU_starpu_config.h_INCLUDE_DIRS) - - if(STARPU_MPI_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_MPI_LIBRARIES}") - elseif(STARPU_SHM_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_SHM_LIBRARIES}") - else() - set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND") - endif() - - if(STARPU_LIBRARIES) - # check a function to validate the find - if (STARPU_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_FLAGS) - foreach(libdir ${STARPU_LIBRARY_DIRS}) - if (libdir) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}") - endif() - endforeach() - set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES}") - if (HWLOC_FOUND) - if (HWLOC_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}") - endif() - if (HWLOC_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${HWLOC_LIBRARY_DIRS}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}") - endif() - if (MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}") - endif() - if (CUDA_FOUND) - if (CUDA_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}") - endif() - if (CUDA_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CUDA_LIBRARY_DIRS}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - endif() - if (MAGMA_FOUND) - if (MAGMA_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}") - endif() - if (MAGMA_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${MAGMA_LIBRARY_DIRS}") - endif() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${MAGMA_LIBRARIES}") - endif() - - unset(STARPU_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(starpu_init STARPU_WORKS) - mark_as_advanced(STARPU_WORKS) - - if(STARPU_WORKS) - set(STARPU_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - set(STARPU_INCLUDE_DIRS "${CMAKE_REQUIRED_INCLUDES}") - else() - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu : test of starpu_init fails") - message(STATUS "STARPU_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "STARPU_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "STARPU_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for starpu : set STARPU_LIBRARIES to NOTFOUND") - endif() - set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(STARPU_LIBRARIES) - -endif( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR - ( MPI_FOUND AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) ) - ) - - -# check that STARPU has been found -# -------------------------------- -include(FindPackageHandleStandardArgs) -if(NOT STARPU_FIND_QUIETLY) - if(STARPU_SHM_FOUND) - message(STATUS "StarPU has been found.") - if(STARPU_MPI_FOUND) - message(STATUS "The mpi version of StarPU has been found so that we manage" - "two lists of libs, one sequential and one parallel (see" - "STARPU_SHM_LIBRARIES and STARPU_MPI_LIBRARIES).") - endif() - message(STATUS "StarPU shared memory libraries stored in STARPU_SHM_LIBRARIES") - endif() -endif() -find_package_handle_standard_args(STARPU DEFAULT_MSG - STARPU_SHM_LIBRARIES) -if(STARPU_MPI_FOUND) - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "StarPU mpi libraries stored in STARPU_MPI_LIBRARIES") - endif() - find_package_handle_standard_args(STARPU DEFAULT_MSG - STARPU_MPI_LIBRARIES) -endif() diff --git a/cmake_modules/morse/find/FindTMG.cmake b/cmake_modules/morse/find/FindTMG.cmake deleted file mode 100644 index 1ae899dc2..000000000 --- a/cmake_modules/morse/find/FindTMG.cmake +++ /dev/null @@ -1,264 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find TMG include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(TMG -# [REQUIRED] # Fail with error if tmg is not found -# [COMPONENTS <libs>...] # required dependencies -# ) -# This module finds headers and tmg library. -# Results are reported in variables: -# TMG_FOUND - True if headers and requested libraries were found -# TMG_INCLUDE_DIRS - tmg include directories -# TMG_LIBRARY_DIRS - Link directories for tmg libraries -# TMG_LIBRARIES - tmg component libraries to be linked -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DTMG=path/to/tmg): -# TMG_DIR - Where to find the base directory of tmg -# TMG_INCDIR - Where to find the header files -# TMG_LIBDIR - Where to find the library files - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 Florent Pruvost -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file MORSE-Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of Morse, substitute the full -# License text for the above reference.) - - -if (NOT TMG_FOUND) - set(TMG_DIR "" CACHE PATH "Root directory of TMG library") - if (NOT TMG_FIND_QUIETLY) - message(STATUS "A cache variable, namely TMG_DIR, has been set to specify the install directory of TMG") - endif() -endif() - - -# used to test a TMG function after -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) - include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) - include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) - -# TMG depends on LAPACK -# try to find it specified as COMPONENTS during the call -if (TMG_FIND_COMPONENTS) - foreach( component ${TMG_FIND_COMPONENTS} ) - if(TMG_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(TMG_${component}_FOUND TRUE) - else() - set(TMG_${component}_FOUND FALSE) - endif() - endforeach() -endif () - -# TMG depends on LAPACK anyway, try to find it -if (NOT LAPACK_FOUND) - if(TMG_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() -endif() - -# TMG depends on LAPACK -if (LAPACK_FOUND) - - # check if a tmg function exists in the LAPACK lib - set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}") - include(CheckFunctionExists) - include(CheckFortranFunctionExists) - unset(TMG_WORKS CACHE) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlarnv TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlarnv TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - if (TMG_WORKS) - unset(TMG_WORKS CACHE) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlagsy TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlagsy TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - mark_as_advanced(TMG_WORKS) - endif() - set(CMAKE_REQUIRED_LIBRARIES) - - if(TMG_WORKS) - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg: test with lapack succeeds") - endif() - # test succeeds: TMG is in LAPACK - set(TMG_LIBRARIES "${LAPACK_LIBRARIES}") - set(TMG_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}") - if(LAPACK_INCLUDE_DIRS) - set(TMG_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}") - endif() - else() - - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg : test with lapack fails") - message(STATUS "Looking for tmg : try to find it elsewhere") - endif() - # test fails: try to find TMG lib exterior to LAPACK - - # Looking for lib tmg - # ------------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the tmg lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(TMG_LIBDIR) - set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND") - find_library(TMG_tmg_LIBRARY - NAMES tmg - HINTS ${TMG_LIBDIR} ) - else() - if(TMG_DIR) - set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND") - find_library(TMG_tmg_LIBRARY - NAMES tmg - HINTS ${TMG_DIR} - PATH_SUFFIXES lib lib32 lib64 ) - else() - set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND") - find_library(TMG_tmg_LIBRARY - NAMES tmg - HINTS ${_lib_env} ) - endif() - endif() - mark_as_advanced(TMG_tmg_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (TMG_tmg_LIBRARY) - get_filename_component(tmg_lib_path ${TMG_tmg_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(TMG_LIBRARIES "${TMG_tmg_LIBRARY}") - set(TMG_LIBRARY_DIRS "${tmg_lib_path}") - else () - set(TMG_LIBRARIES "TMG_LIBRARIES-NOTFOUND") - set(TMG_LIBRARY_DIRS "TMG_LIBRARY_DIRS-NOTFOUND") - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg -- lib tmg not found") - endif() - endif () - - if (TMG_LIBRARY_DIRS) - list(REMOVE_DUPLICATES TMG_LIBRARY_DIRS) - endif () - - # check a function to validate the find - if (TMG_INCLUDE_DIRS) - set(CMAKE_REQUIRED_INCLUDES "${TMG_INCLUDE_DIRS}") - endif() - if (LAPACK_INCLUDE_DIRS) - list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACK_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_LIBRARIES "${TMG_LIBRARIES};${LAPACK_LIBRARIES}") - if (TMG_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "-L${TMG_LIBRARY_DIRS}") - endif() - if (LAPACK_LIBRARY_DIRS) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}") - endif() - - if(TMG_LIBRARIES) - unset(TMG_WORKS CACHE) - include(CheckFunctionExists) - include(CheckFortranFunctionExists) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlarnv TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlarnv TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - if (TMG_WORKS) - unset(TMG_WORKS CACHE) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlagsy TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlagsy TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - mark_as_advanced(TMG_WORKS) - endif() - - if(TMG_WORKS) - set(TMG_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) - set(TMG_LIBRARY_DIRS "${TMG_LIBRARY_DIRS}" "${LAPACK_LIBRARY_DIRS}") - set(TMG_INCLUDE_DIRS ${CMAKE_REQUIRED_INCLUDES}) - else() - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg: test of dlarnv and dlagsy with tmg and lapack libraries fails") - message(STATUS "TMG_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "TMG_LIBRARY_DIRS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "TMG_INCLUDE_DIRS: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - message(STATUS "Looking for tmg : set TMG_LIBRARIES to NOTFOUND") - endif() - set(TMG_LIBRARIES "TMG_LIBRARIES-NOTFOUND") - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(TMG_LIBRARIES) - - endif() - -else() - - if(NOT TMG_FIND_QUIETLY) - message(STATUS "TMG requires LAPACK but LAPACK has not been found." - "Please look for LAPACK first.") - endif() - -endif() - - -# check that TMG has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(TMG DEFAULT_MSG - TMG_LIBRARIES) diff --git a/cmake_modules/morse/find/MORSE-Copyright.txt b/cmake_modules/morse/find/MORSE-Copyright.txt deleted file mode 100644 index 1e5650e0a..000000000 --- a/cmake_modules/morse/find/MORSE-Copyright.txt +++ /dev/null @@ -1,41 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# This software is a computer program whose purpose is to process -# Matrices Over Runtime Systems @ Exascale (MORSE). More information -# can be found on the following website: http://www.inria.fr/en/teams/morse. -# -# This software is governed by the CeCILL-C license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL-C -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL-C license and that you accept its terms. -# -### diff --git a/cmake_modules/morse/precision_generator/Conversion.py b/cmake_modules/morse/precision_generator/Conversion.py deleted file mode 100644 index 00202d701..000000000 --- a/cmake_modules/morse/precision_generator/Conversion.py +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/env python -"""@package Tools - -This python script is responsible for precision generation replacements -as well as replacements of any kind in other files. Different types of -replacements can be defined such that no two sets can conflict. Multiple -types of replacements can, however, be specified for the same file. - -@author Wesley Alvaro -@date 2011-4-8 - -""" -__author__="alvaro" -__date__ ="$Sep 2, 2010 10:09:19 AM$" -__version__=11.0408 - -import sys; -import re; -import shlex; -import os; -import shutil; -from os import path; -from optparse import OptionParser,OptionGroup; -from subs import subs; -from datetime import datetime; - -"""Keyword used to signal replacement actions on a file""" -KEYWORD = '@precisions'; -"""Replace the above keyword with this one post-replacements""" -DONE_KEYWORD = '@generated'; -"""Regular expression for the replacement formatting""" -REGEX = '^.*'+KEYWORD+'\s+((\w+,?)+)\s+(\w+)\s+->\s*((\s\w+)+).*$'; -"""Default acceptable extensions for files during directory walking""" -EXTS = ['.c','.cpp','.h','.hpp','.f','.jdf','.f90','.F90','.f77','.F77','.cu','.cuf','.CUF','.jdf']; - -def check_gen(file, work, rex): - """Reads the file and determines if the file needs generation.""" - fd = open(path.realpath(file), 'r'); - lines = fd.readlines(); - fd.close(); - for line in lines: - m = rex.match(line); - if m is None: continue; - work.append((file, m.groups(), ''.join(lines))); - -def grep(string,list): - expr = re.compile(string) - return filter(expr.search,list) - -def hidden(file): - """Exclude hidden files""" - return not file.startswith('.'); - -def valid_extension(file): - """Exclude non-valid extensions""" - global EXTS; - for ext in EXTS: - if file.endswith(ext): - return True; - return False; - -def relpath(p): - """Get the relative path of a file.""" - p = path.realpath(p); - return p.replace(path.realpath('.')+'/',''); - -class Conversion: - """ - This class works on a single file to create generations - """ - """Static. Is the conversion in debug mode? More verbose.""" - debug = False; - """Static. Is the conversion in test mode? No real work.""" - test = False; - """Static. Is the conversion in make mode? Output make commands.""" - make = False; - """Static. What (if any) prefix is specified for the output folder? - If None, use the file's resident folder.""" - prefix = None; - required_precisions = []; - """Static. A running list of files that are input.""" - files_in = []; - """Static. A running list of files that are output.""" - files_out = []; - """Static. A running list of files that are output.""" - dependencies = []; - def __init__(self, file = None, match = None, content = None): - """Constructor that takes a file, match, and content. - @param file The file name of the input. - @param match The regular expression matches - @param content The ASCII content of the file. - """ - if file is None: return; - self.content = content; - #file = path.realpath(file); - rel = relpath(file); - self.file = list(path.split(file)); - self.date = path.getmtime(file); - if sys.platform!="win32" and path.samefile(path.join(self.file[0],self.file[1]),sys.argv[0]): - raise ValueError('Let\'s just forget codegen.py'); - try: - """['normal','all','mixed'] for example. This(ese) are the replacement types to be used.""" - self.types = match[0].split(','); - """'z' for example. This is the current file's `type`.""" - self.precision = match[2].lower(); - """['c','d','s'] for example. This is the current file's destination `types`.""" - self.precisions = match[3].lower().split(); - if len(self.required_precisions): - self.precstmp = []; - for prec in self.required_precisions: - if prec in self.precisions or prec == self.precision: - self.precstmp.append(prec); - self.precisions = self.precstmp; - except: - raise ValueError(path.join(self.file[0],self.file[1])+' : Invalid conversion string'); - self.files_in.append(rel); - - def run(self): - """Does the appropriate work, if in test mode, this is limited to only converting names.""" - if self.convert_names() and not self.test: - """If not in test mode, actually make changes and export to disk.""" - self.convert_data(); - self.export_data(); - - def convert_names(self): - """Investigate file name and make appropriate changes.""" - self.names = []; - self.dates = []; - self.copy = []; - self.converted = []; - load = False; - if self.debug: print '|'.join(self.types), self.precision, relpath(path.join(self.file[0],self.file[1])); - for precision in self.precisions: - """For each destination precision, make the appropriate changes to the file name/data.""" - new_file = self.convert(self.file[1], precision); - if self.debug: print precision,':', - copy = False; - if new_file <> self.file[1] or self.prefix is not None: - if self.prefix is None: - """If no prefix is specified, use the file's current folder.""" - prefix = '' - makeprefix = ''; - else: - """If a prefix is specified, set it up.""" - prefix = self.prefix; - makeprefix = '--prefix '+prefix; - if new_file == self.file[1]: - copy = True; - """Where the destination file will reside.""" - conversion = path.join(prefix, new_file); - file_out = relpath(conversion); - if self.make: - """If in GNU Make mode, write the rule to create the file.""" - file_in = relpath(path.join(self.file[0],self.file[1])); - print file_out+':',file_in; - print "\t$(PYTHON)",path.realpath(sys.argv[0]),makeprefix,'-p',precision,"--file",file_in; - self.names.append(new_file); - self.files_out.append(file_out); - self.dependencies.append( (path.join(self.file[0],self.file[1]), precision, file_out) ); - if self.debug: print relpath(conversion), ':', - try: - """Try to emulate Make like time based dependencies.""" - date = path.getmtime(conversion); - diff = self.date - date; - self.dates.append(diff); - if self.debug: - if diff > 0: print 'Old', - else: print 'Current', - print diff; - if diff > 0: load = True; - except: - if self.debug: print 'Missing'; - self.dates.append(None); - load = True; - elif precision <> self.precision : - """There was no change in the file's name, thus, - no work can be done without overwriting the original.""" - if self.debug: print '<No Change>',':'; - else: print >> sys.stderr, new_file, 'had no change for', precision; - self.names.append(None); - self.dates.append(None); - self.copy.append(copy); - return load; - - def export_data(self): - """After all of the conversions are complete, - this will write the output file contents to the disk.""" - for i in range(len(self.names)): - name = self.names[i]; - data = self.converted[i]; - copy = self.copy[i]; - if copy: - shutil.copy(self.files_in[i], self.files_out[i]); - continue; - if data is None or name is None: continue; - fd = open(self.files_out[i], 'w'); - fd.write(data); - fd.close(); - - - def convert_data(self): - """Convert the data in the files by making the - appropriate replacements for each destination precision.""" - for i in range(len(self.precisions)): - precision = self.precisions[i]; - name = self.names[i]; - date = self.dates[i]; - copy = self.copy[i]; - if name is not None and not copy and (date is None or date > 0): - self.converted.append(self.convert(self.content, precision)); - else: self.converted.append(None); - - def substitute(self, sub_type, data, precision): - """This operates on a single replacement type. - @param sub_type The name of the replacement set. - @param data The content subject for replacments. - @param precision The target precision for replacements. - """ - try: - """Try to select the requested replacements.""" - work = subs[sub_type]; - prec_to = work[0].index(precision); - prec_from = work[0].index(self.precision); - except: - """If requested replacement type does not exist, - return unaltered contents.""" - return data; - for i in range(1,len(work)): - """Requested replacements were found, - execute replacements for each entry.""" - try: - search = work[i][prec_from]; - replace = work[i][prec_to]; - if not search: continue; - replace = replace.replace('\*','*'); - if sub_type != 'tracing' : - replace = replace.replace('\(','('); - replace = replace.replace('\)',')'); - data = re.sub(search, replace, data); - except: - print 'Bad replacement pair ',i,'in',sub_type; - continue; - return data; - - def convert(self, data, precision): - """Select appropriate replacements for the current file. - @param data The content subject for the replacements. - @param precision The target precision for generation. - """ - global KEYWORD, DONE_KEYWORD; - try: - """All files undergo the "all" replacements.""" - data = self.substitute('all', data, precision); - except: pass; - for sub_type in self.types: - """For all the other types of conversion for the current file, - make the correct replacements.""" - if sub_type == 'all': continue; - try: - data = self.substitute(sub_type, data, precision); - except Exception, e: - raise ValueError('I encountered an unrecoverable error while working in subtype:',sub_type+'.'); - """Replace the replacement keywork with one that signifies this is an output file, - to prevent multiple replacement issues if run again.""" - data = re.sub(KEYWORD+' '+','.join(self.types)+'.*', DONE_KEYWORD+' '+precision+' '+datetime.now().ctime(), data); - return data; diff --git a/cmake_modules/morse/precision_generator/codegen.py b/cmake_modules/morse/precision_generator/codegen.py deleted file mode 100755 index 8b0322361..000000000 --- a/cmake_modules/morse/precision_generator/codegen.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -"""@package Tools - -This python script is responsible for precision generation replacements -as well as replacements of any kind in other files. Different types of -replacements can be defined such that no two sets can conflict. Multiple -types of replacements can, however, be specified for the same file. - -@author Wesley Alvaro -@date 2011-4-8 - -""" -__author__="alvaro" -__date__ ="$Sep 2, 2010 10:09:19 AM$" -__version__=11.0408 - -import sys; -import re; -import shlex; -import os; -import shutil; -from os import path; -from optparse import OptionParser,OptionGroup; -from datetime import datetime; -from Conversion import KEYWORD,DONE_KEYWORD,REGEX,EXTS,Conversion,check_gen,subs; - -def main(): - """Create option parser, set static variables of the converter and manage printing options/order.""" - global REGEX, EXTS; - """The compiled regular expression for detecting proper files.""" - rex = re.compile(REGEX); - """Files found to be workable.""" - work = []; - - """Create the options parser for detecting options on the command line.""" - parser = OptionParser(usage="Usage: %prog [options]",version='%prog '+str(__version__)); - group = OptionGroup(parser,"Printing Options","These options control the printing output."); - group.add_option("-i", "--in-files", help='Print the filenames of files for precision generation.', action='store_true', dest='in_print', default=False); - group.add_option("-o", "--out-files", help='Print the filenames for the precision generated files.', action='store_true', dest='out_print', default=False); - group.add_option("-m", "--make", help='Spew a GNU Make friendly file to standard out.', action='store_true', dest='make', default=False); - group.add_option("-d", "--debug", help='Print debugging messages.', action='store_true', dest='debug', default=False); - parser.add_option_group(group); - group = OptionGroup(parser,"Operating Mode Options","These options alter the way the program operates on the input/output files."); - group.add_option("-c", "--clean", help='Remove the files that are the product of generation.', action='store_true', dest='out_clean', default=False); - group.add_option("-T", "--test", help='Don\'t actually do any work.', action='store_true', dest='test', default=False); - parser.add_option_group(group); - group = OptionGroup(parser,"Settings","These options specify how the work should be done."); - group.add_option("-P", "--prefix", help='The output directory if different from the input directory.', action='store', dest='prefix', default=None); - group.add_option("-f", "--file", help='Specify a file(s) on which to operate.', action='store', dest='fileslst', type='string', default=""); - group.add_option("-p", "--prec", help='Specify a precision(s) on which to operate.', action='store', dest='precslst', type='string', default=""); - group.add_option("-e", "--filetypes", help='Specify file extensions on which to operate when walking.', action='store', dest='fileexts', type='string', default=""); - parser.add_option_group(group); - - (options, args) = parser.parse_args(); - - """If file extensions are specified, override defaults.""" - if options.fileexts: - EXTS = options.fileexts.split(); - - """Fill the 'work' array with files found to be operable.""" - if options.fileslst: - """If files to examine are specified on the command line""" - for file in options.fileslst.split(): - check_gen(file, work, rex); - else: - """Begin directory walking in the current directory.""" - startDir = '.'; - for root, dirs, files in os.walk(startDir, True, None): - dirs = filter(hidden,dirs); - files = filter(hidden,files); - files = filter(valid_extension,files); - for file in files: - check_gen(path.join(root,file), work, rex); - - """Set static options for conversion.""" - Conversion.debug = options.debug; - Conversion.make = options.make; - Conversion.prefix = options.prefix; - Conversion.required_precisions = options.precslst.split(); - if options.out_print or options.out_clean or options.in_print or options.make or options.test: - Conversion.test = True; - - if options.make: - """If the program should be GNU Make friendly.""" - print '## Automatically generated Makefile'; - print 'PYTHON ?= python'; - - c = Conversion(); """This initializes the variable for static member access.""" - - for tuple in work: - """For each valid conversion file found.""" - try: - """Try creating and executing a converter.""" - c = Conversion(tuple[0], tuple[1], tuple[2]); - c.run(); - except Exception, e: - print >> sys.stderr, str(e); - continue; - - if options.make: - """If the program should be GNU Make friendly.""" - print 'gen = ',' '+' '.join(c.files_out); - print 'cleangen:'; - print '\trm -f $(gen)'; - print 'generate: $(gen)'; - print '.PHONY: cleangen generate'; - if options.in_print: - """Should we print the input files?""" - print ' '.join(c.files_in); - if options.out_print: - """Should we print the output files?""" - print ' '.join(c.files_out); - if options.out_clean: - """Clean generated files""" - for file in c.files_out: - if not path.exists(file): continue; - os.remove(file); - -if __name__ == "__main__": - main(); diff --git a/cmake_modules/morse/precision_generator/genDependencies.py b/cmake_modules/morse/precision_generator/genDependencies.py deleted file mode 100755 index 973e5aa29..000000000 --- a/cmake_modules/morse/precision_generator/genDependencies.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python -"""@package Tools - -This python script is responsible for precision generation replacements -as well as replacements of any kind in other files. Different types of -replacements can be defined such that no two sets can conflict. Multiple -types of replacements can, however, be specified for the same file. - -@author Wesley Alvaro -@date 2011-4-8 - -""" -__author__="alvaro" -__date__ ="$Sep 2, 2010 10:09:19 AM$" -__version__=11.0408 - -import sys; -import re; -import shlex; -import os; -import shutil; -import imp; -from os import path; -from optparse import OptionParser,OptionGroup; -from datetime import datetime; -from Conversion import KEYWORD,DONE_KEYWORD,REGEX,EXTS,Conversion,check_gen,relpath,subs; - -class GenConversion: - """ - This class works on a single file to create generations - """ - """Static. Source directory where to find the input files""" - srcdir = None; - """Static. What (if any) prefix is specified for the output folder? - If None, use the file's resident folder.""" - prefix = None; - """Static. Precisions asked by the user.""" - required_precisions = []; - """The compiled regular expression for detecting proper files.""" - rex = re.compile(REGEX); - - def run(self, file = None): - match = None; - """Local complete """ - if self.srcdir is None: - lfile = file; - else: - lfile = path.join(self.srcdir, file); - """Reads the file and determines if the file needs generation.""" - for line in open(path.realpath(lfile), 'r'): - m = self.rex.match(line); - if m is None: continue; - else: - match = m.groups(); - break; - - """This file need to go through precision generation script""" - if match is None: - return ""; - else: - try: - """['normal','all','mixed'] for example. This(ese) are the replacement types to be used.""" - self.types = match[0].split(','); - """'z' for example. This is the current file's `type`.""" - self.precision = match[2].lower(); - """['c','d','s'] for example. This is the current file's destination `types`.""" - self.precisions = set(match[3].lower().split()); - """Add the local precision to the list if not present""" - self.precisions.add(self.precision); - """Take only the intersection of the available precision and the requested ones""" - self.precisions.intersection_update(self.required_precisions); - except: - raise ValueError(lfile+' : Invalid conversion string'); - - filename = list(path.split(lfile))[1]; - result = ""; - for precision in self.precisions: - """For each destination precision, make the appropriate changes to the file name/data.""" - new_file = self.convert(filename, precision); - if new_file <> filename or self.prefix is not None: - if self.prefix is None: - """If no prefix is specified, use the file's current folder.""" - prefix = '' - else: - """If a prefix is specified, set it up.""" - prefix = self.prefix; - """Where the destination file will reside.""" - conversion = path.join(prefix, new_file); - file_out = relpath(conversion); - result = result+file+","+precision+","+file_out+";"; - return result; - - def substitute(self, sub_type, data, precision): - """This operates on a single replacement type. - @param sub_type The name of the replacement set. - @param data The content subject for replacments. - @param precision The target precision for replacements. - """ - try: - """Try to select the requested replacements.""" - work = subs[sub_type]; - prec_to = work[0].index(precision); - prec_from = work[0].index(self.precision); - except: - """If requested replacement type does not exist, - return unaltered contents.""" - return data; - for i in range(1,len(work)): - """Requested replacements were found, - execute replacements for each entry.""" - try: - search = work[i][prec_from]; - replace = work[i][prec_to]; - if not search: continue; - replace = replace.replace('\*','*'); - if sub_type != 'tracing' : - replace = replace.replace('\(','('); - replace = replace.replace('\)',')'); - data = re.sub(search, replace, data); - except: - print 'Bad replacement pair ',i,'in',sub_type; - continue; - return data; - - def convert(self, data, precision): - """Select appropriate replacements for the current file. - @param data The content subject for the replacements. - @param precision The target precision for generation. - """ - global KEYWORD, DONE_KEYWORD; - try: - """All files undergo the "all" replacements.""" - data = self.substitute('all', data, precision); - except: pass; - for sub_type in self.types: - """For all the other types of conversion for the current file, - make the correct replacements.""" - if sub_type == 'all': continue; - try: - data = self.substitute(sub_type, data, precision); - except Exception, e: - raise ValueError('I encountered an unrecoverable error while working in subtype:',sub_type+'.'); - return data; - - -def main(): - """Create option parser, set static variables of the converter and manage printing options/order.""" - global REGEX, EXTS; - """The compiled regular expression for detecting proper files.""" - rex = re.compile(REGEX); - """Files found to be workable.""" - work = []; - - """Create the options parser for detecting options on the command line.""" - parser = OptionParser(usage="Usage: %prog [options]",version='%prog '+str(__version__)); - group = OptionGroup(parser,"Printing Options","These options control the printing output."); - group.add_option("-i", "--in-files", help='Print the filenames of files for precision generation.', action='store_true', dest='in_print', default=False); - group.add_option("-o", "--out-files", help='Print the filenames for the precision generated files.', action='store_true', dest='out_print', default=False); - group.add_option("-d", "--debug", help='Print debugging messages.', action='store_true', dest='debug', default=False); - parser.add_option_group(group); - group = OptionGroup(parser,"Settings","These options specify how the work should be done."); - group.add_option("-s", "--srcdir", help='The input source directory.', action='store', dest='srcdir', default=None); - group.add_option("-P", "--prefix", help='The output directory if different from the input directory.', action='store', dest='prefix', default=None); - group.add_option("-f", "--file", help='Specify a file(s) on which to operate.', action='store', dest='fileslst', type='string', default=""); - group.add_option("-p", "--prec", help='Specify a precision(s) on which to operate.', action='store', dest='precslst', type='string', default=""); - group.add_option("-e", "--filetypes", help='Specify file extensions on which to operate when walking.', action='store', dest='fileexts', type='string', default=""); - group.add_option("-D", "--dictionnary", help='Specify the dictionnary to use in names conversion.', action='store', dest='dictionnary', type='string', default=""); - parser.add_option_group(group); - - (options, args) = parser.parse_args(); - - """If file extensions are specified, override defaults.""" - if options.fileexts: - EXTS = options.fileexts.split(); - - """Fill the 'work' array with files found to be operable.""" - # if options.fileslst: - # """If files to examine are specified on the command line""" - # for file in options.fileslst.split(): - # check_gen(file, work, rex); - # else: - # """Begin directory walking in the current directory.""" - # startDir = '.'; - # for root, dirs, files in os.walk(startDir, True, None): - # dirs = filter(hidden,dirs); - # files = filter(hidden,files); - # files = filter(valid_extension,files); - # for file in files: - # check_gen(path.join(root,file), work, rex); - - """Set static options for conversion.""" - GenConversion.srcdir = options.srcdir; - GenConversion.prefix = options.prefix; - GenConversion.required_precisions = options.precslst.split(); - - c = GenConversion(); """This initializes the variable for static member access.""" - - result = "" - for file in options.fileslst.split(): - """For each valid conversion file found.""" - try: - """Try creating and executing a converter.""" - result += c.run(file); - except Exception, e: - print >> sys.stderr, str(e); - continue; - - print result; - -if __name__ == "__main__": - main(); diff --git a/cmake_modules/morse/precision_generator/subs.py b/cmake_modules/morse/precision_generator/subs.py deleted file mode 100644 index fe0d0effd..000000000 --- a/cmake_modules/morse/precision_generator/subs.py +++ /dev/null @@ -1,968 +0,0 @@ -#!/usr/bin/env python -# Substitutions are applied in the order listed. This is important in cases -# where multiple substitutions could match, or when one substitution matches -# the result of a previous substitution. For example, these rules are correct -# in this order: -# -# ('real', 'double precision', 'real', 'double precision' ), # before double -# ('float', 'double', 'float', 'double' ), -# -# but if switched would translate 'double precision' -> 'float precision', -# which is wrong. -# -# Reorganized 5/2012 Mark Gates - -# Dictionary is keyed on substitution type (mixed, normal, etc.) -subs = { - # ------------------------------------------------------------ - # replacements applied to ALL files. - 'all' : [ - [None, None] - ], - - # ------------------------------------------------------------ - # replacements applied to mixed precision files. - 'mixed' : [ - # ----- Special line indicating column types - ['ds', 'zc' ], - - # ----- Mixed precisions - ('DS', 'ZC' ), - ('ds', 'zc' ), - - # ----- Preprocessor - ('#define PRECISION_d', '#define PRECISION_z' ), - ('#define PRECISION_s', '#define PRECISION_c' ), - ('#undef PRECISION_d', '#undef PRECISION_z' ), - ('#undef PRECISION_s', '#undef PRECISION_c' ), - - # ----- Fortran Types - ('real\(kind=c_double\)', 'complex\(kind=c_double_complex\)' ), - ('real\(kind=c_float\)', 'real\(kind=c_float_complex\)' ), - - # ----- Data types - ('double', 'double2' ), - ('float', 'float2' ), - ('double', 'cuDoubleComplex' ), - ('float', 'cuFloatComplex' ), - ('DOUBLE PRECISION', 'COMPLEX_16' ), - ('SINGLE PRECISION', 'COMPLEX' ), - ('real', 'complex' ), - ('float', 'MORSE_Complex32_t' ), - ('double', 'MORSE_Complex64_t' ), - ('float', 'MORSE_voidComplex32_t' ), - ('double', 'MORSE_voidComplex64_t' ), - ('MorseRealFloat', 'MorseComplexFloat' ), - ('MorseRealDouble', 'MorseComplexDouble' ), - - # ----- CBLAS - ('', 'CBLAS_SADDR' ), - - # ----- Prefixes - ('blasf77_d', 'blasf77_z' ), - ('blasf77_s', 'blasf77_c' ), - ('cublasIdamax', 'cublasIzamax' ), - ('cublasD', 'cublasZ' ), - ('cublasS', 'cublasC' ), - ('lapackf77_d', 'lapackf77_z' ), - ('lapackf77_s', 'lapackf77_c' ), - ('MAGMA_D', 'MAGMA_Z' ), - ('MAGMA_S', 'MAGMA_C' ), - ('magmablas_d', 'magmablas_z' ), - ('magmablas_s', 'magmablas_c' ), - ('magma_d', 'magma_z' ), - ('magma_s', 'magma_c' ), - ('magma_get_d', 'magma_get_z' ), - ('magma_get_s', 'magma_get_c' ), - - # ----- Prefixes MORSE - ('MORSE_D', 'MORSE_Z' ), - ('MORSE_S', 'MORSE_C' ), - ('morse_get_d', 'morse_get_z' ), - ('morse_get_s', 'morse_get_c' ), - ('TASK_S', 'TASK_C' ), - ('TASK_D', 'TASK_Z' ), - ('RUNTIME_S', 'RUNTIME_C' ), - ('RUNTIME_D', 'RUNTIME_Z' ), - - # ----- Complex numbers - ('(double)', 'cuComplexFloatToDouble' ), - ('(float)', 'cuComplexDoubleToFloat' ), - ('', 'cuCrealf' ), - ('', 'cuCimagf' ), - ('', 'cuCreal' ), - ('', 'cuCimag' ), - ('', 'cuConj' ), - ('abs', 'cuCabs' ), - ('absf', 'cuCabsf' ), - - # ----- PLASMA / MAGMA - ('magma_sdgetrs', 'magma_czgetrs' ), - - # ----- MORSE - ('morse_sdgetrs', 'morse_czgetrs' ), - - # ----- Constants - ('CblasTrans', 'CblasConjTrans' ), - ('MagmaTrans', 'MagmaConjTrans' ), - ('MorseTrans', 'MorseConjTrans' ), - - # ----- BLAS and LAPACK, lowercase, alphabetic order - # copy & paste these to uppercase below and fix case. - # mixed precision - ('dsaxpy', 'zcaxpy' ), - ('dslaswp', 'zclaswp' ), - - # regular - ('daxpy', 'zaxpy' ), - ('dgemm', 'zgemm' ), - ('dgesv', 'zgesv' ), - ('dlacpy', 'zlacpy' ), - ('dlange', 'zlange' ), - ('dlansy', 'zlansy' ), - ('dlarnv', 'zlarnv' ), - ('dpotrf', 'zpotrf' ), - ('dsytrf', 'zsytrf' ), - ('dtrmm', 'ztrmm' ), - ('dtrsm', 'ztrsm' ), - ('dtrsv', 'ztrsv' ), - ('idamax', 'izamax' ), - ('spotrf', 'cpotrf' ), - ('ssytrf', 'csytrf' ), - ('strmm', 'ctrmm' ), - ('strsm', 'ctrsm' ), - ('strsv', 'ctrsv' ), - - # ----- BLAS and LAPACK, where complex base name != real base name - # with precision - ('dlag2s', 'zlag2c' ), - ('dlagsy', 'zlaghe' ), - ('dlansy', 'zlanhe' ), - ('dlat2s', 'zlat2c' ), - ('dormqr', 'zunmqr' ), - ('dsymm', 'zhemm' ), - ('dsymv', 'zhemv' ), - ('dsyrk', 'zherk' ), - ('slag2d', 'clag2z' ), - ('slansy', 'clanhe' ), - ('slat2d', 'clat2z' ), - - # without precision - ('lag2s', 'lag2c' ), - ('lagsy', 'laghe' ), - ('lansy', 'lanhe' ), - ('lat2s', 'lat2c' ), - ('ormqr', 'unmqr' ), - ('symm', 'hemm' ), - ('symv', 'hemv' ), - ('syrk', 'herk' ), - ('lag2d', 'lag2z' ), - ('lansy', 'lanhe' ), - ('lat2d', 'lat2z' ), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_L-AG2C', 'DAG_CORE_LAG2C' ), - - # ----- BLAS AND LAPACK, UPPERCASE, ALPHABETIC ORDER - # COPY & PASTE THESE TO UPPERCASE BELOW AND FIX CASE. - # MIXED PRECISION - ('DSAXPY', 'ZCAXPY' ), - ('DSLASWP', 'ZCLASWP' ), - - # REGULAR - ('DAXPY', 'ZAXPY' ), - ('DGEMM', 'ZGEMM' ), - ('DGESV', 'ZGESV' ), - ('DLACPY', 'ZLACPY' ), - ('DLANGE', 'ZLANGE' ), - ('DLANSY', 'ZLANSY' ), - ('DLARNV', 'ZLARNV' ), - ('DPOTRF', 'ZPOTRF' ), - ('DSYTRF', 'ZSYTRF' ), - ('DTRMM', 'ZTRMM' ), - ('DTRSM', 'ZTRSM' ), - ('DTRSV', 'ZTRSV' ), - ('IDAMAX', 'IZAMAX' ), - ('SPOTRF', 'CPOTRF' ), - ('SSYTRF', 'CSYTRF' ), - ('STRMM', 'CTRMM' ), - ('STRSM', 'CTRSM' ), - ('STRSV', 'CTRSV' ), - - # ----- BLAS AND LAPACK, WHERE COMPLEX BASE NAME != REAL BASE NAME - # WITH PRECISION - ('DLAG2S', 'ZLAG2C' ), - ('DLAGSY', 'ZLAGHE' ), - ('DLANSY', 'ZLANHE' ), - ('DLAT2S', 'ZLAT2C' ), - ('DORMQR', 'ZUNMQR' ), - ('DSYMM', 'ZHEMM' ), - ('DSYMV', 'ZHEMV' ), - ('DSYRK', 'ZHERK' ), - ('SLAG2D', 'CLAG2Z' ), - ('SLANSY', 'CLANHE' ), - ('SLAT2D', 'CLAT2Z' ), - - # WITHOUT PRECISION - ('LAG2S', 'LAG2C' ), - ('LAGSY', 'LAGHE' ), - ('LANSY', 'LANHE' ), - ('LAT2S', 'LAT2C' ), - ('ORMQR', 'UNMQR' ), - ('SYMM', 'HEMM' ), - ('SYMV', 'HEMV' ), - ('SYRK', 'HERK' ), - ('LAG2D', 'LAG2Z' ), - ('LANSY', 'LANHE' ), - ('LAT2D', 'LAT2Z' ), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_LAG2C', 'DAG_CORE_L-AG2C' ), -], - - # ------------------------------------------------------------ - # replacements applied to most files. - 'normal' : [ - # ----- Special line indicating column types - # old python (2.4) requires this line to be list [] rather than tuple () to use index() function. - ['s', 'd', 'c', 'z' ], - - # ----- Preprocessor - ('#define PRECISION_s', '#define PRECISION_d', '#define PRECISION_c', '#\s*define PRECISION_z' ), - ('#undef PRECISION_s', '#undef PRECISION_d', '#undef PRECISION_c', '#undef PRECISION_z' ), - ('#define REAL', '#define REAL', '#define COMPLEX', '#define COMPLEX' ), - ('#undef COMPLEX', '#undef COMPLEX', '#undef REAL', '#undef REAL' ), - ('#define SINGLE', '#define DOUBLE', '#define SINGLE', '#define DOUBLE' ), - ('#undef DOUBLE', '#undef SINGLE', '#undef DOUBLE', '#undef SINGLE' ), - - # ----- Fortran Types - ('real\(kind=c_float\)', 'real\(kind=c_double\)', 'complex\(kind=c_float_complex\)', 'complex\(kind=c_double_complex\)' ), - ('real(kind=c_float\)', 'real\(kind=c_double\)', 'real\(kind=c_float\)', 'real\(kind=c_double\)' ), - ('real', 'double precision', 'complex', 'complex\(kind=wp\)' ), - - # ----- Data types - ('real', 'double precision', 'real', r'\bdouble precision' ), # before double - ('float', 'double', 'float _Complex', r'\bdouble _Complex' ), - ('float', 'double', 'cuFloatComplex', r'\bcuDoubleComplex' ), - ('float', 'double', 'make_cuFloatComplex', 'make_cuDoubleComplex' ), - ('float', 'double', 'magmaFloatComplex', r'\bmagmaDoubleComplex' ), - ('float', 'double', 'PLASMA_Complex32_t', r'\bPLASMA_Complex64_t' ), - ('float', 'double', 'PLASMA_voidComplex32_t', r'\bPLASMA_voidComplex64_t' ), - ('PlasmaRealFloat', 'PlasmaRealDouble', 'PlasmaComplexFloat', r'\bPlasmaComplexDouble' ), - ('float', 'double', 'MORSE_Complex32_t', r'\bMORSE_Complex64_t' ), - ('float', 'double', 'MORSE_voidComplex32_t', r'\bMORSE_voidComplex64_t' ), - ('MorseRealFloat', 'MorseRealDouble', 'MorseComplexFloat', r'\bMorseComplexDouble' ), - ('real', 'double precision', 'complex', r'\bcomplex\*16' ), - ('REAL', 'DOUBLE_PRECISION', 'COMPLEX', r'\bCOMPLEX_16' ), - ('REAL', 'DOUBLE PRECISION', 'COMPLEX', r'\bDOUBLE COMPLEX' ), - ('REAL', 'DOUBLE PRECISION', 'REAL', r'\bDOUBLE PRECISION' ), - ('sizeof_real', 'sizeof_double', 'sizeof_complex', r'\bsizeof_complex_16' ), # before complex - ('float', 'double', 'pastix_complex32_t', r'\bpastix_complex64_t' ), - ('real', 'real', 'complex', r'\bcomplex' ), - ('float', 'double', 'float2', r'\bdouble2' ), - ('float', 'double', 'float', r'\bdouble' ), - ('ipt_s', 'ipt_d', 'ipt_c', 'ipt_z' ), - - # ----- Text - ('symmetric', 'symmetric', 'Hermitian', 'Hermitian' ), - ('\*\*T', '\*\*T', '\*\*H', '\*\*H' ), - ('%f', '%lf', '%f', '%lf' ), # for scanf - ('%g', '%lg', '%g', '%lg' ), # for scanf - - # ----- CBLAS - ('cblas_sasum', 'cblas_dasum', 'cblas_scasum', 'cblas_dzasum' ), - ('cblas_snrm2', 'cblas_dnrm2', 'cblas_scnrm2', 'cblas_dznrm2' ), - ('', '', 'CBLAS_SADDR', 'CBLAS_SADDR' ), - ('cblas_ssyr', 'cblas_dsyr', 'cblas_cher', 'cblas_zher' ), - - # ----- Core BLAS - ('CORE_sasum', 'CORE_dasum', 'CORE_scasum', 'CORE_dzasum' ), - ('core_sasum', 'core_dasum', 'core_scasum', 'core_dzasum' ), - ('CORE_ssyrfb', 'CORE_dsyrfb', 'CORE_cherfb', 'CORE_zherfb' ), - ('core_ssyrfb', 'core_dsyrfb', 'core_cherfb', 'core_zherfb' ), - ('CORE_stsmlq_sy', 'CORE_dtsmlq_sy', 'CORE_ctsmlq_he', 'CORE_ztsmlq_he' ), - ('core_stsmlq_sy', 'core_dtsmlq_sy', 'core_ctsmlq_he', 'core_ztsmlq_he' ), - ('CORE_stsmqr_sy', 'CORE_dtsmqr_sy', 'CORE_ctsmqr_he', 'CORE_ztsmqr_he' ), - ('core_stsmqr_sy', 'core_dtsmqr_sy', 'core_ctsmqr_he', 'core_ztsmqr_he' ), - - # ----- Prefixes - # Changing prefixes first requires some calls to be fixed without precision, - # e.g., her2k -> syr2k instead of zher2k -> ssyr2k. - # See BLAS and LAPACK without precision, below. - ('blasf77_s', 'blasf77_d', 'blasf77_c', 'blasf77_z' ), - ('blasf77_s', 'blasf77_d', 'blasf77_s', 'blasf77_d' ), - ('BLAS_S', 'BLAS_D', 'BLAS_C', 'BLAS_Z' ), - ('BLAS_s', 'BLAS_d', 'BLAS_c', 'BLAS_z' ), - ('BLAS_s', 'BLAS_d', 'BLAS_s', 'BLAS_d' ), - ('blas_is', 'blas_id', 'blas_ic', 'blas_iz' ), - ('blas_s', 'blas_d', 'blas_c', 'blas_z' ), - ('cl_ps', 'cl_pd', 'cl_pc', 'cl_pz' ), - ('cl_s', 'cl_d', 'cl_c', 'cl_z' ), - ('cl_s', 'cl_d', 'cl_sc', 'cl_dz' ), - ('CODELETS_S', 'CODELETS_D', 'CODELETS_C', 'CODELETS_Z' ), - ('codelet_s', 'codelet_d', 'codelet_c', 'codelet_z' ), - ('compute_s', 'compute_d', 'compute_c', 'compute_z' ), - ('control_s', 'control_d', 'control_c', 'control_z' ), - ('coreblas_s', 'coreblas_d', 'coreblas_c', 'coreblas_z' ), - ('CORE_S', 'CORE_D', 'CORE_C', 'CORE_Z' ), - ('CORE_s', 'CORE_d', 'CORE_c', 'CORE_z' ), - ('core_s', 'core_d', 'core_c', 'core_z' ), - ('CORE_s', 'CORE_d', 'CORE_s', 'CORE_d' ), - ('cpu_gpu_s', 'cpu_gpu_d', 'cpu_gpu_c', 'cpu_gpu_z' ), - ('cublasS', 'cublasD', 'cublasC', 'cublasZ' ), - ('example_s', 'example_d', 'example_c', 'example_z' ), - ('ipt_s', 'ipt_d', 'ipt_c', 'ipt_z' ), - ('LAPACKE_s', 'LAPACKE_d', 'LAPACKE_c', 'LAPACKE_z' ), - ('lapackf77_s', 'lapackf77_d', 'lapackf77_c', 'lapackf77_z' ), - ('lapackf77_s', 'lapackf77_d', 'lapackf77_s', 'lapackf77_d' ), - ('lapack_s', 'lapack_d', 'lapack_c', 'lapack_z' ), - ('lapack_s', 'lapack_d', 'lapack_s', 'lapack_d' ), - ('MAGMABLAS_S', 'MAGMABLAS_D', 'MAGMABLAS_C', 'MAGMABLAS_Z' ), - ('magmablas_s', 'magmablas_d', 'magmablas_c', 'magmablas_z' ), - ('magmaf_s', 'magmaf_d', 'magmaf_c', 'magmaf_z' ), - ('magma_get_s', 'magma_get_d', 'magma_get_c', 'magma_get_z' ), - ('magma_ps', 'magma_pd', 'magma_pc', 'magma_pz' ), - ('MAGMA_S', 'MAGMA_D', 'MAGMA_C', 'MAGMA_Z' ), - ('MAGMA_s', 'MAGMA_d', 'MAGMA_c', 'MAGMA_z' ), - ('magma_s', 'magma_d', 'magma_c', 'magma_z' ), - ('QUARK_S', 'QUARK_D', 'QUARK_C', 'QUARK_Z' ), - ('QUARK_s', 'QUARK_d', 'QUARK_c', 'QUARK_z' ), - ('quark_s', 'quark_d', 'quark_c', 'quark_z' ), - ('QUARK_s', 'QUARK_d', 'QUARK_s', 'QUARK_d' ), - ('plasma_ps', 'plasma_pd', 'plasma_pc', 'plasma_pz' ), - ('PLASMA_S', 'PLASMA_D', 'PLASMA_C', 'PLASMA_Z' ), - ('PLASMA_sor', 'PLASMA_dor', 'PLASMA_cun', 'PLASMA_zun' ), - ('PLASMA_s', 'PLASMA_d', 'PLASMA_c', 'PLASMA_z' ), - ('plasma_s', 'plasma_d', 'plasma_c', 'plasma_z' ), - ('PROFILE_S', 'PROFILE_D', 'PROFILE_C', 'PROFILE_Z' ), - ('profile_s', 'profile_d', 'profile_c', 'profile_z' ), - ('SCHED_s', 'SCHED_d', 'SCHED_c', 'SCHED_z' ), - ('starpu_s', 'starpu_d', 'starpu_c', 'starpu_z' ), - ('testing_ds', 'testing_ds', 'testing_zc', 'testing_zc' ), - ('TESTING_S', 'TESTING_D', 'TESTING_C', 'TESTING_Z' ), - ('testing_s', 'testing_d', 'testing_c', 'testing_z' ), - ('time_s', 'time_d', 'time_c', 'time_z' ), - ('WRAPPER_S', 'WRAPPER_D', 'WRAPPER_C', 'WRAPPER_Z' ), - ('wrapper_s', 'wrapper_d', 'wrapper_c', 'wrapper_z' ), - ('Workspace_s', 'Workspace_d', 'Workspace_c', 'Workspace_z' ), - ('workspace_s', 'workspace_d', 'workspace_c', 'workspace_z' ), - - ('csc_s', 'csc_d', 'csc_c', 'csc_z' ), - ('sequential_s', 'sequential_d', 'sequential_c', 'sequential_z' ), - ('coeftab_s', 'coeftab_d', 'coeftab_c', 'coeftab_z' ), - - # ----- Prefixes MORSE - ('MORSE_S', 'MORSE_D', 'MORSE_C', 'MORSE_Z' ), - ('MORSE_sor', 'MORSE_dor', 'MORSE_cun', 'MORSE_zun' ), - ('MORSE_s', 'MORSE_d', 'MORSE_c', 'MORSE_z' ), - ('morse_get_s', 'morse_get_d', 'morse_get_c', 'morse_get_z' ), - ('morse_ps', 'morse_pd', 'morse_pc', 'morse_pz' ), - ('morse_s', 'morse_d', 'morse_c', 'morse_z' ), - ('morse_sdesc', 'morse_ddesc', 'morse_sdesc', 'morse_ddesc' ), - ('TASK_sasum', 'TASK_dasum', 'TASK_scasum', 'TASK_dzasum' ), - ('TASK_ssyrfb', 'TASK_dsyrfb', 'TASK_cherfb', 'TASK_zherfb' ), - ('TASK_stsmlq_sy', 'TASK_dtsmlq_sy', 'TASK_ctsmlq_he', 'TASK_ztsmlq_he' ), - ('TASK_stsmqr_sy', 'TASK_dtsmqr_sy', 'TASK_ctsmqr_he', 'TASK_ztsmqr_he' ), - ('TASK_sor', 'TASK_dor', 'TASK_cun', 'TASK_zun' ), - ('TASK_s', 'TASK_d', 'TASK_c', 'TASK_z' ), - ('TASK_slan', 'TASK_dlan', 'TASK_slan', 'TASK_dlan' ), - ('RUNTIME_S', 'RUNTIME_D', 'RUNTIME_C', 'RUNTIME_Z' ), - ('RUNTIME_s', 'RUNTIME_d', 'RUNTIME_c', 'RUNTIME_z' ), - - # ----- Complex numbers - # \b regexp here avoids conjugate -> conjfugate, - # assuming we always translate from z, not to z. - ('', '', 'conjf', 'conj\b' ), - ('fabsf', 'fabs', 'cabsf', 'cabs' ), - ('', '', 'cuCrealf', 'cuCreal' ), - ('', '', 'cuCimagf', 'cuCimag' ), - ('', '', 'cuConjf', 'cuConj' ), - ('fabsf', 'fabs', 'cuCabsf', 'cuCabs' ), - ('', '', 'crealf', 'creal' ), - ('sqrtf', 'sqrt', 'csqrtf', 'csqrt' ), - - # ----- CUDA - ('cublasIsamax', 'cublasIdamax', 'cublasIcamax', 'cublasIzamax' ), - ('cublasIsamax', 'cublasIdamax', 'cublasIsamax', 'cublasIdamax' ), - ('cublasSnrm2', 'cublasDnrm2', 'cublasScnrm2', 'cublasDznrm2' ), - - # ----- PLASMA / MAGMA / MORSE - ('bsy2trc', 'bsy2trc', 'bhe2trc', 'bhe2trc' ), - ('magma_ssqrt', 'magma_dsqrt', 'magma_ssqrt', 'magma_dsqrt' ), - ('morse_ssqrt', 'morse_dsqrt', 'morse_ssqrt', 'morse_dsqrt' ), - ('SAUXILIARY', 'DAUXILIARY', 'CAUXILIARY', 'ZAUXILIARY' ), - ('sauxiliary', 'dauxiliary', 'cauxiliary', 'zauxiliary' ), - ('sbcyclic', 'dbcyclic', 'cbcyclic', 'zbcyclic' ), - ('sbulge', 'dbulge', 'cbulge', 'zbulge' ), - ('SCODELETS', 'DCODELETS', 'CCODELETS', 'ZCODELETS' ), - ('sgetmatrix', 'dgetmatrix', 'cgetmatrix', 'zgetmatrix' ), - ('sinplace', 'dinplace', 'cinplace', 'zinplace' ), - ('slocality', 'dlocality', 'clocality', 'zlocality' ), - ('slapack', 'dlapack', 'clapack', 'zlapack' ), - ('SLAPACK', 'DLAPACK', 'CLAPACK', 'ZLAPACK' ), - ('smalloc', 'dmalloc', 'cmalloc', 'zmalloc' ), - ('smalloc', 'dmalloc', 'smalloc', 'dmalloc' ), - ('spanel_to_q', 'dpanel_to_q', 'cpanel_to_q', 'zpanel_to_q' ), - ('spermute', 'dpermute', 'cpermute', 'zpermute' ), - ('sprint', 'dprint', 'cprint', 'zprint' ), - ('sprint', 'dprint', 'sprint', 'dprint' ), - ('sprofiling', 'dprofiling', 'cprofiling', 'zprofiling' ), - ('sq_to_panel', 'dq_to_panel', 'cq_to_panel', 'zq_to_panel' ), - ('sset', 'dset', 'cset', 'zset' ), - ('ssetmatrix', 'dsetmatrix', 'csetmatrix', 'zsetmatrix' ), - ('SSIZE', 'DSIZE', 'CSIZE', 'ZSIZE' ), - ('ssplit', 'dsplit', 'csplit', 'zsplit' ), - ('stile', 'dtile', 'ctile', 'ztile' ), - ('STILE', 'DTILE', 'CTILE', 'ZTILE' ), - ('stranspose', 'dtranspose', 'ctranspose', 'ztranspose' ), - ('szero', 'dzero', 'czero', 'zzero' ), - ('sy2sb', 'sy2sb', 'he2hb', 'he2hb' ), - - # ----- Constants - ('CblasTrans', 'CblasTrans', 'CblasConjTrans', 'CblasConjTrans' ), - ('MagmaTrans', 'MagmaTrans', 'MagmaConjTrans', 'MagmaConjTrans' ), - ('MorseTrans', 'MorseTrans', 'MorseConjTrans', 'MorseConjTrans' ), - ('PlasmaTrans', 'PlasmaTrans', 'PlasmaConjTrans','PlasmaConjTrans' ), - ('symmetric', 'symmetric', 'Hermitian', 'Hermitian' ), - - # ----- BLAS and LAPACK, lowercase, alphabetic order - # copy & paste these to uppercase below and fix case. - # used for filenames lacking magma_z, etc. prefix - ('isamax', 'idamax', 'icamax', 'izamax' ), - ('isamax', 'idamax', 'isamax', 'idamax' ), - ('saxpy', 'daxpy', 'caxpy', 'zaxpy' ), - ('scopy', 'dcopy', 'ccopy', 'zcopy' ), - ('sgecfi', 'dgecfi', 'cgecfi', 'zgecfi' ), - ('sgemm', 'dgemm', 'cgemm', 'zgemm' ), - ('sgemdm', 'dgemdm', 'cgemdm', 'zgemdm' ), - ('SGEMDM', 'DGEMDM', 'CGEMDM', 'ZGEMDM' ), - ('sgemv', 'dgemv', 'cgemv', 'zgemv' ), - ('sscal', 'dscal', 'cscal', 'zscal' ), - ('sscal', 'dscal', 'csscal', 'zdscal' ), - ('sscal', 'dscal', 'sscal', 'dscal' ), # zdscal -> csscal - ('sswap', 'dswap', 'cswap', 'zswap' ), - ('ssymm', 'dsymm', 'csymm', 'zsymm' ), - ('ssymv', 'dsymv', 'csymv', 'zsymv' ), - ('ssyr2k', 'dsyr2k', 'csyr2k', 'zsyr2k' ), - ('ssyrk', 'dsyrk', 'csyrk', 'zsyrk' ), - ('strmm', 'dtrmm', 'ctrmm', 'ztrmm' ), - ('strmv', 'dtrmv', 'ctrmv', 'ztrmv' ), - ('strsm', 'dtrsm', 'ctrsm', 'ztrsm' ), - ('strsv', 'dtrsv', 'ctrsv', 'ztrsv' ), - -# ADD FOR NEW VERSION OF CHAMELEON - ('sgeadd', 'dgeadd', 'cgeadd', 'zgeadd' ), - ('shbcpy', 'dhbcpy', 'chbcpy', 'zhbcpy' ), - ('ssyrbt', 'dsyrbt', 'cherbt', 'zherbt' ), - ('ssygv', 'dsygv', 'chegv', 'zhegv' ), -# END ADD - - # LAPACK - ('sbarrier', 'dbarrier', 'cbarrier', 'zbarrier' ), - ('sbdsqr', 'dbdsqr', 'cbdsqr', 'zbdsqr' ), - ('sbdt01', 'dbdt01', 'cbdt01', 'zbdt01' ), - ('scheck', 'dcheck', 'ccheck', 'zcheck' ), - ('sgebak', 'dgebak', 'cgebak', 'zgebak' ), - ('sgebal', 'dgebal', 'cgebal', 'zgebal' ), - ('sgebd2', 'dgebd2', 'cgebd2', 'zgebd2' ), - ('sgebrd', 'dgebrd', 'cgebrd', 'zgebrd' ), - ('sgeev', 'dgeev', 'cgeev', 'zgeev' ), - ('sgehd2', 'dgehd2', 'cgehd2', 'zgehd2' ), - ('sgehrd', 'dgehrd', 'cgehrd', 'zgehrd' ), - ('sgelq2', 'dgelq2', 'cgelq2', 'zgelq2' ), - ('sgelqf', 'dgelqf', 'cgelqf', 'zgelqf' ), - ('sgelqs', 'dgelqs', 'cgelqs', 'zgelqs' ), - ('sgelqt', 'dgelqt', 'cgelqt', 'zgelqt' ), - ('sgels', 'dgels', 'cgels', 'zgels' ), - ('sgeqlf', 'dgeqlf', 'cgeqlf', 'zgeqlf' ), - ('sgeqp3', 'dgeqp3', 'cgeqp3', 'zgeqp3' ), - ('sgeqr2', 'dgeqr2', 'cgeqr2', 'zgeqr2' ), - ('sgeqrf', 'dgeqrf', 'cgeqrf', 'zgeqrf' ), - ('sgeqrs', 'dgeqrs', 'cgeqrs', 'zgeqrs' ), - ('sgeqrt', 'dgeqrt', 'cgeqrt', 'zgeqrt' ), - ('sgessm', 'dgessm', 'cgessm', 'zgessm' ), - ('sgessq', 'dgessq', 'cgessq', 'zgessq' ), - ('sgesv', 'dgesv', 'cgesv', 'zgesv' ), - ('sgesv', 'sgesv', 'cgesv', 'cgesv' ), - ('sget22', 'dget22', 'cget22', 'zget22' ), - ('sgetf2', 'dgetf2', 'cgetf2', 'zgetf2' ), - ('sgetmi', 'dgetmi', 'cgetmi', 'zgetmi' ), - ('sgetmo', 'dgetmo', 'cgetmo', 'zgetmo' ), - ('sgetrf', 'dgetrf', 'cgetrf', 'zgetrf' ), - ('sgetri', 'dgetri', 'cgetri', 'zgetri' ), - ('sgetrl', 'dgetrl', 'cgetrl', 'zgetrl' ), - ('sgetrs', 'dgetrs', 'cgetrs', 'zgetrs' ), - ('shseqr', 'dhseqr', 'chseqr', 'zhseqr' ), - ('shst01', 'dhst01', 'chst01', 'zhst01' ), - ('slabad', 'dlabad', 'slabad', 'dlabad' ), - ('slabrd', 'dlabrd', 'clabrd', 'zlabrd' ), - ('slacgv', 'dlacgv', 'clacgv', 'zlacgv' ), - ('slacpy', 'dlacpy', 'clacpy', 'zlacpy' ), - ('slaed', 'dlaed', 'slaed', 'dlaed' ), - ('slaex', 'dlaex', 'slaex', 'dlaex' ), - ('slagsy', 'dlagsy', 'clagsy', 'zlagsy' ), - ('slahr', 'dlahr', 'clahr', 'zlahr' ), - ('slamc3', 'dlamc3', 'slamc3', 'dlamc3' ), - ('slamch', 'dlamch', 'slamch', 'dlamch' ), - ('slamrg', 'dlamrg', 'slamrg', 'dlamrg' ), - ('slange', 'dlange', 'clange', 'zlange' ), - ('slanst', 'dlanst', 'clanht', 'zlanht' ), - ('slansy', 'dlansy', 'clansy', 'zlansy' ), - ('slantr', 'dlantr', 'clantr', 'zlantr' ), - ('slaqps', 'dlaqps', 'claqps', 'zlaqps' ), - ('slaqp2', 'dlaqp2', 'claqp2', 'zlaqp2' ), - ('slarfb', 'dlarfb', 'clarfb', 'zlarfb' ), - ('slarfg', 'dlarfg', 'clarfg', 'zlarfg' ), - ('slarft', 'dlarft', 'clarft', 'zlarft' ), - ('slarfx', 'dlarfx', 'clarfx', 'zlarfx' ), - ('slarfy', 'dlarfy', 'clarfy', 'zlarfy' ), - ('slarnv', 'dlarnv', 'clarnv', 'zlarnv' ), - ('slarnv', 'dlarnv', 'slarnv', 'dlarnv' ), - ('slartg', 'dlartg', 'clartg', 'zlartg' ), - ('slascl', 'dlascl', 'clascl', 'zlascl' ), - ('slaset', 'dlaset', 'claset', 'zlaset' ), - ('slaswp', 'dlaswp', 'claswp', 'zlaswp' ), - ('slatrd', 'dlatrd', 'clatrd', 'zlatrd' ), - ('slauum', 'dlauum', 'clauum', 'zlauum' ), - ('spack', 'dpack', 'cpack', 'zpack' ), - ('splgsy', 'dplgsy', 'cplgsy', 'zplgsy' ), - ('splrnt', 'dplrnt', 'cplrnt', 'zplrnt' ), - ('splssq', 'dplssq', 'cplssq', 'zplssq' ), - ('sposv', 'dposv', 'cposv', 'zposv' ), - ('ssysv', 'dsysv', 'csysv', 'zsysv' ), - ('sposv', 'sposv', 'cposv', 'cposv' ), - ('spotrf', 'dpotrf', 'cpotrf', 'zpotrf' ), - ('ssytrf', 'dsytrf', 'csytrf', 'zsytrf' ), - ('spotri', 'dpotri', 'cpotri', 'zpotri' ), - ('spotrs', 'dpotrs', 'cpotrs', 'zpotrs' ), - ('ssytrs', 'dsytrs', 'csytrs', 'zsytrs' ), - ('sqpt01', 'dqpt01', 'cqpt01', 'zqpt01' ), - ('sqrt02', 'dqrt02', 'cqrt02', 'zqrt02' ), - ('sshift', 'dshift', 'cshift', 'zshift' ), - ('sssssm', 'dssssm', 'cssssm', 'zssssm' ), - ('sstebz', 'dstebz', 'sstebz', 'dstebz' ), - ('sstedc', 'dstedc', 'cstedc', 'zstedc' ), - ('sstedx', 'dstedx', 'cstedx', 'zstedx' ), - ('sstedx', 'dstedx', 'sstedx', 'dstedx' ), - ('sstein', 'dstein', 'cstein', 'zstein' ), - ('sstemr', 'dstemr', 'cstemr', 'zstemr' ), - ('ssteqr', 'dsteqr', 'csteqr', 'zsteqr' ), - ('ssterf', 'dsterf', 'ssterf', 'dsterf' ), - ('ssterm', 'dsterm', 'csterm', 'zsterm' ), - ('sstt21', 'dstt21', 'cstt21', 'zstt21' ), - ('strasm', 'dtrasm', 'ctrasm', 'ztrasm' ), - ('strevc', 'dtrevc', 'ctrevc', 'ztrevc' ), - ('strsmpl', 'dtrsmpl', 'ctrsmpl', 'ztrsmpl' ), - ('strssq', 'dtrssq', 'ctrssq', 'ztrssq' ), - ('strtri', 'dtrtri', 'ctrtri', 'ztrtri' ), - ('stslqt', 'dtslqt', 'ctslqt', 'ztslqt' ), - ('stsmlq_sy', 'dtsmlq_sy', 'ctsmlq_he', 'ztsmlq_he' ), - ('stsmqr_sy', 'dtsmqr_sy', 'ctsmqr_he', 'ztsmqr_he' ), - ('stsmqr', 'dtsmqr', 'ctsmqr', 'ztsmqr' ), - ('stsmlq', 'dtsmlq', 'ctsmlq', 'ztsmlq' ), - ('stsqrt', 'dtsqrt', 'ctsqrt', 'ztsqrt' ), - ('stslqt', 'dtslqt', 'ctslqt', 'ztslqt' ), - ('ststrf', 'dtstrf', 'ctstrf', 'ztstrf' ), - ('sttlqt', 'dttlqt', 'cttlqt', 'zttlqt' ), - ('sttmlq', 'dttmlq', 'cttmlq', 'zttmlq' ), - ('sttmqr', 'dttmqr', 'cttmqr', 'zttmqr' ), - ('sttqrt', 'dttqrt', 'cttqrt', 'zttqrt' ), - ('sungesv', 'sungesv', 'cungesv', 'cungesv' ), - ('sstegr', 'dstegr', 'cstegr', 'zstegr' ), - ('ssyssq', 'dsyssq', 'csyssq', 'zsyssq' ), - - # ----- BLAS and LAPACK, where complex base name != real base name - # BLAS, with precision - ('sasum', 'dasum', 'scasum', 'dzasum' ), - ('sasum', 'dasum', 'casum', 'zasum' ), - ('sdot', 'ddot', 'cdotc', 'zdotc' ), - ('sdot_sub', 'ddot_sub', 'cdotc_sub', 'zdotc_sub' ), - ('sdot_sub', 'ddot_sub', 'cdotu_sub', 'zdotu_sub' ), - ('sger', 'dger', 'cgerc', 'zgerc' ), - ('sger', 'dger', 'cgeru', 'zgeru' ), - ('snrm2', 'dnrm2', 'scnrm2', 'dznrm2' ), - ('ssymm', 'dsymm', 'chemm', 'zhemm' ), - ('ssymv', 'dsymv', 'chemv', 'zhemv' ), - ('ssyr2', 'dsyr2', 'cher2', 'zher2' ), - ('ssyr2k', 'dsyr2k', 'cher2k', 'zher2k' ), - ('ssyrk', 'dsyrk', 'cherk', 'zherk' ), - ('ssyr', 'dsyr', 'cher', 'zher' ), - - # LAPACK, with precision - ('slag2d', 'dlag2s', 'clag2z', 'zlag2c' ), - ('slagsy', 'dlagsy', 'claghe', 'zlaghe' ), - ('slasyf', 'dlasyf', 'clahef', 'zlahef' ), - ('slansy', 'dlansy', 'clanhe', 'zlanhe' ), - ('slavsy', 'dlavsy', 'clavhe', 'zlavhe' ), - ('sorg2r', 'dorg2r', 'cung2r', 'zung2r' ), - ('sorgbr', 'dorgbr', 'cungbr', 'zungbr' ), - ('sorghr', 'dorghr', 'cunghr', 'zunghr' ), - ('sorglq', 'dorglq', 'cunglq', 'zunglq' ), - ('sorgql', 'dorgql', 'cungql', 'zungql' ), - ('sorgqr', 'dorgqr', 'cungqr', 'zungqr' ), - ('sorgtr', 'dorgtr', 'cungtr', 'zungtr' ), - ('sorm2r', 'dorm2r', 'cunm2r', 'zunm2r' ), - ('sormbr', 'dormbr', 'cunmbr', 'zunmbr' ), - ('sormlq', 'dormlq', 'cunmlq', 'zunmlq' ), - ('sormql', 'dormql', 'cunmql', 'zunmql' ), - ('sormqr', 'dormqr', 'cunmqr', 'zunmqr' ), - ('sormr2', 'dormr2', 'cunmr2', 'zunmr2' ), - ('sormtr', 'dormtr', 'cunmtr', 'zunmtr' ), - ('sort01', 'dort01', 'cunt01', 'zunt01' ), - ('splgsy', 'dplgsy', 'cplghe', 'zplghe' ), - ('ssbtrd', 'dsbtrd', 'chbtrd', 'zhbtrd' ), - ('ssybbd', 'dsybbd', 'chebbd', 'zhebbd' ), - ('ssyev', 'dsyev', 'cheev', 'zheev' ), - ('ssyevd', 'dsyevd', 'cheevd', 'zheevd' ), - ('ssygs2', 'dsygs2', 'chegs2', 'zhegs2' ), - ('ssygst', 'dsygst', 'chegst', 'zhegst' ), - ('ssygvd', 'dsygvd', 'chegvd', 'zhegvd' ), - ('ssygvr', 'dsygvr', 'chegvr', 'zhegvr' ), - ('ssygvx', 'dsygvx', 'chegvx', 'zhegvx' ), - ('ssyssq', 'dsyssq', 'chessq', 'zhessq' ), - ('ssyt21', 'dsyt21', 'chet21', 'zhet21' ), - ('ssytd2', 'dsytd2', 'chetd2', 'zhetd2' ), - ('ssytrd', 'dsytrd', 'chetrd', 'zhetrd' ), - ('ssytrf', 'dsytrf', 'chetrf', 'zhetrf' ), - - # BLAS, without precision - # must be after BLAS with precision - # Ex: cublasZhemm -> cublasShemm -> cublasSsymm - ('dot', 'dot', 'dotc', 'dotc' ), - ('dot_sub', 'dot_sub', 'dotc_sub', 'dotc_sub' ), - ('dot_sub', 'dot_sub', 'dotu_sub', 'dotu_sub' ), - ('ger', 'ger', 'gerc', 'gerc' ), - ('ger', 'ger', 'geru', 'geru' ), - ('nrm2', 'nrm2', 'cnrm2', 'znrm2' ), # dznrm2 -> dnrm2 - ('symm', 'symm', 'hemm', 'hemm' ), - ('symv', 'symv', 'hemv', 'hemv' ), - ('syr2', 'syr2', 'her2', 'her2' ), - ('syr2k', 'syr2k', 'her2k', 'her2k' ), - ('syrk', 'syrk', 'herk', 'herk' ), - - # LAPACK, without precision - ('lag2d', 'lag2s', 'lag2z', 'lag2c' ), - ('lagsy', 'lagsy', 'laghe', 'laghe' ), - ('lasyf', 'lasyf', 'lahef', 'lahef' ), - ('lansy', 'lansy', 'lanhe', 'lanhe' ), - ('lanst', 'lanst', 'lanht', 'lanht' ), - ('lavsy', 'lavsy', 'lavhe', 'lavhe' ), - ('org2r', 'org2r', 'ung2r', 'ung2r' ), - ('orgbr', 'orgbr', 'ungbr', 'ungbr' ), - ('orghr', 'orghr', 'unghr', 'unghr' ), - ('orglq', 'orglq', 'unglq', 'unglq' ), - ('orgql', 'orgql', 'ungql', 'ungql' ), - ('orgqr', 'orgqr', 'ungqr', 'ungqr' ), - ('orgtr', 'orgtr', 'ungtr', 'ungtr' ), - ('orm2r', 'orm2r', 'unm2r', 'unm2r' ), - ('ormbr', 'ormbr', 'unmbr', 'unmbr' ), - ('ormlq', 'ormlq', 'unmlq', 'unmlq' ), - ('ormql', 'ormql', 'unmql', 'unmql' ), - ('ormqr', 'ormqr', 'unmqr', 'unmqr' ), - ('ormr2', 'ormr2', 'unmr2', 'unmr2' ), - ('ormtr', 'ormtr', 'unmtr', 'unmtr' ), - ('ort01', 'ort01', 'unt01', 'unt01' ), - ('plgsy', 'plgsy', 'plghe', 'plghe' ), - ('sbtrd', 'sbtrd', 'hbtrd', 'hbtrd' ), - ('sybbd', 'sybbd', 'hebbd', 'hebbd' ), - ('syev', 'syev', 'heev', 'heev' ), - ('syevd', 'syevd', 'heevd', 'heevd' ), - ('sygs2', 'sygs2', 'hegs2', 'hegs2' ), - ('sygst', 'sygst', 'hegst', 'hegst' ), - ('sygvd', 'sygvd', 'hegvd', 'hegvd' ), - ('sygvr', 'sygvr', 'hegvr', 'hegvr' ), - ('sygvx', 'sygvx', 'hegvx', 'hegvx' ), - ('syssq', 'syssq', 'hessq', 'hessq' ), - ('syt21', 'syt21', 'het21', 'het21' ), - ('sytd2', 'sytd2', 'hetd2', 'hetd2' ), - ('sytrd', 'sytrd', 'hetrd', 'hetrd' ), - ('sytrf', 'sytrf', 'hetrf', 'hetrf' ), - - # ----- For norms: compute result in Real or Double - ('sgeadd', 'dgeadd', 'sgeadd', 'dgeadd' ), - ('slange', 'dlange', 'slange', 'dlange' ), - ('slaset', 'dlaset', 'slaset', 'dlaset' ), - ('splssq', 'dplssq', 'splssq', 'dplssq' ), - ('slacpy', 'dlacpy', 'slacpy', 'dlacpy' ), - ('saxpy', 'daxpy', 'saxpy', 'daxpy' ), - ('MorseRealFloat', 'MorseRealDouble', 'MorseRealFloat', 'MorseRealDouble'), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_U-NG2R', 'DAG_CORE_U-NG2R', 'DAG_CORE_UNG2R', 'DAG_CORE_UNG2R' ), - ('DAG_CORE_U-NGBR', 'DAG_CORE_U-NGBR', 'DAG_CORE_UNGBR', 'DAG_CORE_UNGBR' ), - ('DAG_CORE_U-NGHR', 'DAG_CORE_U-NGHR', 'DAG_CORE_UNGHR', 'DAG_CORE_UNGHR' ), - ('DAG_CORE_U-NGLQ', 'DAG_CORE_U-NGLQ', 'DAG_CORE_UNGLQ', 'DAG_CORE_UNGLQ' ), - ('DAG_CORE_U-NGQL', 'DAG_CORE_U-NGQL', 'DAG_CORE_UNGQL', 'DAG_CORE_UNGQL' ), - ('DAG_CORE_U-NGQR', 'DAG_CORE_U-NGQR', 'DAG_CORE_UNGQR', 'DAG_CORE_UNGQR' ), - ('DAG_CORE_U-NGTR', 'DAG_CORE_U-NGTR', 'DAG_CORE_UNGTR', 'DAG_CORE_UNGTR' ), - ('DAG_CORE_U-NM2R', 'DAG_CORE_U-NM2R', 'DAG_CORE_UNM2R', 'DAG_CORE_UNM2R' ), - ('DAG_CORE_U-NMBR', 'DAG_CORE_U-NMBR', 'DAG_CORE_UNMBR', 'DAG_CORE_UNMBR' ), - ('DAG_CORE_U-NMLQ', 'DAG_CORE_U-NMLQ', 'DAG_CORE_UNMLQ', 'DAG_CORE_UNMLQ' ), - ('DAG_CORE_U-NMQL', 'DAG_CORE_U-NMQL', 'DAG_CORE_UNMQL', 'DAG_CORE_UNMQL' ), - ('DAG_CORE_U-NMQR', 'DAG_CORE_U-NMQR', 'DAG_CORE_UNMQR', 'DAG_CORE_UNMQR' ), - - # ----- BLAS AND LAPACK, UPPERCASE, ALPHABETIC ORDER - # COPY & PASTE THESE TO UPPERCASE BELOW AND FIX CASE. - # USED FOR FILENAMES LACKING MAGMA_Z, ETC. PREFIX - ('ISAMAX', 'IDAMAX', 'ICAMAX', 'IZAMAX' ), - ('ISAMAX', 'IDAMAX', 'ISAMAX', 'IDAMAX' ), - ('SAXPY', 'DAXPY', 'CAXPY', 'ZAXPY' ), - ('SCOPY', 'DCOPY', 'CCOPY', 'ZCOPY' ), - ('SGEMV', 'DGEMV', 'CGEMV', 'ZGEMV' ), - ('SSCAL', 'DSCAL', 'CSCAL', 'ZSCAL' ), - ('SSCAL', 'DSCAL', 'CSSCAL', 'ZDSCAL' ), - ('SSCAL', 'DSCAL', 'SSCAL', 'DSCAL' ), # ZDSCAL -> CSSCAL - ('SSWAP', 'DSWAP', 'CSWAP', 'ZSWAP' ), - ('SSYMM', 'DSYMM', 'CSYMM', 'ZSYMM' ), - ('SSYMV', 'DSYMV', 'CSYMV', 'ZSYMV' ), - ('SSYR2K', 'DSYR2K', 'CSYR2K', 'ZSYR2K' ), - ('SSYRK', 'DSYRK', 'CSYRK', 'ZSYRK' ), - ('STRMM', 'DTRMM', 'CTRMM', 'ZTRMM' ), - ('STRMV', 'DTRMV', 'CTRMV', 'ZTRMV' ), - ('STRSM', 'DTRSM', 'CTRSM', 'ZTRSM' ), - ('STRSV', 'DTRSV', 'CTRSV', 'ZTRSV' ), - - # LAPACK - ('SBDSQR', 'DBDSQR', 'CBDSQR', 'ZBDSQR' ), - ('SBDT01', 'DBDT01', 'CBDT01', 'ZBDT01' ), - ('SCHECK', 'DCHECK', 'CCHECK', 'ZCHECK' ), - ('SGEBAK', 'DGEBAK', 'CGEBAK', 'ZGEBAK' ), - ('SGEBAL', 'DGEBAL', 'CGEBAL', 'ZGEBAL' ), - ('SGEBD2', 'DGEBD2', 'CGEBD2', 'ZGEBD2' ), - ('SGEBRD', 'DGEBRD', 'CGEBRD', 'ZGEBRD' ), - ('SGEEV', 'DGEEV', 'CGEEV', 'ZGEEV' ), - ('SGEHD2', 'DGEHD2', 'CGEHD2', 'ZGEHD2' ), - ('SGEHRD', 'DGEHRD', 'CGEHRD', 'ZGEHRD' ), - ('SGELQ2', 'DGELQ2', 'CGELQ2', 'ZGELQ2' ), - ('SGELQF', 'DGELQF', 'CGELQF', 'ZGELQF' ), - ('SGELQS', 'DGELQS', 'CGELQS', 'ZGELQS' ), - ('SGELS', 'DGELS', 'CGELS', 'ZGELS' ), - ('SGEMM', 'DGEMM', 'CGEMM', 'ZGEMM' ), - ('SGEQLF', 'DGEQLF', 'CGEQLF', 'ZGEQLF' ), - ('SGEQP3', 'DGEQP3', 'CGEQP3', 'ZGEQP3' ), - ('SGEQR2', 'DGEQR2', 'CGEQR2', 'ZGEQR2' ), - ('SGEQRF', 'DGEQRF', 'CGEQRF', 'ZGEQRF' ), - ('SGEQRS', 'DGEQRS', 'CGEQRS', 'ZGEQRS' ), - ('SGESSM', 'DGESSM', 'CGESSM', 'ZGESSM' ), - ('SGESV', 'DGESV', 'CGESV', 'ZGESV' ), - ('SGESV', 'SGESV', 'CGESV', 'CGESV' ), - ('SGET22', 'DGET22', 'CGET22', 'ZGET22' ), - ('SGETF2', 'DGETF2', 'CGETF2', 'ZGETF2' ), - ('SGETRF', 'DGETRF', 'CGETRF', 'ZGETRF' ), - ('SGETRI', 'DGETRI', 'CGETRI', 'ZGETRI' ), - ('SGETRL', 'DGETRL', 'CGETRL', 'ZGETRL' ), - ('SGETRS', 'DGETRS', 'CGETRS', 'ZGETRS' ), - ('SHSEQR', 'DHSEQR', 'CHSEQR', 'ZHSEQR' ), - ('SHST01', 'DHST01', 'CHST01', 'ZHST01' ), - ('SLABAD', 'DLABAD', 'SLABAD', 'DLABAD' ), - ('SLABRD', 'DLABRD', 'CLABRD', 'ZLABRD' ), - ('SLACGV', 'DLACGV', 'CLACGV', 'ZLACGV' ), - ('SLACPY', 'DLACPY', 'CLACPY', 'ZLACPY' ), - ('SLAED', 'DLAED', 'SLAED', 'DLAED' ), - ('SLAEX', 'DLAEX', 'SLAEX', 'DLAEX' ), - ('SLAGSY', 'DLAGSY', 'CLAGSY', 'ZLAGSY' ), - ('SLAHR', 'DLAHR', 'CLAHR', 'ZLAHR' ), - ('SLAMC3', 'DLAMC3', 'SLAMC3', 'DLAMC3' ), - ('SLAMCH', 'DLAMCH', 'SLAMCH', 'DLAMCH' ), - ('SLAMRG', 'DLAMRG', 'SLAMRG', 'DLAMRG' ), - ('SLANGE', 'DLANGE', 'CLANGE', 'ZLANGE' ), - ('SLANST', 'DLANST', 'CLANHT', 'ZLANHT' ), - ('SLANSY', 'DLANSY', 'CLANSY', 'ZLANSY' ), - ('SLANTR', 'DLANTR', 'CLANTR', 'ZLANTR' ), - ('SLAQPS', 'DLAQPS', 'CLAQPS', 'ZLAQPS' ), - ('SLAQP2', 'DLAQP2', 'CLAQP2', 'ZLAQP2' ), - ('SLARFB', 'DLARFB', 'CLARFB', 'ZLARFB' ), - ('SLARFG', 'DLARFG', 'CLARFG', 'ZLARFG' ), - ('SLARFT', 'DLARFT', 'CLARFT', 'ZLARFT' ), - ('SLARFX', 'DLARFX', 'CLARFX', 'ZLARFX' ), - ('SLARFY', 'DLARFY', 'CLARFY', 'ZLARFY' ), - ('SLARNV', 'DLARNV', 'CLARNV', 'ZLARNV' ), - ('SLARNV', 'DLARNV', 'SLARNV', 'DLARNV' ), - ('SLARTG', 'DLARTG', 'CLARTG', 'ZLARTG' ), - ('SLASCL', 'DLASCL', 'CLASCL', 'ZLASCL' ), - ('SLASET', 'DLASET', 'CLASET', 'ZLASET' ), - ('SLASWP', 'DLASWP', 'CLASWP', 'ZLASWP' ), - ('SLATRD', 'DLATRD', 'CLATRD', 'ZLATRD' ), - ('SLAUUM', 'DLAUUM', 'CLAUUM', 'ZLAUUM' ), - ('SPOSV', 'DPOSV', 'CPOSV', 'ZPOSV' ), - ('SSYSV', 'DSYSV', 'CSYSV', 'ZSYSV' ), - ('SPOSV', 'SPOSV', 'CPOSV', 'CPOSV' ), - ('SPOTRF', 'DPOTRF', 'CPOTRF', 'ZPOTRF' ), - ('SSYTRF', 'DSYTRF', 'CSYTRF', 'ZSYTRF' ), - ('SPOTRI', 'DPOTRI', 'CPOTRI', 'ZPOTRI' ), - ('SPOTRS', 'DPOTRS', 'CPOTRS', 'ZPOTRS' ), - ('SSYTRS', 'DSYTRS', 'CSYTRS', 'ZSYTRS' ), - ('SQPT01', 'DQPT01', 'CQPT01', 'ZQPT01' ), - ('SQRT02', 'DQRT02', 'CQRT02', 'ZQRT02' ), - ('SSSSSM', 'DSSSSM', 'CSSSSM', 'ZSSSSM' ), - ('SSTEBZ', 'DSTEBZ', 'SSTEBZ', 'DSTEBZ' ), - ('SSTEDC', 'DSTEDC', 'CSTEDC', 'ZSTEDC' ), - ('SSTEDX', 'DSTEDX', 'CSTEDX', 'ZSTEDX' ), - ('SSTEDX', 'DSTEDX', 'SSTEDX', 'DSTEDX' ), - ('SSTEIN', 'DSTEIN', 'CSTEIN', 'ZSTEIN' ), - ('SSTEMR', 'DSTEMR', 'CSTEMR', 'ZSTEMR' ), - ('SSTEQR', 'DSTEQR', 'CSTEQR', 'ZSTEQR' ), - ('SSTERF', 'DSTERF', 'SSTERF', 'DSTERF' ), - ('SSTERM', 'DSTERM', 'CSTERM', 'ZSTERM' ), - ('SSTT21', 'DSTT21', 'CSTT21', 'ZSTT21' ), - ('STREVC', 'DTREVC', 'CTREVC', 'ZTREVC' ), - ('STRSMPL', 'DTRSMPL', 'CTRSMPL', 'ZTRSMPL' ), - ('STRTRI', 'DTRTRI', 'CTRTRI', 'ZTRTRI' ), - ('STSQRT', 'DTSQRT', 'CTSQRT', 'ZTSQRT' ), - ('STSTRF', 'DTSTRF', 'CTSTRF', 'ZTSTRF' ), - ('SUNGESV', 'SUNGESV', 'CUNGESV', 'CUNGESV' ), - ('SSTEGR', 'DSTEGR', 'CSTEGR', 'ZSTEGR' ), - - # ----- BLAS AND LAPACK, WHERE COMPLEX BASE NAME != REAL BASE NAME - # BLAS, WITH PRECISION - ('SDOT', 'DDOT', 'CDOTC', 'ZDOTC' ), - ('SDOT_SUB', 'DDOT_SUB', 'CDOTC_SUB', 'ZDOTC_SUB' ), - ('SDOT_SUB', 'DDOT_SUB', 'CDOTU_SUB', 'ZDOTU_SUB' ), - ('SGER', 'DGER', 'CGERC', 'ZGERC' ), - ('SGER', 'DGER', 'CGERU', 'ZGERU' ), - ('SNRM2', 'DNRM2', 'SCNRM2', 'DZNRM2' ), - ('SSYMM', 'DSYMM', 'CHEMM', 'ZHEMM' ), - ('SSYMV', 'DSYMV', 'CHEMV', 'ZHEMV' ), - ('SSYR2', 'DSYR2', 'CHER2', 'ZHER2' ), - ('SSYR2K', 'DSYR2K', 'CHER2K', 'ZHER2K' ), - ('SSYRK', 'DSYRK', 'CHERK', 'ZHERK' ), - ('SSYR', 'DSYR', 'CHER', 'ZHER' ), - - # LAPACK, WITH PRECISION - ('SLAG2D', 'DLAG2S', 'CLAG2Z', 'ZLAG2C' ), - ('SLAGSY', 'DLAGSY', 'CLAGHE', 'ZLAGHE' ), - ('SLASYF', 'DLASYF', 'CLAHEF', 'ZLAHEF' ), - ('SLANSY', 'DLANSY', 'CLANHE', 'ZLANHE' ), - ('SLAVSY', 'DLAVSY', 'CLAVHE', 'ZLAVHE' ), - ('SORG2R', 'DORG2R', 'CUNG2R', 'ZUNG2R' ), - ('SORGBR', 'DORGBR', 'CUNGBR', 'ZUNGBR' ), - ('SORGHR', 'DORGHR', 'CUNGHR', 'ZUNGHR' ), - ('SORGLQ', 'DORGLQ', 'CUNGLQ', 'ZUNGLQ' ), - ('SORGQL', 'DORGQL', 'CUNGQL', 'ZUNGQL' ), - ('SORGQR', 'DORGQR', 'CUNGQR', 'ZUNGQR' ), - ('SORGTR', 'DORGTR', 'CUNGTR', 'ZUNGTR' ), - ('SORM2R', 'DORM2R', 'CUNM2R', 'ZUNM2R' ), - ('SORMBR', 'DORMBR', 'CUNMBR', 'ZUNMBR' ), - ('SORMLQ', 'DORMLQ', 'CUNMLQ', 'ZUNMLQ' ), - ('SORMQL', 'DORMQL', 'CUNMQL', 'ZUNMQL' ), - ('SORMQR', 'DORMQR', 'CUNMQR', 'ZUNMQR' ), - ('SORMR2', 'DORMR2', 'CUNMR2', 'ZUNMR2' ), - ('SORMTR', 'DORMTR', 'CUNMTR', 'ZUNMTR' ), - ('SORT01', 'DORT01', 'CUNT01', 'ZUNT01' ), - ('SPLGSY', 'DPLGSY', 'CPLGHE', 'ZPLGHE' ), - ('SSBTRD', 'DSBTRD', 'CHBTRD', 'ZHBTRD' ), - ('SSYBBD', 'DSYBBD', 'CHEBBD', 'ZHEBBD' ), - ('SSYEV', 'DSYEV', 'CHEEV', 'ZHEEV' ), - ('SSYEVD', 'DSYEVD', 'CHEEVD', 'ZHEEVD' ), - ('SSYGS2', 'DSYGS2', 'CHEGS2', 'ZHEGS2' ), - ('SSYGST', 'DSYGST', 'CHEGST', 'ZHEGST' ), - ('SSYGVD', 'DSYGVD', 'CHEGVD', 'ZHEGVD' ), - ('SSYGVR', 'DSYGVR', 'CHEGVR', 'ZHEGVR' ), - ('SSYGVX', 'DSYGVX', 'CHEGVX', 'ZHEGVX' ), - ('SSYT21', 'DSYT21', 'CHET21', 'ZHET21' ), - ('SSYTD2', 'DSYTD2', 'CHETD2', 'ZHETD2' ), - ('SSYTRD', 'DSYTRD', 'CHETRD', 'ZHETRD' ), - ('SSYTRF', 'DSYTRF', 'CHETRF', 'ZHETRF' ), - - # BLAS, WITHOUT PRECISION - # MUST BE AFTER BLAS WITH PRECISION - # EX: CUBLASZHEMM -> CUBLASSHEMM -> CUBLASSSYMM - ('DOT', 'DOT', 'DOTC', 'DOTC' ), - ('DOT_SUB', 'DOT_SUB', 'DOTC_SUB', 'DOTC_SUB' ), - ('DOT_SUB', 'DOT_SUB', 'DOTU_SUB', 'DOTU_SUB' ), - ('GER', 'GER', 'GERC', 'GERC' ), - ('GER', 'GER', 'GERU', 'GERU' ), - ('NRM2', 'NRM2', 'CNRM2', 'ZNRM2' ), # DZNRM2 -> DNRM2 - ('SYMM', 'SYMM', 'HEMM', 'HEMM' ), - ('SYMV', 'SYMV', 'HEMV', 'HEMV' ), - ('SYR2', 'SYR2', 'HER2', 'HER2' ), - ('SYR2K', 'SYR2K', 'HER2K', 'HER2K' ), - ('SYRK', 'SYRK', 'HERK', 'HERK' ), - - # LAPACK, WITHOUT PRECISION - ('LAG2D', 'LAG2S', 'LAG2Z', 'LAG2C' ), - ('LAGSY', 'LAGSY', 'LAGHE', 'LAGHE' ), - ('LASYF', 'LASYF', 'LAHEF', 'LAHEF' ), - ('LANSY', 'LANSY', 'LANHE', 'LANHE' ), - ('LAVSY', 'LAVSY', 'LAVHE', 'LAVHE' ), - ('ORG2R', 'ORG2R', 'UNG2R', 'UNG2R' ), - ('ORGBR', 'ORGBR', 'UNGBR', 'UNGBR' ), - ('ORGHR', 'ORGHR', 'UNGHR', 'UNGHR' ), - ('ORGLQ', 'ORGLQ', 'UNGLQ', 'UNGLQ' ), - ('ORGQL', 'ORGQL', 'UNGQL', 'UNGQL' ), - ('ORGQR', 'ORGQR', 'UNGQR', 'UNGQR' ), - ('ORGTR', 'ORGTR', 'UNGTR', 'UNGTR' ), - ('ORM2R', 'ORM2R', 'UNM2R', 'UNM2R' ), - ('ORMBR', 'ORMBR', 'UNMBR', 'UNMBR' ), - ('ORMLQ', 'ORMLQ', 'UNMLQ', 'UNMLQ' ), - ('ORMQL', 'ORMQL', 'UNMQL', 'UNMQL' ), - ('ORMQR', 'ORMQR', 'UNMQR', 'UNMQR' ), - ('ORMR2', 'ORMR2', 'UNMR2', 'UNMR2' ), - ('ORMTR', 'ORMTR', 'UNMTR', 'UNMTR' ), - ('ORT01', 'ORT01', 'UNT01', 'UNT01' ), - ('PLGSY', 'PLGSY', 'PLGHE', 'PLGHE' ), - ('SBTRD', 'SBTRD', 'HBTRD', 'HBTRD' ), - ('SYBBD', 'SYBBD', 'HEBBD', 'HEBBD' ), - ('SYEV', 'SYEV', 'HEEV', 'HEEV' ), - ('SYEVD', 'SYEVD', 'HEEVD', 'HEEVD' ), - ('SYGS2', 'SYGS2', 'HEGS2', 'HEGS2' ), - ('SYGST', 'SYGST', 'HEGST', 'HEGST' ), - ('SYGVD', 'SYGVD', 'HEGVD', 'HEGVD' ), - ('SYGVR', 'SYGVR', 'HEGVR', 'HEGVR' ), - ('SYGVX', 'SYGVX', 'HEGVX', 'HEGVX' ), - ('SYT21', 'SYT21', 'HET21', 'HET21' ), - ('SYTD2', 'SYTD2', 'HETD2', 'HETD2' ), - ('SYTRD', 'SYTRD', 'HETRD', 'HETRD' ), - ('SYTRF', 'SYTRF', 'HETRF', 'HETRF' ), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_UNG2R', 'DAG_CORE_UNG2R', 'DAG_CORE_UNG2R', 'DAG_CORE_U-NG2R' ), - ('DAG_CORE_UNGBR', 'DAG_CORE_UNGBR', 'DAG_CORE_UNGBR', 'DAG_CORE_U-NGBR' ), - ('DAG_CORE_UNGHR', 'DAG_CORE_UNGHR', 'DAG_CORE_UNGHR', 'DAG_CORE_U-NGHR' ), - ('DAG_CORE_UNGLQ', 'DAG_CORE_UNGLQ', 'DAG_CORE_UNGLQ', 'DAG_CORE_U-NGLQ' ), - ('DAG_CORE_UNGQL', 'DAG_CORE_UNGQL', 'DAG_CORE_UNGQL', 'DAG_CORE_U-NGQL' ), - ('DAG_CORE_UNGQR', 'DAG_CORE_UNGQR', 'DAG_CORE_UNGQR', 'DAG_CORE_U-NGQR' ), - ('DAG_CORE_UNGTR', 'DAG_CORE_UNGTR', 'DAG_CORE_UNGTR', 'DAG_CORE_U-NGTR' ), - ('DAG_CORE_UNM2R', 'DAG_CORE_UNM2R', 'DAG_CORE_UNM2R', 'DAG_CORE_U-NM2R' ), - ('DAG_CORE_UNMBR', 'DAG_CORE_UNMBR', 'DAG_CORE_UNMBR', 'DAG_CORE_U-NMBR' ), - ('DAG_CORE_UNMLQ', 'DAG_CORE_UNMLQ', 'DAG_CORE_UNMLQ', 'DAG_CORE_U-NMLQ' ), - ('DAG_CORE_UNMQL', 'DAG_CORE_UNMQL', 'DAG_CORE_UNMQL', 'DAG_CORE_U-NMQL' ), - ('DAG_CORE_UNMQR', 'DAG_CORE_UNMQR', 'DAG_CORE_UNMQR', 'DAG_CORE_U-NMQR' ), - - # PaStiX - ('sutils.h', 'dutils.h', 'cutils.h', 'zutils.h' ), - ('SMURGE_', 'DMURGE_', 'CMURGE_', 'ZMURGE_' ), - ('smurge_', 'dmurge_', 'cmurge_', 'zmurge_' ), - ('smurge.h', 'dmurge.h', 'cmurge.h', 'zmurge.h' ), - ('smurge.inc', 'dmurge.inc', 'cmurge.inc', 'zmurge.inc' ), - ('smurge.c', 'dmurge.c', 'cmurge.c', 'zmurge.c' ), - ('ssimple', 'dsimple', 'csimple', 'zsimple' ), - ('sstep-by-step', 'dstep-by-step', 'cstep-by-step', 'zstep-by-step' ), - ('starpu_s', 'starpu_d', 'starpu_c', 'starpu_z' ), - ('STARPU_S', 'STARPU_D', 'STARPU_C', 'STARPU_Z' ), - ('pastix_s', 'pastix_d', 'pastix_c', 'pastix_z' ), - ('s_', 'd_', 'c_', 'z_' ), - ('S_', 'D_', 'C_', 'Z_' ), - ('FLT_EPSILON', 'DBL_EPSILON', 'FLT_EPSILON', 'DBL_EPSILON' ), - ('s_RAFF_FLOAT', 'd_RAFF_FLOAT', 'c_RAFF_FLOAT', 'z_RAFF_FLOAT' ), - ('MPI_FLOAT', 'MPI_DOUBLE', 'MPI_COMPLEX', 'MPI_DOUBLE_COMPLEX'), - ('MPI_FLOAT', 'MPI_DOUBLE', 'MPI_FLOAT', 'MPI_DOUBLE' ), - # ----- unused? - ('s_check', 'd_check', 'c_check', 'z_check' ), - ('s_get_idparm', 'd_get_idparm', 's_get_idparm', 'd_get_idparm', ), - #('stesting', 'dtesting', 'ctesting', 'ztesting' ), - #('SAUXILIARY', 'DAUXILIARY', 'CAUXILIARY', 'ZAUXILIARY' ), - ], - - # ------------------------------------------------------------ - # replacements applied for profiling with tau - 'tracing' :[ - # ----- Special line indicating column types - ['plain', 'tau'], - - # ----- Replacements - ('(\w+\*?)\s+(\w+)\s*\(([a-z* ,A-Z_0-9]*)\)\s*{\s+(.*)\s*#pragma tracing_start\s+(.*)\s+#pragma tracing_end\s+(.*)\s+}', - r'\1 \2(\3){\n\4tau("\2");\5tau();\6}'), - ('\.c','.c.tau'), - ], -}; -- GitLab