Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
morse_cmake
Commits
c7a0a99a
Commit
c7a0a99a
authored
Apr 12, 2018
by
PRUVOST Florent
Browse files
Merge branch 'improve-consistency' into 'master'
Improve consistency See merge request
!17
parents
82fc6489
10f9bd7e
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
c7a0a99a
...
...
@@ -11,5 +11,5 @@ Find:
-
cd modules/find/tests
-
mkdir -p build
-
cd build
-
cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -D
PASTIX
_COMPONENTS="
PARSEC
;STARPU"
-
cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -D
CHAMELEON
_COMPONENTS="
MPI;FXT
;STARPU"
-
ctest -V
modules/FindPkgconfigLibrariesAbsolutePath.cmake
View file @
c7a0a99a
...
...
@@ -71,8 +71,17 @@ macro(FIND_PKGCONFIG_LIBRARIES_ABSOLUTE_PATH _prefix)
if
(
${
_index
}
GREATER -1
)
get_filename_component
(
_library
"
${
_library
}
"
NAME_WE
)
endif
()
# try static first
set
(
default_find_library_suffixes
${
CMAKE_FIND_LIBRARY_SUFFIXES
}
)
set
(
CMAKE_FIND_LIBRARY_SUFFIXES
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
find_library
(
_library_path NAMES
${
_library
}
HINTS
${${
_prefix
}
_STATIC_LIBDIR
}
${${
_prefix
}
_STATIC_LIBRARY_DIRS
}
${
_lib_env
}
)
set
(
CMAKE_FIND_LIBRARY_SUFFIXES
${
default_find_library_suffixes
}
)
# if not found try dynamic
if
(
NOT _library_path
)
find_library
(
_library_path NAMES
${
_library
}
HINTS
${${
_prefix
}
_STATIC_LIBDIR
}
${${
_prefix
}
_STATIC_LIBRARY_DIRS
}
${
_lib_env
}
)
endif
()
if
(
_library_path
)
list
(
APPEND
${
_prefix
}
_STATIC_LIBRARIES
${
_library_path
}
)
else
()
...
...
modules/find/FindBLAS.cmake
View file @
c7a0a99a
...
...
@@ -18,12 +18,13 @@
# This module sets the following variables:
# BLAS_FOUND - set to true if a library implementing the BLAS interface
# is found
# BLAS_L
INKER_FLAGS - uncached
list of required linker flags (excluding -l
# BLAS_L
DFLAGS_OTHER -
list of required linker flags (excluding -l
# and -L).
# BLAS_COMPILER_FLAGS - uncached list of required compiler flags (including -I).
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
# BLAS_CFLAGS_OTHER - list of required compiler flags (excluding -I).
# BLAS_INCLUDE_DIRS - include directories
# BLAS_LIBRARIES - list of libraries (using full path name) to
# link against to use BLAS
# BLAS95_LIBRARIES -
uncached
list of libraries (using full path name)
# BLAS95_LIBRARIES - 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
...
...
@@ -294,7 +295,8 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
list
(
APPEND
${
LIBRARIES
}
"-Wl,--end-group"
)
endif
()
set
(
CMAKE_REQUIRED_LIBRARIES
"
${
_flags
}
;
${${
LIBRARIES
}}
;
${
_thread
}
"
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
BLAS_COMPILER_FLAGS
}
"
)
set
(
CMAKE_REQUIRED_INCLUDES
"
${
BLAS_INCLUDE_DIRS
}
"
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
BLAS_CFLAGS_OTHER
}
"
)
if
(
BLAS_VERBOSE
)
message
(
"
${
Cyan
}
BLAS libs found for BLA_VENDOR
${
BLA_VENDOR
}
."
"Try to compile symbol
${
_name
}
with following libraries:"
...
...
@@ -331,7 +333,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
endmacro
(
Check_Fortran_Libraries
)
set
(
BLAS_L
INKER_FLAGS
)
set
(
BLAS_L
DFLAGS_OTHER
)
set
(
BLAS_LIBRARIES
)
set
(
BLAS95_LIBRARIES
)
if
(
$ENV{BLA_VENDOR} MATCHES
".+"
)
...
...
@@ -354,9 +356,27 @@ endif()
# -------------------------------------------------------------------------------------
include
(
FindPkgConfig
)
find_package
(
PkgConfig QUIET
)
if
(
PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER
AND BLA_VENDOR STREQUAL
"All"
)
if
(
PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER
)
pkg_search_module
(
BLAS blas
)
if
(
BLA_STATIC
)
set
(
MKL_STR_BLA_STATIC
"static"
)
else
()
set
(
MKL_STR_BLA_STATIC
"dynamic"
)
endif
()
# try different blas
if
(
BLA_VENDOR STREQUAL
"Intel10_64lp"
)
pkg_search_module
(
BLAS mkl-
${
MKL_STR_BLA_STATIC
}
-lp64-iomp
)
elseif
(
BLA_VENDOR STREQUAL
"Intel10_64lp_seq"
)
pkg_search_module
(
BLAS mkl-
${
MKL_STR_BLA_STATIC
}
-lp64-seq
)
elseif
(
BLA_VENDOR STREQUAL
"Open"
)
pkg_search_module
(
BLAS openblas
)
elseif
(
BLA_VENDOR STREQUAL
"Generic"
)
pkg_search_module
(
BLAS blas
)
else
()
pkg_search_module
(
BLAS blas
)
pkg_search_module
(
BLAS openblas
)
pkg_search_module
(
BLAS mkl-
${
MKL_STR_BLA_STATIC
}
-lp64-seq
)
endif
()
if
(
NOT BLAS_FIND_QUIETLY
)
if
(
BLAS_FOUND AND BLAS_LIBRARIES
)
...
...
@@ -371,14 +391,6 @@ if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER AND BLA_VENDOR STREQUAL "Al
if
(
BLAS_FOUND AND BLAS_LIBRARIES
)
set
(
BLAS_FOUND_WITH_PKGCONFIG
"TRUE"
)
find_pkgconfig_libraries_absolute_path
(
BLAS
)
if
(
BLA_STATIC
)
set
(
BLAS_LINKER_FLAGS
"
${
BLAS_STATIC_LDFLAGS_OTHER
}
"
)
set
(
BLAS_COMPILER_FLAGS
"
${
BLAS_STATIC_CFLAGS_OTHER
}
"
)
set
(
BLAS_LIBRARIES
"
${
BLAS_STATIC_LIBRARIES
}
"
)
else
()
set
(
BLAS_LINKER_FLAGS
"
${
BLAS_LDFLAGS_OTHER
}
"
)
set
(
BLAS_COMPILER_FLAGS
"
${
BLAS_CFLAGS_OTHER
}
"
)
endif
()
else
()
set
(
BLAS_FOUND_WITH_PKGCONFIG
"FALSE"
)
endif
()
...
...
@@ -536,7 +548,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
set
(
LGFORTRAN
"{FORTRAN_ifcore_LIBRARY}"
)
endif
()
endif
()
set
(
BLAS_C
OMPILER_FLAGS
""
)
set
(
BLAS_C
FLAGS_OTHER
""
)
if
(
NOT BLA_VENDOR STREQUAL
"Intel10_64lp_seq"
)
if
(
BLAS_FIND_REQUIRED
)
find_package
(
OpenMP REQUIRED
)
...
...
@@ -544,21 +556,18 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
find_package
(
OpenMP
)
endif
()
if
(
OPENMP_C_FLAGS
)
list
(
APPEND BLAS_C
OMPILER_FLAGS
"
${
OPENMP_C_FLAGS
}
"
)
list
(
APPEND BLAS_C
FLAGS_OTHER
"
${
OPENMP_C_FLAGS
}
"
)
endif
()
endif
()
if
(
CMAKE_C_COMPILER_ID STREQUAL
"GNU"
)
if
(
BLA_VENDOR STREQUAL
"Intel10_32"
)
list
(
APPEND BLAS_C
OMPILER_FLAGS
"-m32"
)
list
(
APPEND BLAS_C
FLAGS_OTHER
"-m32"
)
else
()
list
(
APPEND BLAS_C
OMPILER_FLAGS
"-m64"
)
list
(
APPEND BLAS_C
FLAGS_OTHER
"-m64"
)
endif
()
if
(
NOT BLA_VENDOR STREQUAL
"Intel10_64lp_seq"
)
list
(
APPEND OMP_LIB
"-ldl"
)
endif
()
if
(
ENV_MKLROOT
)
list
(
APPEND BLAS_COMPILER_FLAGS
"-I
${
ENV_MKLROOT
}
/include"
)
endif
()
endif
()
set
(
additional_flags
""
)
...
...
@@ -744,7 +753,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
"
${
OMP_LIB
}
;
${
CMAKE_THREAD_LIBS_INIT
}
;
${
LM
}
"
)
if
(
_LIBRARIES
)
set
(
BLAS_L
INKER_FLAGS
"
${
additional_flags
}
"
)
set
(
BLAS_L
DFLAGS_OTHER
"
${
additional_flags
}
"
)
endif
()
endif
()
endforeach
()
...
...
@@ -990,7 +999,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
""
)
if
(
BLAS_LIBRARIES
)
set
(
BLAS_L
INKER_FLAGS
"-xlic_lib=sunperf"
)
set
(
BLAS_L
DFLAGS_OTHER
"-xlic_lib=sunperf"
)
endif
()
if
(
NOT BLAS_FIND_QUIETLY
)
if
(
BLAS_LIBRARIES
)
...
...
modules/find/FindBLASEXT.cmake
View file @
c7a0a99a
...
...
@@ -18,20 +18,18 @@
#
# 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_SEQ_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).
# BLAS_SEQ_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers)
# BLAS_PAR_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
# BLASEXT_LIBRARY_DIRS - Idem BLAS_LIBRARY_DIRS
# 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_SEQ_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_SEQ_LDFLAGS_OTHER - linker flags without libraries
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_PAR_LDFLAGS_OTHER - linker flags without libraries
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
# BLASEXT_LIBRARY_DIRS - Idem BLAS_LIBRARY_DIRS
#=============================================================================
# Copyright 2012-2013 Inria
...
...
@@ -90,11 +88,9 @@ if(NOT BLASEXT_FIND_QUIETLY)
"
\n
ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic"
)
endif
()
if
(
NOT BLAS_FOUND
)
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas
(
0
)
endif
()
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas
(
0
)
# detect the cases where SEQ and PAR libs are handled
if
(
BLA_VENDOR STREQUAL
"All"
AND
...
...
@@ -206,11 +202,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas
(
0
)
if
(
BLAS_FOUND
)
set
(
BLAS_SEQ_LIBRARIES
"
${
BLAS_LIBRARIES
}
"
)
if
(
BLAS_C
OMPILER_FLAGS
)
set
(
BLAS_SEQ_C
OMPILER_FLAGS
"
${
BLAS_COMPILER_FLAGS
}
"
)
if
(
BLAS_C
FLAGS_OTHER
)
set
(
BLAS_SEQ_C
FLAGS_OTHER
"
${
BLAS_CFLAGS_OTHER
}
"
)
endif
()
if
(
BLAS_L
INKER_FLAGS
)
set
(
BLAS_SEQ_L
INKER_FLAGS
"
${
BLAS_LINKER_FLAGS
}
"
)
if
(
BLAS_L
DFLAGS_OTHER
)
set
(
BLAS_SEQ_L
DFLAGS_OTHER
"
${
BLAS_LDFLAGS_OTHER
}
"
)
endif
()
else
()
set
(
BLAS_SEQ_LIBRARIES
"
${
BLAS_SEQ_LIBRARIES-NOTFOUND
}
"
)
...
...
@@ -224,11 +220,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas
(
0
)
if
(
BLAS_FOUND
)
set
(
BLAS_PAR_LIBRARIES
"
${
BLAS_LIBRARIES
}
"
)
if
(
BLAS_C
OMPILER_FLAGS
)
set
(
BLAS_PAR_C
OMPILER_FLAGS
"
${
BLAS_COMPILER_FLAGS
}
"
)
if
(
BLAS_C
FLAGS_OTHER
)
set
(
BLAS_PAR_C
FLAGS_OTHER
"
${
BLAS_CFLAGS_OTHER
}
"
)
endif
()
if
(
BLAS_L
INKER_FLAGS
)
set
(
BLAS_PAR_L
INKER_FLAGS
"
${
BLAS_LINKER_FLAGS
}
"
)
if
(
BLAS_L
DFLAGS_OTHER
)
set
(
BLAS_PAR_L
DFLAGS_OTHER
"
${
BLAS_LDFLAGS_OTHER
}
"
)
endif
()
else
()
set
(
BLAS_PAR_LIBRARIES
"
${
BLAS_PAR_LIBRARIES-NOTFOUND
}
"
)
...
...
@@ -301,8 +297,8 @@ endif()
# Reset pure BLAS cmake variables to the sequential case (arbitrary default)
if
(
BLAS_SEQ_LIBRARIES
)
set
(
BLAS_LIBRARIES
"
${
BLAS_SEQ_LIBRARIES
}
"
)
set
(
BLAS_C
OMPILER_FLAGS
"
${
BLAS_SEQ_C
OMPILER_FLAGS
}
"
)
set
(
BLAS_L
INKER_FLAGS
"
${
BLAS_SEQ_L
INKER_FLAGS
}
"
)
set
(
BLAS_C
FLAGS_OTHER
"
${
BLAS_SEQ_C
FLAGS_OTHER
}
"
)
set
(
BLAS_L
DFLAGS_OTHER
"
${
BLAS_SEQ_L
DFLAGS_OTHER
}
"
)
endif
()
# extract libs paths if not given by find_package(BLAS)
...
...
modules/find/FindCBLAS.cmake
View file @
c7a0a99a
...
...
@@ -20,14 +20,18 @@
#
# 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
# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories
# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories
# CBLAS_LIBRARIES_DEP - cblas libraries + dependencies
# CBLAS_HAS_ZGEMM3M - True if cblas contains zgemm3m fast complex mat-mat product
# CBLAS_FOUND - True if headers and requested libraries were found
# CBLAS_CFLAGS_OTHER - cblas compiler flags without headers paths
# CBLAS_LDFLAGS_OTHER - cblas linker flags without libraries
# CBLAS_INCLUDE_DIRS - cblas include directories
# CBLAS_LIBRARY_DIRS - cblas link directories
# CBLAS_LIBRARIES - cblas libraries to be linked (absolute path)
# CBLAS_CFLAGS_OTHER_DEP - cblas + dependencies compiler flags without headers paths
# CBLAS_LDFLAGS_OTHER_DEP - cblas + dependencies linker flags without libraries
# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories
# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories
# CBLAS_LIBRARIES_DEP - cblas + dependencies libraries
# CBLAS_HAS_ZGEMM3M - True if cblas contains zgemm3m fast complex mat-mat product
#
# CBLAS_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
...
...
@@ -98,12 +102,10 @@ endif()
# CBLAS depends on BLAS anyway, try to find it
if
(
NOT BLAS_FOUND
)
if
(
CBLAS_FIND_REQUIRED
)
find_package
(
BLASEXT REQUIRED
)
else
()
find_package
(
BLASEXT
)
endif
()
if
(
CBLAS_FIND_REQUIRED
)
find_package
(
BLAS REQUIRED
)
else
()
find_package
(
BLAS
)
endif
()
...
...
@@ -114,8 +116,9 @@ if (BLAS_FOUND)
# 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_LINKER_FLAGS
}
;
${
BLAS_LIBRARIES
}
"
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
BLAS_COMPILER_FLAGS
}
"
)
set
(
CMAKE_REQUIRED_LIBRARIES
"
${
BLAS_LDFLAGS_OTHER
}
;
${
BLAS_LIBRARIES
}
"
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
BLAS_CFLAGS_OTHER
}
"
)
set
(
CMAKE_REQUIRED_INCLUDES
"
${
BLAS_INCLUDE_DIRS
}
"
)
unset
(
CBLAS_WORKS CACHE
)
check_function_exists
(
cblas_dscal CBLAS_WORKS
)
check_function_exists
(
cblas_zgemm3m CBLAS_ZGEMM3M_FOUND
)
...
...
@@ -135,15 +138,9 @@ if (BLAS_FOUND)
endif
()
# test succeeds: CBLAS is in BLAS
set
(
CBLAS_LIBRARIES
"
${
BLAS_LIBRARIES
}
"
)
set
(
CBLAS_LIBRARIES_DEP
"
${
BLAS_LIBRARIES
}
"
)
if
(
BLAS_LIBRARY_DIRS
)
set
(
CBLAS_LIBRARY_DIRS
"
${
BLAS_LIBRARY_DIRS
}
"
)
endif
()
if
(
BLAS_INCLUDE_DIRS
)
set
(
CBLAS_INCLUDE_DIRS
"
${
BLAS_INCLUDE_DIRS
}
"
)
set
(
CBLAS_INCLUDE_DIRS_DEP
"
${
BLAS_INCLUDE_DIRS_DEP
}
"
)
endif
()
endif
()
endif
(
NOT CBLAS_STANDALONE
)
# test fails with blas: try to find CBLAS lib exterior to BLAS
...
...
@@ -166,7 +163,25 @@ if (BLAS_FOUND)
find_package
(
PkgConfig QUIET
)
if
(
PKG_CONFIG_EXECUTABLE AND NOT CBLAS_GIVEN_BY_USER
)
pkg_search_module
(
CBLAS cblas
)
if
(
BLA_STATIC
)
set
(
MKL_STR_BLA_STATIC
"static"
)
else
()
set
(
MKL_STR_BLA_STATIC
"dynamic"
)
endif
()
# try different blas
if
(
BLA_VENDOR STREQUAL
"Intel10_64lp"
)
pkg_search_module
(
CBLAS mkl-
${
MKL_STR_BLA_STATIC
}
-lp64-iomp
)
elseif
(
BLA_VENDOR STREQUAL
"Intel10_64lp_seq"
)
pkg_search_module
(
CBLAS mkl-
${
MKL_STR_BLA_STATIC
}
-lp64-seq
)
elseif
(
BLA_VENDOR STREQUAL
"Open"
)
pkg_search_module
(
CBLAS openblas
)
elseif
(
BLA_VENDOR STREQUAL
"Generic"
)
pkg_search_module
(
CBLAS cblas
)
else
()
pkg_search_module
(
CBLAS cblas
)
pkg_search_module
(
CBLAS openblas
)
pkg_search_module
(
CBLAS mkl-
${
MKL_STR_BLA_STATIC
}
-lp64-seq
)
endif
()
if
(
NOT CBLAS_FIND_QUIETLY
)
if
(
CBLAS_FOUND AND CBLAS_LIBRARIES
)
...
...
@@ -336,6 +351,7 @@ if (BLAS_FOUND)
if
(
CBLAS_LIBRARIES
)
set
(
REQUIRED_INCDIRS
)
set
(
REQUIRED_FLAGS
)
set
(
REQUIRED_LDFLAGS
)
set
(
REQUIRED_LIBDIRS
)
set
(
REQUIRED_LIBS
)
...
...
@@ -345,10 +361,10 @@ if (BLAS_FOUND)
set
(
REQUIRED_INCDIRS
"
${
CBLAS_INCLUDE_DIRS
}
"
)
endif
()
if
(
CBLAS_CFLAGS_OTHER
)
list
(
APPEND
REQUIRED_FLAGS
"
${
CBLAS_CFLAGS_OTHER
}
"
)
set
(
REQUIRED_FLAGS
"
${
CBLAS_CFLAGS_OTHER
}
"
)
endif
()
if
(
CBLAS_LDFLAGS_OTHER
)
list
(
APPEND
REQUIRED_LDFLAGS
"
${
CBLAS_LDFLAGS_OTHER
}
"
)
set
(
REQUIRED_LDFLAGS
"
${
CBLAS_LDFLAGS_OTHER
}
"
)
endif
()
if
(
CBLAS_LIBRARY_DIRS
)
set
(
REQUIRED_LIBDIRS
"
${
CBLAS_LIBRARY_DIRS
}
"
)
...
...
@@ -358,11 +374,11 @@ if (BLAS_FOUND)
if
(
BLAS_INCLUDE_DIRS
)
list
(
APPEND REQUIRED_INCDIRS
"
${
BLAS_INCLUDE_DIRS
}
"
)
endif
()
if
(
BLAS_C
OMPILER_FLAGS
)
list
(
APPEND REQUIRED_FLAGS
"
${
BLAS_C
OMPILER_FLAGS
}
"
)
if
(
BLAS_C
FLAGS_OTHER
)
list
(
APPEND REQUIRED_FLAGS
"
${
BLAS_C
FLAGS_OTHER
}
"
)
endif
()
if
(
BLAS_L
INKER_FLAGS
)
list
(
APPEND REQUIRED_LDFLAGS
"
${
BLAS_L
INKER_FLAGS
}
"
)
if
(
BLAS_L
DFLAGS_OTHER
)
list
(
APPEND REQUIRED_LDFLAGS
"
${
BLAS_L
DFLAGS_OTHER
}
"
)
endif
()
if
(
BLAS_LIBRARY_DIRS
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
BLAS_LIBRARY_DIRS
}
"
)
...
...
@@ -371,12 +387,22 @@ if (BLAS_FOUND)
# set required libraries for link
set
(
CMAKE_REQUIRED_INCLUDES
"
${
REQUIRED_INCDIRS
}
"
)
if
(
REQUIRED_FLAGS
)
set
(
REQUIRED_FLAGS_COPY
"
${
REQUIRED_FLAGS
}
"
)
set
(
REQUIRED_FLAGS
)
set
(
REQUIRED_DEFINITIONS
)
foreach
(
_flag
${
REQUIRED_FLAGS_COPY
}
)
if
(
_flag MATCHES
"^-D"
)
list
(
APPEND REQUIRED_DEFINITIONS
"
${
_flag
}
"
)
endif
()
string
(
REGEX REPLACE
"^-D.*"
""
_flag
"
${
_flag
}
"
)
list
(
APPEND REQUIRED_FLAGS
"
${
_flag
}
"
)
endforeach
()
endif
()
set
(
CMAKE_REQUIRED_DEFINITIONS
"
${
REQUIRED_DEFINITIONS
}
"
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
REQUIRED_FLAGS
}
"
)
set
(
CMAKE_REQUIRED_LIBRARIES
)
list
(
APPEND CMAKE_REQUIRED_LIBRARIES
"
${
REQUIRED_LDFLAGS
}
"
)
foreach
(
lib_dir
${
REQUIRED_LIBDIRS
}
)
list
(
APPEND CMAKE_REQUIRED_LIBRARIES
"-L
${
lib_dir
}
"
)
endforeach
()
list
(
APPEND CMAKE_REQUIRED_LIBRARIES
"
${
REQUIRED_LIBS
}
"
)
string
(
REGEX REPLACE
"^ -"
"-"
CMAKE_REQUIRED_LIBRARIES
"
${
CMAKE_REQUIRED_LIBRARIES
}
"
)
...
...
@@ -399,13 +425,17 @@ if (BLAS_FOUND)
set
(
CBLAS_LIBRARIES_DEP
"
${
REQUIRED_LIBS
}
"
)
set
(
CBLAS_LIBRARY_DIRS_DEP
"
${
REQUIRED_LIBDIRS
}
"
)
set
(
CBLAS_INCLUDE_DIRS_DEP
"
${
REQUIRED_INCDIRS
}
"
)
set
(
CBLAS_CFLAGS_OTHER_DEP
"
${
REQUIRED_FLAGS
}
"
)
set
(
CBLAS_LDFLAGS_OTHER_DEP
"
${
REQUIRED_LDFLAGS
}
"
)
list
(
REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP
)
list
(
REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP
)
list
(
REMOVE_DUPLICATES CBLAS_CFLAGS_OTHER_DEP
)
list
(
REMOVE_DUPLICATES CBLAS_LDFLAGS_OTHER_DEP
)
else
()
if
(
NOT CBLAS_FIND_QUIETLY
)
message
(
STATUS
"Looking for cblas : test of cblas_dscal with cblas and blas libraries fails"
)
message
(
STATUS
"CMAKE_REQUIRED_LIBRARIES:
${
CMAKE_REQUIRED_LIBRARIES
}
"
)
message
(
STATUS
"CMAKE_REQUIRED_INCLUDES:
${
CMAKE_REQUIRED_INCLUDES
}
"
)
message
(
STATUS
"CMAKE_REQUIRED_FLAGS:
${
CMAKE_REQUIRED_FLAGS
}
"
)
message
(
STATUS
"Check in CMakeFiles/CMakeError.log to figure out why it fails"
)
endif
()
endif
()
...
...
modules/find/FindCHAMELEON.cmake
View file @
c7a0a99a
...
...
@@ -30,19 +30,22 @@
# - STARPU (default): to activate detection of Chameleon linked with StarPU
# - QUARK (STARPU will be deactivated): to activate detection of Chameleon linked with QUARK
# - CUDA (comes with cuBLAS): to activate detection of Chameleon linked with CUDA
# - MAGMA: to activate detection of Chameleon linked with MAGMA
# - MPI: to activate detection of Chameleon linked with MPI
# - FXT: to activate detection of Chameleon linked with StarPU+FXT
#
# This module finds headers and chameleon library.
# Results are reported in variables:
# CHAMELEON_FOUND - True if headers and requested libraries were found
# CHAMELEON_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# CHAMELEON_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries
# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
# CHAMELEON_LIBRARY_DIRS_DEP - chameleon + dependencies link directories
# CHAMELEON_LIBRARIES_DEP - chameleon libraries + dependencies
# CHAMELEON_FOUND - True if headers and requested libraries were found
# CHAMELEON_CFLAGS_OTHER - chameleon compiler flags without headers paths
# CHAMELEON_LDFLAGS_OTHER - chameleon linker flags without libraries
# CHAMELEON_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - chameleon link directories
# CHAMELEON_LIBRARIES - chameleon libraries to be linked (absolute path)
# CHAMELEON_CFLAGS_OTHER_DEP - chameleon + dependencies compiler flags without headers paths
# CHAMELEON_LDFLAGS_OTHER_DEP - chameleon + dependencies linker flags without libraries
# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
# CHAMELEON_LIBRARY_DIRS_DEP - chameleon + dependencies link directories
# CHAMELEON_LIBRARIES_DEP - chameleon + dependencies libraries
#
# CHAMELEON_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
...
...
@@ -95,7 +98,6 @@ endif()
set
(
CHAMELEON_LOOK_FOR_STARPU ON
)
set
(
CHAMELEON_LOOK_FOR_QUARK OFF
)
set
(
CHAMELEON_LOOK_FOR_CUDA OFF
)
set
(
CHAMELEON_LOOK_FOR_MAGMA OFF
)
set
(
CHAMELEON_LOOK_FOR_MPI OFF
)
set
(
CHAMELEON_LOOK_FOR_FXT OFF
)
...
...
@@ -115,10 +117,6 @@ if( CHAMELEON_FIND_COMPONENTS )
# means we look for Chameleon with CUDA
set
(
CHAMELEON_LOOK_FOR_CUDA ON
)
endif
()
if
(
${
component
}
STREQUAL
"MAGMA"
)
# means we look for Chameleon with MAGMA
set
(
CHAMELEON_LOOK_FOR_MAGMA ON
)
endif
()
if
(
${
component
}
STREQUAL
"MPI"
)
# means we look for Chameleon with MPI
set
(
CHAMELEON_LOOK_FOR_MPI ON
)
...
...
@@ -308,19 +306,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
endif
()
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 AND CHAMELEON_LOOK_FOR_MAGMA
)
set
(
CHAMELEON_MAGMA_VERSION
"1.4"
CACHE STRING
"oldest MAGMA version desired"
)
if
(
CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MAGMA
)
find_package
(
MAGMA
${
CHAMELEON_MAGMA_VERSION
}
REQUIRED
)
else
()
find_package
(
MAGMA
${
CHAMELEON_MAGMA_VERSION
}
)
endif
()
endif
()
# CHAMELEON depends on MPI
#-------------------------
if
(
NOT MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI
)
...
...
@@ -496,6 +481,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
list
(
APPEND CHAMELEON_libs_to_find
"chameleon_quark"
)
endif
()
list
(
APPEND CHAMELEON_libs_to_find
"coreblas"
)
if
(
CHAMELEON_LOOK_FOR_CUDA
)
list
(
APPEND CHAMELEON_libs_to_find
"cudablas"
)
endif
()
# call cmake macro to find the lib path
if
(
CHAMELEON_LIBDIR
)
...
...
@@ -549,8 +537,9 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_F
# check a function to validate the find
if
(
CHAMELEON_LIBRARIES
)
set
(
REQUIRED_LDFLAGS
)
set
(
REQUIRED_INCDIRS
)
set
(
REQUIRED_FLAGS
)
set
(
REQUIRED_LDFLAGS
)
set
(
REQUIRED_LIBDIRS
)
set
(
REQUIRED_LIBS
)
...
...
@@ -574,42 +563,36 @@ if(CHAMELEON_LIBRARIES)
if
(
STARPU_FOUND AND CHAMELEON_LOOK_FOR_STARPU
)
if
(
STARPU_INCLUDE_DIRS_DEP
)
list
(
APPEND REQUIRED_INCDIRS
"
${
STARPU_INCLUDE_DIRS_DEP
}
"
)
elseif
(
STARPU_INCLUDE_DIRS
)
list
(
APPEND REQUIRED_INCDIRS
"
${
STARPU_INCLUDE_DIRS
}
"
)
endif
()
if
(
STARPU_CFLAGS_OTHER_DEP
)
list
(
APPEND REQUIRED_FLAGS
"
${
STARPU_CFLAGS_OTHER_DEP
}
"
)
endif
()
if
(
STARPU_LDFLAGS_OTHER_DEP
)
list
(
APPEND REQUIRED_LDFLAGS
"
${
STARPU_LDFLAGS_OTHER_DEP
}
"
)
endif
()
if
(
STARPU_LIBRARY_DIRS_DEP
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
STARPU_LIBRARY_DIRS_DEP
}
"
)
elseif
(
STARPU_LIBRARY_DIRS
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
STARPU_LIBRARY_DIRS
}
"
)
endif
()
if
(
STARPU_LIBRARIES_DEP
)
list
(
APPEND REQUIRED_LIBS
"
${
STARPU_LIBRARIES_DEP
}
"
)
elseif
(
STARPU_LIBRARIES
)
foreach
(
lib
${
STARPU_LIBRARIES
}
)
if
(
EXISTS
${
lib
}
OR
${
lib
}
MATCHES
"^-"
)
list
(
APPEND REQUIRED_LIBS
"
${
lib
}
"
)
else
()
list
(
APPEND REQUIRED_LIBS
"-l
${
lib
}
"
)
endif
()
endforeach
()
endif
()
endif
()
# QUARK
if
(
QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK
)
if
(
QUARK_INCLUDE_DIRS_DEP
)
list
(
APPEND REQUIRED_INCDIRS
"
${
QUARK_INCLUDE_DIRS_DEP
}
"
)
elseif
(
QUARK_INCLUDE_DIRS
)
list
(
APPEND REQUIRED_INCDIRS
"
${
QUARK_INCLUDE_DIRS
}
"
)
endif
()
if
(
QUARK_CFLAGS_OTHER_DEP
)
list
(
APPEND REQUIRED_FLAGS
"
${
QUARK_CFLAGS_OTHER_DEP
}
"
)
endif
()
if
(
QUARK_LDFLAGS_OTHER_DEP
)
list
(
APPEND REQUIRED_LDFLAGS
"
${
QUARK_LDFLAGS_OTHER_DEP
}
"
)
endif
()
if
(
QUARK_LIBRARY_DIRS_DEP
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
QUARK_LIBRARY_DIRS_DEP
}
"
)
elseif
(
QUARK_LIBRARY_DIRS
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
QUARK_LIBRARY_DIRS
}
"
)
endif
()
if
(
QUARK_LIBRARY_DIRS_DEP
)
list
(
APPEND REQUIRED_LIBS
"
${
QUARK_LIBRARIES_DEP
}
"
)
elseif
(
QUARK_LIBRARY_DIRS_DEP
)
list
(
APPEND REQUIRED_LIBS
"
${
QUARK_LIBRARIES
}
"
)
endif
()
endif
()
# CUDA
...
...
@@ -624,30 +607,6 @@ if(CHAMELEON_LIBRARIES)
endforeach
()
list
(
APPEND REQUIRED_LIBS
"
${
CUDA_CUBLAS_LIBRARIES
}
;
${
CUDA_LIBRARIES
}
"
)
endif
()
# MAGMA
if
(
MAGMA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA
)
if
(
MAGMA_INCLUDE_DIRS_DEP
)
list
(
APPEND REQUIRED_INCDIRS
"
${
MAGMA_INCLUDE_DIRS_DEP
}
"
)
elseif
(
MAGMA_INCLUDE_DIRS
)
list
(
APPEND REQUIRED_INCDIRS
"
${
MAGMA_INCLUDE_DIRS
}
"
)
endif
()
if
(
MAGMA_LIBRARY_DIRS_DEP
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
MAGMA_LIBRARY_DIRS_DEP
}
"
)
elseif
(
MAGMA_LIBRARY_DIRS
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
MAGMA_LIBRARY_DIRS
}
"
)
endif
()
if
(
MAGMA_LIBRARIES_DEP
)
list
(
APPEND REQUIRED_LIBS
"
${
MAGMA_LIBRARIES_DEP
}
"
)
elseif
(
MAGMA_LIBRARIES
)
foreach
(
lib
${
MAGMA_LIBRARIES
}
)
if
(
EXISTS
${
lib
}
OR
${
lib
}
MATCHES
"^-"
)
list
(
APPEND REQUIRED_LIBS
"
${
lib
}
"
)
else
()
list
(
APPEND REQUIRED_LIBS
"-l
${
lib
}
"
)
endif
()
endforeach
()
endif
()
endif
()
# MPI
if
(
MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI
)
if
(
MPI_C_INCLUDE_PATH
)
...
...
@@ -666,80 +625,69 @@ if(CHAMELEON_LIBRARIES)
if
(
HWLOC_INCLUDE_DIRS
)
list
(
APPEND REQUIRED_INCDIRS
"
${
HWLOC_INCLUDE_DIRS
}
"
)
endif
()
foreach
(
libdir
${
HWLOC_LIBRARY_DIRS
}
)
if
(
libdir
)
list
(
APPEND REQUIRED_LIBDIRS
"
${
libdir
}
"
)
endif
()
endforeach
()
foreach
(
lib
${
HWLOC_LIBRARIES
}
)
if
(
EXISTS
${
lib
}
OR
${
lib
}
MATCHES
"^-"
)
list
(
APPEND REQUIRED_LIBS
"
${
lib
}
"
)
else
()
list
(
APPEND REQUIRED_LIBS
"-l
${
lib
}
"
)
endif
()
endforeach
()
if
(
HWLOC_CFLAGS_OTHER
)
list
(
APPEND REQUIRED_FLAGS
"
${
HWLOC_CFLAGS_OTHER
}
"
)
endif
()
if
(
HWLOC_LDFLAGS_OTHER
)
list
(
APPEND REQUIRED_LDFLAGS
"
${
HWLOC_LDFLAGS_OTHER
}
"
)