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

add a variable to get the number of CPUs

parent 5b62fa94
...@@ -43,6 +43,9 @@ include(PrintFindStatus) ...@@ -43,6 +43,9 @@ include(PrintFindStatus)
# Define some auxilary flags # Define some auxilary flags
include(AuxilaryFlags) 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 # Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
......
###
#
# @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()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
# - BLAS libraries can be detected from different ways # - BLAS libraries can be detected from different ways
# Here is the order of precedence: # Here is the order of precedence:
# 1) we look in cmake variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined # 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) # 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: # 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 # - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
# - CBLAS libraries can be detected from different ways # - CBLAS libraries can be detected from different ways
# Here is the order of precedence: # Here is the order of precedence:
# 1) we look in cmake variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined # 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) # 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: # 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 # - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
......
...@@ -150,17 +150,17 @@ if(NOT CHAMELEON_SIMULATION) ...@@ -150,17 +150,17 @@ if(NOT CHAMELEON_SIMULATION)
link_directories(${LAPACK_LIBRARY_DIRS}) link_directories(${LAPACK_LIBRARY_DIRS})
link_directories(${CBLAS_LIBRARY_DIRS}) link_directories(${CBLAS_LIBRARY_DIRS})
link_directories(${BLAS_LIBRARY_DIRS}) link_directories(${BLAS_LIBRARY_DIRS})
else() else()
list(APPEND libs_for_tests list(APPEND libs_for_tests
coreblas coreblas
simulapacke simulapacke
simucblas simucblas
${HWLOC_LIBRARIES} ${HWLOC_LIBRARIES}
${EXTRA_LIBRARIES} ${EXTRA_LIBRARIES}
) )
endif() endif()
link_directories(${HWLOC_LIBRARY_DIRS}) link_directories(${HWLOC_LIBRARY_DIRS})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment