Mentions légales du service

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • solverstack/morse_cmake
  • gmarait/morse_cmake
  • rboucher/morse_cmake
  • mkuhn/morse_cmake
  • lvilleve/morse_cmake
  • tmijieux/morse_cmake
  • tcojean/morse_cmake
  • thibault/morse_cmake
  • vperrier/morse_cmake
  • tdelarue/morse_cmake
  • ekorkmaz/morse_cmake
11 results
Show changes
Commits on Source (30)
Showing
with 684 additions and 559 deletions
image: hpclib/hiepacs
Find:
artifacts:
name: find_ctests
expire_in: 1 week
paths:
- modules/find/tests/build/Testing/
script:
- cd modules/find/tests
- mkdir -p build
- cd build
- cmake .. -DENABLE_CTEST=ON -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
- ctest -V
......@@ -18,7 +18,7 @@ master branch:
Documentation
---------------------
TODO
See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
Installation
---------------------
......
......@@ -1354,11 +1354,17 @@ if(BLA_F95)
set(BLAS_FOUND TRUE)
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
if (NOT BLAS_LIBRARIES_DEP)
set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}")
endif()
else(BLA_F95)
if(BLAS_LIBRARIES)
set(BLAS_FOUND TRUE)
if (NOT BLAS_LIBRARIES_DEP)
set(BLAS_LIBRARIES_DEP "${BLAS_LIBRARIES}")
endif()
else()
set(BLAS_FOUND FALSE)
endif()
......
......@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -18,17 +18,21 @@
#
# 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_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# 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_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# 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
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013-2016 Florent Pruvost
# Copyright 2013-2017 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
......@@ -161,14 +165,14 @@ if(BLA_VENDOR MATCHES "Intel*")
if(BLAS_DIR)
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_INCLUDE_DIRS
NAMES mkl.h
HINTS ${BLAS_DIR}
PATH_SUFFIXES include)
NAMES mkl.h
HINTS ${BLAS_DIR}
PATH_SUFFIXES include)
else()
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_INCLUDE_DIRS
NAMES mkl.h
HINTS ${_inc_env})
NAMES mkl.h
HINTS ${_inc_env})
endif()
endif()
mark_as_advanced(BLAS_mkl.h_INCLUDE_DIRS)
......@@ -296,7 +300,7 @@ foreach(blas_lib ${BLAS_LIBRARIES})
else()
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
if (EXISTS "${a_blas_lib_dir}")
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
endif()
endif()
endif()
......@@ -312,8 +316,8 @@ if(BLA_VENDOR MATCHES "Intel*")
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is Intel MKL:"
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLAS DEFAULT_MSG
......@@ -322,10 +326,10 @@ if(BLA_VENDOR MATCHES "Intel*")
BLAS_INCLUDE_DIRS)
if(BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLAS DEFAULT_MSG
BLAS_PAR_LIBRARIES)
BLAS_PAR_LIBRARIES)
endif()
else()
if(NOT BLASEXT_FIND_QUIETLY)
......@@ -378,3 +382,16 @@ else()
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
endif()
if (BLAS_FOUND)
set(BLASEXT_FOUND ${BLAS_FOUND})
endif()
if (BLAS_LIBRARIES)
set(BLASEXT_LIBRARIES ${BLAS_LIBRARIES})
endif()
if (BLAS_INCLUDE_DIRS)
set(BLASEXT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
endif()
if (BLAS_LIBRARY_DIRS)
set(BLASEXT_LIBRARY_DIRS ${BLAS_LIBRARY_DIRS})
endif()
......@@ -767,8 +767,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
else()
set(FFTW_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
......
......@@ -77,8 +77,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT HQR_GIVEN_BY_USER)
#endif()
else()
message(STATUS "${Magenta}Looking for HQR - not found using PkgConfig."
"\n Perhaps you should add the directory containing hqr.pc to the"
"\n PKG_CONFIG_PATH environment variable.${ColourReset}")
"\n Perhaps you should add the directory containing hqr.pc to the"
"\n PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......@@ -133,14 +133,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
if(HQR_DIR)
set(HQR_libhqr.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND")
find_path(HQR_libhqr.h_DIRS
NAMES libhqr.h
HINTS ${HQR_DIR}
NAMES libhqr.h
HINTS ${HQR_DIR})
else()
set(HQR_libhqr.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND")
find_path(HQR_libhqr.h_DIRS
NAMES libhqr.h
HINTS ${_inc_env}
PATH_SUFFIXES "hqr")
NAMES libhqr.h
HINTS ${_inc_env}
PATH_SUFFIXES "hqr")
endif()
endif()
mark_as_advanced(HQR_libhqr.h_DIRS)
......@@ -177,9 +177,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
......@@ -200,14 +200,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
if(HQR_DIR)
set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND")
find_library(HQR_hqr_LIBRARY
NAMES hqr
HINTS ${HQR_DIR}
PATH_SUFFIXES lib lib32 lib64)
NAMES hqr
HINTS ${HQR_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND")
find_library(HQR_hqr_LIBRARY
NAMES hqr
HINTS ${_lib_env})
NAMES hqr
HINTS ${_lib_env})
endif()
endif()
mark_as_advanced(HQR_hqr_LIBRARY)
......@@ -259,15 +259,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
# test link
unset(HQR_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(libhqr_hqr_init HQR_WORKS)
check_function_exists(libhqr_init_hqr HQR_WORKS)
mark_as_advanced(HQR_WORKS)
if(NOT HQR_WORKS)
if(NOT HQR_FIND_QUIETLY)
message(STATUS "Looking for hqr : test of libhqr_hqr_init with hqr library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Looking for hqr : test of libhqr_hqr_init with hqr library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
......
......@@ -321,6 +321,18 @@ endif()
if (HWLOC_FOUND)
set(HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${HWLOC_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES)
if (HWLOC_LIBRARY_DIRS)
set (LIBDIR ${HWLOC_LIBRARY_DIRS})
elseif(HWLOC_LIBDIR)
set (LIBDIR ${HWLOC_LIBDIR})
endif()
if (LIBDIR)
foreach(lib_dir ${LIBDIR})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
endif()
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test headers to guess the version
check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER )
......
###
# WARNING: only HYPRE lib is searched for now
# it is surely too simple, must be completed
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
......
......@@ -3,7 +3,7 @@
# @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-2017 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -18,17 +18,21 @@
#
# The following variables have been added to manage links with sequential or multithreaded
# versions:
# LAPACK_INCLUDE_DIRS - LAPACK include directories
# LAPACK_LIBRARY_DIRS - Link directories for LAPACK libraries
# LAPACK_SEQ_LIBRARIES - LAPACK component libraries to be linked (sequential)
# LAPACK_PAR_LIBRARIES - LAPACK component libraries to be linked (multithreaded)
# LAPACK_INCLUDE_DIRS - LAPACK include directories
# LAPACK_LIBRARY_DIRS - Link directories for LAPACK libraries
# LAPACK_SEQ_LIBRARIES - LAPACK component libraries to be linked (sequential)
# LAPACK_PAR_LIBRARIES - LAPACK component libraries to be linked (multithreaded)
# LAPACKEXT_FOUND - if a LAPACK has been found
# LAPACKEXT_LIBRARIES - Idem LAPACK_LIBRARIES
# LAPACKEXT_INCLUDE_DIRS - Idem LAPACK_INCLUDE_DIRS
# LAPACKEXT_LIBRARY_DIRS - Idem LAPACK_LIBRARY_DIRS
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost
# Copyright 2013-2017 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
......@@ -123,13 +127,13 @@ if(BLA_VENDOR MATCHES "Intel*")
else()
if(LAPACK_DIR)
find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS
NAMES mkl_lapack.h
HINTS ${LAPACK_DIR}
PATH_SUFFIXES include)
NAMES mkl_lapack.h
HINTS ${LAPACK_DIR}
PATH_SUFFIXES include)
else()
find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS
NAMES mkl_lapack.h
HINTS ${_inc_env})
NAMES mkl_lapack.h
HINTS ${_inc_env})
endif()
endif()
mark_as_advanced(LAPACK_mkl_lapack.h_INCLUDE_DIRS)
......@@ -162,9 +166,9 @@ if(BLA_VENDOR MATCHES "Intel*")
# if BLAS Intel 10 64 bit -> save sequential and multithreaded versions
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if(BLAS_PAR_LIBRARIES)
set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}")
set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}")
else()
set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}")
set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}")
endif()
endif()
endif()
......@@ -265,7 +269,7 @@ foreach(lapack_lib ${LAPACK_LIBRARIES})
else()
get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH)
if (EXISTS "${a_lapack_lib_dir}")
list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" )
list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" )
endif()
endif()
endif()
......@@ -281,8 +285,8 @@ if(BLA_VENDOR MATCHES "Intel*")
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK found is Intel MKL:"
"\n we manage two lists of libs, one sequential and one parallel"
"\n (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
"\n we manage two lists of libs, one sequential and one parallel"
"\n (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
......@@ -291,10 +295,10 @@ if(BLA_VENDOR MATCHES "Intel*")
LAPACK_INCLUDE_DIRS)
if(LAPACK_PAR_LIBRARIES)
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_PAR_LIBRARIES)
LAPACK_PAR_LIBRARIES)
endif()
else()
......@@ -348,3 +352,16 @@ else()
LAPACK_SEQ_LIBRARIES
LAPACK_LIBRARY_DIRS)
endif()
if (LAPACK_FOUND)
set(LAPACKEXT_FOUND ${LAPACK_FOUND})
endif()
if (LAPACK_LIBRARIES)
set(LAPACKEXT_LIBRARIES ${LAPACK_LIBRARIES})
endif()
if (LAPACK_INCLUDE_DIRS)
set(LAPACKEXT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
endif()
if (LAPACK_LIBRARY_DIRS)
set(LAPACKEXT_LIBRARY_DIRS ${LAPACK_LIBRARY_DIRS})
endif()
###
# WARNING: not maintained anymore
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
......@@ -126,28 +128,28 @@ if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
#endif()
else()
message(STATUS "${Magenta}Looking for MAGMA - not found using PkgConfig. "
"\n Perhaps you should add the directory containing magma.pc "
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
"\n Perhaps you should add the directory containing magma.pc "
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
if (MAGMA_FIND_VERSION_EXACT)
if( NOT (MAGMA_FIND_VERSION_MAJOR STREQUAL MAGMA_VERSION_MAJOR) OR
NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) )
NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) )
if(NOT MAGMA_FIND_QUIETLY)
message(FATAL_ERROR
"MAGMA version found is ${MAGMA_VERSION_STRING} "
"when required is ${MAGMA_FIND_VERSION}")
message(FATAL_ERROR
"MAGMA version found is ${MAGMA_VERSION_STRING} "
"when required is ${MAGMA_FIND_VERSION}")
endif()
endif()
else()
# if the version found is older than the required then error
if( (MAGMA_FIND_VERSION_MAJOR STRGREATER MAGMA_VERSION_MAJOR) OR
(MAGMA_FIND_VERSION_MINOR STRGREATER MAGMA_VERSION_MINOR) )
(MAGMA_FIND_VERSION_MINOR STRGREATER MAGMA_VERSION_MINOR) )
if(NOT MAGMA_FIND_QUIETLY)
message(FATAL_ERROR
"MAGMA version found is ${MAGMA_VERSION_STRING} "
"when required is ${MAGMA_FIND_VERSION} or newer")
message(FATAL_ERROR
"MAGMA version found is ${MAGMA_VERSION_STRING} "
"when required is ${MAGMA_FIND_VERSION} or newer")
endif()
endif()
endif()
......@@ -219,14 +221,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
if(MAGMA_DIR)
set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND")
find_path(MAGMA_magma.h_DIRS
NAMES magma.h
HINTS ${MAGMA_DIR}
PATH_SUFFIXES "include" "include/magma")
NAMES magma.h
HINTS ${MAGMA_DIR}
PATH_SUFFIXES "include" "include/magma")
else()
set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND")
find_path(MAGMA_magma.h_DIRS
NAMES magma.h
HINTS ${_inc_env})
NAMES magma.h
HINTS ${_inc_env})
endif()
endif()
mark_as_advanced(MAGMA_magma.h_DIRS)
......@@ -260,9 +262,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
......@@ -283,14 +285,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
if(MAGMA_DIR)
set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND")
find_library(MAGMA_magma_LIBRARY
NAMES magma
HINTS ${MAGMA_DIR}
PATH_SUFFIXES lib lib32 lib64)
NAMES magma
HINTS ${MAGMA_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND")
find_library(MAGMA_magma_LIBRARY
NAMES magma
HINTS ${_lib_env})
NAMES magma
HINTS ${_lib_env})
endif()
endif()
mark_as_advanced(MAGMA_magma_LIBRARY)
......@@ -392,11 +394,11 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
list(REMOVE_DUPLICATES MAGMA_LINKER_FLAGS)
else()
if(NOT MAGMA_FIND_QUIETLY)
message(STATUS "Looking for magma : test of magma_dgetrf with
magma, cblas, cuda and lapack libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Looking for magma : test of magma_dgetrf with
magma, cblas, cuda and lapack libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
......@@ -410,7 +412,7 @@ if (MAGMA_LIBRARIES)
if (MAGMA_LIBRARY_DIRS)
foreach(dir ${MAGMA_LIBRARY_DIRS})
if ("${dir}" MATCHES "magma")
set(first_lib_path "${dir}")
set(first_lib_path "${dir}")
endif()
endforeach()
else()
......
......@@ -3,6 +3,7 @@
# This module allows to find MPI libraries by calling the official FindMPI module
# and adds an additional variable indicating the level of thread supported:
# MPI_THREAD_SUPPORTED_LEVEL - MPI_THREAD_MULTIPLE, MPI_THREAD_SERIALIZED, MPI_THREAD_FUNNELED, or MPI_THREAD_SINGLE
# MPIEXT_FOUND - if a MPI has been found
#=============================================================================
# Copyright 2012-2013 Inria
......@@ -29,8 +30,10 @@ if (NOT MPI_FOUND)
find_package(MPI)
endif()
endif ()
set(MPIEXT_FOUND ${MPI_FOUND})
if (MPI_FOUND)
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
......@@ -103,9 +106,9 @@ int main(int argc, char **argv) {
if(NOT SERIALIZED_TEST_RUNS)
check_c_source_runs("${MPI_C_TEST_FUNNELED_SOURCE}" FUNNELED_TEST_RUNS)
if(NOT FUNNELED_TEST_RUNS)
set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SINGLE")
set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SINGLE")
else(NOT FUNNELED_TEST_RUNS)
set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_FUNNELED")
set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_FUNNELED")
endif(NOT FUNNELED_TEST_RUNS)
else(NOT SERIALIZED_TEST_RUNS)
set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SERIALIZED")
......@@ -117,4 +120,5 @@ int main(int argc, char **argv) {
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
endif(MPI_FOUND)
......@@ -27,6 +27,7 @@
# - MPI: to activate detection of the parallel MPI version (default)
# it looks for Threads, HWLOC, BLAS, MPI and ScaLAPACK libraries
# - SEQ: to activate detection of the sequential version (exclude MPI version)
# - PARSEC: to activate detection of PASTIX with PARSEC
# - STARPU: to activate detection of StarPU version
# it looks for MPI version of StarPU (default behaviour)
# if SEQ and STARPU are given, it looks for a StarPU without MPI
......@@ -84,6 +85,7 @@ endif()
set(PASTIX_LOOK_FOR_MPI ON)
set(PASTIX_LOOK_FOR_SEQ OFF)
set(PASTIX_LOOK_FOR_STARPU OFF)
set(PASTIX_LOOK_FOR_PARSEC OFF)
set(PASTIX_LOOK_FOR_STARPU_CUDA OFF)
set(PASTIX_LOOK_FOR_STARPU_FXT OFF)
set(PASTIX_LOOK_FOR_SCOTCH ON)
......@@ -102,6 +104,9 @@ if( PASTIX_FIND_COMPONENTS )
set(PASTIX_LOOK_FOR_SEQ OFF)
set(PASTIX_LOOK_FOR_MPI ON)
endif()
if (${component} STREQUAL "PARSEC")
set(PASTIX_LOOK_FOR_PARSEC ON)
endif()
if (${component} STREQUAL "STARPU")
# means we look for PaStiX with StarPU
set(PASTIX_LOOK_FOR_STARPU ON)
......@@ -165,7 +170,7 @@ if(UNIX OR WIN32)
else()
if (PASTIX_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find libm on your system."
"Are you sure to a have a C compiler installed?")
"Are you sure to a have a C compiler installed?")
endif()
endif()
endif()
......@@ -240,6 +245,19 @@ if (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)
endif()
endif (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)
# PASTIX may depends on SCOTCH
#-----------------------------
if (NOT PARSEC_FOUND AND PASTIX_LOOK_FOR_PARSEC)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect PARSEC")
endif()
if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_PARSEC)
find_package(PARSEC REQUIRED)
else()
find_package(PARSEC)
endif()
endif()
# PASTIX may depend on STARPU
#----------------------------
if( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU)
......@@ -446,16 +464,16 @@ else()
foreach(pastix_lib ${PASTIX_libs_to_find})
set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")
find_library(PASTIX_${pastix_lib}_LIBRARY
NAMES ${pastix_lib}
HINTS ${PASTIX_DIR}
PATH_SUFFIXES lib lib32 lib64)
NAMES ${pastix_lib}
HINTS ${PASTIX_DIR}
PATH_SUFFIXES lib lib32 lib64)
endforeach()
else()
foreach(pastix_lib ${PASTIX_libs_to_find})
set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")
find_library(PASTIX_${pastix_lib}_LIBRARY
NAMES ${pastix_lib}
HINTS ${_lib_env})
NAMES ${pastix_lib}
HINTS ${_lib_env})
endforeach()
endif()
endif()
......@@ -498,6 +516,30 @@ if(PASTIX_LIBRARIES)
endif()
endforeach()
set(REQUIRED_LIBS "${PASTIX_LIBRARIES}")
# PARSEC
if (PASTIX_LOOK_FOR_PARSEC AND PARSEC_FOUND)
if (PARSEC_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${PARSEC_INCLUDE_DIRS_DEP}")
elseif (PARSEC_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${PARSEC_INCLUDE_DIRS}")
endif()
if(PARSEC_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${PARSEC_LIBRARY_DIRS_DEP}")
elseif(PARSEC_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${PARSEC_LIBRARY_DIRS}")
endif()
if (PARSEC_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${PARSEC_LIBRARIES_DEP}")
elseif (PARSEC_LIBRARIES)
foreach(lib ${PARSEC_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
endif()
# STARPU
if (PASTIX_LOOK_FOR_STARPU AND STARPU_FOUND)
if (STARPU_INCLUDE_DIRS_DEP)
......@@ -514,11 +556,11 @@ if(PASTIX_LIBRARIES)
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()
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
endif()
......@@ -529,7 +571,7 @@ if(PASTIX_LIBRARIES)
endif()
foreach(libdir ${CUDA_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
......@@ -541,7 +583,7 @@ if(PASTIX_LIBRARIES)
endif()
if (MPI_C_LINK_FLAGS)
if (${MPI_C_LINK_FLAGS} MATCHES " -")
string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
endif()
list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
endif()
......@@ -554,14 +596,14 @@ if(PASTIX_LIBRARIES)
endif()
foreach(libdir ${HWLOC_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
foreach(lib ${HWLOC_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
......@@ -572,7 +614,7 @@ if(PASTIX_LIBRARIES)
endif()
foreach(libdir ${BLAS_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
......@@ -587,7 +629,7 @@ if(PASTIX_LIBRARIES)
endif()
foreach(libdir ${SCOTCH_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}")
......@@ -599,7 +641,7 @@ if(PASTIX_LIBRARIES)
endif()
foreach(libdir ${PTSCOTCH_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}")
......@@ -611,7 +653,7 @@ if(PASTIX_LIBRARIES)
endif()
foreach(libdir ${METIS_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}")
......@@ -674,8 +716,8 @@ if(PASTIX_LIBRARIES)
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Maybe PASTIX is linked with specific libraries. "
"Have you tried with COMPONENTS (MPI/SEQ, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? "
"See the explanation in FindPASTIX.cmake.")
"Have you tried with COMPONENTS (MPI/SEQ, PARSEC, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? "
"See the explanation in FindPASTIX.cmake.")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
......
# - Try to find PETSc
# Once done this will define
#
# PETSC_FOUND - system has PETSc
# PETSC_INCLUDE_DIRS - include directories for PETSc
# PETSC_LIBRARY_DIRS - library directories for PETSc
# PETSC_LIBRARIES - libraries for PETSc
# PETSC_STATIC_LIBRARIES - libraries for PETSc (static linking, undefined if not required)
# PETSC_VERSION - version for PETSc
# PETSC_VERSION_MAJOR - First number in PETSC_VERSION
# PETSC_VERSION_MINOR - Second number in PETSC_VERSION
# PETSC_VERSION_SUBMINOR - Third number in PETSC_VERSION
# PETSC_INT_SIZE - sizeof(PetscInt)
#
#=============================================================================
# Copyright (C) 2010-2016 Garth N. Wells, Anders Logg and Johannes Ring
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Outline:
# 1. Get flags from PETSc-generated pkg-config file
# 2. Test compile and run program using shared library linking
# 3. If shared library linking fails, test with static library linking
# Load pkg-config module (provided by CMake)
find_package(PkgConfig REQUIRED)
# Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems
set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
pkg_search_module(PETSC craypetsc_real PETSc)
# Extract major, minor, etc from version string
if (PETSC_VERSION)
string(REPLACE "." ";" VERSION_LIST ${PETSC_VERSION})
list(GET VERSION_LIST 0 PETSC_VERSION_MAJOR)
list(GET VERSION_LIST 1 PETSC_VERSION_MINOR)
list(GET VERSION_LIST 2 PETSC_VERSION_SUBMINOR)
endif()
# Configure PETSc IMPORT (this involves creating an 'imported' target
# and attaching 'properties')
if (PETSC_FOUND AND NOT TARGET PETSC::petsc)
add_library(PETSC::petsc INTERFACE IMPORTED)
# Add include paths
set_property(TARGET PETSC::petsc PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${PETSC_INCLUDE_DIRS})
# Add libraries
unset(_libs)
foreach (lib ${PETSC_LIBRARIES})
find_library(LIB_${lib} NAMES ${lib} PATHS ${PETSC_LIBRARY_DIRS} NO_DEFAULT_PATH)
list(APPEND _libs ${LIB_${lib}})
endforeach()
set_property(TARGET PETSC::petsc PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
endif()
# Configure PETSc 'static' IMPORT (this involves creating an
# 'imported' target and attaching 'properties')
if (PETSC_FOUND AND NOT TARGET PETSC::petsc_static)
add_library(PETSC::petsc_static INTERFACE IMPORTED)
# Add libraries (static)
unset(_libs)
foreach (lib ${PETSC_STATIC_LIBRARIES})
find_library(LIB_${lib} ${lib} HINTS ${PETSC_STATIC_LIBRARY_DIRS})
list(APPEND _libs ${LIB_${lib}})
endforeach()
set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
endif()
# Attempt to build and run PETSc test program
if (DOLFIN_SKIP_BUILD_TESTS)
# Assume PETSc works
set(PETSC_TEST_RUNS TRUE)
elseif (PETSC_FOUND)
# Create PETSc test program
set(PETSC_TEST_LIB_CPP
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/petsc_test_lib.cpp")
file(WRITE ${PETSC_TEST_LIB_CPP} "
#include \"petscts.h\"
#include \"petsc.h\"
int main()
{
PetscErrorCode ierr;
TS ts;
int argc = 0;
char** argv = NULL;
ierr = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);
ierr = TSSetFromOptions(ts);CHKERRQ(ierr);
ierr = TSDestroy(&ts);CHKERRQ(ierr);
ierr = PetscFinalize();CHKERRQ(ierr);
return 0;
}
")
# Add MPI variables if MPI has been found
if (MPI_C_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
endif()
# Try to run test program (shared linking)
try_run(
PETSC_TEST_LIB_EXITCODE
PETSC_TEST_LIB_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${PETSC_TEST_LIB_CPP}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
LINK_LIBRARIES PETSC::petsc
COMPILE_OUTPUT_VARIABLE PETSC_TEST_LIB_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE PETSC_TEST_LIB_OUTPUT)
# Check program output
if (PETSC_TEST_LIB_COMPILED AND PETSC_TEST_LIB_EXITCODE EQUAL 0)
message(STATUS "Test PETSC_TEST_RUNS with shared library linking - Success")
set(PETSC_TEST_RUNS TRUE)
# Static libraries not required, so unset
set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES)
else()
message(STATUS "Test PETSC_TEST_RUNS with shared library linking - Failed")
# Add MPI variables if MPI has been found
if (MPI_C_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
endif()
# Try to run test program (static linking)
try_run(
PETSC_TEST_LIB_EXITCODE
PETSC_TEST_LIB_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${PETSC_TEST_LIB_CPP}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
LINK_LIBRARIES PETSC::petsc PETSC::petsc_static
COMPILE_OUTPUT_VARIABLE PETSC_TEST_LIB_COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE PETSC_TEST_LIB_OUTPUT)
if (PETSC_TEST_LIB_COMPILED AND PETSC_TEST_LIB_EXITCODE EQUAL 0)
message(STATUS "Test PETSC_TEST_RUNS static linking - Success")
set(PETSC_TEST_RUNS TRUE)
else()
message(STATUS "Test PETSC_TEST_RUNS static linking - Failed")
set(PETSC_TEST_RUNS FALSE)
endif()
endif()
endif()
# Check sizeof(PetscInt)
if (PETSC_INCLUDE_DIRS)
include(CheckTypeSize)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PETSC_INCLUDE_DIRS})
set(CMAKE_EXTRA_INCLUDE_FILES petscsys.h)
check_type_size("PetscInt" PETSC_INT_SIZE)
unset(CMAKE_EXTRA_INCLUDE_FILES)
unset(CMAKE_REQUIRED_INCLUDES)
endif()
# Standard package handling
include(FindPackageHandleStandardArgs)
if (PETSC_FOUND)
find_package_handle_standard_args(PETSc
REQUIRED_VARS PETSC_FOUND PETSC_TEST_RUNS VERSION_VAR PETSC_VERSION
FAIL_MESSAGE "PETSc could not be configured.")
else()
find_package_handle_standard_args(PETSc
REQUIRED_VARS PETSC_FOUND
FAIL_MESSAGE "PETSc could not be found. Be sure to set PETSC_DIR.")
endif()
# - Try to find PETSc
# Once done this will define
#
# PETSC_FOUND - system has PETSc
# PETSC_INCLUDES - the PETSc include directories
# PETSC_LIBRARIES - Link these to use PETSc
# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI
# PETSC_DEFINITIONS - Compiler switches for using PETSc
# PETSC_MPIEXEC - Executable for running MPI programs
# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR)
#
# Usage:
# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0
# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler
# find_package(PETSc) - same as above
#
# Setting these changes the behavior of the search
# PETSC_DIR - directory in which PETSc resides
# PETSC_ARCH - build architecture
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
function (petsc_get_version)
if (EXISTS "${PETSC_DIR}/include/petscversion.h")
file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ")
foreach (line ${vstrings})
string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define")
list (GET fields 1 var)
list (GET fields 2 val)
set (${var} ${val} PARENT_SCOPE)
set (${var} ${val}) # Also in local scope so we have access below
endforeach ()
if (PETSC_VERSION_RELEASE)
set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE)
else ()
# make dev version compare higher than any patch level of a released version
set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE)
endif ()
else ()
message (SEND_ERROR "PETSC_DIR can not be used, ${PETSC_DIR}/include/petscversion.h does not exist")
endif ()
endfunction ()
find_path (PETSC_DIR include/petsc.h
HINTS ENV PETSC_DIR
PATHS
${AEROSOL_TOP_DIR}/../../petsc-3.3-p4 ${AEROSOL_TOP_DIR}/../../petsc-3.2-p7 ${AEROSOL_TOP_DIR}/../../petsc-3.2-p6 ${AEROSOL_TOP_DIR}/../../petsc-3.2-p5
${AEROSOL_TOP_DIR}/../../petsc
/usr/lib/petscdir/3.1 /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 # Debian
$ENV{HOME}/petsc
DOC "PETSc Directory")
find_program (MAKE_EXECUTABLE NAMES make gmake)
if (PETSC_DIR AND NOT PETSC_ARCH)
set (_petsc_arches
$ENV{PETSC_ARCH} # If set, use environment variable first
arch-linux2-cxx-opt arch-linux2-c-opt
arch-linux2-cxx-debug arch-linux2-c-debug
linux-x86_64-python
linux-gnu-c-debug linux-gnu-c-opt # Debian defaults
x86_64-unknown-linux-gnu i386-unknown-linux-gnu)
set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
foreach (arch ${_petsc_arches})
if (NOT PETSC_ARCH)
find_path (petscconf petscconf.h
HINTS ${PETSC_DIR}
PATH_SUFFIXES ${arch}/include bmake/${arch}
NO_DEFAULT_PATH)
if (petscconf)
set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture")
endif (petscconf)
endif (NOT PETSC_ARCH)
endforeach (arch)
set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
endif (PETSC_DIR AND NOT PETSC_ARCH)
set(PETSC_VALID_COMPONENTS
C
CXX)
if(NOT PETSc_FIND_COMPONENTS)
#on cherche si on a compile PETSc avec l'option --with-clanguage=cxx
#on regarde dans PETSC_ARCH si on trouve cxx
#on pourrait aussi chercher --with-clanguage=cxx dans configure.log
if (PETSC_ARCH)
string(REGEX MATCH "-cxx-" PETSc_FIND_COMPONENTS ${PETSC_ARCH})
if(PETSc_FIND_COMPONENTS)
set(PETSC_LANGUAGE_BINDINGS "CXX")
else(PETSc_FIND_COMPONENTS)
set(PETSC_LANGUAGE_BINDINGS "C")
endif(PETSc_FIND_COMPONENTS)
endif(PETSC_ARCH)
else()
# Right now, this is designed for compatability with the --with-clanguage option, so
# only allow one item in the components list.
list(LENGTH ${PETSc_FIND_COMPONENTS} components_length)
if(${components_length} GREATER 1)
message(FATAL_ERROR "Only one component for PETSc is allowed to be specified")
endif()
list(FIND PETSC_VALID_COMPONENTS ${PETSc_FIND_COMPONENTS} component_location)
if(${component_location} EQUAL -1)
message(FATAL_ERROR "\"${PETSc_FIND_COMPONENTS}\" is not a valid PETSc component.")
else()
list(APPEND PETSC_LANGUAGE_BINDINGS ${PETSc_FIND_COMPONENTS})
endif()
endif()
if (PETSC_DIR AND PETSC_ARCH)
SET( PETSC_FOUND TRUE)
else(PETSC_DIR AND PETSC_ARCH)
SET( PETSC_FOUND FALSE)
endif(PETSC_DIR AND PETSC_ARCH)
set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS
INCLUDE_DIR INCLUDE_CONF)
include (FindPackageMultipass)
find_package_multipass (PETSc petsc_config_current
STATES DIR ARCH
DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves})
# Determine whether the PETSc layout is old-style (through 2.3.3) or
# new-style (>= 3.0.0)
if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3
set (petsc_conf_rules "${PETSC_DIR}/conf/rules")
set (petsc_conf_variables "${PETSC_DIR}/conf/variables")
elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3
set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules")
set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables")
elseif (PETSC_DIR)
message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation")
endif ()
if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current)
petsc_get_version()
# Put variables into environment since they are needed to get
# configuration (petscvariables) in the PETSc makefile
set (ENV{PETSC_DIR} "${PETSC_DIR}")
set (ENV{PETSC_ARCH} "${PETSC_ARCH}")
# A temporary makefile to probe the PETSc configuration
set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc")
file (WRITE "${petsc_config_makefile}"
"## This file was autogenerated by FindPETSc.cmake
# PETSC_DIR = ${PETSC_DIR}
# PETSC_ARCH = ${PETSC_ARCH}
include ${petsc_conf_rules}
include ${petsc_conf_variables}
show :
@echo -n \${\${VARIABLE}}
")
macro (PETSC_GET_VARIABLE name var)
set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name}
OUTPUT_VARIABLE ${var}
RESULT_VARIABLE petsc_return)
endmacro (PETSC_GET_VARIABLE)
petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir)
petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external)
petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line)
petsc_get_variable (PETSC_INCLUDE petsc_include)
petsc_get_variable (PCC petsc_cc)
petsc_get_variable (MPIEXEC petsc_mpiexec)
# We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid!
file (REMOVE ${petsc_config_makefile})
include (ResolveCompilerPaths)
# Extract include paths and libraries from compile command line
resolve_includes (petsc_includes_all "${petsc_cpp_line}")
macro (PETSC_FIND_LIBRARY suffix name)
set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again
find_library (PETSC_LIBRARY_${suffix} NAMES ${name} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH)
set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}")
mark_as_advanced (PETSC_LIBRARY_${suffix})
endmacro (PETSC_FIND_LIBRARY suffix name)
# Look for petscvec first, if it doesn't exist, we must be using single-library
petsc_find_library (VEC petscvec)
if (PETSC_LIBRARY_VEC)
petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced)
petsc_find_library (MAT petscmat)
petsc_find_library (DM petscdm)
petsc_find_library (KSP petscksp)
petsc_find_library (SNES petscsnes)
petsc_find_library (TS petscts)
macro (PETSC_JOIN libs deps)
list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}})
endmacro (PETSC_JOIN libs deps)
petsc_join (VEC SYS)
petsc_join (MAT VEC)
petsc_join (DM MAT)
petsc_join (KSP DM)
petsc_join (SNES KSP)
petsc_join (TS SNES)
petsc_join (ALL TS)
else ()
set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec
petsc_find_library (SINGLE petsc)
foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}")
endforeach ()
endif ()
if (PETSC_LIBRARY_TS)
message (STATUS "Recognized PETSc install with separate libraries for each package")
else ()
message (STATUS "Recognized PETSc install with single library for all packages")
endif ()
include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns)
macro (PETSC_TEST_RUNS includes libraries runs)
if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C")
set(_PETSC_ERR_FUNC "CHKERRQ(ierr)")
elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX")
set(_PETSC_ERR_FUNC "CHKERRXX(ierr)")
endif()
if (PETSC_VERSION VERSION_GREATER 3.1)
set (_PETSC_TSDestroy "TSDestroy(&ts)")
else ()
set (_PETSC_TSDestroy "TSDestroy(ts)")
endif ()
set(_PETSC_TEST_SOURCE "
static const char help[] = \"PETSc test program.\";
#include <petscts.h>
int main(int argc,char *argv[]) {
PetscErrorCode ierr;
TS ts;
ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC};
ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC};
ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC};
ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC};
ierr = PetscFinalize();${_PETSC_ERR_FUNC};
return 0;
}
")
multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}")
if (${${runs}})
set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL
"Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)
endif (${${runs}})
endmacro (PETSC_TEST_RUNS)
find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH)
find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH)
mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF)
set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR})
petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal)
if (petsc_works_minimal)
message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.")
set (petsc_includes_needed "${petsc_includes_minimal}")
else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it
petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes)
if (petsc_works_allincludes) # It does, we just need all the includes (
message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).")
set (petsc_includes_needed ${petsc_includes_all})
else (petsc_works_allincludes) # We are going to need to link the external libs explicitly
resolve_libraries (petsc_libraries_external "${petsc_libs_external}")
foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external})
endforeach (pkg)
petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries)
if (petsc_works_alllibraries)
message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.")
set (petsc_includes_needed ${petsc_includes_minimal})
else (petsc_works_alllibraries)
# It looks like we really need everything, should have listened to Matt
set (petsc_includes_needed ${petsc_includes_all})
petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all)
if (petsc_works_all) # We fail anyways
message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.")
else (petsc_works_all) # We fail anyways
message (STATUS "PETSc could not be used, maybe the install is broken.")
endif (petsc_works_all)
endif (petsc_works_alllibraries)
endif (petsc_works_allincludes)
endif (petsc_works_minimal)
# We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous
if (${PETSC_VERSION} VERSION_LESS 3.1)
set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE)
else ()
set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE)
endif ()
# Sometimes this can be used to assist FindMPI.cmake
set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE)
set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE)
set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE)
set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE)
# Note that we have forced values for all these choices. If you
# change these, you are telling the system to trust you that they
# work. It is likely that you will end up with a broken build.
mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS)
endif ()
########
# MESSAGE( "PETSC_DIR : ${PETSC_DIR}")
# MESSAGE( "PETSC_ARCH : ${PETSC_ARCH}")
# MESSAGE( "PETSC_FOUND : ${PETSC_FOUND}")
# MESSAGE( "PETSC_INCLUDES : ${PETSC_INCLUDES}")
# MESSAGE( "PETSC_LIBRARIES : ${PETSC_LIBRARIES}")
# MESSAGE( "PETSC_COMPILER : ${PETSC_COMPILER}")
# MESSAGE( "PETSC_DEFINITIONS : ${PETSC_DEFINITIONS}")
# MESSAGE( "PETSC_MPIEXEC : ${PETSC_MPIEXEC}")
# MESSAGE( "PETSC_VERSION : ${PETSC_VERSION}")
# MESSAGE( "PETSC_EXECUTABLE_RUNS : ${PETSC_EXECUTABLE_RUNS}")
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (PETSc
"PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH."
PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS)
......@@ -68,18 +68,18 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
else()
if(${LIBNAME}_DIR)
message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
"has not been found in ${ARGN}${ColourReset}")
else()
message("${Yellow}${_lib_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
if(_lib_env)
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
endif()
endif()
endif()
......@@ -145,11 +145,11 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
list(APPEND _libdir "${BLAS_DIR}")
list(APPEND _libdir "${BLAS_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${BLAS_DIR}/lib64")
list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
list(APPEND _libdir "${BLAS_DIR}/lib64")
list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
else()
list(APPEND _libdir "${BLAS_DIR}/lib32")
list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
list(APPEND _libdir "${BLAS_DIR}/lib32")
list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
endif()
elseif(ENV_BLAS_LIBDIR)
list(APPEND _libdir "${ENV_BLAS_LIBDIR}")
......@@ -157,11 +157,11 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
list(APPEND _libdir "${ENV_BLAS_DIR}")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
else()
list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
endif()
endif()
if (SCALAPACK_LIBDIR)
......@@ -170,11 +170,11 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
list(APPEND _libdir "${SCALAPACK_DIR}")
list(APPEND _libdir "${SCALAPACK_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${SCALAPACK_DIR}/lib64")
list(APPEND _libdir "${SCALAPACK_DIR}/lib/intel64")
list(APPEND _libdir "${SCALAPACK_DIR}/lib64")
list(APPEND _libdir "${SCALAPACK_DIR}/lib/intel64")
else()
list(APPEND _libdir "${SCALAPACK_DIR}/lib32")
list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32")
list(APPEND _libdir "${SCALAPACK_DIR}/lib32")
list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32")
endif()
elseif(ENV_SCALAPACK_LIBDIR)
list(APPEND _libdir "${ENV_SCALAPACK_LIBDIR}")
......@@ -182,29 +182,29 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
list(APPEND _libdir "${ENV_SCALAPACK_DIR}")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib64")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/intel64")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib64")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/intel64")
else()
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib32")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/ia32")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib32")
list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/ia32")
endif()
else()
if (ENV_MKLROOT)
list(APPEND _libdir "${ENV_MKLROOT}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_MKLROOT}/lib64")
list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
else()
list(APPEND _libdir "${ENV_MKLROOT}/lib32")
list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
endif()
list(APPEND _libdir "${ENV_MKLROOT}/lib")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
list(APPEND _libdir "${ENV_MKLROOT}/lib64")
list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
else()
list(APPEND _libdir "${ENV_MKLROOT}/lib32")
list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
endif()
endif()
if (WIN32)
string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
elseif (APPLE)
string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
else ()
string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
endif ()
list(APPEND _libdir "${_libdir2}")
list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
......@@ -221,29 +221,29 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
if(_libraries_work)
if (BLA_STATIC)
if (WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ( WIN32 )
if (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif (APPLE)
if (WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ( WIN32 )
if (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif (APPLE)
else (BLA_STATIC)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and libscalapack3gf packages
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and libscalapack3gf packages
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif ()
endif (BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
HINTS ${_libdir}
)
NAMES ${_library}
HINTS ${_libdir}
)
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
# Print status if not found
# -------------------------
if (NOT ${_prefix}_${_library}_LIBRARY AND NOT SCALAPACK_FIND_QUIETLY AND SCALAPACK_VERBOSE)
Print_Find_Library_Blas_Status(scalapack ${_library} ${_libdir})
Print_Find_Library_Blas_Status(scalapack ${_library} ${_libdir})
endif ()
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
......@@ -259,7 +259,7 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
endif(UNIX AND BLA_STATIC)
if (SCALAPACK_VERBOSE)
message("${Cyan}SCALAPACK libs found. Try to compile symbol ${_name} with"
"following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
"following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
endif ()
if(NOT SCALAPACK_FOUND)
unset(${_prefix}${_combined_name}_WORKS CACHE)
......@@ -322,84 +322,96 @@ if(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND)
endif(NOT BLA_VENDOR)
endif ($ENV{BLA_VENDOR} MATCHES ".+")
# Generic SCALAPACK library
if (BLA_VENDOR STREQUAL "Generic" OR
BLA_VENDOR STREQUAL "All")
if ( NOT SCALAPACK_LIBRARIES )
check_scalapack_libraries(
SCALAPACK_LIBRARIES
SCALAPACK
pdgemm
""
"scalapack" # scalapack lib to look for
"${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs
"${MPI_Fortran_LIBRARIES}" # mpi libs
"" # threads libs
)
endif ( NOT SCALAPACK_LIBRARIES )
endif ()
#intel scalapack
if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (UNIX AND NOT WIN32)
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
set(LM "-lm")
set(LM "-lm")
else()
set(LM "")
set(LM "")
endif()
endif ()
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED)
find_PACKAGE(Threads)
find_PACKAGE(Threads)
else()
find_package(Threads REQUIRED)
find_package(Threads REQUIRED)
endif()
set(SCALAPACK_SEARCH_LIBS "")
if (BLA_F95)
set(SCALAPACK_mkl_SEARCH_SYMBOL "PDGEMM")
set(_LIBRARIES SCALAPACK95_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
set(SCALAPACK_mkl_SEARCH_SYMBOL "PDGEMM")
set(_LIBRARIES SCALAPACK95_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
else()
set(SCALAPACK_mkl_SEARCH_SYMBOL "pdgemm")
set(_LIBRARIES SCALAPACK_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
set(SCALAPACK_mkl_SEARCH_SYMBOL "pdgemm")
set(_LIBRARIES SCALAPACK_LIBRARIES)
set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
endif()
# First try empty scalapack libs
if (NOT ${_LIBRARIES})
check_scalapack_libraries(
${_LIBRARIES}
BLAS
${SCALAPACK_mkl_SEARCH_SYMBOL}
""
""
"${_BLAS_LIBRARIES}"
""
"${MPI_Fortran_LIBRARIES}"
)
check_scalapack_libraries(
${_LIBRARIES}
BLAS
${SCALAPACK_mkl_SEARCH_SYMBOL}
""
""
"${_BLAS_LIBRARIES}"
""
"${MPI_Fortran_LIBRARIES}"
)
endif ()
# Then try the search libs
foreach (IT ${SCALAPACK_SEARCH_LIBS})
if (NOT ${_LIBRARIES})
check_scalapack_libraries(
${_LIBRARIES}
BLAS
${SCALAPACK_mkl_SEARCH_SYMBOL}
""
"${IT};mkl_blacs_intelmpi_lp64"
"${_BLAS_LIBRARIES}"
""
"${MPI_Fortran_LIBRARIES}"
)
endif ()
if (NOT ${_LIBRARIES})
check_scalapack_libraries(
${_LIBRARIES}
BLAS
${SCALAPACK_mkl_SEARCH_SYMBOL}
""
"${IT};mkl_blacs_intelmpi_lp64"
"${_BLAS_LIBRARIES}"
""
"${MPI_Fortran_LIBRARIES}"
)
endif ()
endforeach ()
endif ()
endif()
# Generic SCALAPACK library
if (BLA_VENDOR STREQUAL "Generic" OR
BLA_VENDOR STREQUAL "All")
if ( NOT SCALAPACK_LIBRARIES )
check_scalapack_libraries(
SCALAPACK_LIBRARIES
SCALAPACK
pdgemm
""
"scalapack" # scalapack lib to look for
"${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs
"${MPI_Fortran_LIBRARIES}" # mpi libs
"" # threads libs
)
endif ( NOT SCALAPACK_LIBRARIES )
if ( NOT SCALAPACK_LIBRARIES )
check_scalapack_libraries(
SCALAPACK_LIBRARIES
SCALAPACK
pdgemm
""
"scalapack-openmpi" # scalapack lib to look for
"${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs
"${MPI_Fortran_LIBRARIES}" # mpi libs
"" # threads libs
)
endif ( NOT SCALAPACK_LIBRARIES )
endif ()
else(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND)
message(STATUS "SCALAPACK requires BLAS, LAPACK, and MPI")
endif(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND)
......@@ -416,23 +428,23 @@ if(BLA_F95)
message(STATUS "SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARIES}")
else(SCALAPACK95_FOUND)
message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but SCALAPACK 95 libraries could not be found or check of symbols failed."
"\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
"\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
if(SCALAPACK_FIND_REQUIRED)
message(FATAL_ERROR
"A required library with SCALAPACK95 API not found. Please specify library location."
)
message(FATAL_ERROR
"A required library with SCALAPACK95 API not found. Please specify library location."
)
else(SCALAPACK_FIND_REQUIRED)
message(STATUS
"A library with SCALAPACK95 API not found. Please specify library location."
)
message(STATUS
"A library with SCALAPACK95 API not found. Please specify library location."
)
endif(SCALAPACK_FIND_REQUIRED)
endif(SCALAPACK95_FOUND)
endif(NOT SCALAPACK_FIND_QUIETLY)
......@@ -451,23 +463,23 @@ else(BLA_F95)
message(STATUS "SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARIES}")
else(SCALAPACK_FOUND)
message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but SCALAPACK libraries could not be found or check of symbols failed."
"\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
"\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
"- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
if(SCALAPACK_FIND_REQUIRED)
message(FATAL_ERROR
"A required library with SCALAPACK API not found. Please specify library location."
)
message(FATAL_ERROR
"A required library with SCALAPACK API not found. Please specify library location."
)
else(SCALAPACK_FIND_REQUIRED)
message(STATUS
"A library with SCALAPACK API not found. Please specify library location."
)
message(STATUS
"A library with SCALAPACK API not found. Please specify library location."
)
endif(SCALAPACK_FIND_REQUIRED)
endif(SCALAPACK_FOUND)
endif(NOT SCALAPACK_FIND_QUIETLY)
......
......@@ -3,6 +3,9 @@
# Setup the minimal environment to compile and generate .JDF files.
#
set(PARSEC_PTGPP_CFLAGS "--noline" CACHE STRING "Additional parsec_ptgpp precompiling flags (separate flags with ';')" )
mark_as_advanced(PARSEC_PTGPP_CFLAGS)
#
# This macro creates a rule for every jdf basename passed in SOURCES.
# The OUTPUTLIST contains the list of files generated by the maxro.
......
cmake_minimum_required(VERSION 2.8)
project(TEST_MORSE_CMAKE_MODULES_FIND Fortran C CXX)
# location of find package modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../")
# main variable: control the list of libraries to find thanks to find_package
# pay attention that package names must be given with capital letters
set(PACKAGES "" CACHE STRING "List of packages to find, ex: BLAS;STARPU;PASTIX")
# specific components to look for with packages
set(QUARK_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with QUARK, ex: HWLOC")
set(PASTIX_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with PASTIX, ex: MPI;SEQ;STARPU;STARPU_CUDA;STARPU_FXT;SCOTCH;PTSCOTCH;METIS")
set(PETSC_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with PETSc, ex: CXX|C")
set(FFTW_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with FFTW, ex: MKL;ESSL;THREADS;OMP;SIMPLE;LONG;QUAD")
set(MUMPS_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with MUMPS, ex: MPI;SEQ;SCOTCH;PTSCOTCH;METIS;PARMETIS;OPENMP")
set(CHAMELEON_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with CHAMELEON, ex: STARPU;QUARK;CUDA;MPI;FXT")
set(STARPU_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with STARPU, ex: HWLOC;CUDA;MPI;BLAS;MAGMA;FXT;SIMGRID")
set(PARSEC_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with PARSEC, ex: HWLOC;CUDA;MPI;AYUDAME")
# to enable ctests
option(ENABLE_CTEST "Enable Testing: will test all supported packages" OFF)
foreach(_library ${PACKAGES})
if (${_library}_COMPONENTS)
find_package(${_library} COMPONENTS ${${_library}_COMPONENTS})
else()
find_package(${_library})
endif()
if (${_library}_FOUND)
if (${_library}_LIBRARIES)
message(STATUS "${_library}_LIBRARIES found: ${${_library}_LIBRARIES}")
else()
message(WARNING "${_library}_LIBRARIES not found: ${${_library}_LIBRARIES}")
endif()
if (${_library}_LIBRARY_DIRS)
message(STATUS "${_library}_LIBRARY_DIRS found: ${${_library}_LIBRARY_DIRS}")
else()
message(WARNING "${_library}_LIBRARY_DIRS not found: ${${_library}_LIBRARY_DIRS}")
endif()
if (${_library}_INCLUDE_DIRS)
message(STATUS "${_library}_INCLUDE_DIRS found: ${${_library}_INCLUDE_DIRS}")
else()
message(WARNING "${_library}_INCLUDE_DIRS not found: ${${_library}_INCLUDE_DIRS}")
endif()
else()
message(FATAL_ERROR "${_library} NOT FOUND !!")
endif()
endforeach()
# Add CTest rules
if (ENABLE_CTEST)
enable_testing()
include(CTest)
set(CTEST_PACKAGES_LIST
BLAS
BLASEXT
CBLAS
CHAMELEON
CPPCHECK
EZTRACE
#FABULOUS see https://gitlab.inria.fr/solverstack/fabulous/issues/1
FFTW
FXT
GTG
HQR
HWLOC
#HYPRE module not ready TODO: complete it
LAPACK
LAPACKE
LAPACKEXT
METIS
MPIEXT
MUMPS
#PAMPA not able to install it, link problem with ptscotch
PAPI
PARMETIS
PARSEC
PASTIX
PETSC
PTSCOTCH
QUARK
SCALAPACK
SCOTCH
SIMGRID
STARPU
SUITESPARSE
TMG)
foreach(_package ${CTEST_PACKAGES_LIST})
add_test(FIND${_package} cmake ${CMAKE_SOURCE_DIR} -DPACKAGES=${_package})
endforeach()
endif()
###
### END CMakeLists.txt
###
......@@ -399,6 +399,7 @@ subs = {
('', 'csc_s', 'csc_d', 'csc_c', 'csc_z' ),
('', 'sequential_s', 'sequential_d', 'sequential_c', 'sequential_z' ),
('', 'coeftab_s', 'coeftab_d', 'coeftab_c', 'coeftab_z' ),
('', 'cblk_s', 'cblk_d', 'cblk_c', 'cblk_z' ),
('', 'thread_s', 'thread_d', 'thread_c', 'thread_z' ),
('', 'thread_ps', 'thread_pd', 'thread_pc', 'thread_pz' ),
......