Commits (24)
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2018 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
# @copyright 2017-2018 King Abdullah University of Science and Technology (KAUST). All rights reserved.
###
#
# - Find AL4SAN include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(AL4SAN
# [REQUIRED] # Fail with error if al4san is not found
# )
#
# Results are reported in variables:
#
# AL4SAN_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = AL4SAN
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#=============================================================================
# Copyright 2018 Inria
# Copyright 2018 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.)
# Use pkg-config to detect include/library dirs (if pkg-config is available)
# --------------------------------------------------------------------------
include(FindPkgConfig)
if (AL4SAN_FIND_REQUIRED)
find_package(PkgConfig QUIET REQUIRED)
else()
find_package(PkgConfig QUIET)
endif()
if(PKG_CONFIG_EXECUTABLE)
pkg_search_module(AL4SAN al4san)
if (NOT AL4SAN_FIND_QUIETLY)
if (AL4SAN_FOUND AND AL4SAN_LIBRARIES)
message(STATUS "Looking for AL4SAN - found using PkgConfig")
else()
message(STATUS "${Magenta}Looking for AL4SAN - not found using PkgConfig."
"\n Perhaps you should add the directory containing al4san.pc"
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
# check version if a precise version is required
if (AL4SAN_FIND_VERSION_EXACT)
if( NOT (AL4SAN_FIND_VERSION_MAJOR STREQUAL AL4SAN_VERSION_MAJOR) OR
NOT (AL4SAN_FIND_VERSION_MINOR STREQUAL AL4SAN_VERSION_MINOR) )
if(NOT AL4SAN_FIND_QUIETLY)
message(FATAL_ERROR
"AL4SAN version found is ${AL4SAN_VERSION_STRING}"
"when required is ${AL4SAN_FIND_VERSION}")
endif()
endif()
else()
# if the version found is older than the required then error
if( (AL4SAN_FIND_VERSION_MAJOR STRGREATER AL4SAN_VERSION_MAJOR) OR
(AL4SAN_FIND_VERSION_MINOR STRGREATER AL4SAN_VERSION_MINOR) )
if(NOT AL4SAN_FIND_QUIETLY)
message(FATAL_ERROR
"AL4SAN version found is ${AL4SAN_VERSION_STRING}"
"when required is ${AL4SAN_FIND_VERSION} or newer")
endif()
endif()
endif()
if (AL4SAN_FOUND AND AL4SAN_LIBRARIES)
set(AL4SAN_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(AL4SAN)
else()
set(AL4SAN_FOUND_WITH_PKGCONFIG "FALSE")
endif()
endif(PKG_CONFIG_EXECUTABLE)
if (AL4SAN_LIBRARIES)
if (AL4SAN_LIBRARY_DIRS)
foreach(dir ${AL4SAN_LIBRARY_DIRS})
if ("${dir}" MATCHES "al4san")
set(first_lib_path "${dir}")
endif()
endforeach()
else()
list(GET AL4SAN_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
endif()
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(AL4SAN_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of AL4SAN library" FORCE)
else()
set(AL4SAN_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of AL4SAN library" FORCE)
endif()
endif()
mark_as_advanced(AL4SAN_DIR_FOUND)
# check that AL4SAN has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
if (PKG_CONFIG_EXECUTABLE AND AL4SAN_FOUND)
find_package_handle_standard_args(AL4SAN DEFAULT_MSG
AL4SAN_LIBRARIES)
else()
find_package_handle_standard_args(AL4SAN DEFAULT_MSG
AL4SAN_LIBRARIES
AL4SAN_WORKS)
endif()
This diff is collapsed.
......@@ -58,9 +58,7 @@
# 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)
# look for a stand alone cblas, please set CBLAS_STANDALONE to TRUE
###
# We handle different modes to find the dependency
#
......
This diff is collapsed.
......@@ -62,9 +62,7 @@
# 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)
# look for a stand alone lapacke, please set LAPACKE_STANDALONE to TRUE
#=============================================================================
# Copyright 2012-2018 Inria
......@@ -433,9 +431,15 @@ if (LAPACK_FOUND)
unset(LAPACKE_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS)
if(NOT LAPACKE_WORKS AND NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails")
endif()
if (LAPACKE_WORKS AND LAPACKE_WITH_TMG)
unset(LAPACKE_WORKS CACHE)
check_function_exists(LAPACKE_dlatms_work LAPACKE_WORKS)
if(NOT LAPACKE_WORKS AND NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke tmg interface : test of LAPACKE_dlatms_work with lapacke and lapack libraries fails")
endif()
endif()
mark_as_advanced(LAPACKE_WORKS)
unset(LAPACKE_WITH_LASCL CACHE)
......@@ -451,7 +455,6 @@ if (LAPACK_FOUND)
set(LAPACKE_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
else()
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack 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}")
......
......@@ -9,8 +9,8 @@
# INPUT
# -----
#
# PETSc is not installed in a standard way on Unix systems so that
# this module requires hints to know where PETSc is installed. Please
# PETSC is not installed in a standard way on Unix systems so that
# this module requires hints to know where PETSC is installed. Please
# give the installation directory (contains ./include/petsc.h, ./lib/, etc):
# 1. by setting the PETSC_DIR variable
# a. as an environment variable, e.g.
......@@ -22,12 +22,12 @@
#
# OUTPUT
# -------
# PETSC_INCLUDE_DIRS - the PETSc include directories
# PETSC_LIBRARIES - Link these to use PETSc
# PETSC_LIBRARY_DIRS - Link these to use PETSc
# PETSC_INCLUDE_DIRS - the PETSC include directories
# PETSC_LIBRARIES - Link these to use PETSC
# PETSC_LIBRARY_DIRS - Link these to use PETSC
# PETSC_MPIEXEC - Executable for running MPI programs
#
# if pkg-config is used i.e. pkgconfig installed, PETSc.pc file path
# if pkg-config is used i.e. pkgconfig installed, PETSC.pc file path
# in the PKG_CONFIG_PATH environment variable and PETSC_DIR not set
# then the following variables are set (or empty)
#
......@@ -50,15 +50,15 @@
#
# PETSC_FOUND_WITH_PKGCONFIG - True if found with pkg-config
#
# find_package(PETSc [QUIET] [REQUIRED])
# find_package(PETSC [QUIET] [REQUIRED])
#
# Setting these changes the behavior of the search
# PETSC_DIR - directory in which PETSc is installed
# PETSC_DIR - directory in which PETSC is installed
# PETSC_ARCH - build architecture
# create a cmake cache variable
set(PETSC_DIR "" CACHE PATH "Installation directory of PETSC library")
if (NOT PETSc_FIND_QUIETLY AND NOT PETSC_DIR)
if (NOT PETSC_FIND_QUIETLY AND NOT PETSC_DIR)
message(STATUS "A cache variable, namely PETSC_DIR, has been set
to specify a custom installation directory of PETSC")
endif()
......@@ -69,12 +69,12 @@ include(FindPkgConfig)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT PETSC_DIR )
pkg_search_module(PETSC PETSc)
if (NOT PETSc_FIND_QUIETLY)
if (NOT PETSC_FIND_QUIETLY)
if (PETSC_FOUND AND PETSC_LIBRARIES)
message(STATUS "Looking for PETSC - found using PkgConfig")
else()
message(STATUS "Looking for PETSC - not found using PkgConfig."
"\n Perhaps you should add the directory containing PETSc.pc to"
"\n Perhaps you should add the directory containing PETSC.pc to"
"\n the PKG_CONFIG_PATH environment variable.")
endif()
endif()
......@@ -95,24 +95,24 @@ endif()
if (PETSC_DIR)
if (EXISTS ${PETSC_DIR})
if (EXISTS ${PETSC_DIR}/include/petsc.h)
if (NOT PETSc_FIND_QUIETLY)
if (NOT PETSC_FIND_QUIETLY)
message(STATUS "PETSC_DIR = ${PETSC_DIR} contains include/petsc.h")
endif()
else()
if (PETSc_FIND_REQUIRED)
if (PETSC_FIND_REQUIRED)
message(FATAL_ERROR "include/petsc.h not found in PETSC_DIR = ${PETSC_DIR}")
endif()
endif()
else()
if (PETSc_FIND_REQUIRED)
if (PETSC_FIND_REQUIRED)
message(FATAL_ERROR "PETSC_DIR defined, but ${PETSC_DIR} does not exist")
endif()
endif()
else()
if (PETSc_FIND_REQUIRED)
if (PETSC_FIND_REQUIRED)
message(FATAL_ERROR "\
PETSc is not installed in a standard way on Unix systems so that
this module requires hints to know where PETSc is installed. Please
PETSC is not installed in a standard way on Unix systems so that
this module requires hints to know where PETSC is installed. Please
give the installation directory (contains ./include/petsc.h, ./lib/, etc):
1. by setting the PETSC_DIR variable
a. as an environment variable, e.g.
......@@ -127,40 +127,39 @@ endif()
find_file(petscconf NAMES petscconf.h HINTS ${PETSC_DIR}/include)
if (petscconf)
if (NOT PETSc_FIND_QUIETLY)
message(STATUS "petscconf.h is located ad ${petscconf}")
if (NOT PETSC_FIND_QUIETLY)
message(STATUS "petscconf.h is located in ${petscconf}")
endif()
else()
if (PETSc_FIND_REQUIRED)
message(FATAL_ERROR "\petscconf.h not found
if (PETSC_FIND_REQUIRED)
message(FATAL_ERROR "petscconf.h not found
we must find it into PETSC_DIR/include/")
endif()
endif()
if (NOT PETSC_ARCH)
if (petscconf)
file(READ ${petscconf} contents)
string(REGEX MATCHALL "#define *PETSC_ARCH *\".+\" *\n" foundArch ${contents})
string(REGEX REPLACE "#define *PETSC_ARCH *\"(.+)\" *\n" "\\1" archFromFile ${foundArch})
if (NOT PETSc_FIND_QUIETLY)
message(STATUS "PETSC_ARCH taken from petscconf.h = ${archFromFile}")
endif()
if(archFromFile)
set(PETSC_ARCH ${archFromFile})
endif(archFromFile)
file(READ ${petscconf} contents)
string(REGEX MATCH "#define *PETSC_ARCH *\"[a-z0-9-]*\" *\n" foundArch ${contents})
if (foundArch)
string(REGEX REPLACE "#define *PETSC_ARCH *\"([a-z0-9-]*)\" *\n" "\\1" archFromFile ${foundArch})
if (NOT PETSC_FIND_QUIETLY)
message(STATUS "PETSC_ARCH taken from petscconf.h = ${archFromFile}")
endif()
if(archFromFile)
set(PETSC_ARCH ${archFromFile})
endif(archFromFile)
endif()
endif(petscconf)
endif (NOT PETSC_ARCH)
if (NOT PETSc_FIND_QUIETLY)
message(STATUS "PETSC_ARCH = ${PETSC_ARCH}")
endif()
find_file(petscvariables NAMES petscvariables HINTS ${PETSC_DIR}/lib/petsc/conf/ ${PETSC_DIR}/conf)
if (petscvariables)
if (NOT PETSc_FIND_QUIETLY)
if (NOT PETSC_FIND_QUIETLY)
message(STATUS "petscvariables = ${petscvariables}")
endif()
else()
if (PETSc_FIND_REQUIRED)
if (PETSC_FIND_REQUIRED)
message(FATAL_ERROR "petscvariables not found")
endif()
endif()
......@@ -196,17 +195,18 @@ get_variable(PETSC_CC_INCLUDES ${petscvariables} PETSC_INCLUDES_RAW)
string(REGEX REPLACE "-I" "" PETSC_INCLUDES_RAW ${PETSC_INCLUDES_RAW} )
string(REGEX REPLACE " " ";" PETSC_INCLUDE_DIRS ${PETSC_INCLUDES_RAW} )
# extract library directories from petscvariables
string(REGEX MATCHALL "-L([^ ]+) " foundLibPaths ${PETSC_LIBRARIES_RAW})
string(REGEX REPLACE "-L" "" PETSC_LIBRARY_DIRS ${foundLibPaths})
string(REGEX REPLACE " " ";" PETSC_LIBRARY_DIRS ${PETSC_LIBRARY_DIRS})
# extract libraries from petscvariables
string(REGEX MATCHALL " -l([^ ]+) " foundLibs ${PETSC_LIBRARIES_RAW})
string(REGEX REPLACE " -l" "" PETSC_LIBRARIES ${foundLibs})
string(REGEX REPLACE " " ";" PETSC_LIBRARIES ${PETSC_LIBRARIES})
# extract library directories from petscvariables
string(REGEX MATCHALL " -L([^ ]+) " foundLibPaths ${PETSC_LIBRARIES_RAW})
string(REGEX REPLACE " -L" "" PETSC_LIBRARY_DIRS ${foundLibPaths})
string(REGEX REPLACE " " ";" PETSC_LIBRARY_DIRS ${PETSC_LIBRARY_DIRS})
libraries_absolute_path(PETSC_LIBRARIES "${PETSC_LIBRARY_DIRS}")
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (PETSc
"PETSc could not be found. Be sure to set PETSC_DIR."
find_package_handle_standard_args (PETSC
"PETSC could not be found. Be sure to set PETSC_DIR."
PETSC_MPIEXEC PETSC_INCLUDE_DIRS PETSC_LIBRARIES PETSC_LIBRARY_DIRS)
......@@ -26,6 +26,7 @@
# - MAGMA: to activate the detection of StarPU linked with MAGMA
# - FXT: to activate the detection of StarPU linked with FxT
# - SIMGRID: to activate the detection of StarPU linked with SimGrid
# - FORTRAN: to activate the detection of the StarPU Fortran interface
#
# Results are reported in variables:
# STARPU_FOUND - True if headers and requested libraries were found
......@@ -42,6 +43,7 @@
# STARPU_VERSION - 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
# STARPU_FORTRAN_MOD - Points to the StarPU Fortran interface module fstarpu_mod.f90
#
# STARPU_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
......@@ -118,6 +120,8 @@ if( STARPU_FIND_COMPONENTS )
set(STARPU_LOOK_FOR_FXT TRUE)
elseif(${component} STREQUAL "SIMGRID")
set(STARPU_LOOK_FOR_SIMGRID TRUE)
elseif(${component} STREQUAL "FORTRAN")
set(STARPU_LOOK_FOR_FORTRAN TRUE)
endif()
endforeach()
endif()
......@@ -807,6 +811,47 @@ if(STARPU_LIBRARIES)
check_function_exists(starpu_init STARPU_WORKS)
mark_as_advanced(STARPU_WORKS)
if(STARPU_WORKS)
if(STARPU_LOOK_FOR_FORTRAN)
unset(FSTARPU_WORKS CACHE)
check_function_exists(fstarpu_task_insert FSTARPU_WORKS)
if(FSTARPU_WORKS)
set(STARPU_FMOD_DIRS "STARPU_FMOD_DIRS-NOTFOUND")
find_path(STARPU_FMOD_DIRS
NAMES "fstarpu_mod.f90"
HINTS ${STARPU_INCLUDE_DIRS})
if(STARPU_FMOD_DIRS)
set(STARPU_FORTRAN_MOD "${STARPU_FMOD_DIRS}/fstarpu_mod.f90")
mark_as_advanced(STARPU_FORTRAN_MOD)
if (NOT STARPU_FIND_QUIETLY)
message(STATUS "Looking for starpu fstarpu_mod.f90: found")
endif()
else(STARPU_FMOD_DIRS)
set(FSTARPU_WORKS "FSTARPU_WORKS-NOTFOUND")
endif(STARPU_FMOD_DIRS)
endif(FSTARPU_WORKS)
if(NOT FSTARPU_WORKS)
if(NOT STARPU_FIND_REQUIRED_FORTRAN)
if (NOT STARPU_FIND_QUIETLY)
message(STATUS "Looking for starpu Fortran interface: not found (not required)")
endif (NOT STARPU_FIND_QUIETLY)
else()
if (NOT STARPU_FIND_QUIETLY)
message(STATUS "Looking for starpu Fortran interface: not found")
endif (NOT STARPU_FIND_QUIETLY)
set(STARPU_WORKS FALSE)
set(STARPU_FOUND FALSE)
endif(NOT STARPU_FIND_REQUIRED_FORTRAN)
else()
if (NOT STARPU_FIND_QUIETLY)
message(STATUS "Looking for starpu Fortran interface: found")
endif (NOT STARPU_FIND_QUIETLY)
endif(NOT FSTARPU_WORKS)
endif(STARPU_LOOK_FOR_FORTRAN)
endif(STARPU_WORKS)
if(STARPU_WORKS)
# save link with dependencies
set(STARPU_LIBRARIES_DEP "${REQUIRED_LIBS}")
......@@ -822,7 +867,7 @@ if(STARPU_LIBRARIES)
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Maybe STARPU is linked with specific libraries. "
"Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT, SIMGRID)? "
"Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT, SIMGRID, FORTRAN)? "
"See the explanation in FindSTARPU.cmake.")
endif()
endif()
......
......@@ -77,6 +77,7 @@ if (ENABLE_CTEST)
include(CTest)
set(CTEST_PACKAGES_LIST
# AL4SAN # not installed in the common image hpclib/hiepacs, see hpclib/al4san to get it
BLAS
BLASEXT
CBLAS
......@@ -101,7 +102,7 @@ if (ENABLE_CTEST)
PARMETIS
PARSEC
PASTIX
PETSc
PETSC
PTSCOTCH
QUARK
SCALAPACK
......