Commit 8b8078af authored by PRUVOST Florent's avatar PRUVOST Florent

remove cmake_modules, they are located in trunk/morse_distrib and we have to...

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/
parent 70c02408
......@@ -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),"