diff --git a/cmake_modules/morse/MorseInit.cmake b/cmake_modules/morse/MorseInit.cmake index ccb52876201ceca6e85d975ae6c2a6da8e2e5b7f..c4ed4fd337f4f8ec9e9e7773f34ba2648c84d710 100644 --- a/cmake_modules/morse/MorseInit.cmake +++ b/cmake_modules/morse/MorseInit.cmake @@ -43,6 +43,9 @@ include(PrintFindStatus) # Define some auxilary flags include(AuxilaryFlags) +# Define some variables to et info about ressources +include(Ressources) + # Add the path where we handle our FindFOO.cmake to seek for liraries list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) diff --git a/cmake_modules/morse/Ressources.cmake b/cmake_modules/morse/Ressources.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3a5cf6cdf0fb7ba0418925acb2252dccc0a8224d --- /dev/null +++ b/cmake_modules/morse/Ressources.cmake @@ -0,0 +1,56 @@ +### +# +# @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 Ressources.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 13-05-2015 +# +# Define variables for hardware ressources: +# - NUMBER_OF_CPU. +# - TODO: NUMBER_OF_CUDA. +### + + +if(NOT DEFINED PROCESSOR_COUNT) + # Unknown: + set(NUMBER_OF_CPU 0) + + # Linux: + set(cpuinfo_file "/proc/cpuinfo") + if(EXISTS "${cpuinfo_file}") + file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$") + list(LENGTH procs NUMBER_OF_CPU) + endif() + + # Mac: + if(APPLE) + find_program(cmd_sys_pro "system_profiler") + if(cmd_sys_pro) + execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info) + string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1" + NUMBER_OF_CPU "${info}") + endif() + endif() + + # Windows: + if(WIN32) + set(NUMBER_OF_CPU "$ENV{NUMBER_OF_PROCESSORS}") + endif() +endif() diff --git a/cmake_modules/morse/find/FindBLAS.cmake b/cmake_modules/morse/find/FindBLAS.cmake index 8fbf9f66b101458f168708d04edee2dc549c55b8..d56ea30959376468dc059a1f2cf5fd3530e10e35 100644 --- a/cmake_modules/morse/find/FindBLAS.cmake +++ b/cmake_modules/morse/find/FindBLAS.cmake @@ -54,7 +54,7 @@ # - BLAS libraries can be detected from different ways # Here is the order of precedence: # 1) we look in cmake variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined -# 2) we look in environnement variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined +# 2) we look in environment variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined # 3) we look in common environnment variables depending on the system (INCLUDE, C_INCLUDE_PATH, CPATH - LIB, DYLD_LIBRARY_PATH, LD_LIBRARY_PATH) # 4) we look in common system paths depending on the system, see for example paths contained in the following cmake variables: # - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES diff --git a/cmake_modules/morse/find/FindCBLAS.cmake b/cmake_modules/morse/find/FindCBLAS.cmake index eefd7b59ded0416e74d8ada8b5a1ea4a3df5feb6..73eb80271307cd5d582214385aa52e024cc13223 100644 --- a/cmake_modules/morse/find/FindCBLAS.cmake +++ b/cmake_modules/morse/find/FindCBLAS.cmake @@ -55,7 +55,7 @@ # - CBLAS libraries can be detected from different ways # Here is the order of precedence: # 1) we look in cmake variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined -# 2) we look in environnement variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined +# 2) we look in environment variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined # 3) we look in common environnment variables depending on the system (INCLUDE, C_INCLUDE_PATH, CPATH - LIB, DYLD_LIBRARY_PATH, LD_LIBRARY_PATH) # 4) we look in common system paths depending on the system, see for example paths contained in the following cmake variables: # - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 7af1c2fa35d9a62eb527110895840b8d63a18b52..bb3c5b71741e5cc69552d3133c8af12fb29828da 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -150,17 +150,17 @@ if(NOT CHAMELEON_SIMULATION) link_directories(${LAPACK_LIBRARY_DIRS}) link_directories(${CBLAS_LIBRARY_DIRS}) link_directories(${BLAS_LIBRARY_DIRS}) - + else() list(APPEND libs_for_tests coreblas - simulapacke + simulapacke simucblas ${HWLOC_LIBRARIES} ${EXTRA_LIBRARIES} ) - + endif() link_directories(${HWLOC_LIBRARY_DIRS})