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
Select Git revision
  • ci
  • feature/prec_xd_xz
  • master
3 results

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
Select Git revision
  • fix_find_TMG_C
  • master
2 results
Show changes
Commits on Source (302)
Showing
with 1360 additions and 1878 deletions
image: hpclib/hiepacs
default:
image: $CI_REGISTRY_IMAGE
tags: ['ci.inria.fr']
interruptible: true
Find:
build:
stage: build
image: docker
rules:
- if: $CI_PIPELINE_SOURCE == "push"
changes:
compare_to: 'refs/heads/master'
paths:
- .gitlab/Dockerfile
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE -f .gitlab/Dockerfile .
- docker push $CI_REGISTRY_IMAGE
test:
stage: test
artifacts:
name: find_ctests
expire_in: 1 week
paths:
- modules/find/tests/build/Testing/
- build
reports:
junit: build/report.xml
script:
- cd modules/find/tests
- mkdir -p build
- cd build
- cmake .. -DENABLE_CTEST=ON -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
- ctest -V
- modules/find/tests/run_ctest.sh
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update
RUN apt-get -y upgrade --no-install-recommends \
# linux base packages
bash ca-certificates cpio sudo vim wget \
# dev tools
bison cppcheck flex git pkg-config python-is-python3 \
# C/Fortran compiling tools
build-essential cmake cmake-data cmake-curses-gui gfortran
RUN apt-get -y upgrade --no-install-recommends \
# packages to find with morse_cmake
libblas-dev \
libfftw3-dev \
libfxt-dev \
liblapack-dev \
liblapacke-dev \
libmetis-dev \
libmumps-dev \
libopenmpi-dev \
libpapi-dev \
libparmetis-dev \
libptscotch-dev \
libscalapack-mpi-dev \
libsimgrid-dev \
libstarpu-dev \
libsuitesparse-dev \
petsc-dev \
slepc-dev
RUN apt-get autoremove -y
RUN apt-get autoclean -y
RUN apt-get purge -y
RUN update-ca-certificates
RUN update-alternatives --set libblas.so-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/blas/libblas.so
RUN update-alternatives --set libblas.so.3-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/blas/libblas.so.3
RUN update-alternatives --set liblapack.so-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/lapack/liblapack.so
RUN update-alternatives --set liblapack.so.3-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3
# Install QUARK
RUN git clone https://github.com/ecrc/quark && \
cd quark/ && \
git checkout db4aef9a66a00487d849cf8591927dcebe18ef2f && \
sed -i -e "s#prefix=.*#prefix=/usr#g" make.inc && \
sed -i -e "s#CFLAGS=.*#CFLAGS= -g -O2 -DADD_ -fPIC#g" make.inc && \
make && \
make install && \
cd .. && \
rm quark/ -rf
# Install PARSEC
RUN git clone https://bitbucket.org/mfaverge/parsec.git && \
cd parsec && \
git checkout mymaster && \
git checkout 6022a61dc96c25f11dd2aeabff2a5b3d7bce867d && \
git submodule update && \
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DPARSEC_GPU_WITH_CUDA=OFF -DPARSEC_DIST_WITH_MPI=ON && \
cmake --build build -j5 && \
cmake --install build && \
cd .. && \
rm parsec/ -rf
RUN groupadd -f -g 1001 gitlab && \
useradd -u 1001 -g gitlab -ms /bin/bash gitlab && \
echo "gitlab:gitlab" | chpasswd && adduser gitlab sudo
USER gitlab
# change the default shell to be bash
SHELL ["/bin/bash", "-c"]
# default working directory is
WORKDIR /home/gitlab
......@@ -13,7 +13,7 @@ git clone git@gitlab.inria.fr:username/forkname.git
Once this is done, you can setup the morse_cmake repository as the upstream of your clone to simplify the update of your fork repository.
```
#!shell
git remote add upstream git@bitbucket.org:solverstack/morse_cmake.git
git remote add upstream git@gitlab.inria.fr:solverstack/morse_cmake.git
```
Now, you have your repository configured, and you want to create a new pull request. The first step is to create a branch from the HEAD of the your fork repository.
......
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
# @copyright (c) 2016 KAUST. All rights reserved.
# @copyright (c) 2012-2020 Inria. All rights reserved.
# @copyright (c) 2012-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
......
......@@ -23,18 +23,23 @@ See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
Installation
---------------------
We recommend to use this project as a `git submodule` of your project.
# Example if morse_cmake is defined as a git submodule in ./cmake_modules/
git submodule add https://gitlab.inria.fr/solverstack/morse_cmake.git cmake_modules/morse_cmake
To use MORSE modules you have to add the path to the modules in your
CMake project and include the MorseInit module:
# Define where are located module files on your system
set(MORSE_CMAKE_MODULE_PATH "/where/is/morse_cmake" CACHE PATH "Path to morse_cmake sources")
# Append this directory to the list of directories containing CMake modules
list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}/modules/" )
# Example if Morse CMake modules are located in ./cmake_modules/morse_cmake/modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules" )
# Include the init module
include(MorseInit)
#
We recommend to use this project as a `git submodule` of your project.
Testing
---------------------
See the file [README](modules/find/tests/README.md).
Get involved!
---------------------
......
......@@ -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-2019 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -53,31 +53,66 @@ if (MORSE_ENABLE_WARNING)
endif(MORSE_ENABLE_WARNING)
if (MORSE_ENABLE_STATIC_ANALYSIS)
find_program(CLANGTIDY "clang-tidy")
if (CLANGTIDY)
set(CMAKE_C_CLANG_TIDY "${CLANGTIDY}")
endif()
find_program(CPPCHECK "cppcheck")
if (CPPCHECK)
set(CMAKE_C_CPPCHECK "${CPPCHECK}"
"--language=c"
"--enable=all"
"--force"
)
endif()
find_program(INCLUDE_WHAT_YOU_USE "iwyu")
if (INCLUDE_WHAT_YOU_USE)
set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${INCLUDE_WHAT_YOU_USE}")
endif()
set(CMAKE_LINK_WHAT_YOU_USE TRUE)
endif()
if (MORSE_ENABLE_COVERAGE)
get_property( languages GLOBAL PROPERTY ENABLED_LANGUAGES )
set( _enable_coverage FALSE )
if(CMAKE_C_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fno-inline --coverage")
else()
message(FATAL_ERROR "Code coverage is only available with the GNU C (gcc)"
"\n compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
if ( "C" IN_LIST languages )
if(CMAKE_C_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fno-inline --coverage")
set( _enable_coverage TRUE )
else()
message(FATAL_ERROR "Code coverage is only available with the GNU C (gcc)"
"\n compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-inline --coverage")
else()
message(FATAL_ERROR "Code coverage is only available with the GNU CXX"
"\n (g++) compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
if ( "CXX" IN_LIST languages )
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-inline --coverage")
set( _enable_coverage TRUE )
else()
message(FATAL_ERROR "Code coverage is only available with the GNU CXX"
"\n (g++) compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
endif()
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fPIC -fno-inline --coverage")
else()
message(FATAL_ERROR "Code coverage is only available with the GNU"
"\n Fortran (gfortran) compiler, please turn MORSE_ENABLE_COVERAGE"
"\n OFF\n.")
if ( "Fortran" IN_LIST languages )
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fPIC -fno-inline --coverage")
set( _enable_coverage TRUE )
else()
message(FATAL_ERROR "Code coverage is only available with the GNU"
"\n Fortran (gfortran) compiler, please turn MORSE_ENABLE_COVERAGE"
"\n OFF\n.")
endif()
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
if ( _enable_coverage )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
endif(MORSE_ENABLE_COVERAGE)
......
......@@ -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-2019 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -18,7 +18,7 @@
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 0.9.0
# @version 1.0.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
......@@ -28,51 +28,51 @@
###
# Set some colors
#if(NOT WIN32)
# string(ASCII 27 Esc)
# set(ColourReset "${Esc}[m")
# set(ColourBold "${Esc}[1m")
# set(Red "${Esc}[31m")
# set(Green "${Esc}[32m")
# set(Yellow "${Esc}[33m")
# set(Blue "${Esc}[34m")
# set(Magenta "${Esc}[35m")
# set(Cyan "${Esc}[36m")
# set(White "${Esc}[37m")
# set(BoldRed "${Esc}[1;31m")
# set(BoldGreen "${Esc}[1;32m")
# set(BoldYellow "${Esc}[1;33m")
# set(BoldBlue "${Esc}[1;34m")
# set(BoldMagenta "${Esc}[1;35m")
# set(BoldCyan "${Esc}[1;36m")
# set(BoldWhite "${Esc}[1;37m")
#endif()
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(ColourBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
# Colorize cmake messages during configure
function(message)
list(GET ARGV 0 MessageType)
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL WARNING)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL AUTHOR_WARNING)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL STATUS)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${Green}${ARGV_STR}${ColourReset}")
else()
string (REPLACE ";" " " ARGV_STR "${ARGV}")
string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}")
_message("${ARGV_STR}")
endif()
endfunction()
# Colorize cmake messages during configure
function(message)
list(GET ARGV 0 MessageType)
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL WARNING)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL AUTHOR_WARNING)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL STATUS)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${Green}${ARGV_STR}${ColourReset}")
else()
string (REPLACE ";" " " ARGV_STR "${ARGV}")
string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}")
_message("${ARGV_STR}")
endif()
endfunction()
endif()
##
## @end file ColorizeMessage.cmake
......
###
#
# @copyright (c) 2017-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
#
# @file GenPkgConfig.cmake
#
# @project MORSE
#
# @version 0.9.0
# @author Florent Pruvost
# @author Mathieu Faverge
# @date 2018-06-21
#
#.rst:
# GenPkgConfig
# ------------
#
# The GenPkgConfig module intend to provide functions to generate a
# pkg-config file with the right format, and a environment file that
# the user can source to setup its environment with the library
# installed.
#
# generate_pkgconfig_files(
# file1 file2 ...
# [PROJECTNAME name]
# [LIBS lib1 lib2 ...]
# [LIBS_PRIVATE lib1 lib2 ...]
# [REQUIRED pkg1 pkg2 ...]
# [REQUIRED_PRIVATE pkg1 pkg2 ...]
# )
# Where:
# - file1, file2, .. are the different input files for the
# pkg-config configuration files.
# - PROJECTNAME defines the prefix of the variables to use for the
# default following values ${PROJECTNAME}_PKGCONFIG_XXX with XXX
# being part of (LIBS, LIBS_PRIVATE, REQUIRED and
# REQUIRED_PRIVATE)
# - LIBS defines the libs of the current project for dynamic
# linking.
# - LIBS_PRIVATE defines the libs of the current project and its
# required dependencies not handled by pkg-config for static
# linking.
# - LIBS defines the additional pkg-config packages needed by the
# project for dynamic linking.
# - LIBS_PRIVATE defines the additional pkg-config packages needed
# by the project for static linking.
#
# The generated files are then installed in the subdirectory
# lib/pkgconfig of the prefix directory.
#
# generate_env_file(
# [PROJECTNAME name]
# )
# Where:
# - PROJECTNAME defines the project name of the library if different
# from CMAKE_PROJECT_NAME.
#
# The generated file is installed in the subdirectory bin of the
# prefix directory.
#
# generate_newenv_file(
# [PACKAGE name]
# [PACKAGE_TEST test]
# )
# Where:
# - PACKAGE defines the project name of the library if different
# from CMAKE_PROJECT_NAME.
# - PACKAGE_TEST defines a test string to check if the installation
# - is correct within the generated file.
#
# While the first version generates a file named $PACKAGE_env.sh, the
# new one generates a $PACKAGE_env file to avoid conflict
#
# The generated file is installed in the subdirectory bin of the
# prefix directory.
#
###
###
#
# gpc_convert_incstyle_to_pkgconfig(): convert a libraries list to
# follow the pkg-config style used in gpc_clean_lib_list
#
###
macro(gpc_convert_incstyle_to_pkgconfig _inclist)
set(${_inclist}_CPY "${${_inclist}}")
set(${_inclist} "")
foreach(_dep ${${_inclist}_CPY})
if (${_dep} MATCHES "^-")
# any compiler flag (e.g. -pthread, -DUSE_FOO): keep as it is
list(APPEND ${_inclist} ${_dep})
elseif (EXISTS ${_dep})
# an absolute path to includes: add the -I
list(APPEND ${_inclist} "-I${_dep}")
endif()
endforeach()
endmacro(gpc_convert_incstyle_to_pkgconfig)
###
#
# gpc_convert_libstyle_to_pkgconfig(): convert a libraries list to
# follow the pkg-config style used in gpc_clean_lib_list
#
###
macro(gpc_convert_libstyle_to_pkgconfig _liblist)
# Start by removing duplicates
list(REVERSE ${_liblist})
list(REMOVE_DUPLICATES ${_liblist})
list(REVERSE ${_liblist})
# Convert to pkg-config file format
set(${_liblist}_CPY "${${_liblist}}")
set(${_liblist} "")
# we consider a list of libraries as input
foreach(_dep ${${_liblist}_CPY})
if (${_dep} MATCHES "^/|^[A-Z]:/")
# case library is an absolute path (e.g. /opt/foo/lib/libfoo.so)
get_filename_component(dep_libname ${_dep} NAME)
get_filename_component(dep_libdir ${_dep} PATH)
foreach( _ext ${CMAKE_FIND_LIBRARY_SUFFIXES} )
string(REGEX REPLACE "${_ext}$" "" dep_libname "${dep_libname}")
endforeach()
string(REGEX REPLACE "^lib" "" dep_libname "${dep_libname}")
list(APPEND ${_liblist} -L${dep_libdir} -l${dep_libname})
elseif(${_dep} MATCHES "^-l|^-L")
# case library given with -l (e.g. -lfoo) or -L (e.g. -L/opt/foo/lib -lfoo)
list(APPEND ${_liblist} ${_dep})
else()
# case library given by name (e.g. foo)
list(APPEND ${_liblist} "-l${_dep}")
endif()
endforeach()
endmacro(gpc_convert_libstyle_to_pkgconfig)
###
#
# gpc_clean_lib_list(): clean libraries lists to follow the pkg-config
# style used in GENERATE_PKGCONFIG_FILE
#
###
macro(gpc_clean_lib_list _package)
if ( ${_package}_PKGCONFIG_CFLAGS )
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_CFLAGS)
gpc_convert_incstyle_to_pkgconfig(${_package}_PKGCONFIG_CFLAGS)
string(REPLACE ";" " " ${_package}_PKGCONFIG_CFLAGS "${${_package}_PKGCONFIG_CFLAGS}")
endif()
if ( ${_package}_PKGCONFIG_INCS )
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_INCS)
gpc_convert_incstyle_to_pkgconfig(${_package}_PKGCONFIG_INCS)
string(REPLACE ";" " " ${_package}_PKGCONFIG_INCS "${${_package}_PKGCONFIG_INCS}")
endif()
if ( ${_package}_PKGCONFIG_LIBS )
gpc_convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS)
string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS "${${_package}_PKGCONFIG_LIBS}")
endif()
if ( ${_package}_PKGCONFIG_LIBS_PRIVATE )
gpc_convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS_PRIVATE)
string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS_PRIVATE "${${_package}_PKGCONFIG_LIBS_PRIVATE}")
endif()
if ( ${_package}_PKGCONFIG_REQUIRED )
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED)
string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED "${${_package}_PKGCONFIG_REQUIRED}")
endif()
if ( ${_package}_PKGCONFIG_REQUIRED_PRIVATE )
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED_PRIVATE)
string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED_PRIVATE "${${_package}_PKGCONFIG_REQUIRED_PRIVATE}")
endif()
endmacro(gpc_clean_lib_list)
###
#
# generate_pkgconfig_file: generate pkg-config file
#
###
macro(generate_pkgconfig_files)
set(_options )
set(_oneValueArgs PROJECTNAME)
set(_multiValueArgs LIBS LIBS_PRIVATE REQUIRED REQUIRED_PRIVATE)
set(MN "generate_pkgconfig_files")
cmake_parse_arguments(${MN}
"${_options}" "${_oneValueArgs}"
"${_multiValueArgs}" ${ARGN} )
if ( NOT DEFINED ${MN}_PROJECTNAME )
set( ${MN}_PROJECTNAME ${CMAKE_PROJECT_NAME} )
endif()
set(ARGN ${${MN}_UNPARSED_ARGUMENTS})
# The link flags specific to this package and any required libraries
# that don't support PkgConfig
list(APPEND ${${MN}_PROJECTNAME}_PKGCONFIG_LIBS ${${MN}_LIBS})
# The link flags for private libraries required by this package but not
# exposed to applications
list(APPEND ${${MN}_PROJECTNAME}_PKGCONFIG_LIBS_PRIVATE ${${MN}_LIBS_PRIVATE})
# A list of packages required by this package
list(APPEND ${${MN}_PROJECTNAME}_PKGCONFIG_REQUIRED ${${MN}_REQUIRED})
# A list of private packages required by this package but not exposed to
# applications
list(APPEND ${${MN}_PROJECTNAME}_PKGCONFIG_REQUIRED_PRIVATE ${${MN}_REQUIRED_PRIVATE})
# Define required package
# -----------------------
gpc_clean_lib_list(${${MN}_PROJECTNAME})
foreach(f IN LISTS ARGN)
get_filename_component(fname "${f}" NAME_WE)
# Create .pc files
# ----------------
configure_file(
${f}
"${CMAKE_BINARY_DIR}/lib/pkgconfig/${fname}.pc" @ONLY)
# installation
# ------------
install(FILES
"${CMAKE_BINARY_DIR}/lib/pkgconfig/${fname}.pc"
DESTINATION lib/pkgconfig )
endforeach()
endmacro(generate_pkgconfig_files)
###
#
# generate_env_file: generate file to setup environment variables
#
###
macro(generate_env_file)
set(_options )
set(_oneValueArgs PROJECTNAME)
set(_multiValueArgs )
set(MN "generate_env_file")
cmake_parse_arguments(generate_env_file
"${_options}" "${_oneValueArgs}"
"${_multiValueArgs}" ${ARGN} )
if ( NOT DEFINED ${MN}_PROJECTNAME )
set( ${MN}_PROJECTNAME ${CMAKE_PROJECT_NAME} )
endif()
string(TOLOWER ${${MN}_PROJECTNAME} LONAME)
string(TOUPPER ${${MN}_PROJECTNAME} UPNAME)
# Create .sh file
# ---------------
configure_file(
"${MORSE_CMAKE_MODULE_PATH}/env.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/bin/${LONAME}_env.sh" @ONLY)
# installation
# ------------
# Check if the PREFIX is in the PATH or not
# If yes, no need to install this file
string(REPLACE ":" ";" pathlist "$ENV{PATH}")
if ( "${CMAKE_INSTALL_PREFIX}/bin" IN_LIST pathlist )
message( STATUS "No installation of ${LONAME}_env.sh - already in the default environment" )
else ()
message( STATUS "Install ${LONAME}_env.sh in ${CMAKE_INSTALL_PREFIX}/bin" )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${LONAME}_env.sh"
DESTINATION bin)
endif()
endmacro(generate_env_file)
###
#
# generate_env_file2: generate file to setup environment variables (StarPU-like)
#
###
macro(generate_newenv_file)
set(_options )
set(_oneValueArgs PACKAGE PACKAGE_TEST)
set(_multiValueArgs )
set(MN "generate_env_file2")
cmake_parse_arguments(generate_env_file2
"${_options}" "${_oneValueArgs}"
"${_multiValueArgs}" ${ARGN} )
set(MN "generate_pkgconfig_files")
cmake_parse_arguments(${MN}
"${_options}" "${_oneValueArgs}"
"${_multiValueArgs}" ${ARGN} )
if ( NOT DEFINED ${MN}_PACKAGE )
set( PACKAGE ${CMAKE_PROJECT_NAME} )
else()
set( PACKAGE ${${MN}_PACKAGE} )
endif()
if ( NOT DEFINED ${MN}_PACKAGE_TEST )
set( PACKAGE_TEST "0 = 0" )
else()
set( PACKAGE_TEST ${${MN}_PACKAGE_TEST} )
endif()
string(TOLOWER ${PACKAGE} PACKAGE_LC)
string(TOUPPER ${PACKAGE} PACKAGE_UC)
# Create .sh file
# ---------------
configure_file(
"${MORSE_CMAKE_MODULE_PATH}/env.in"
"${CMAKE_CURRENT_BINARY_DIR}/bin/${PACKAGE_LC}_env" @ONLY)
# installation
# ------------
# Check if the PREFIX is in the PATH or not
# If yes, no need to install this file
string(REPLACE ":" ";" pathlist "$ENV{PATH}")
if ( "${CMAKE_INSTALL_PREFIX}/bin" IN_LIST pathlist )
message( STATUS "No installation of ${PACKAGE_LC}_env - already in the default environment" )
else ()
message( STATUS "Install ${PACKAGE_LC}_env in ${CMAKE_INSTALL_PREFIX}/bin" )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/bin/${PACKAGE_LC}_env"
DESTINATION bin)
endif()
endmacro(generate_newenv_file)
##
## @end file GenPkgConfig.cmake
##
......@@ -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-2019 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -18,7 +18,7 @@
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 0.9.0
# @version 1.0.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
......@@ -27,36 +27,88 @@
#
###
# Path to Morse modules
get_filename_component(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} DIRECTORY CACHE)
# Global Morse options
option(MORSE_ENABLE_WARNING "Enable warning messages from the compiler" OFF)
option(MORSE_ENABLE_STATIC_ANALYSIS "Enable warning messages from external static analyzers such as cppcheck " OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
option(MORSE_ENABLE_COLOR_MESSAGE "Enable colors in messages" OFF)
option(MORSE_ENABLE_ENV_INCLUDE "Enable the use of INCLUDE, INCLUDE_PATH to populate CMAKE_INCLUDE_PATH in that order" ON)
option(MORSE_ENABLE_ENV_LIBRARY "Enable the use of LIBRARY_PATH, LD_LIBRARY_PATH to populate CMAKE_LIBRARY_PATH in that order" ON)
#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# " information about packages not found")
# This include is required to check symbols of libs in the main CMakeLists.txt
include(CheckFunctionExists)
# This include is required to check defines in headers
include(CheckIncludeFiles)
# To colorize messages
#include(ColorizeMessage)
# To find headers and libs
include(FindHeadersAndLibs)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
if (MORSE_ENABLE_COLOR_MESSAGE)
# colorize messages
include(ColorizeMessage)
endif()
# Define some auxilary flags
include(AuxilaryFlags)
# Define some variables to et info about ressources
# Define some variables to set info about ressources
include(Ressources)
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# " information about packages not found")
# To load some macros used in Finds (could be useful for other projects)
include(FindMorseInit)
### Build type
set( CMAKE_BUILD_TYPE_DROP_LIST "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
include(Sanitizer)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are None, Debug, Release, RelWithDebInfo, MinSizeRel, ..." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_BUILD_TYPE_DROP_LIST})
if ( MORSE_ENABLE_ENV_LIBRARY )
set(_libdir "$ENV{LIBRARY_PATH}")
if (WIN32)
set(_libdir "${_libdir}:$ENV{LIB}")
elseif (APPLE)
set(_libdir "${_libdir}:$ENV{DYLD_LIBRARY_PATH}")
else ()
set(_libdir "${_libdir}:$ENV{LD_LIBRARY_PATH}")
endif ()
string(REPLACE ":" ";" _libdir "${_libdir}")
string(REPLACE ";;" ";" _libdir "${_libdir}")
list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
list(REMOVE_DUPLICATES _libdir)
list(APPEND CMAKE_LIBRARY_PATH "${_libdir}" )
endif()
if ( MORSE_ENABLE_ENV_INCLUDE )
if(WIN32)
set( _incdir "$ENV{INCLUDE}" )
else()
set( _incdir "$ENV{INCLUDE}:" )
set( _incdir "${_incdir}:$ENV{C_INCLUDE_PATH}" )
set( _incdir "${_incdir}:$ENV{CPATH}" )
set( _incdir "${_incdir}:$ENV{INCLUDE_PATH}" )
endif()
string( REPLACE ":" ";" _incdir "${_incdir}" )
string( REPLACE ";;" ";" _incdir "${_incdir}" )
list(APPEND _incdir "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _incdir)
list(APPEND CMAKE_INCLUDE_PATH "${_incdir}" )
endif()
##
## @end file MorseInit.cmake
......
......@@ -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-2019 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......
......@@ -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-2019 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......
......@@ -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 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# @copyright (c) 2012-2019 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
......@@ -26,21 +26,25 @@
# @date 13-07-2012
#
###
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.12)
include(CMakeDependentOption)
set(RP_GENDEPENDENCIES ${MORSE_CMAKE_MODULE_PATH}/precision_generator/genDependencies.py)
set(RP_CODEGEN ${MORSE_CMAKE_MODULE_PATH}/precision_generator/codegen.py)
set(RP_CODEGEN ${MORSE_CMAKE_MODULE_PATH}/precision_generator/codegen.py)
set(RP_DEFAULT_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py
CACHE INTERNAL "Default dictionnary used for precision generation" )
# Dictionnary
# -----------
if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_DICTIONNARY )
message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_DICTIONNARY was defined (Default is used)" )
set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py
CACHE INTERNAL "Dictionnary used for precision generation" )
message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_DICTIONNARY was defined (Only the default one is used)" )
set( RP_DICTIONNARIES ""
CACHE INTERNAL "List of Dictionnaries to use for precision generation" )
else()
set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY}
CACHE INTERNAL "Dictionnary used for precision generation" )
set( RP_DICTIONNARIES ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY}
CACHE INTERNAL "List of Dictionnaries to use for precision generation" )
endif()
# Default Precisions
......@@ -159,9 +163,8 @@ endif()
include(ParseArguments)
# Add a hint to help Cmake to find the correct python version:
# (see https://cmake.org/cmake/help/v3.0/module/FindPythonInterp.html)
set(Python_ADDITIONAL_VERSIONS 2)
find_package(PythonInterp REQUIRED)
# (see https://cmake.org/cmake/help/latest/module/FindPythonInterp.html)
find_package(Python3 COMPONENTS Interpreter QUIET)
MACRO(precisions_rules_py)
PARSE_ARGUMENTS(PREC_RULE "TARGETDIR;PRECISIONS" "" ${ARGN})
......@@ -177,23 +180,24 @@ MACRO(precisions_rules_py)
message( FATAL_ERROR "precisions_rules_init must be called before any call to precisions_rules_py" )
endif()
if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_DICTIONNARY )
message( FATAL_ERROR "precisions_rules_init must be called before any call to precisions_rules_py" )
endif()
# By default the TARGETDIR is the current binary directory
if( "${PREC_RULE_TARGETDIR}" STREQUAL "" )
set(PREC_RULE_TARGETDIR "./")
set(PRECISIONPP_prefix "./")
set(PRECISIONPP_arg "-P")
else( "${PREC_RULE_TARGETDIR}" STREQUAL "" )
else()
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR})
else(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR})
endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${PREC_RULE_TARGETDIR})
set(PRECISIONPP_arg "-P")
set(PRECISIONPP_prefix "${PREC_RULE_TARGETDIR}")
endif( "${PREC_RULE_TARGETDIR}" STREQUAL "" )
endif()
message( DEBUG "[RP] PRECISIONPP_arg ${PRECISIONPP_arg}")
message( DEBUG "[RP] PRECISIONPP_prefix ${PRECISIONPP_prefix}")
message( DEBUG "[RP] PREC_RULE_PRECISIONS ${PREC_RULE_PRECISIONS}")
message( DEBUG "[RP] DICTIONNARIES ${RP_DICTIONNARIES}")
set(options_list "")
foreach(prec_rules_PREC ${PREC_RULE_PRECISIONS})
......@@ -205,8 +209,14 @@ MACRO(precisions_rules_py)
set(sources_list "${sources_list} ${_src}")
endforeach()
set(gencmd ${PYTHON_EXECUTABLE} ${RP_GENDEPENDENCIES} -f "${sources_list}" -p "${options_list}" -s "${CMAKE_CURRENT_SOURCE_DIR}" ${PRECISIONPP_arg} ${PRECISIONPP_prefix})
EXECUTE_PROCESS(COMMAND ${gencmd} OUTPUT_VARIABLE dependencies_list)
set( gencmd ${Python3_EXECUTABLE} ${RP_CODEGEN} -c -f "${sources_list}" -p "${options_list}" -s "${CMAKE_CURRENT_SOURCE_DIR}" -b "${CMAKE_CURRENT_BINARY_DIR}" ${PRECISIONPP_arg} ${PRECISIONPP_prefix} )
if( DEFINED RP_DICTIONNARIES )
set( gencmd ${gencmd} -D "${RP_DICTIONNARIES}" )
endif()
message( DEBUG "[RP] gen command ${gencmd}")
execute_process(COMMAND ${gencmd} OUTPUT_VARIABLE dependencies_list)
message( DEBUG "[RP] dependencies_list ${dependencies_list}")
foreach(_dependency ${dependencies_list})
......@@ -218,7 +228,10 @@ MACRO(precisions_rules_py)
set(_dependency_PREC "${CMAKE_MATCH_2}")
set(_dependency_OUTPUT "${CMAKE_MATCH_3}")
set(pythoncmd ${PYTHON_EXECUTABLE} ${RP_CODEGEN} -f ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} -p ${_dependency_PREC} ${PRECISIONPP_arg} ${PRECISIONPP_prefix})
set(pythoncmd ${Python3_EXECUTABLE} ${RP_CODEGEN} -g -f ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} -b "${CMAKE_CURRENT_BINARY_DIR}" -p ${_dependency_PREC} ${PRECISIONPP_arg} ${PRECISIONPP_prefix})
if( DEFINED RP_DICTIONNARIES )
set( pythoncmd ${pythoncmd} -D "${RP_DICTIONNARIES}" )
endif()
string(STRIP "${_dependency_OUTPUT}" _dependency_OUTPUT)
string(COMPARE NOTEQUAL "${_dependency_OUTPUT}" "" got_file)
......@@ -233,16 +246,21 @@ MACRO(precisions_rules_py)
# We generate a dependency only if a file will be generated
if( got_file )
set( _compile_flags "-DPRECISION_${_dependency_PREC}" )
set( _listtmp ${PREC_RULE_PRECISIONS})
list(REMOVE_ITEM _listtmp ${_dependency_PREC})
foreach( _prec ${_listtmp})
set( _compile_flags "${_compile_flags} -UPRECISION_${_prec}" )
endforeach()
if( generate_out )
# the custom command is executed in CMAKE_CURRENT_BINARY_DIR
ADD_CUSTOM_COMMAND(
OUTPUT ${_dependency_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E remove -f ${_dependency_OUTPUT} && ${pythoncmd} && chmod a-w ${_dependency_OUTPUT}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} ${RP_CODEGEN} ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY})
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 1 IS_IN_BINARY_DIR 1 )
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} ${RP_CODEGEN} ${RP_DICTIONNARIES} ${RP_DEFAULT_DICTIONNARY} )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 1 IS_IN_BINARY_DIR 1 )
else( generate_out )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 0 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 0 )
endif( generate_out )
list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT})
......@@ -250,6 +268,7 @@ MACRO(precisions_rules_py)
endif()
endforeach()
message( DEBUG "[RP] OUTPUTLIST ${OUTPUTLIST}")
message(STATUS "Generate precision dependencies in ${CMAKE_CURRENT_SOURCE_DIR} - Done")
ENDMACRO(precisions_rules_py)
......
cmake_minimum_required(VERSION 3.12)
include (CheckCCompilerFlag)
include (CheckCXXCompilerFlag)
set( SANITIZERS
TSAN ASAN LSAN MSAN UBSAN )
# ThreadSanitizer
set( TSAN_OPTION "-fsanitize=thread" )
set( TSAN_FLAGS "-g -O1" )
# AddressSanitizer
set( ASAN_OPTION "-fsanitize=address" )
set( ASAN_FLAGS " -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" )
# LeakSanitizer
set( LSAN_OPTION "-fsanitize=leak" )
set( LSAN_FLAGS "-fno-omit-frame-pointer" )
# MemorySanitizer
set( MSAN_OPTION "-fsanitize=memory" )
set( MSAN_FLAGS "-fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" )
# UndefinedBehaviour
set( UBSAN_OPTION "-fsanitize=undefined" )
set( UBSAN_FLAGS "" )
get_property( languages GLOBAL PROPERTY ENABLED_LANGUAGES )
foreach(sanitizer ${SANITIZERS} )
set(CMAKE_REQUIRED_FLAGS "${${sanitizer}_OPTION}" ) # Also needs to be a link flag for test to pass
if ( "C" IN_LIST languages )
check_c_compiler_flag( "${${sanitizer}_OPTION} ${${sanitizer}_FLAGS}" HAVE_C_${sanitizer} )
if ( HAVE_C_${sanitizer} )
set( CMAKE_C_FLAGS_${sanitizer} "${${sanitizer}_OPTION} ${${sanitizer}_FLAGS}" CACHE STRING
"Flags used by the C compiler during ${sanitizer} builds."
FORCE )
endif()
endif()
if ( "CXX" IN_LIST languages )
check_cxx_compiler_flag( "${${sanitizer}_OPTION} ${${sanitizer}_FLAGS}" HAVE_CXX_${sanitizer} )
if ( HAVE_CXX_${sanitizer} )
set( CMAKE_CXX_FLAGS_${sanitizer} "${${sanitizer}_OPTION} ${${sanitizer}_FLAGS}" CACHE STRING
"Flags used by the C++ compiler during ${sanitizer} builds."
FORCE )
endif()
endif()
if ( HAVE_C_${sanitizer} OR HAVE_CXX_${sanitizer} )
set( CMAKE_Fortran_FLAGS_${sanitizer} "" CACHE STRING
"Flags used by the Fortran compiler during ${sanitizer} builds."
FORCE )
set( CMAKE_EXE_LINKER_FLAGS_${sanitizer}
"${${sanitizer}_OPTION}" CACHE STRING
"Flags used for linking binaries during ${sanitizer} builds."
FORCE )
set( CMAKE_MODULE_LINKER_FLAGS_${sanitizer}
"" CACHE STRING
"Flags used by the linker the creation of module during ${sanitizer} builds."
FORCE )
set( CMAKE_SHARED_LINKER_FLAGS_${sanitizer}
"${${sanitizer}_OPTION}" CACHE STRING
"Flags used by the shared libraries linker during ${sanitizer} builds."
FORCE )
set( CMAKE_STATIC_LINKER_FLAGS_${sanitizer}
"" CACHE STRING
"Flags used by the static libraries linker during ${sanitizer} builds."
FORCE )
mark_as_advanced(
CMAKE_C_FLAGS_${sanitizer}
CMAKE_CXX_FLAGS_${sanitizer}
CMAKE_Fortran_FLAGS_${sanitizer}
CMAKE_EXE_LINKER_FLAGS_${sanitizer}
CMAKE_MODULE_LINKER_FLAGS_${sanitizer}
CMAKE_SHARED_LINKER_FLAGS_${sanitizer}
CMAKE_STATIC_LINKER_FLAGS_${sanitizer} )
set( CMAKE_BUILD_TYPE_DROP_LIST ${CMAKE_BUILD_TYPE_DROP_LIST} "${sanitizer}")
endif()
endforeach()
# Restore CMAKE_REQUIRED_FLAGS
set(CMAKE_REQUIRED_FLAGS)
###
#
# @copyright (c) 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
# @copyright (c) 2009-2023 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
#
###
#
# @file SetCMakeCudaArchitectures.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Mathieu Faverge
# @date 04-07-2023
#
###
if (NOT CUDAToolkit_FOUND)
message( STATUS "SetCMakeCudaArchitectures: This file should not be included if CUDA Toolkit has not bee found" )
return()
endif()
set(CMAKE_CUDA_STANDARD 11)
# Define the architectures (inspired from the MAGMA project)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "Kepler Maxwell Pascal Volta Ampere" CACHE STRING "CUDA architectures to compile for; one or more of Fermi, Kepler, Maxwell, Pascal, Volta, Turing, Ampere, Hopper, or valid sm_[0-9][0-9]" )
# NVCC options for the different cards
# sm_xx is binary, compute_xx is PTX for forward compatibility
# MIN_ARCH is the lowest requested version
if(WIN32)
# Disable separable compilation on Windows because object linking list
# becomes too long when building multiple archs and MSVC throws errors
set(CUDA_SEPARABLE_COMPILATION OFF)
else()
set(CUDA_SEPARABLE_COMPILATION ON)
endif()
set(__cuda_architectures)
# Architectures by names
# ----------------------
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Fermi)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_20" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Kepler)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_30 sm_35 sm_37" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Maxwell)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_50" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Pascal)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_60" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Volta)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_70" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Turing)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_75" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Ampere)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_80" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES Hopper)
set( ${CMAKE_PROJECT_NAME}_CUDA_TARGETS "${${CMAKE_PROJECT_NAME}_CUDA_TARGETS} sm_90" )
endif()
# Architectures versions
# ----------------------
if ( (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_20) AND (CUDA_VERSION VERSION_LESS "8.0") )
if (NOT MIN_ARCH)
set( MIN_ARCH 200 )
endif()
list(APPEND __cuda_architectures 20)
message( STATUS " compile for CUDA arch 2.0 (Fermi)" )
endif()
if ( (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_30) AND (CUDA_VERSION VERSION_LESS "10.0") )
if (NOT MIN_ARCH)
set( MIN_ARCH 300 )
endif()
list(APPEND __cuda_architectures 30)
message( STATUS " compile for CUDA arch 3.0 (Kepler)" )
endif()
if ( (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_35) AND (CUDA_VERSION VERSION_LESS "11.0") )
if (NOT MIN_ARCH)
set( MIN_ARCH 300 )
endif()
list(APPEND __cuda_architectures 35)
message( STATUS " compile for CUDA arch 3.5 (Kepler)" )
endif()
if ( (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_50) AND (CUDA_VERSION VERSION_LESS "11.0") )
if (NOT MIN_ARCH)
set( MIN_ARCH 500 )
endif()
list(APPEND __cuda_architectures 50)
message( STATUS " compile for CUDA arch 5.0 (Maxwell)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_52)
if (NOT MIN_ARCH)
set( MIN_ARCH 520 )
endif()
list(APPEND __cuda_architectures 52)
message( STATUS " compile for CUDA arch 5.2 (Maxwell)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_53)
if (NOT MIN_ARCH)
set( MIN_ARCH 530 )
endif()
list(APPEND __cuda_architectures 53)
message( STATUS " compile for CUDA arch 5.3 (Maxwell)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_60)
if (NOT MIN_ARCH)
set( MIN_ARCH 600 )
endif()
list(APPEND __cuda_architectures 60)
message( STATUS " compile for CUDA arch 6.0 (Pascal)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_61)
if (NOT MIN_ARCH)
set( MIN_ARCH 610 )
endif()
list(APPEND __cuda_architectures 61)
message( STATUS " compile for CUDA arch 6.1 (Pascal)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_62)
if (NOT MIN_ARCH)
set( MIN_ARCH 620 )
endif()
list(APPEND __cuda_architectures 62)
message( STATUS " compile for CUDA arch 6.2 (Pascal)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_70)
if (NOT MIN_ARCH)
set( MIN_ARCH 700 )
endif()
list(APPEND __cuda_architectures 70)
message( STATUS " compile for CUDA arch 7.0 (Volta)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_71)
if (NOT MIN_ARCH)
set( MIN_ARCH 710 )
endif()
list(APPEND __cuda_architectures 71)
message( STATUS " compile for CUDA arch 7.1 (Volta)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_75)
if (NOT MIN_ARCH)
set( MIN_ARCH 750 )
endif()
list(APPEND __cuda_architectures 75)
message( STATUS " compile for CUDA arch 7.5 (Turing)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_80)
if (NOT MIN_ARCH)
set( MIN_ARCH 800 )
endif()
list(APPEND __cuda_architectures 80)
message( STATUS " compile for CUDA arch 8.0 (Ampere)" )
endif()
if (${CMAKE_PROJECT_NAME}_CUDA_TARGETS MATCHES sm_90)
if (NOT MIN_ARCH)
set( MIN_ARCH 900 )
endif()
list(APPEND __cuda_architectures 90)
message( STATUS " compile for CUDA arch 9.0 (Hopper)" )
endif()
if (NOT MIN_ARCH)
message( FATAL_ERROR "${CMAKE_PROJECT_NAME}_CUDA_TARGETS must contain one or more of Fermi, Kepler, Maxwell, Pascal, Volta, Turing, Ampere, or valid sm_[0-9][0-9]" )
endif()
# Remove extra
# ------------
if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0")
list(REMOVE_ITEM __cuda_architectures "20" "21")
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0")
list(REMOVE_ITEM __cuda_architectures "20" "21")
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0")
list(REMOVE_ITEM __cuda_architectures "30" "32")
endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
list(REMOVE_ITEM __cuda_architectures "35" "50")
endif()
set(CMAKE_CUDA_ARCHITECTURES "${__cuda_architectures}")
###
#
# @copyright (c) 2012-2020 Inria. All rights reserved.
# @copyright (c) 2012-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
#
# @file cmake_uninstall.cmake.in
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 0.9.0
# @author Mathieu Faverge
# @date 13-05-2015
#
# This file is a copy-paste of the file propose by the cmake FAQ
# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
#
# If you want to use this file in your project, add the following
# block at the top-level CMakeLists.txt
#
# # uninstall target
# if(NOT TARGET uninstall)
# configure_file(
# "${MORSE_CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
# "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
# IMMEDIATE @ONLY)
#
# add_custom_target(uninstall
# COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
# endif()
#
###
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
#
# @file @LONAME@_env.sh
#
# @copyright 2016-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
# @version 0.9.0
# @author Mathieu Faverge
# @date 2024-09-26
#
# @brief Script to setup environment file inspired from StarPU
#
#!/bin/sh
PROGNAME=@PACKAGE_LC@_env
usage()
{
echo "Tool to set @PACKAGE@ environment variables"
echo ""
echo "Usage: source $PROGNAME"
echo ""
echo ""
echo "Options:"
echo " -h, --help display this help and exit"
echo " -v, --version output version information and exit"
echo ""
echo "Report bugs to <@PACKAGE_BUGREPORT@>"
}
if [ "$1" = "-v" ] || [ "$1" = "--version" ]
then
echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
usage
else
prefix=$(realpath @CMAKE_INSTALL_PREFIX@)
@PACKAGE_LC@_bindir=$(realpath @CMAKE_INSTALL_PREFIX@/bin)
@PACKAGE_LC@_libdir=$(realpath @CMAKE_INSTALL_PREFIX@/lib)
@PACKAGE_LC@_datarootdir=$(realpath @CMAKE_INSTALL_PREFIX@/share)
if [ -n "@PACKAGE_TEST@" ]
then
if test @PACKAGE_TEST@
then
echo "Setting @PACKAGE@ environment for $prefix"
export @PACKAGE_UC@_ROOT=$prefix
export PKG_CONFIG_PATH=$@PACKAGE_LC@_libdir/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$@PACKAGE_LC@_libdir:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$@PACKAGE_LC@_libdir:$DYLD_LIBRARY_PATH
export LIBRARY_PATH=$@PACKAGE_LC@_libdir:$LIBRARY_PATH
export PATH=$@PACKAGE_LC@_bindir:$PATH
export MANPATH=$@PACKAGE_LC@_datarootdir/man:$MANPATH
for d in $@PACKAGE_LC@_libdir/python3*/site-packages ; do export PYTHONPATH=$d:$PYTHONPATH ; done
else
echo "[Error] $prefix is not a valid @PACKAGE@ installation directory"
fi
fi
fi
#
# @file @LONAME@_env.sh
#
# @copyright 2016-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
# @version 0.9.0
# @author Mathieu Faverge
# @date 2018-06-21
#
#!/bin/sh
LIB=@LONAME@
export @UPNAME@_DIR=@CMAKE_INSTALL_PREFIX@
for i in PATH DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH LD_RUN_PATH INCLUDE INCLUDE_PATH PKG_CONFIG_PATH PYTHONPATH
do
for j in /@LONAME@
do
cmd1="echo \\\"\$$i\\\" | sed -E 's+^(\(.*:|\))[^:]*${j}[^:]*(\(|:.*\))$+\1\2+' | sed 's/::/:/' | sed 's/^://' | sed 's/:$//' "
temp=`eval $cmd1`;
eval "$i=$temp";
done
done
export PATH=$PATH:$@UPNAME@_DIR/bin
export LD_RUN_PATH=$LD_RUN_PATH:$@UPNAME@_DIR/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$@UPNAME@_DIR/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$@UPNAME@_DIR/lib
export LIBRARY_PATH=$LIBRARY_PATH:$@UPNAME@_DIR/lib
export PYTHONPATH=$PYTHONPATH:$@UPNAME@_DIR/lib/python
export INCLUDE=$INCLUDE:$@UPNAME@_DIR/include
export INCLUDE_PATH=$INCLUDE_PATH:$@UPNAME@_DIR/include
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$@UPNAME@_DIR/lib/pkgconfig
###
#
# @copyright (c) 2012-2020 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# @copyright (c) 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 2019 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)
if (NOT AL4SAN_INCLUDE_DIRS)
pkg_get_variable(AL4SAN_INCLUDE_DIRS al4san includedir)
endif()
set(AL4SAN_FOUND_WITH_PKGCONFIG "TRUE")
morse_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}" DIRECTORY)
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.
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2024 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find BLAS EXTENDED for MORSE projects: find include dirs and libraries
#
# This module allows to find BLAS libraries by calling the official FindBLAS module
# and handles the creation of different library lists whether the user wishes to link
# with a sequential BLAS or a multihreaded (BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES).
# BLAS is detected with a FindBLAS call then if the BLAS vendor is Intel10_64lp, ACML
# or IBMESSLMT then the module attempts to find the corresponding multithreaded libraries.
#
# 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)
# 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-2017 Florent Pruvost
# Copyright 2012-2024 Mathieu Faverge
# Copyright 2013-2024 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
......@@ -43,336 +15,135 @@
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Macro to factorize this call. required arguments allows to decide if
# the REQUIRED option must be given to find_package calls
macro(find_package_blas required)
if(BLASEXT_FIND_REQUIRED AND required)
if(BLASEXT_FIND_QUIETLY)
find_package(BLAS REQUIRED QUIET)
else()
find_package(BLAS REQUIRED)
endif()
else()
if(BLASEXT_FIND_QUIETLY)
find_package(BLAS QUIET)
else()
find_package(BLAS)
endif()
endif()
endmacro()
# add a cache variable to let the user specify the BLAS vendor
set(BLA_VENDOR "" CACHE STRING "list of possible BLAS vendor:
Open, Eigen, Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT,
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")
###
#
# - Extension of FindBLAS in order to provide both sequential and multi-threaded libraries when possible (e.g. Intel MKL)
#
# Result variables:
#
# - ``BLASEXT_FOUND`` if BLAS is found
# - ``BLAS_SEQ_LINKER_FLAGS`` sequential version of BLAS_LINKER_FLAGS
# - ``BLAS_MT_LINKER_FLAGS`` multi-threaded version of BLAS_LINKER_FLAGS
# - ``BLAS_SEQ_LIBRARIES`` sequential version of BLAS_LIBRARIES
# - ``BLAS_MT_LIBRARIES`` multi-threaded version of BLAS_LIBRARIES
#
# This module defines the following :prop_tgt:`IMPORTED` target:
#
# ``BLAS::BLAS_SEQ``
# The libraries of sequential blas, if found.
#
# ``BLAS::BLAS_MT``
# The libraries of multi-threaded blas, if found.
#
#=============================================================================
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "In FindBLASEXT")
message(STATUS "If you want to force the use of one specific library, "
"\n please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name"
"\n at cmake configure.")
message(STATUS "List of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, "
"\n DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT, Intel10_32 (intel mkl v10 32 bit),"
"\n Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),"
"\n Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"\n Intel( older versions of mkl 32 and 64 bit),"
"\n ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
message(STATUS "FindBLASEXT: Try to find BLAS")
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 ()
# detect the cases where SEQ and PAR libs are handled
if(BLA_VENDOR STREQUAL "All" AND
(BLAS_mkl_core_LIBRARY OR BLAS_mkl_core_dll_LIBRARY)
)
set(BLA_VENDOR "Intel")
if(BLAS_mkl_intel_LIBRARY)
set(BLA_VENDOR "Intel10_32")
endif()
if(BLAS_mkl_intel_lp64_LIBRARY)
set(BLA_VENDOR "Intel10_64lp")
endif()
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"\n have also potentially detected some multithreaded BLAS libraries from the MKL."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
elseif(BLA_VENDOR STREQUAL "All" AND BLAS_acml_LIBRARY)
set(BLA_VENDOR "ACML")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"\n have also potentially detected some multithreaded BLAS libraries from the ACML."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
elseif(BLA_VENDOR STREQUAL "All" AND BLAS_essl_LIBRARY)
set(BLA_VENDOR "IBMESSL")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"\n have also potentially detected some multithreaded BLAS libraries from the ESSL."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
# BLASEXT first search for the main BLAS library available
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS QUIET REQUIRED)
else()
find_package(BLAS QUIET)
endif()
# Intel case
if(BLA_VENDOR MATCHES "Intel*")
###
# look for include path if the BLAS vendor is Intel
###
# gather system include paths
unset(_inc_env)
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
set(ENV_MKLROOT "$ENV{MKLROOT}")
if (ENV_MKLROOT)
list(APPEND _inc_env "${ENV_MKLROOT}/include")
endif()
list(REMOVE_DUPLICATES _inc_env)
set(BLA_VENDOR_COPY ${BLA_VENDOR})
# find mkl.h inside known include paths
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
if(BLAS_INCDIR)
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_INCLUDE_DIRS
NAMES mkl.h
HINTS ${BLAS_INCDIR})
else()
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)
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})
macro(blasext_set_library VERSION)
if (BLAS_FOUND)
set(BLAS_${VERSION}_FOUND ${BLAS_FOUND})
if(NOT TARGET BLAS::BLAS_${VERSION})
add_library(BLAS::BLAS_${VERSION} INTERFACE IMPORTED)
endif()
if (BLAS_LINKER_FLAGS)
set(BLAS_${VERSION}_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
set_target_properties(BLAS::BLAS_${VERSION} PROPERTIES
INTERFACE_LINK_OPTIONS "${BLAS_LINKER_FLAGS}"
)
endif()
if (BLAS_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "FindBLASEXT: Found BLAS ${BLA_VENDOR}")
message(STATUS "FindBLASEXT: Store following libraries in BLAS_${VERSION}_LIBRARIES and target BLAS::BLAS_${VERSION} ${BLAS_LIBRARIES}")
endif()
set(BLAS_${VERSION}_LIBRARIES ${BLAS_LIBRARIES})
set_target_properties(BLAS::BLAS_${VERSION} PROPERTIES
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}"
)
endif()
endif()
mark_as_advanced(BLAS_mkl.h_INCLUDE_DIRS)
## Print status if not found
## -------------------------
#if (NOT BLAS_mkl.h_INCLUDE_DIRS AND MORSE_VERBOSE)
# Print_Find_Header_Status(blas mkl.h)
#endif ()
set(BLAS_INCLUDE_DIRS "")
if(BLAS_mkl.h_INCLUDE_DIRS)
list(APPEND BLAS_INCLUDE_DIRS "${BLAS_mkl.h_INCLUDE_DIRS}" )
endif()
endmacro()
###
# look for libs
###
# if Intel 10 64 bit -> look for sequential and multithreaded versions
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if (BLAS_FOUND)
## look for the sequential version
set(BLA_VENDOR "Intel10_64lp_seq")
if(BLAS_LIBRARIES MATCHES "mkl")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "Look for the sequential version Intel10_64lp_seq")
endif()
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
message(STATUS "FindBLASEXT: BLAS_LIBRARIES matches mkl")
endif()
## look for the multithreaded version
# Look for the sequential MKL
# ---------------------------
set(BLA_VENDOR "Intel10_64lp_seq")
unset(BLAS_FOUND)
unset(BLAS_LINKER_FLAGS)
unset(BLAS_LIBRARIES)
find_package(BLAS QUIET)
blasext_set_library( SEQ )
# Look for the multi-threaded MKL
# -------------------------------
set(BLA_VENDOR "Intel10_64lp")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "Look for the multithreaded version Intel10_64lp")
unset(BLAS_FOUND)
unset(BLAS_LINKER_FLAGS)
unset(BLAS_LIBRARIES)
find_package(BLAS QUIET)
blasext_set_library( MT )
# Restore the original library to make sure BLAS_LIBRARIES is set
# ---------------------------------------------------------------
set(BLA_VENDOR ${BLA_VENDOR_COPY})
unset(BLAS_FOUND)
unset(BLAS_LINKER_FLAGS)
unset(BLAS_LIBRARIES)
find_package(BLAS QUIET)
else(BLAS_LIBRARIES MATCHES "mkl")
blasext_set_library( SEQ )
endif(BLAS_LIBRARIES MATCHES "mkl")
# number of theads function detection
if(BLAS_LIBRARIES MATCHES "blis|mkl|openblas")
include(CheckFortranFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}")
if(BLAS_LIBRARIES MATCHES "blis")
unset(HAVE_BLI_THREAD_SET_NUM_THREADS CACHE)
check_fortran_function_exists(bli_thread_set_num_threads HAVE_BLI_THREAD_SET_NUM_THREADS)
elseif(BLAS_LIBRARIES MATCHES "mkl")
unset(HAVE_MKL_SET_NUM_THREADS CACHE)
check_fortran_function_exists(mkl_set_num_threads HAVE_MKL_SET_NUM_THREADS)
elseif(BLAS_LIBRARIES MATCHES "openblas")
unset(HAVE_OPENBLAS_SET_NUM_THREADS CACHE)
check_fortran_function_exists(openblas_set_num_threads HAVE_OPENBLAS_SET_NUM_THREADS)
endif()
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_BLI_THREAD_SET_NUM_THREADS OR HAVE_MKL_SET_NUM_THREADS OR HAVE_OPENBLAS_SET_NUM_THREADS)
set(HAVE_BLAS_SET_NUM_THREADS 1)
endif()
else()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
endif()
# ACML case
elseif(BLA_VENDOR MATCHES "ACML*")
## look for the sequential version
set(BLA_VENDOR "ACML")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
## look for the multithreaded version
set(BLA_VENDOR "ACML_MP")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
# IBMESSL case
elseif(BLA_VENDOR MATCHES "IBMESSL*")
## look for the sequential version
set(BLA_VENDOR "IBMESSL")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
## look for the multithreaded version
set(BLA_VENDOR "IBMESSLMT")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
else()
if(BLAS_FOUND)
# define the SEQ libs as the BLAS_LIBRARIES
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
else(BLAS_FOUND)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "FindBLASEXT: BLAS not found or BLAS_LIBRARIES does not match mkl")
endif()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
endif(BLAS_FOUND)
if(BLAS_SEQ_LIBRARIES)
set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
endif()
# extract libs paths
# remark: because it is not given by find_package(BLAS)
set(BLAS_LIBRARY_DIRS "")
string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")
foreach(blas_lib ${BLAS_LIBRARIES})
if (EXISTS "${blas_lib}")
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
else()
string(REPLACE "-L" "" blas_lib "${blas_lib}")
if (EXISTS "${blas_lib}")
list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" )
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}" )
endif()
endif()
endif()
endforeach()
if (BLAS_LIBRARY_DIRS)
list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)
endif ()
set(BLA_VENDOR ${BLA_VENDOR_COPY})
# check that BLASEXT has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
if(BLA_VENDOR MATCHES "Intel*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is Intel MKL")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS
BLAS_INCLUDE_DIRS)
if(BLA_VENDOR MATCHES "Intel10_64lp*" AND BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_PAR_LIBRARIES)
endif()
elseif(BLA_VENDOR MATCHES "ACML*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is ACML")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
if(BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_PAR_LIBRARIES)
endif()
elseif(BLA_VENDOR MATCHES "IBMESSL*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is ESSL")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
if(BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_PAR_LIBRARIES)
endif()
else()
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
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()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_LIBRARIES)