diff --git a/cmake_modules/GenPkgConfig.cmake b/cmake_modules/GenPkgConfig.cmake deleted file mode 100644 index a8044b2ff699f8daab3a84af5c529e10d5915930..0000000000000000000000000000000000000000 --- a/cmake_modules/GenPkgConfig.cmake +++ /dev/null @@ -1,135 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file GenPkgConfig.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 10-11-2014 -# -### - -### -# -# GENERATE_PKGCONFIG_FILE: generate a file .pc according to the options -# -### -MACRO(GENERATE_PKGCONFIG_FILE _file) - - # The link flags specific to this package and any required libraries - # that don't support PkgConfig - set(CHAMELEON_PKGCONFIG_LIBS "") - # The link flags for private libraries required by this package but not - # exposed to applications - set(CHAMELEON_PKGCONFIG_LIBS_PRIVATE "") - # A list of packages required by this package - set(CHAMELEON_PKGCONFIG_REQUIRED "") - # A list of private packages required by this package but not exposed to - # applications - set(CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE "") - - list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon) - if(CHAMELEON_SCHED_STARPU) - list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon_starpu) - if ( CHAMELEON_USE_MPI ) - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED - starpumpi-${STARPU_VERSION_STRING}) - else() - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED - starpu-${STARPU_VERSION_STRING}) - endif() - elseif(CHAMELEON_SCHED_QUARK) - list(APPEND CHAMELEON_PKGCONFIG_LIBS -lchameleon_quark) - list(APPEND CHAMELEON_PKGCONFIG_LIBS "-l${QUARK_quark_LIBRARY}") - endif() - - - if(NOT CHAMELEON_SIMULATION) - - if(CHAMELEON_USE_CUDA) - list(APPEND CHAMELEON_PKGCONFIG_LIBS ${CUDA_LIBRARIES}) - endif() - - if(CHAMELEON_USE_MAGMA) - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED magma) - endif() - - list(APPEND CHAMELEON_PKGCONFIG_LIBS - -lcoreblas - ${LAPACKE_LIBRARIES} - ${CBLAS_LIBRARIES} - ${EXTRA_LIBRARIES} - ) - - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED hwloc) - - else(NOT CHAMELEON_SIMULATION) - - list(APPEND CHAMELEON_PKGCONFIG_LIBS - -lcoreblas - -lsimulapacke - -lsimucblas - ${EXTRA_LIBRARIES} - ) - - list(APPEND CHAMELEON_PKGCONFIG_REQUIRED hwloc) - - endif(NOT CHAMELEON_SIMULATION) - - # Define required package - # ----------------------- - set(CHAMELEON_PKGCONFIG_LIBS_CPY "${CHAMELEON_PKGCONFIG_LIBS}") - set(CHAMELEON_PKGCONFIG_LIBS "") - foreach(_dep ${CHAMELEON_PKGCONFIG_LIBS_CPY}) - get_filename_component(dep_we ${_dep} NAME) - STRING(REPLACE "lib" "-l" dep_we "${dep_we}") - STRING(REPLACE ".so" "" dep_we "${dep_we}") - STRING(REPLACE ".a" "" dep_we "${dep_we}") - STRING(REPLACE ".dylib" "" dep_we "${dep_we}") - STRING(REPLACE ".dll" "" dep_we "${dep_we}") - list(APPEND CHAMELEON_PKGCONFIG_LIBS ${dep_we}) - endforeach() - - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_LIBS) - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_LIBS_PRIVATE) - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_REQUIRED) - list(REMOVE_DUPLICATES CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE) - - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_LIBS "${CHAMELEON_PKGCONFIG_LIBS}") - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_LIBS_PRIVATE "${CHAMELEON_PKGCONFIG_LIBS_PRIVATE}") - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_REQUIRED "${CHAMELEON_PKGCONFIG_REQUIRED}") - STRING(REPLACE ";" " " CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE "${CHAMELEON_PKGCONFIG_REQUIRED_PRIVATE}") - - # Create .pc file - # --------------- - SET(_output_file "${CMAKE_BINARY_DIR}/chameleon.pc") - # TODO: add url of MORSE releases in .pc file - CONFIGURE_FILE("${_file}" "${_output_file}" @ONLY) - - # installation - # ------------ - INSTALL(FILES ${_output_file} DESTINATION lib/pkgconfig) - -ENDMACRO(GENERATE_PKGCONFIG_FILE) - -## -## @end file GenPkgConfig.cmake -## diff --git a/cmake_modules/PrintOpts.cmake b/cmake_modules/PrintOpts.cmake deleted file mode 100644 index 4a096ec338b80d772b822854e7753dcae8684647..0000000000000000000000000000000000000000 --- a/cmake_modules/PrintOpts.cmake +++ /dev/null @@ -1,85 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file PrintOpts.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Florent Pruvost -# @date 10-11-2014 -# -### -set(dep_message "\nConfiguration of Chameleon:\n" - " BUILDNAME ...........: ${BUILDNAME}\n" - " SITE ................: ${SITE}\n" - "\n" - " Compiler: C .........: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})\n" - " Compiler: Fortran ...: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID})\n") -if(CHAMELEON_USE_MPI) - set(dep_message "${dep_message}" - " Compiler: MPI .......: ${MPI_C_COMPILER}\n" - " compiler flags ......: ${MPI_C_COMPILE_FLAGS}\n") -endif() -set(dep_message "${dep_message}" -" Linker: .............: ${CMAKE_LINKER}\n" -"\n" -" Build type ..........: ${CMAKE_BUILD_TYPE}\n" -" Build shared ........: ${BUILD_SHARED_LIBS}\n" -" CFlags ..............: ${CMAKE_C_FLAGS}\n" -" LDFlags .............: ${CMAKE_C_LINK_FLAGS}\n" -"\n" -" Implementation paradigm\n" -" CUDA ................: ${CHAMELEON_USE_CUDA}\n" -" MPI .................: ${CHAMELEON_USE_MPI}\n" -"\n" -" Runtime specific\n" -" QUARK ...............: ${CHAMELEON_SCHED_QUARK}\n" -" StarPU ..............: ${CHAMELEON_SCHED_STARPU}\n" -" FxT .................: ${CHAMELEON_USE_FXT}\n" -"\n" -" Kernels specific\n" -" BLAS ................: ${BLA_VENDOR}\n" -" MAGMA ...............: ${CHAMELEON_USE_MAGMA}\n" -"\n" -" Simulation mode .....: ${CHAMELEON_SIMULATION}\n" -"\n" -" Binaries to build\n" -" documentation ........: ${CHAMELEON_ENABLE_DOCS}\n" -" example ..............: ${CHAMELEON_ENABLE_EXAMPLE}\n" -" testing ..............: ${CHAMELEON_ENABLE_TESTING}\n" -" timing ...............: ${CHAMELEON_ENABLE_TIMING}\n" -"\n" -" CHAMELEON dependencies :\n") -foreach (_dep ${CHAMELEON_DEP}) - set(dep_message "${dep_message}" - " ${_dep}\n") -endforeach () -set(dep_message "${dep_message}" -"\n" -" Definitions: ${CHAMELEON_DEFINITIONS_LIST}\n") -set(dep_message "${dep_message}" -"\n" -" INSTALL_PREFIX ......: ${CMAKE_INSTALL_PREFIX}\n\n") - -string(REPLACE ";" " " dep_message_wsc "${dep_message}") -#message(${dep_message}) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config.log "${dep_message_wsc}") -message(STATUS "Configuration is done - A summary of the current configuration" -"has been written in ${CMAKE_CURRENT_BINARY_DIR}/config.log") -# installation -# ------------ -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.log DESTINATION share/chameleon) diff --git a/cmake_modules/array2d.cmake b/cmake_modules/array2d.cmake deleted file mode 100644 index 251130b577105299c5b295139bb5631f325df8fc..0000000000000000000000000000000000000000 --- a/cmake_modules/array2d.cmake +++ /dev/null @@ -1,46 +0,0 @@ - -#------------------------------------------------------------------- - -macro( array2d_get_item out_value offset ) - math( EXPR _finalindex "${_array2d_index}+${offset}" ) - list( GET _array2d_array ${_finalindex} _item ) - set( ${out_value} "${_item}" ) -endmacro() - -#------------------------------------------------------------------- - -macro( array2d_begin_loop out_advanced array width var_names ) - set( _array2d_out_advanced ${out_advanced} ) - set( _array2d_index 0 ) - set( _array2d_array ${array} ) - set( _array2d_width ${width} ) - set( _array2d_var_names ${var_names} ) - array2d_advance() -endmacro() - -#------------------------------------------------------------------- - -macro( array2d_advance ) - if( NOT _array2d_array ) - set( ${_array2d_out_advanced} false ) - else() - list( LENGTH _array2d_array _size ) - math( EXPR _remaining "${_size}-${_array2d_index}" ) - - if( (_array2d_width LESS 1) OR (_size LESS _array2d_width) OR (_remaining LESS _array2d_width) ) - set( ${_array2d_out_advanced} false ) - else() - math( EXPR _adjusted_width "${_array2d_width}-1" ) - foreach( offset RANGE ${_adjusted_width} ) - list( GET _array2d_var_names ${offset} _var_name ) - array2d_get_item( ${_var_name} ${offset} ) - endforeach() - - math( EXPR _index "${_array2d_index}+${_array2d_width}" ) - set( _array2d_index ${_index} ) - set( ${_array2d_out_advanced} true ) - endif() - endif() -endmacro() - -#------------------------------------------------------------------- \ No newline at end of file diff --git a/cmake_modules/morse/AuxilaryFlags.cmake b/cmake_modules/morse/AuxilaryFlags.cmake deleted file mode 100644 index 9b15b0f33ddf639a35d1a25fefab722f7f056534..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/AuxilaryFlags.cmake +++ /dev/null @@ -1,39 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file AuxilaryFlags.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Xavier Lacoste -# @date 30-01-2015 -# -# Define auxilary variables: -# - CMAKE_Fortran_PREPROCESS_FLAGS : force C preprocessor. -# - CMAKE_Fortran_FREEFORM_FLAG : Force free format. -# - CMAKE_Fortran -### - - -IF(CMAKE_Fortran_COMPILER_ID MATCHES GNU) - list(APPEND CMAKE_Fortran_PREPROCESS_FLAGS "-cpp") - list(APPEND CMAKE_Fortran_FREEFORM_FLAG "-ffree-form") - -ELSEIF(CMAKE_Fortran_COMPILER_ID MATCHES Intel) - list(APPEND CMAKE_Fortran_PREPROCESS_FLAG "-fpp") - list(APPEND CMAKE_Fortran_FREEFORM_FLAG "") -ENDIF() diff --git a/cmake_modules/morse/ColorizeMessage.cmake b/cmake_modules/morse/ColorizeMessage.cmake deleted file mode 100644 index e0e4d2b656968fc5c0581ed5b8b8e2b015d8c37a..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/ColorizeMessage.cmake +++ /dev/null @@ -1,79 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file ColorizeMessage.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 13-07-2012 -# -### - -# 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() - -# 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() - -## -## @end file ColorizeMessage.cmake -## diff --git a/cmake_modules/morse/FindHeadersAndLibs.cmake b/cmake_modules/morse/FindHeadersAndLibs.cmake deleted file mode 100644 index 0f5eadde7b0618cc20e65feab12de5982b2fe3cc..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/FindHeadersAndLibs.cmake +++ /dev/null @@ -1,100 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file FindHeadersAndLibs.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 13-07-2012 -# -### - -# Add the path where we handle our FindFOO.cmake to seek for liraries -list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) - -# Some macros to print status when search for headers and libs -# PrintFindStatus.cmake is in cmake_modules/morse/find directory -include(PrintFindStatus) - - -function(FindHeader _libname _header_to_find) - - # save _libname upper and lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - 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}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the _header_to_find in the given paths - # -------------------------------------------------- - # call cmake macro to find the header path - if(${LIBNAME}_INCDIR) - set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND") - find_path(${LIBNAME}_${_header_to_find}_DIRS - NAMES ${_header_to_find} - HINTS ${${LIBNAME}_INCDIR}) - elseif(${LIBNAME}_DIR) - set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND") - find_path(${LIBNAME}_${_header_to_find}_DIRS - NAMES ${_header_to_find} - HINTS ${${LIBNAME}_DIR} - PATH_SUFFIXES include) - else() - set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND") - find_path(${LIBNAME}_${_header_to_find}_DIRS - NAMES ${_header_to_find} - HINTS ${_inc_env}) - endif() - mark_as_advanced(${LIBNAME}_${_header_to_find}_DIRS) - - # Print status if not found - # ------------------------- - if (NOT ${LIBNAME}_${_header_to_find}_DIRS) - Print_Find_Header_Status(${libname} ${_header_to_find}) - endif () - -endfunction(FindHeader) - - -## -## @end file FindHeadersAndLibs.cmake -## diff --git a/cmake_modules/morse/MorseInit.cmake b/cmake_modules/morse/MorseInit.cmake deleted file mode 100644 index c4ed4fd337f4f8ec9e9e7773f34ba2648c84d710..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/MorseInit.cmake +++ /dev/null @@ -1,58 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file MorseInit.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @author Florent Pruvost -# @date 13-07-2012 -# -### - -# This include is required to check symbols of libs in the main CMakeLists.txt -include(CheckFunctionExists) - -# 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) - -# Define some auxilary flags -include(AuxilaryFlags) - -# Define some variables to et info about ressources -include(Ressources) - -# Add the path where we handle our FindFOO.cmake to seek for liraries -list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) - -option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning no found packages" OFF) -#message("-- ${BoldGreen}MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get" -# "information about packages not found${ColourReset}") - -## -## @end file MorseInit.cmake -## diff --git a/cmake_modules/morse/ParseArguments.cmake b/cmake_modules/morse/ParseArguments.cmake deleted file mode 100644 index 1407ded47d3d57d3f7ac8e5048188988e1e9bcb6..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/ParseArguments.cmake +++ /dev/null @@ -1,71 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file ParseArguments.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Cedric Castagnede -# @author Emmanuel Agullo -# @author Mathieu Faverge -# @date 13-07-2012 -# -### - -MACRO(PARSE_ARGUMENTS prefix arg_names option_names) - set(DEFAULT_ARGS) - foreach(arg_name ${arg_names}) - set(${prefix}_${arg_name}) - endforeach(arg_name) - foreach(option ${option_names}) - set(${prefix}_${option} FALSE) - endforeach(option) - - set(current_arg_name DEFAULT_ARGS) - set(current_arg_list) - foreach(arg ${ARGN}) - set(larg_names ${arg_names}) - list(FIND larg_names "${arg}" is_arg_name) - if(is_arg_name GREATER -1) - set(${prefix}_${current_arg_name} ${current_arg_list}) - set(current_arg_name ${arg}) - set(current_arg_list) - else(is_arg_name GREATER -1) - set(loption_names ${option_names}) - list(FIND loption_names "${arg}" is_option) - if(is_option GREATER -1) - set(${prefix}_${arg} TRUE) - else(is_option GREATER -1) - set(current_arg_list ${current_arg_list} ${arg}) - endif(is_option GREATER -1) - endif(is_arg_name GREATER -1) - endforeach(arg) - set(${prefix}_${current_arg_name} ${current_arg_list}) - -ENDMACRO(PARSE_ARGUMENTS) - -MACRO(CAR var) - set(${var} ${ARGV1}) -ENDMACRO(CAR) - -MACRO(CDR var junk) - set(${var} ${ARGN}) -ENDMACRO(CDR) - -## -## @end file ParseArguments.cmake -## diff --git a/cmake_modules/morse/PrintFindStatus.cmake b/cmake_modules/morse/PrintFindStatus.cmake deleted file mode 100644 index 1ea56edb0b856fe1bbd482a5aef2c65a195f12d0..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/PrintFindStatus.cmake +++ /dev/null @@ -1,210 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Some macros to print status when search for headers and libs -# Main parameters of macros -# _libname: name of the lib you seek, foo for example -# _header_to_find: name of the header you seek, foo.h for example -# _lib_to_find: name of the library you seek, libfoo for example -# _pc_to_find: name of the pkg-config file zyou seek, foo.pc for example - - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -# 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() - - -# This macro informs why the _header_to_find file has not been found -macro(Print_Find_Header_Status _libname _header_to_find) - - # save _libname upper and lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_INCDIR) - message("${Blue}${LIBNAME}_INCDIR is defined but ${_header_to_find}" - "has not been found in ${${LIBNAME}_INCDIR}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Blue}${LIBNAME}_DIR is defined but" - "${_header_to_find} has not been found in" - "${${LIBNAME}_DIR}/include${ColourReset}") - else() - message("${Blue}${_header_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_INCDIR" - "are defined so that we looked for ${_header_to_find} in" - "system paths (INCLUDE, CPATH, C_INCLUDE_PATH," - "INCLUDE_PATH, CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES" - ", CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)${ColourReset}") - if(_inc_env) - message("${Blue}${_header_to_find} has not been found in" - "${_inc_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldBlue}Please indicate where to find ${_header_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the headers with cmake option: -D${LIBNAME}_INCDIR=your/path/to/${libname}/include/\n" - "- Option 3: Update your environment variable (INCLUDE or CPATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - #message(" ") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${${LIBNAME}_LIBDIR}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${${LIBNAME}_DIR}/lib(or /lib32 or" - "/lib64)${ColourReset}") - else() - message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we looked 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}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "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}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_CheckFunc_Status _name) - - # save _libname upper/lower case - string(TOUPPER ${_name} FUNCNAME) - string(TOLOWER ${_name} funcname) - - # print status - #message(" ") - message("${Red}Libs have been found but check of symbol ${_name} failed " - "with following libraries ${ARGN}${ColourReset}") - message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log" - "to figure out why it fails${ColourReset}") - #message(" ") - -endmacro() - -# This macro informs that _pc_to_find file has not been found in the list -# path you give as last argument (read in ${ARGN}) -# ex: Print_Find_Pkgconfig_Status(foo foo.pc ${PATHLIST} -macro(Print_Find_Pkgconfig_Status _libname _pc_to_find) - - # save _libname lower case - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - message("${Magenta}${_pc_to_find} has not been found in" - "${ARGN}${ColourReset}") - message("${BoldMagenta}If you really want to use the pkg-config file of" - "${libname}, please update your PKG_CONFIG_PATH with the path" - "where ${_pc_to_find} states${ColourReset}") - #message(" ") - -endmacro() diff --git a/cmake_modules/morse/Ressources.cmake b/cmake_modules/morse/Ressources.cmake deleted file mode 100644 index 3a5cf6cdf0fb7ba0418925acb2252dccc0a8224d..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/Ressources.cmake +++ /dev/null @@ -1,56 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file Ressources.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Florent Pruvost -# @date 13-05-2015 -# -# Define variables for hardware ressources: -# - NUMBER_OF_CPU. -# - TODO: NUMBER_OF_CUDA. -### - - -if(NOT DEFINED PROCESSOR_COUNT) - # Unknown: - set(NUMBER_OF_CPU 0) - - # Linux: - set(cpuinfo_file "/proc/cpuinfo") - if(EXISTS "${cpuinfo_file}") - file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$") - list(LENGTH procs NUMBER_OF_CPU) - endif() - - # Mac: - if(APPLE) - find_program(cmd_sys_pro "system_profiler") - if(cmd_sys_pro) - execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info) - string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1" - NUMBER_OF_CPU "${info}") - endif() - endif() - - # Windows: - if(WIN32) - set(NUMBER_OF_CPU "$ENV{NUMBER_OF_PROCESSORS}") - endif() -endif() diff --git a/cmake_modules/morse/RulesPrecisions.cmake b/cmake_modules/morse/RulesPrecisions.cmake deleted file mode 100644 index bef0c4418aa0aba574c03309df6dd921f7446998..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/RulesPrecisions.cmake +++ /dev/null @@ -1,257 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# @file RulesPrecisions.cmake -# -# @project MORSE -# MORSE is a software package provided by: -# Inria Bordeaux - Sud-Ouest, -# Univ. of Tennessee, -# King Abdullah Univesity of Science and Technology -# Univ. of California Berkeley, -# Univ. of Colorado Denver. -# -# @version 0.9.0 -# @author Thomas Herault -# @author George Bosilca -# @author Aurelien Bouteiller -# @author Mathieu Faverge -# @author Florent Puvost -# @date 13-07-2012 -# -### -cmake_minimum_required(VERSION 2.8) -include(CMakeDependentOption) - -set(RP_GENDEPENDENCIES ${MORSE_CMAKE_MODULE_PATH}/precision_generator/genDependencies.py) -set(RP_CODEGEN ${MORSE_CMAKE_MODULE_PATH}/precision_generator/codegen.py) - -# 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" ) -else() - set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY} - CACHE INTERNAL "Dictionnary used for precision generation" ) -endif() - -# Default Precisions -# ------------------ -if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_PRECISIONS ) - message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_PRECISIONS was defined (\"s;d;c;z\" is used)" ) - set(RP_${CMAKE_PROJECT_NAME}_PRECISIONS "s;d;c;z" - CACHE INTERNAL "Set of available precisions for the project" ) -else() - set(RP_${CMAKE_PROJECT_NAME}_PRECISIONS ${RP_${CMAKE_PROJECT_NAME}_PRECISIONS} - CACHE INTERNAL "Set of available precisions for the project" ) -endif() - -# Detect if compilation is done in or out of place -# ------------------------------------------------ -string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" __inplace) -set( ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ${__inplace} - CACHE INTERNAL "Defines if the project compilation is made inplace or not" ) - -# Detect default settings -# ----------------------- -set( _prec_S OFF ) -set( _prec_D OFF ) -set( _prec_DS OFF ) -set( _prec_C OFF ) -set( _prec_Z OFF ) -set( _prec_ZC OFF ) -foreach(_prec ${RP_${CMAKE_PROJECT_NAME}_PRECISIONS}) - if ( ${_prec} STREQUAL "zc" ) - set( _prec_S ON ) - set( _prec_D ON ) - set( _prec_C ON ) - set( _prec_Z ON ) - set( _prec_ZC ON ) - elseif( ${_prec} STREQUAL "z" ) - set( _prec_D ON ) - set( _prec_Z ON ) - elseif( ${_prec} STREQUAL "c" ) - set( _prec_S ON ) - set( _prec_C ON ) - elseif( ${_prec} STREQUAL "ds" ) - set( _prec_S ON ) - set( _prec_D ON ) - set( _prec_DS ON ) - elseif( ${_prec} STREQUAL "d" ) - set( _prec_S ON ) - elseif( ${_prec} STREQUAL "s" ) - set( _prec_S ON ) - endif() -endforeach() - -# set computed precisions -# ----------------------- -if( ${_prec_S} ) - option(${PROJECT_NAME}_PREC_S - "Build ${PROJECT_NAME} real single precision" ON) -endif() -if( ${_prec_D} ) - option(${PROJECT_NAME}_PREC_D - "Build ${PROJECT_NAME} real double precision" ON) -endif() - -if( ${_prec_C} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_C - "Build ${PROJECT_NAME} complex single precision" ON "${PROJECT_NAME}_PREC_S" OFF) -endif() -if( ${_prec_Z} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_Z - "Build ${PROJECT_NAME} complex double precision" ON "${PROJECT_NAME}_PREC_D" OFF) -endif() - -if( ${_prec_DS} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_DS - "Build ${PROJECT_NAME} real mixed precision" ON "${PROJECT_NAME}_PREC_S;${PROJECT_NAME}_PREC_D" OFF) -endif() -if( ${_prec_ZC} ) - cmake_dependent_option(${PROJECT_NAME}_PREC_ZC - "Build ${PROJECT_NAME} complex mixed precision" ON "${PROJECT_NAME}_PREC_C;${PROJECT_NAME}_PREC_Z" OFF) -endif() - -# Define precision supported by the project -# ----------------------------------------- -set( ${CMAKE_PROJECT_NAME}_PRECISION "" ) -if(${CMAKE_PROJECT_NAME}_PREC_S) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "s") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_D) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "d") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_DS) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "ds") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_C) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "c") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_Z) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "z") -endif() - -if(${CMAKE_PROJECT_NAME}_PREC_ZC) - list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "zc") -endif() - -# -# Generates a rule for every SOURCES file, to create the precisions in PRECISIONS. If TARGETDIR -# is not empty then all generated files will be prepended with the $TARGETDIR/. -# A new file is created, from a copy by default -# If the first precision is "/", all occurences of the basename in the file are remplaced by -# "pbasename" where p is the selected precision. -# the target receives a -DPRECISION_p in its cflags. -# -include(ParseArguments) -find_package(PythonInterp REQUIRED) - -MACRO(precisions_rules_py) - PARSE_ARGUMENTS(PREC_RULE "TARGETDIR;PRECISIONS" "" ${ARGN}) - - message(STATUS "Generate precision dependencies in ${CMAKE_CURRENT_SOURCE_DIR}") - - # The first is the output variable list - CAR(OUTPUTLIST ${PREC_RULE_DEFAULT_ARGS}) - # Everything else should be source files. - CDR(SOURCES ${PREC_RULE_DEFAULT_ARGS}) - - if( NOT DEFINED ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ) - 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 "" ) - 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 "" ) - - set(options_list "") - foreach(prec_rules_PREC ${PREC_RULE_PRECISIONS}) - set(options_list "${options_list} ${prec_rules_PREC}") - endforeach() - - set(sources_list "") - foreach(_src ${SOURCES}) - 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) - - foreach(_dependency ${dependencies_list}) - - string(STRIP "${_dependency}" _dependency) - string(COMPARE NOTEQUAL "${_dependency}" "" not_empty) - if( not_empty ) - - string(REGEX REPLACE "^(.*),(.*),(.*)$" "\\1" _dependency_INPUT "${_dependency}") - 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}) - - string(STRIP "${_dependency_OUTPUT}" _dependency_OUTPUT) - string(COMPARE NOTEQUAL "${_dependency_OUTPUT}" "" got_file) - - # Force the copy of the original files in the binary_dir - # for VPATH compilation - if( NOT ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ) - set(generate_out 1) - else( NOT ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ) - string(COMPARE NOTEQUAL "${_dependency_OUTPUT}" "${_dependency_INPUT}" generate_out ) - endif() - - # We generate a dependency only if a file will be generated - if( got_file ) - 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 ) - - else( generate_out ) - set_SOURCE_FILES_PROPERTIES(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 0 ) - endif( generate_out ) - - list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT}) - endif( got_file ) - endif() - endforeach() - - message(STATUS "Generate precision dependencies in ${CMAKE_CURRENT_SOURCE_DIR} - Done") - -ENDMACRO(precisions_rules_py) - -## -## @end file RulesPrecisions.cmake -## diff --git a/cmake_modules/morse/find/FindBLAS.cmake b/cmake_modules/morse/find/FindBLAS.cmake deleted file mode 100644 index 22db03278774a8885e387ab145ab0a7411bc0fa7..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindBLAS.cmake +++ /dev/null @@ -1,1135 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find BLAS library -# This module finds an installed fortran library that implements the BLAS -# linear-algebra interface (see http://www.netlib.org/blas/). -# The list of libraries searched for is taken -# from the autoconf macro file, acx_blas.m4 (distributed at -# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). -# -# This module sets the following variables: -# BLAS_FOUND - set to true if a library implementing the BLAS interface -# is found -# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l -# and -L). -# BLAS_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers). -# BLAS_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use BLAS -# BLAS95_LIBRARIES - uncached list of libraries (using full path name) -# to link against to use BLAS95 interface -# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface -# is found -# BLA_STATIC if set on this determines what kind of linkage we do (static) -# BLA_VENDOR if set checks only the specified vendor, if not set checks -# all the possibilities -# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DBLAS_DIR=path/to/blas): -# BLAS_DIR - Where to find the base directory of blas -# BLAS_INCDIR - Where to find the header files -# BLAS_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: BLAS_DIR, BLAS_INCDIR, BLAS_LIBDIR -# For MKL case and if no paths are given as hints, we will try to use the MKLROOT -# environment variable -########## -### List of vendors (BLA_VENDOR) valid in this module -########## List of vendors (BLA_VENDOR) valid in this module -## 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 -# C/CXX should be enabled to use Intel mkl -### -# We handle different modes to find the dependency -# -# - Detection if already installed on the system -# - BLAS libraries can be detected from different ways -# Here is the order of precedence: -# 1) we look in cmake variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined -# 2) we look in environment variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined -# 3) we look in common environnment variables depending on the system (INCLUDE, C_INCLUDE_PATH, CPATH - LIB, DYLD_LIBRARY_PATH, LD_LIBRARY_PATH) -# 4) we look in common system paths depending on the system, see for example paths contained in the following cmake variables: -# - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES -# - CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_C_IMPLICIT_LINK_DIRECTORIES -# - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file 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 CMake, substitute the full -# License text for the above reference.) - - -# 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() - -## Some macros to print status when search for headers and libs -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "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}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the Installation directory of BLAS library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_CheckFunc_Status _name) - - # save _libname upper/lower case - string(TOUPPER ${_name} FUNCNAME) - string(TOLOWER ${_name} funcname) - - # print status - #message(" ") - message("${Red}Libs have been found but check of symbol ${_name} failed " - "with following libraries ${ARGN}${ColourReset}") - message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log" - "to figure out why it fails${ColourReset}") - #message(" ") - -endmacro() - -if (NOT BLAS_FOUND) - set(BLAS_DIR "" CACHE PATH "Installation directory of BLAS library") - if (NOT BLAS_FIND_QUIETLY) - message(STATUS "A cache variable, namely BLAS_DIR, has been set to specify the install directory of BLAS") - endif() -endif() - -option(BLAS_VERBOSE "Print some additional information during BLAS libraries detection" OFF) - -include(CheckFunctionExists) -include(CheckFortranFunctionExists) - -set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -# Check the language being used -get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) -if( _LANGUAGES_ MATCHES Fortran ) - set( _CHECK_FORTRAN TRUE ) -elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) - set( _CHECK_FORTRAN FALSE ) -else() - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") - else() - message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") - return() - endif() -endif() - -macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - - set(_libdir ${ARGN}) - - set(_libraries_work TRUE) - set(${LIBRARIES}) - set(_combined_name) - set(ENV_MKLROOT "$ENV{MKLROOT}") - set(ENV_BLAS_DIR "$ENV{BLAS_DIR}") - set(ENV_BLAS_LIBDIR "$ENV{BLAS_LIBDIR}") - if (NOT _libdir) - if (BLAS_LIBDIR) - list(APPEND _libdir "${BLAS_LIBDIR}") - elseif (BLAS_DIR) - 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") - else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") - endif() - elseif(ENV_BLAS_LIBDIR) - list(APPEND _libdir "${ENV_BLAS_LIBDIR}") - elseif(ENV_BLAS_DIR) - 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") - else() - list(APPEND _libdir "${ENV_BLAS_DIR}/lib32") - list(APPEND _libdir "${ENV_BLAS_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() - endif() - if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${_libdir2}") - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() - endif () - - if (BLAS_VERBOSE) - message("${Cyan}Try to find BLAS libraries: ${_list}") - endif () - - foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - if(_libraries_work) - if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else () - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif () - else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () - endif () - find_library(${_prefix}_${_library}_LIBRARY - NAMES ${_library} - HINTS ${_libdir} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - # Print status if not found - # ------------------------- - if (NOT ${_prefix}_${_library}_LIBRARY AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE) - Print_Find_Library_Blas_Status(blas ${_library} ${_libdir}) - endif () - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) - endforeach(_library ${_list}) - - if(_libraries_work) - # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES "${_flags};${${LIBRARIES}};${_thread}") - set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}") - if (BLAS_VERBOSE) - message("${Cyan}BLAS libs found for BLA_VENDOR ${BLA_VENDOR}." - "Try to compile symbol ${_name} with following libraries:" - "${CMAKE_REQUIRED_LIBRARIES}") - endif () - if(NOT BLAS_FOUND) - unset(${_prefix}${_combined_name}_WORKS CACHE) - endif() - if (_CHECK_FORTRAN) - if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") - string(REPLACE "mkl_intel_lp64" "mkl_gf_lp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - string(REPLACE "mkl_intel_ilp64" "mkl_gf_ilp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - endif() - check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) - else() - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - endif() - mark_as_advanced(${_prefix}${_combined_name}_WORKS) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) - # Print status if not found - # ------------------------- - if (NOT _libraries_work AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE) - Print_Find_Library_Blas_CheckFunc_Status(${_name} ${CMAKE_REQUIRED_LIBRARIES}) - endif () - set(CMAKE_REQUIRED_LIBRARIES) - endif() - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) - else(_libraries_work) - set(${LIBRARIES} FALSE) - endif(_libraries_work) - -# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") - -endmacro(Check_Fortran_Libraries) - - -set(BLAS_LINKER_FLAGS) -set(BLAS_LIBRARIES) -set(BLAS95_LIBRARIES) -if ($ENV{BLA_VENDOR} MATCHES ".+") - set(BLA_VENDOR $ENV{BLA_VENDOR}) -else () - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif() -endif () - -#BLAS in intel mkl 10 library? (em64t 64bit) -if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_MKLROOT "$ENV{MKLROOT}") - set(ENV_BLAS_DIR "$ENV{BLAS_DIR}") - set(ENV_BLAS_INCDIR "$ENV{BLAS_INCDIR}") - if(ENV_BLAS_INCDIR) - list(APPEND _inc_env "${ENV_BLAS_INCDIR}") - elseif(ENV_BLAS_DIR) - list(APPEND _inc_env "${ENV_BLAS_DIR}") - list(APPEND _inc_env "${ENV_BLAS_DIR}/include") - else() - if (ENV_MKLROOT) - list(APPEND _inc_env "${ENV_MKLROOT}/include") - endif() - # system variables - if(WIN32) - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_inc_env}") - - # Try to find the fftw header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(BLAS_INCDIR) - set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND") - find_path(BLAS_mkl.h_DIRS - NAMES mkl.h - HINTS ${BLAS_INCDIR}) - else() - if(BLAS_DIR) - set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND") - find_path(BLAS_mkl.h_DIRS - NAMES mkl.h - HINTS ${BLAS_DIR} - PATH_SUFFIXES "include") - else() - set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND") - find_path(BLAS_mkl.h_DIRS - NAMES mkl.h - HINTS ${PATH_TO_LOOK_FOR}) - endif() - endif() - mark_as_advanced(BLAS_mkl.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (BLAS_mkl.h_DIRS) - set(BLAS_INCLUDE_DIRS "${BLAS_mkl.h_DIRS}") - else () - set(BLAS_INCLUDE_DIRS "BLAS_INCLUDE_DIRS-NOTFOUND") - if(NOT BLAS_FIND_QUIETLY) - message(STATUS "Looking for BLAS -- mkl.h not found") - endif() - endif() - - if (WIN32) - string(REPLACE ":" ";" _libdir "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - # libiomp5 - # -------- - set(OMP_iomp5_LIBRARY "OMP_iomp5_LIBRARY-NOTFOUND") - find_library(OMP_iomp5_LIBRARY - NAMES iomp5 - HINTS ${_libdir} - ) - mark_as_advanced(OMP_iomp5_LIBRARY) - set(OMP_LIB "") - # libgomp - # ------- - set(OMP_gomp_LIBRARY "OMP_gomp_LIBRARY-NOTFOUND") - find_library(OMP_gomp_LIBRARY - NAMES gomp - HINTS ${_libdir} - ) - mark_as_advanced(OMP_gomp_LIBRARY) - # choose one or another depending on the compilo - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - if (OMP_gomp_LIBRARY) - set(OMP_LIB "${OMP_gomp_LIBRARY}") - endif() - else(CMAKE_C_COMPILER_ID STREQUAL "Intel") - if (OMP_iomp5_LIBRARY) - set(OMP_LIB "${OMP_iomp5_LIBRARY}") - endif() - endif() - - if (UNIX AND NOT WIN32) - set(LM "-lm") - set(BLAS_COMPILER_FLAGS "") - if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq") - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list(APPEND BLAS_COMPILER_FLAGS "-openmp") - endif() - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - list(APPEND BLAS_COMPILER_FLAGS "-fopenmp") - endif() - endif() - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - if (BLA_VENDOR STREQUAL "Intel10_32") - #list(APPEND BLAS_COMPILER_FLAGS "-m32") - else() - #list(APPEND BLAS_COMPILER_FLAGS "-m64") - endif() - if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq") - list(APPEND OMP_LIB "-ldl") - endif() - endif() - - set(additional_flags "") - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(additional_flags "-Wl,--no-as-needed") - endif() - endif () - - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) - find_package(Threads) - else() - find_package(Threads REQUIRED) - endif() - - set(BLAS_SEARCH_LIBS "") - - if(BLA_F95) - - set(BLAS_mkl_SEARCH_SYMBOL SGEMM) - set(_LIBRARIES BLAS95_LIBRARIES) - if (WIN32) - if (BLA_STATIC) - set(BLAS_mkl_DLL_SUFFIX "") - else() - set(BLAS_mkl_DLL_SUFFIX "_dll") - endif() - - # Find the main file (32-bit or 64-bit) - set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") - endif () - - # Add threading/sequential libs - set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - endif() - - # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) - list(APPEND BLAS_SEARCH_LIBS - "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") - endforeach() - endforeach() - else (WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide") - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") - # mkl >= 10.3 - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core") - endif() - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - list(APPEND BLAS_SEARCH_LIBS - "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core") - endif() - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_sequential mkl_core") - if (BLA_VENDOR STREQUAL "Intel10_64lp_seq") - set(OMP_LIB "") - endif() - endif () - endif (WIN32) - - else (BLA_F95) - - set(BLAS_mkl_SEARCH_SYMBOL sgemm) - set(_LIBRARIES BLAS_LIBRARIES) - if (WIN32) - if (BLA_STATIC) - set(BLAS_mkl_DLL_SUFFIX "") - else() - set(BLAS_mkl_DLL_SUFFIX "_dll") - endif() - - # Find the main file (32-bit or 64-bit) - set(BLAS_SEARCH_LIBS_WIN_MAIN "") - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN - "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") - endif () - - # Add threading/sequential libs - set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - # mkl >= 10.3 - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") - endif() - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD - "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") - endif() - - # Cartesian product of the above - foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN}) - foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD}) - list(APPEND BLAS_SEARCH_LIBS - "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}") - endforeach() - endforeach() - else (WIN32) - if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel mkl_intel_thread mkl_core guide") - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All") - # old version - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_intel_thread mkl_core guide") - # mkl >= 10.3 - if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_intel_thread mkl_core") - endif() - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_gnu_thread mkl_core") - endif() - endif () - if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl_intel_lp64 mkl_sequential mkl_core") - if (BLA_VENDOR STREQUAL "Intel10_64lp_seq") - set(OMP_LIB "") - endif() - endif () - #older vesions of intel mkl libs - if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All") - list(APPEND BLAS_SEARCH_LIBS - "mkl") - list(APPEND BLAS_SEARCH_LIBS - "mkl_ia32") - list(APPEND BLAS_SEARCH_LIBS - "mkl_em64t") - endif () - endif (WIN32) - - endif (BLA_F95) - - foreach (IT ${BLAS_SEARCH_LIBS}) - string(REPLACE " " ";" SEARCH_LIBS ${IT}) - if (${_LIBRARIES}) - else () - check_fortran_libraries( - ${_LIBRARIES} - BLAS - ${BLAS_mkl_SEARCH_SYMBOL} - "${additional_flags}" - "${SEARCH_LIBS}" - "${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - if(_LIBRARIES) - set(BLAS_LINKER_FLAGS "${additional_flags}") - endif() - endif() - endforeach () - - endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - -endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "goto2" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - # openblas (http://www.openblas.net/) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "openblas" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "f77blas;atlas" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "sgemm;dgemm;blas" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in Alpha CXML library? -if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "cxml" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in Alpha DXML library? (now called CXML, see above) -if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "dxml" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") - - -# BLAS in Sun Performance library? -if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "-xlic_lib=sunperf" - "sunperf;sunmath" - "" - ) - if(BLAS_LIBRARIES) - set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf") - endif() - endif() - -endif () - - -# BLAS in SCSL library? (SGI/Cray Scientific Library) -if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "scsl" - "" - ) - endif() - -endif () - - -# BLAS in SGIMATH library? -if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "complib.sgimath" - "" - ) - endif() - -endif () - - -# BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "essl;blas" - "" - ) - endif() - -endif () - - -#BLAS in acml library? -if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") - - if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR - ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR - ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))) - - # try to find acml in "standard" paths - if( WIN32 ) - file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) - else() - file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) - endif() - if( WIN32 ) - file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" ) - else() - file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" ) - endif() - list(GET _ACML_ROOT 0 _ACML_ROOT) - list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT) - - if( _ACML_ROOT ) - - get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) - if( SIZEOF_INTEGER EQUAL 8 ) - set( _ACML_PATH_SUFFIX "_int64" ) - else() - set( _ACML_PATH_SUFFIX "" ) - endif() - if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) - set( _ACML_COMPILER32 "ifort32" ) - set( _ACML_COMPILER64 "ifort64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) - set( _ACML_COMPILER32 "sun32" ) - set( _ACML_COMPILER64 "sun64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) - set( _ACML_COMPILER32 "pgi32" ) - if( WIN32 ) - set( _ACML_COMPILER64 "win64" ) - else() - set( _ACML_COMPILER64 "pgi64" ) - endif() - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) - # 32 bit builds not supported on Open64 but for code simplicity - # We'll just use the same directory twice - set( _ACML_COMPILER32 "open64_64" ) - set( _ACML_COMPILER64 "open64_64" ) - elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) - set( _ACML_COMPILER32 "nag32" ) - set( _ACML_COMPILER64 "nag64" ) - else() - set( _ACML_COMPILER32 "gfortran32" ) - set( _ACML_COMPILER64 "gfortran64" ) - endif() - - if( BLA_VENDOR STREQUAL "ACML_MP" ) - set(_ACML_MP_LIB_DIRS - "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) - else() - set(_ACML_LIB_DIRS - "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" - "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) - endif() - - endif(_ACML_ROOT) - - elseif(BLAS_${BLA_VENDOR}_LIB_DIRS) - - set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS}) - - endif() - - if( BLA_VENDOR STREQUAL "ACML_MP" ) - foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS}) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() - elseif( BLA_VENDOR STREQUAL "ACML_GPU" ) - foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS}) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() - else() - foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) - check_fortran_libraries ( - BLAS_LIBRARIES - BLAS - sgemm - "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS} - ) - if( BLAS_LIBRARIES ) - break() - endif() - endforeach() - endif() - - # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml;acml_mv" - "" - ) - endif() - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml_mp;acml_mv" - "" - ) - endif() - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "acml;acml_mv;CALBLAS" - "" - ) - endif() - -endif (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") # ACML - - -# Apple BLAS library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - - if(NOT BLAS_LIBRARIES) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "Accelerate" - "" - ) - endif() - -endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - - -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - - if ( NOT BLAS_LIBRARIES ) - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - dgemm - "" - "vecLib" - "" - ) - endif () - -endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - - -# Generic BLAS library? -if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") - - set(BLAS_SEARCH_LIBS "blas;blas_LINUX;blas_MAC;blas_WINDOWS") - foreach (SEARCH_LIB ${BLAS_SEARCH_LIBS}) - if (BLAS_LIBRARIES) - else () - check_fortran_libraries( - BLAS_LIBRARIES - BLAS - sgemm - "" - "${SEARCH_LIB}" - "" - ) - endif() - endforeach () - -endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") - - -if(BLA_F95) - - if(BLAS95_LIBRARIES) - set(BLAS95_FOUND TRUE) - else() - set(BLAS95_FOUND FALSE) - endif() - - if(NOT BLAS_FIND_QUIETLY) - if(BLAS95_FOUND) - message(STATUS "A library with BLAS95 API found.") - message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}") - else(BLAS95_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas 95 libraries could not be found or check of symbols failed." - "\nPlease indicate where to find blas libraries. You have three options:\n" - "- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\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 -DBLAS_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(BLAS_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with BLAS95 API not found. Please specify library location.") - else() - message(STATUS - "A library with BLAS95 API not found. Please specify library location.") - endif() - endif(BLAS95_FOUND) - endif(NOT BLAS_FIND_QUIETLY) - - 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) - else() - set(BLAS_FOUND FALSE) - endif() - - if(NOT BLAS_FIND_QUIETLY) - if(BLAS_FOUND) - message(STATUS "A library with BLAS API found.") - message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}") - else(BLAS_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas libraries could not be found or check of symbols failed." - "\nPlease indicate where to find blas libraries. You have three options:\n" - "- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\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 -DBLAS_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(BLAS_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with BLAS API not found. Please specify library location.") - else() - message(STATUS - "A library with BLAS API not found. Please specify library location.") - endif() - endif(BLAS_FOUND) - endif(NOT BLAS_FIND_QUIETLY) - -endif(BLA_F95) - -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - -if (BLAS_FOUND) - list(GET BLAS_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(BLAS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of BLAS library" FORCE) - else() - set(BLAS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of BLAS library" FORCE) - endif() -endif() - diff --git a/cmake_modules/morse/find/FindBLASEXT.cmake b/cmake_modules/morse/find/FindBLASEXT.cmake deleted file mode 100644 index 4838e5143d8f4af6982c58f0c7c30571243811be..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindBLASEXT.cmake +++ /dev/null @@ -1,335 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - 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 or ACML -# then the module tries 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) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -# add a cache variable to let the user specify the BLAS vendor -set(BLA_VENDOR "" CACHE STRING "list 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 (NOT BLAS_FOUND) - # First try to detect two cases: - # 1: only SEQ libs are handled - # 2: both SEQ and PAR libs are handled - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() -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" - "have also potentially detected some BLAS libraries from the MKL." - "We try to use this one.") - message(STATUS "If you want to force the use of one specific library, " - "please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name" - "at cmake configure.") - message(STATUS "List 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") - 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" - "have also potentially detected some BLAS libraries from the ACML." - "We try to use this one.") - message(STATUS "If you want to force the use of one specific library, " - "please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name" - "at cmake configure.") - message(STATUS "List 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") - endif() - set(BLAS_FOUND "") -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}") - list(REMOVE_DUPLICATES _inc_env) - - # 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}) - 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() - - ### - # look for libs - ### - # if Intel 10 64 bit -> look for sequential and multithreaded versions - if(BLA_VENDOR MATCHES "Intel10_64lp*") - - ## look for the sequential version - set(BLA_VENDOR "Intel10_64lp_seq") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "Look for the sequential version Intel10_64lp_seq") - endif() -# if(NOT BLAS_FOUND AND BLASEXT_FIND_REQUIRED) - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() - 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 "Intel10_64lp") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "Look for the multithreaded version Intel10_64lp") - endif() - find_package(BLAS) - if(BLAS_FOUND) - set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}") - else() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - 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") - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() - 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") - if(BLASEXT_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else(BLAS_FOUND) - find_package(BLAS) - endif() - 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}") - endif() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - -endif() - - -if(BLAS_SEQ_LIBRARIES) - set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}") -endif() -# message("DEBUG BLAS: ${BLAS_SEQ_LIBRARIES} ${BLAS_LIBRARIES}") - -# extract libs paths -# remark: because it is not given by find_package(BLAS) -set(BLAS_LIBRARY_DIRS "") -foreach(blas_lib ${BLAS_LIBRARIES}) - get_filename_component(a_blas_lib_dir "${blas_lib}" PATH) - list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" ) -endforeach() -if (BLAS_LIBRARY_DIRS) - list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS) -endif () - - -# message(STATUS "BLAS_FOUND: ${BLAS_FOUND}") -# message(STATUS "BLA_VENDOR: ${BLA_VENDOR}") -# message(STATUS "BLAS_LIBRARIES: ${BLAS_LIBRARIES}") -# message(STATUS "BLAS_SEQ_LIBRARIES: ${BLAS_SEQ_LIBRARIES}") -# message(STATUS "BLAS_PAR_LIBRARIES: ${BLAS_PAR_LIBRARIES}") -# message(STATUS "BLAS_INCLUDE_DIRS: ${BLAS_INCLUDE_DIRS}") -# message(STATUS "BLAS_LIBRARY_DIRS: ${BLAS_LIBRARY_DIRS}") - -# check that BLAS has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -if(BLA_VENDOR MATCHES "Intel*") - if(BLA_VENDOR MATCHES "Intel10_64lp*") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS found is Intel MKL:" - "we manage two lists of libs," - " one sequential and one parallel if found (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 - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS - BLAS_INCLUDE_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(BLAS 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(BLAS DEFAULT_MSG - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS - BLAS_INCLUDE_DIRS) - endif() -elseif(BLA_VENDOR MATCHES "ACML*") - if(NOT BLASEXT_FIND_QUIETLY) - message(STATUS "BLAS found is ACML:" - "we manage two lists of libs," - " one sequential and one parallel if found (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 - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS - BLAS_INCLUDE_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(BLAS 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(BLAS DEFAULT_MSG - BLAS_SEQ_LIBRARIES - BLAS_LIBRARY_DIRS) -endif() diff --git a/cmake_modules/morse/find/FindCBLAS.cmake b/cmake_modules/morse/find/FindCBLAS.cmake deleted file mode 100644 index 0d080d5f522a3bb32e260a7e5d870990aa10b854..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindCBLAS.cmake +++ /dev/null @@ -1,391 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find CBLAS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(CBLAS -# [REQUIRED] # Fail with error if cblas is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# CBLAS depends on the following libraries: -# - BLAS -# -# COMPONENTS are optional libraries LAPACKE could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - BLASEXT: to activate detection of BLAS with BLASEXT cmake module -# -# This module finds headers and cblas library. -# Results are reported in variables: -# CBLAS_FOUND - True if headers and requested libraries were found -# CBLAS_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# CBLAS_INCLUDE_DIRS - cblas include directories -# CBLAS_LIBRARY_DIRS - Link directories for cblas libraries -# CBLAS_LIBRARIES - cblas component libraries to be linked -# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories -# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories -# CBLAS_LIBRARIES_DEP - cblas libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DCBLAS_DIR=path/to/cblas): -# CBLAS_DIR - Where to find the base directory of cblas -# CBLAS_INCDIR - Where to find the header files -# CBLAS_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: CBLAS_DIR, CBLAS_INCDIR, CBLAS_LIBDIR -# -# CBLAS could be directly embedded in BLAS library (ex: Intel MKL) so that -# we test a cblas function with the blas libraries found and set CBLAS -# variables to BLAS ones if test is successful. To skip this feature and -# look for a stand alone cblas, please add the following in your -# CMakeLists.txt before to call find_package(CBLAS): -# set(CBLAS_STANDALONE TRUE) -### -# We handle different modes to find the dependency -# -# - Detection if already installed on the system -# - CBLAS libraries can be detected from different ways -# Here is the order of precedence: -# 1) we look in cmake variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined -# 2) we look in environment variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined -# 3) we look in common environnment variables depending on the system (INCLUDE, C_INCLUDE_PATH, CPATH - LIB, DYLD_LIBRARY_PATH, LD_LIBRARY_PATH) -# 4) we look in common system paths depending on the system, see for example paths contained in the following cmake variables: -# - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES -# - CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_C_IMPLICIT_LINK_DIRECTORIES -# - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT CBLAS_FOUND) - set(CBLAS_DIR "" CACHE PATH "Installation directory of CBLAS library") - if (NOT CBLAS_FIND_QUIETLY) - message(STATUS "A cache variable, namely CBLAS_DIR, has been set to specify the install directory of CBLAS") - endif() -endif() - - -# CBLAS may depend on BLASEXT -# try to find it specified as COMPONENTS during the call -if (CBLAS_FIND_COMPONENTS) - foreach( component ${CBLAS_FIND_COMPONENTS} ) - if(CBLAS_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(CBLAS_${component}_FOUND TRUE) - else() - set(CBLAS_${component}_FOUND FALSE) - endif() - endforeach() -endif () - - -# CBLAS depends on BLAS anyway, try to find it -if (NOT BLAS_FOUND) - if(CBLAS_FIND_REQUIRED) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() -endif() - - -# find CBLAS -if (BLAS_FOUND) - - if (NOT CBLAS_STANDALONE) - # check if a cblas function exists in the BLAS lib - # this can be the case with libs such as MKL, ACML - include(CheckFunctionExists) - set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LINKER_FLAGS};${BLAS_LIBRARIES}") - unset(CBLAS_WORKS CACHE) - check_function_exists(cblas_dscal CBLAS_WORKS) - mark_as_advanced(CBLAS_WORKS) - set(CMAKE_REQUIRED_LIBRARIES) - - if(CBLAS_WORKS) - if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas: test with blas succeeds") - endif() - # test succeeds: CBLAS is in BLAS - set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}") - if (BLAS_LIBRARY_DIRS) - set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}") - endif() - if(BLAS_INCLUDE_DIRS) - set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}") - endif() - if (BLAS_LINKER_FLAGS) - set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") - endif() - endif() - endif (NOT CBLAS_STANDALONE) - - if (CBLAS_STANDALONE OR NOT CBLAS_WORKS) - - if(NOT CBLAS_WORKS AND NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas : test with blas fails") - endif() - # test fails: try to find CBLAS lib exterior to BLAS - - # Try to find CBLAS lib - ####################### - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_CBLAS_DIR "$ENV{CBLAS_DIR}") - set(ENV_CBLAS_INCDIR "$ENV{CBLAS_INCDIR}") - if(ENV_CBLAS_INCDIR) - list(APPEND _inc_env "${ENV_CBLAS_INCDIR}") - elseif(ENV_CBLAS_DIR) - list(APPEND _inc_env "${ENV_CBLAS_DIR}") - list(APPEND _inc_env "${ENV_CBLAS_DIR}/include") - list(APPEND _inc_env "${ENV_CBLAS_DIR}/include/cblas") - else() - if(WIN32) - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the cblas header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(CBLAS_INCDIR) - set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND") - find_path(CBLAS_cblas.h_DIRS - NAMES cblas.h - HINTS ${CBLAS_INCDIR}) - else() - if(CBLAS_DIR) - set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND") - find_path(CBLAS_cblas.h_DIRS - NAMES cblas.h - HINTS ${CBLAS_DIR} - PATH_SUFFIXES "include" "include/cblas") - else() - set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND") - find_path(CBLAS_cblas.h_DIRS - NAMES cblas.h - HINTS ${_inc_env} - PATH_SUFFIXES "cblas") - endif() - endif() - mark_as_advanced(CBLAS_cblas.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (CBLAS_cblas.h_DIRS) - set(CBLAS_INCLUDE_DIRS "${CBLAS_cblas.h_DIRS}") - else () - set(CBLAS_INCLUDE_DIRS "CBLAS_INCLUDE_DIRS-NOTFOUND") - if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas -- cblas.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_CBLAS_LIBDIR "$ENV{CBLAS_LIBDIR}") - if(ENV_CBLAS_LIBDIR) - list(APPEND _lib_env "${ENV_CBLAS_LIBDIR}") - elseif(ENV_CBLAS_DIR) - list(APPEND _lib_env "${ENV_CBLAS_DIR}") - list(APPEND _lib_env "${ENV_CBLAS_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the cblas lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(CBLAS_LIBDIR) - set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") - find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${CBLAS_LIBDIR}) - else() - if(CBLAS_DIR) - set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") - find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${CBLAS_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") - find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(CBLAS_cblas_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (CBLAS_cblas_LIBRARY) - get_filename_component(cblas_lib_path "${CBLAS_cblas_LIBRARY}" PATH) - # set cmake variables - set(CBLAS_LIBRARIES "${CBLAS_cblas_LIBRARY}") - set(CBLAS_LIBRARY_DIRS "${cblas_lib_path}") - else () - set(CBLAS_LIBRARIES "CBLAS_LIBRARIES-NOTFOUND") - set(CBLAS_LIBRARY_DIRS "CBLAS_LIBRARY_DIRS-NOTFOUND") - if (NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas -- lib cblas not found") - endif() - endif () - - # check a function to validate the find - if(CBLAS_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LDFLAGS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # CBLAS - if (CBLAS_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}") - endif() - if (CBLAS_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${CBLAS_LIBRARIES}") - # BLAS - if (BLAS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") - endif() - if (BLAS_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") - if (BLAS_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(CBLAS_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(cblas_dscal CBLAS_WORKS) - mark_as_advanced(CBLAS_WORKS) - - if(CBLAS_WORKS) - # save link with dependencies - set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(CBLAS_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS) - else() - if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails") - message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(CBLAS_LIBRARIES) - - endif (CBLAS_STANDALONE OR NOT CBLAS_WORKS) - -else(BLAS_FOUND) - - if (NOT CBLAS_FIND_QUIETLY) - message(STATUS "CBLAS requires BLAS but BLAS has not been found." - "Please look for BLAS first.") - endif() - -endif(BLAS_FOUND) - -if (CBLAS_LIBRARIES) - list(GET CBLAS_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(CBLAS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of CBLAS library" FORCE) - else() - set(CBLAS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of CBLAS library" FORCE) - endif() -endif() - -# check that CBLAS has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CBLAS DEFAULT_MSG - CBLAS_LIBRARIES - CBLAS_WORKS) diff --git a/cmake_modules/morse/find/FindCHAMELEON.cmake b/cmake_modules/morse/find/FindCHAMELEON.cmake deleted file mode 100644 index 7e20d8223f4aa3f6a45eb74e4f1486134ff0af2e..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindCHAMELEON.cmake +++ /dev/null @@ -1,798 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find CHAMELEON include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(CHAMELEON -# [REQUIRED] # Fail with error if chameleon is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# CHAMELEON depends on the following libraries: -# - Threads, m, rt -# - HWLOC -# - CBLAS -# - LAPACKE -# - TMG -# - At least one runtime, default is StarPU -# (For QUARK, use COMPONENTS QUARK) -# -# COMPONENTS are optional libraries CHAMELEON could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - STARPU (default): to activate detection of Chameleon linked with StarPU -# - QUARK (STARPU will be deactivated): to activate detection of Chameleon linked with QUARK -# - CUDA (comes with cuBLAS): to activate detection of Chameleon linked with CUDA -# - MAGMA: to activate detection of Chameleon linked with MAGMA -# - MPI: to activate detection of Chameleon linked with MPI -# - FXT: to activate detection of Chameleon linked with StarPU+FXT -# -# This module finds headers and chameleon library. -# Results are reported in variables: -# CHAMELEON_FOUND - True if headers and requested libraries were found -# CHAMELEON_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# CHAMELEON_INCLUDE_DIRS - chameleon include directories -# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries -# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories -# CHAMELEON_LIBRARY_DIRS_DEP - chameleon + dependencies link directories -# CHAMELEON_LIBRARIES_DEP - chameleon libraries + dependencies -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DCHAMELEON_DIR=path/to/chameleon): -# CHAMELEON_DIR - Where to find the base directory of chameleon -# CHAMELEON_INCDIR - Where to find the header files -# CHAMELEON_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: CHAMELEON_DIR, CHAMELEON_INCDIR, CHAMELEON_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT CHAMELEON_FOUND) - set(CHAMELEON_DIR "" CACHE PATH "Installation directory of CHAMELEON library") - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "A cache variable, namely CHAMELEON_DIR, has been set to specify the install directory of CHAMELEON") - endif() -endif() - -# Try to find CHAMELEON dependencies if specified as COMPONENTS during the call -set(CHAMELEON_LOOK_FOR_STARPU ON) -set(CHAMELEON_LOOK_FOR_QUARK OFF) -set(CHAMELEON_LOOK_FOR_CUDA OFF) -set(CHAMELEON_LOOK_FOR_MAGMA OFF) -set(CHAMELEON_LOOK_FOR_MPI OFF) -set(CHAMELEON_LOOK_FOR_FXT OFF) - -if( CHAMELEON_FIND_COMPONENTS ) - foreach( component ${CHAMELEON_FIND_COMPONENTS} ) - if (${component} STREQUAL "STARPU") - # means we look for Chameleon with StarPU - set(CHAMELEON_LOOK_FOR_STARPU ON) - set(CHAMELEON_LOOK_FOR_QUARK OFF) - endif() - if (${component} STREQUAL "QUARK") - # means we look for Chameleon with QUARK - set(CHAMELEON_LOOK_FOR_QUARK ON) - set(CHAMELEON_LOOK_FOR_STARPU OFF) - endif() - if (${component} STREQUAL "CUDA") - # means we look for Chameleon with CUDA - set(CHAMELEON_LOOK_FOR_CUDA ON) - endif() - if (${component} STREQUAL "MAGMA") - # means we look for Chameleon with MAGMA - set(CHAMELEON_LOOK_FOR_MAGMA ON) - endif() - if (${component} STREQUAL "MPI") - # means we look for Chameleon with MPI - set(CHAMELEON_LOOK_FOR_MPI ON) - endif() - if (${component} STREQUAL "FXT") - # means we look for Chameleon with FXT - set(CHAMELEON_LOOK_FOR_FXT ON) - endif() - endforeach() -endif() - -set(ENV_CHAMELEON_DIR "$ENV{CHAMELEON_DIR}") -set(ENV_CHAMELEON_INCDIR "$ENV{CHAMELEON_INCDIR}") -set(ENV_CHAMELEON_LIBDIR "$ENV{CHAMELEON_LIBDIR}") -set(CHAMELEON_GIVEN_BY_USER "FALSE") -if ( CHAMELEON_DIR OR ( CHAMELEON_INCDIR AND CHAMELEON_LIBDIR) OR ENV_CHAMELEON_DIR OR (ENV_CHAMELEON_INCDIR AND ENV_CHAMELEON_LIBDIR) ) - set(CHAMELEON_GIVEN_BY_USER "TRUE") -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER) - - pkg_search_module(CHAMELEON chameleon) - if (NOT CHAMELEON_FIND_QUIETLY) - if (CHAMELEON_FOUND AND CHAMELEON_LIBRARIES) - message(STATUS "Looking for CHAMELEON - found using PkgConfig") - #if(NOT CHAMELEON_INCLUDE_DIRS) - # message("${Magenta}CHAMELEON_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to chameleon headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for CHAMELEON - not found using PkgConfig." - "Perhaps you should add the directory containing chameleon.pc" - "to the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - - if (CHAMELEON_FIND_VERSION_EXACT) - if( NOT (CHAMELEON_FIND_VERSION_MAJOR STREQUAL CHAMELEON_VERSION_MAJOR) OR - NOT (CHAMELEON_FIND_VERSION_MINOR STREQUAL CHAMELEON_VERSION_MINOR) ) - if(NOT CHAMELEON_FIND_QUIETLY) - message(FATAL_ERROR - "CHAMELEON version found is ${CHAMELEON_VERSION_STRING}" - "when required is ${CHAMELEON_FIND_VERSION}") - endif() - endif() - else() - # if the version found is older than the required then error - if( (CHAMELEON_FIND_VERSION_MAJOR STRGREATER CHAMELEON_VERSION_MAJOR) OR - (CHAMELEON_FIND_VERSION_MINOR STRGREATER CHAMELEON_VERSION_MINOR) ) - if(NOT CHAMELEON_FIND_QUIETLY) - message(FATAL_ERROR - "CHAMELEON version found is ${CHAMELEON_VERSION_STRING}" - "when required is ${CHAMELEON_FIND_VERSION} or newer") - endif() - endif() - endif() - - set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_INCLUDE_DIRS}") - set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_LIBRARY_DIRS}") - set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_LIBRARIES}") - -endif(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER) - -if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_GIVEN_BY_USER) ) - - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - PkgConfig not used") - endif() - - # Dependencies detection - # ---------------------- - - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect pthread") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() - set(CHAMELEON_EXTRA_LIBRARIES "") - if( THREADS_FOUND ) - list(APPEND CHAMELEON_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - endif () - - # Add math library to the list of extra - # it normally exists on all common systems provided with a C compiler - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect libm") - endif() - set(CHAMELEON_M_LIBRARIES "") - if(UNIX OR WIN32) - find_library( - CHAMELEON_M_m_LIBRARY - NAMES m - ) - mark_as_advanced(CHAMELEON_M_m_LIBRARY) - if (CHAMELEON_M_m_LIBRARY) - list(APPEND CHAMELEON_M_LIBRARIES "${CHAMELEON_M_m_LIBRARY}") - list(APPEND CHAMELEON_EXTRA_LIBRARIES "${CHAMELEON_M_m_LIBRARY}") - else() - if (CHAMELEON_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find libm on your system." - "Are you sure to a have a C compiler installed?") - endif() - endif() - endif() - - # Try to find librt (libposix4 - POSIX.1b Realtime Extensions library) - # on Unix systems except Apple ones because it does not exist on it - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect librt") - endif() - set(CHAMELEON_RT_LIBRARIES "") - if(UNIX AND NOT APPLE) - find_library( - CHAMELEON_RT_rt_LIBRARY - NAMES rt - ) - mark_as_advanced(CHAMELEON_RT_rt_LIBRARY) - if (CHAMELEON_RT_rt_LIBRARY) - list(APPEND CHAMELEON_RT_LIBRARIES "${CHAMELEON_RT_rt_LIBRARY}") - list(APPEND CHAMELEON_EXTRA_LIBRARIES "${CHAMELEON_RT_rt_LIBRARY}") - else() - if (CHAMELEON_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find librt on your system") - endif() - endif() - endif() - - # CHAMELEON depends on CBLAS - #--------------------------- - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect CBLAS (depends on BLAS)") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(CBLAS REQUIRED COMPONENTS BLASEXT) - else() - find_package(CBLAS COMPONENTS BLASEXT) - endif() - - # CHAMELEON depends on LAPACKE - #----------------------------- - - # standalone version of lapacke seems useless for now - # let the comment in case we meet some problems of non existing lapacke - # functions in lapack library such as mkl, acml, ... - #set(LAPACKE_STANDALONE TRUE) - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect LAPACKE (depends on LAPACK)") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(LAPACKE REQUIRED COMPONENTS LAPACKEXT) - else() - find_package(LAPACKE COMPONENTS LAPACKEXT) - endif() - - # CHAMELEON depends on TMG - #------------------------- - if (NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for CHAMELEON - Try to detect TMG (depends on LAPACK)") - endif() - if (CHAMELEON_FIND_REQUIRED) - find_package(TMG REQUIRED) - else() - find_package(TMG) - endif() - - # CHAMELEON may depend on CUDA/CUBLAS - #------------------------------------ - if (NOT CUDA_FOUND AND CHAMELEON_LOOK_FOR_CUDA) - if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_CUDA) - find_package(CUDA REQUIRED) - else() - find_package(CUDA) - endif() - if (CUDA_FOUND) - mark_as_advanced(CUDA_BUILD_CUBIN) - mark_as_advanced(CUDA_BUILD_EMULATION) - mark_as_advanced(CUDA_SDK_ROOT_DIR) - mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR) - mark_as_advanced(CUDA_VERBOSE_BUILD) - endif() - endif() - - # CHAMELEON may depend on MAGMA gpu kernels - # call our cmake module to test (in cmake_modules) - # change this call position if not appropriated - #------------------------------------------------- - if( CUDA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA ) - set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired") - if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MAGMA) - find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} REQUIRED) - else() - find_package(MAGMA ${CHAMELEON_MAGMA_VERSION}) - endif() - endif() - - # CHAMELEON depends on MPI - #------------------------- - if( NOT MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI ) - - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MPI) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() - - endif() - - if( NOT STARPU_FOUND AND CHAMELEON_LOOK_FOR_STARPU ) - - set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired") - - # create list of components in order to make a single call to find_package(starpu...) - # we explicitly need a StarPU version built with hwloc - set(STARPU_COMPONENT_LIST "HWLOC") - - # StarPU may depend on MPI - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if (CHAMELEON_LOOK_FOR_MPI) - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - list(APPEND STARPU_COMPONENT_LIST "MPI") - endif() - if (CHAMELEON_LOOK_FOR_CUDA) - list(APPEND STARPU_COMPONENT_LIST "CUDA") - endif() - if (CHAMELEON_LOOK_FOR_FXT) - list(APPEND STARPU_COMPONENT_LIST "FXT") - endif() - if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_STARPU) - find_package(STARPU ${CHAMELEON_STARPU_VERSION} REQUIRED - COMPONENTS ${STARPU_COMPONENT_LIST}) - else() - find_package(STARPU ${CHAMELEON_STARPU_VERSION} - COMPONENTS ${STARPU_COMPONENT_LIST}) - endif() - - endif() - - if( NOT QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK ) - - # try to find quark runtime - if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_QUARK) - find_package(QUARK REQUIRED COMPONENTS HWLOC) - else() - find_package(QUARK COMPONENTS HWLOC) - endif() - - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_CHAMELEON_DIR "$ENV{CHAMELEON_DIR}") - set(ENV_CHAMELEON_INCDIR "$ENV{CHAMELEON_INCDIR}") - if(ENV_CHAMELEON_INCDIR) - list(APPEND _inc_env "${ENV_CHAMELEON_INCDIR}") - elseif(ENV_CHAMELEON_DIR) - list(APPEND _inc_env "${ENV_CHAMELEON_DIR}") - list(APPEND _inc_env "${ENV_CHAMELEON_DIR}/include") - list(APPEND _inc_env "${ENV_CHAMELEON_DIR}/include/chameleon") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the chameleon header in the given paths - # --------------------------------------------------- - # call cmake macro to find the header path - if(CHAMELEON_INCDIR) - set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND") - find_path(CHAMELEON_morse.h_DIRS - NAMES morse.h - HINTS ${CHAMELEON_INCDIR}) - else() - if(CHAMELEON_DIR) - set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND") - find_path(CHAMELEON_morse.h_DIRS - NAMES morse.h - HINTS ${CHAMELEON_DIR} - PATH_SUFFIXES "include" "include/chameleon") - else() - set(CHAMELEON_morse.h_DIRS "CHAMELEON_morse.h_DIRS-NOTFOUND") - find_path(CHAMELEON_morse.h_DIRS - NAMES morse.h - HINTS ${_inc_env} - PATH_SUFFIXES "chameleon") - endif() - endif() - mark_as_advanced(CHAMELEON_morse.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (CHAMELEON_morse.h_DIRS) - set(CHAMELEON_INCLUDE_DIRS "${CHAMELEON_morse.h_DIRS}") - else () - set(CHAMELEON_INCLUDE_DIRS "CHAMELEON_INCLUDE_DIRS-NOTFOUND") - if(NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for chameleon -- morse.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_CHAMELEON_LIBDIR "$ENV{CHAMELEON_LIBDIR}") - if(ENV_CHAMELEON_LIBDIR) - list(APPEND _lib_env "${ENV_CHAMELEON_LIBDIR}") - elseif(ENV_CHAMELEON_DIR) - list(APPEND _lib_env "${ENV_CHAMELEON_DIR}") - list(APPEND _lib_env "${ENV_CHAMELEON_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the chameleon lib in the given paths - # ------------------------------------------------ - - # create list of libs to find - set(CHAMELEON_libs_to_find "chameleon") - if (STARPU_FOUND) - list(APPEND CHAMELEON_libs_to_find "chameleon_starpu") - elseif (QUARK_FOUND) - list(APPEND CHAMELEON_libs_to_find "chameleon_quark") - endif() - list(APPEND CHAMELEON_libs_to_find "coreblas") - - # call cmake macro to find the lib path - if(CHAMELEON_LIBDIR) - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - set(CHAMELEON_${chameleon_lib}_LIBRARY "CHAMELEON_${chameleon_lib}_LIBRARY-NOTFOUND") - find_library(CHAMELEON_${chameleon_lib}_LIBRARY - NAMES ${chameleon_lib} - HINTS ${CHAMELEON_LIBDIR}) - endforeach() - else() - if(CHAMELEON_DIR) - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - set(CHAMELEON_${chameleon_lib}_LIBRARY "CHAMELEON_${chameleon_lib}_LIBRARY-NOTFOUND") - find_library(CHAMELEON_${chameleon_lib}_LIBRARY - NAMES ${chameleon_lib} - HINTS ${CHAMELEON_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - set(CHAMELEON_${chameleon_lib}_LIBRARY "CHAMELEON_${chameleon_lib}_LIBRARY-NOTFOUND") - find_library(CHAMELEON_${chameleon_lib}_LIBRARY - NAMES ${chameleon_lib} - HINTS ${_lib_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - foreach(chameleon_lib ${CHAMELEON_libs_to_find}) - - get_filename_component(${chameleon_lib}_lib_path ${CHAMELEON_${chameleon_lib}_LIBRARY} PATH) - # set cmake variables (respects naming convention) - if (CHAMELEON_LIBRARIES) - list(APPEND CHAMELEON_LIBRARIES "${CHAMELEON_${chameleon_lib}_LIBRARY}") - else() - set(CHAMELEON_LIBRARIES "${CHAMELEON_${chameleon_lib}_LIBRARY}") - endif() - if (CHAMELEON_LIBRARY_DIRS) - list(APPEND CHAMELEON_LIBRARY_DIRS "${${chameleon_lib}_lib_path}") - else() - set(CHAMELEON_LIBRARY_DIRS "${${chameleon_lib}_lib_path}") - endif() - mark_as_advanced(CHAMELEON_${chameleon_lib}_LIBRARY) - - endforeach(chameleon_lib ${CHAMELEON_libs_to_find}) - - # check a function to validate the find - if(CHAMELEON_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # CHAMELEON - if (CHAMELEON_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${CHAMELEON_INCLUDE_DIRS}") - endif() - foreach(libdir ${CHAMELEON_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - set(REQUIRED_LIBS "${CHAMELEON_LIBRARIES}") - # STARPU - if (STARPU_FOUND AND CHAMELEON_LOOK_FOR_STARPU) - if (STARPU_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS_DEP}") - elseif (STARPU_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS}") - endif() - if(STARPU_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS_DEP}") - elseif(STARPU_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS}") - endif() - if (STARPU_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}") - elseif (STARPU_LIBRARIES) - foreach(lib ${STARPU_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - endif() - # QUARK - if (QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK) - if (QUARK_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS_DEP}") - elseif(QUARK_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS}") - endif() - if(QUARK_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS_DEP}") - elseif(QUARK_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS}") - endif() - if (QUARK_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBS "${QUARK_LIBRARIES_DEP}") - elseif (QUARK_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBS "${QUARK_LIBRARIES}") - endif() - endif() - # CUDA - if (CUDA_FOUND AND CHAMELEON_LOOK_FOR_CUDA) - if (CUDA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}") - endif() - foreach(libdir ${CUDA_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - endif() - # MAGMA - if (MAGMA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA) - if (MAGMA_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS_DEP}") - elseif(MAGMA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}") - endif() - if (MAGMA_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS_DEP}") - elseif(MAGMA_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}") - endif() - if (MAGMA_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${MAGMA_LIBRARIES_DEP}") - elseif(MAGMA_LIBRARIES) - foreach(lib ${MAGMA_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - endif() - # MPI - if (MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI) - if (MPI_C_INCLUDE_PATH) - list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}") - endif() - if (MPI_C_LINK_FLAGS) - if (${MPI_C_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS}) - endif() - list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}") - endif() - list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}") - endif() - # HWLOC - if (HWLOC_FOUND) - if (HWLOC_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") - endif() - foreach(libdir ${HWLOC_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - foreach(lib ${HWLOC_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - # TMG - if (TMG_FOUND) - if (TMG_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS_DEP}") - elseif (TMG_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS}") - endif() - if(TMG_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS_DEP}") - elseif(TMG_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS}") - endif() - if (TMG_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES_DEP}") - elseif(TMG_LIBRARIES) - list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES}") - endif() - if (TMG_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${TMG_LINKER_FLAGS}") - endif() - endif() - # LAPACKE - if (LAPACKE_FOUND) - if (LAPACKE_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS_DEP}") - elseif (LAPACKE_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}") - endif() - if(LAPACKE_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS_DEP}") - elseif(LAPACKE_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}") - endif() - if (LAPACKE_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES_DEP}") - elseif(LAPACKE_LIBRARIES) - list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES}") - endif() - if (LAPACK_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}") - endif() - endif() - # CBLAS - if (CBLAS_FOUND) - if (CBLAS_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS_DEP}") - elseif (CBLAS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}") - endif() - if(CBLAS_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS_DEP}") - elseif(CBLAS_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}") - endif() - if (CBLAS_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES_DEP}") - elseif(CBLAS_LIBRARIES) - list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES}") - endif() - if (BLAS_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") - endif() - endif() - # EXTRA LIBS such that pthread, m, rt - list(APPEND REQUIRED_LIBS ${CHAMELEON_EXTRA_LIBRARIES}) - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(CHAMELEON_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(MORSE_Init CHAMELEON_WORKS) - mark_as_advanced(CHAMELEON_WORKS) - - if(CHAMELEON_WORKS) - # save link with dependencies - set(CHAMELEON_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(CHAMELEON_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(CHAMELEON_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(CHAMELEON_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES CHAMELEON_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES CHAMELEON_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES CHAMELEON_LINKER_FLAGS) - else() - if(NOT CHAMELEON_FIND_QUIETLY) - message(STATUS "Looking for chameleon : test of MORSE_Init 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 "Maybe CHAMELEON is linked with specific libraries. " - "Have you tried with COMPONENTS (STARPU/QUARK, CUDA, MAGMA, MPI, FXT)? " - "See the explanation in FindCHAMELEON.cmake.") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(CHAMELEON_LIBRARIES) - -endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_GIVEN_BY_USER) ) - -if (CHAMELEON_LIBRARIES) - if (CHAMELEON_LIBRARY_DIRS) - foreach(dir ${CHAMELEON_LIBRARY_DIRS}) - if ("${dir}" MATCHES "chameleon") - set(first_lib_path "${dir}") - endif() - endforeach() - else() - list(GET CHAMELEON_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - endif() - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(CHAMELEON_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of CHAMELEON library" FORCE) - else() - set(CHAMELEON_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of CHAMELEON library" FORCE) - endif() -endif() - -# check that CHAMELEON has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_EXECUTABLE AND CHAMELEON_FOUND) - find_package_handle_standard_args(CHAMELEON DEFAULT_MSG - CHAMELEON_LIBRARIES) -else() - find_package_handle_standard_args(CHAMELEON DEFAULT_MSG - CHAMELEON_LIBRARIES - CHAMELEON_WORKS) -endif() diff --git a/cmake_modules/morse/find/FindEZTRACE.cmake b/cmake_modules/morse/find/FindEZTRACE.cmake deleted file mode 100644 index bfcdf34e5c1904b5c058f5a4002eee00fb8b89b7..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindEZTRACE.cmake +++ /dev/null @@ -1,353 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find EZTRACE include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(EZTRACE -# [REQUIRED]) # Fail with error if eztrace is not found -# -# EZTRACE depends on the following libraries: -# - libbfd.so -# - libiberty.so (optional) -# -# This module finds headers and eztrace library. -# Results are reported in variables: -# EZTRACE_FOUND - True if headers and requested libraries were found -# EZTRACE_INCLUDE_DIRS - eztrace include directories -# EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries -# EZTRACE_LIBRARIES - eztrace component libraries to be linked -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DEZTRACE_DIR=path/to/eztrace): -# EZTRACE_DIR - Where to find the base directory of eztrace -# EZTRACE_INCDIR - Where to find the header files -# EZTRACE_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: EZTRACE_DIR, EZTRACE_INCDIR, EZTRACE_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT EZTRACE_FOUND) - set(EZTRACE_DIR "" CACHE PATH "Installation directory of EZTRACE library") - if (NOT EZTRACE_FIND_QUIETLY) - message(STATUS "A cache variable, namely EZTRACE_DIR, has been set to specify the install directory of EZTRACE") - endif() -endif() - -set(ENV_EZTRACE_DIR "$ENV{EZTRACE_DIR}") -set(ENV_EZTRACE_INCDIR "$ENV{EZTRACE_INCDIR}") -set(ENV_EZTRACE_LIBDIR "$ENV{EZTRACE_LIBDIR}") -set(EZTRACE_GIVEN_BY_USER "FALSE") -if ( EZTRACE_DIR OR ( EZTRACE_INCDIR AND EZTRACE_LIBDIR) OR ENV_EZTRACE_DIR OR (ENV_EZTRACE_INCDIR AND ENV_EZTRACE_LIBDIR) ) - set(EZTRACE_GIVEN_BY_USER "TRUE") -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER ) - - pkg_search_module(EZTRACE eztrace) - if (NOT EZTRACE_FIND_QUIETLY) - if (EZTRACE_FOUND AND EZTRACE_LIBRARIES) - message(STATUS "Looking for EZTRACE - found using PkgConfig") - #if(NOT EZTRACE_INCLUDE_DIRS) - # message("${Magenta}EZTRACE_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to eztrace headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for EZTRACE - not found using PkgConfig." - "Perhaps you should add the directory containing eztrace.pc to" - "the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - -endif( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER ) - -if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) ) - - if (NOT EZTRACE_FIND_QUIETLY) - message(STATUS "Looking for EZTRACE - PkgConfig not used") - endif() - - # Looking for libbfd - # ------------------ - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - list(REMOVE_DUPLICATES _lib_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_lib_env}") - - # Try to find the bfd lib in the given paths - # ------------------------------------------ - - # call cmake macro to find the lib path - set(EZTRACE_bfd_LIBRARY "EZTRACE_bfd_LIBRARY-NOTFOUND") - find_library(EZTRACE_bfd_LIBRARY - NAMES bfd - HINTS ${PATH_TO_LOOK_FOR}) - mark_as_advanced(EZTRACE_bfd_LIBRARY) - - if (NOT EZTRACE_bfd_LIBRARY) - if(NOT EZTRACE_FIND_QUIETLY) - message(STATUS "Looking for eztrace -- lib bfd not found") - endif() - endif () - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(ENV_EZTRACE_INCDIR) - list(APPEND _inc_env "${ENV_EZTRACE_INCDIR}") - elseif(ENV_EZTRACE_DIR) - list(APPEND _inc_env "${ENV_EZTRACE_DIR}") - list(APPEND _inc_env "${ENV_EZTRACE_DIR}/include") - list(APPEND _inc_env "${ENV_EZTRACE_DIR}/include/eztrace") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_inc_env}") - - # Try to find the eztrace header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(EZTRACE_INCDIR) - set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND") - find_path(EZTRACE_eztrace.h_DIRS - NAMES eztrace.h - HINTS ${EZTRACE_INCDIR}) - else() - if(EZTRACE_DIR) - set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND") - find_path(EZTRACE_eztrace.h_DIRS - NAMES eztrace.h - HINTS ${EZTRACE_DIR} - PATH_SUFFIXES "include" "include/eztrace") - else() - set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND") - find_path(EZTRACE_eztrace.h_DIRS - NAMES eztrace.h - HINTS ${PATH_TO_LOOK_FOR} - PATH_SUFFIXES "eztrace") - endif() - endif() - mark_as_advanced(EZTRACE_eztrace.h_DIRS) - - # Add path to cmake variable - # ------------------------------------ - if (EZTRACE_eztrace.h_DIRS) - set(EZTRACE_INCLUDE_DIRS "${EZTRACE_eztrace.h_DIRS}") - else () - set(EZTRACE_INCLUDE_DIRS "EZTRACE_INCLUDE_DIRS-NOTFOUND") - if(NOT EZTRACE_FIND_QUIETLY) - message(STATUS "Looking for eztrace -- eztrace.h not found") - endif() - endif () - - if (EZTRACE_INCLUDE_DIRS) - list(REMOVE_DUPLICATES EZTRACE_INCLUDE_DIRS) - endif () - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(ENV_EZTRACE_LIBDIR) - list(APPEND _lib_env "${ENV_EZTRACE_LIBDIR}") - elseif(ENV_EZTRACE_DIR) - list(APPEND _lib_env "${ENV_EZTRACE_DIR}") - list(APPEND _lib_env "${ENV_EZTRACE_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_lib_env}") - - # Try to find the eztrace lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(EZTRACE_LIBDIR) - set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND") - find_library(EZTRACE_eztrace_LIBRARY - NAMES eztrace - HINTS ${EZTRACE_LIBDIR}) - else() - if(EZTRACE_DIR) - set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND") - find_library(EZTRACE_eztrace_LIBRARY - NAMES eztrace - HINTS ${EZTRACE_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND") - find_library(EZTRACE_eztrace_LIBRARY - NAMES eztrace - HINTS ${PATH_TO_LOOK_FOR}) - endif() - endif() - mark_as_advanced(EZTRACE_eztrace_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (EZTRACE_eztrace_LIBRARY) - get_filename_component(eztrace_lib_path ${EZTRACE_eztrace_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(EZTRACE_LIBRARIES "${EZTRACE_eztrace_LIBRARY}") - set(EZTRACE_LIBRARY_DIRS "${eztrace_lib_path}") - else () - set(EZTRACE_LIBRARIES "EZTRACE_LIBRARIES-NOTFOUND") - set(EZTRACE_LIBRARY_DIRS "EZTRACE_LIBRARY_DIRS-NOTFOUND") - if(NOT EZTRACE_FIND_QUIETLY) - message(STATUS "Looking for eztrace -- lib eztrace not found") - endif() - endif () - - if (EZTRACE_LIBRARY_DIRS) - list(REMOVE_DUPLICATES EZTRACE_LIBRARY_DIRS) - endif () - - # check a function to validate the find - if(EZTRACE_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # EZTRACE - if (EZTRACE_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${EZTRACE_INCLUDE_DIRS}") - endif() - if (EZTRACE_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${EZTRACE_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${EZTRACE_LIBRARIES}") - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(EZTRACE_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(eztrace_start EZTRACE_WORKS) - mark_as_advanced(EZTRACE_WORKS) - - if(NOT EZTRACE_WORKS) - if(NOT EZTRACE_FIND_QUIETLY) - message(STATUS "Looking for eztrace : test of eztrace_topology_init with eztrace 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(EZTRACE_LIBRARIES) - -endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) ) - -if (EZTRACE_LIBRARIES) - if (EZTRACE_LIBRARY_DIRS) - list(GET EZTRACE_LIBRARY_DIRS 0 first_lib_path) - else() - list(GET EZTRACE_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - endif() - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(EZTRACE_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of EZTRACE library" FORCE) - else() - set(EZTRACE_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of EZTRACE library" FORCE) - endif() -endif() - -# check that EZTRACE has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_EXECUTABLE AND EZTRACE_FOUND) - find_package_handle_standard_args(EZTRACE DEFAULT_MSG - EZTRACE_LIBRARIES) -else() - find_package_handle_standard_args(EZTRACE DEFAULT_MSG - EZTRACE_LIBRARIES - EZTRACE_WORKS) -endif() diff --git a/cmake_modules/morse/find/FindFFTW.cmake b/cmake_modules/morse/find/FindFFTW.cmake deleted file mode 100644 index ac8e4d64783840550d44cc9a1b978ee126070006..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindFFTW.cmake +++ /dev/null @@ -1,503 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find FFTW Version 3 include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(FFTW -# [REQUIRED] # Fail with error if fftw is not found -# [COMPONENTS MKL] -# -# COMPONENTS can be some of the following: -# - MKL: to detect the FFTW from Intel MKL -# - THREADS: to detect the Threads version of FFTW -# - OMP: to detect the OpenMP version of FFTW -# - SIMPLE: to detect the FFTW simple precision fftw3f -# - DOUBLE: to detect the FFTW double precision fftw3 (default) -# - LONG: to detect the FFTW long double precision fftw3l -# - QUAD: to detect the FFTW quadruple precision fftw3q -# -# This module finds headers and fftw library. -# Results are reported in variables: -# FFTW_FOUND - True if headers and requested libraries were found -# FFTW_C_FLAGS - list of required compilation flags (excluding -I) -# FFTW_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# FFTW_INCLUDE_DIRS - fftw include directories -# FFTW_LIBRARY_DIRS - Link directories for fftw libraries -# FFTW_LIBRARIES - fftw component libraries to be linked -# FFTW_INCLUDE_DIRS_DEP - fftw + dependencies include directories -# FFTW_LIBRARY_DIRS_DEP - fftw + dependencies link directories -# FFTW_LIBRARIES_DEP - fftw libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DFFTW_DIR=path/to/fftw): -# FFTW_DIR - Where to find the base directory of fftw -# FFTW_INCDIR - Where to find the header files -# FFTW_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: FFTW_DIR, FFTW_INCDIR, FFTW_LIBDIR -# For MKL case and if no paths are given as hints, we will try to use the MKLROOT -# environment variable - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT FFTW_FOUND) - set(FFTW_DIR "" CACHE PATH "Installation directory of FFTW library given by user") - if (NOT FFTW_FIND_QUIETLY) - message(STATUS "A cache variable, namely FFTW_DIR, has been set to specify the install directory of FFTW") - endif() -endif() - -# Set the version to find -set(FFTW_LOOK_FOR_MKL OFF) -set(FFTW_LOOK_FOR_THREADS OFF) -set(FFTW_LOOK_FOR_OMP OFF) -set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF) -set(FFTW_LOOK_FOR_FFTW_DOUBLE ON) -set(FFTW_LOOK_FOR_FFTW_LONG OFF) -set(FFTW_LOOK_FOR_FFTW_QUAD OFF) - -if( FFTW_FIND_COMPONENTS ) - foreach( component ${FFTW_FIND_COMPONENTS} ) - if (${component} STREQUAL "THREADS") - # means we look for the Threads version of FFTW - set(FFTW_LOOK_FOR_THREADS ON) - endif() - if (${component} STREQUAL "OMP") - # means we look for the OpenMP version of FFTW - set(FFTW_LOOK_FOR_OMP ON) - endif() - if (${component} STREQUAL "SIMPLE") - # means we look for FFTW simple precision (fftw3f) - set(FFTW_LOOK_FOR_FFTW_SIMPLE ON) - set(FFTW_LOOK_FOR_FFTW_DOUBLE OFF) - set(FFTW_LOOK_FOR_FFTW_LONG OFF) - set(FFTW_LOOK_FOR_FFTW_QUAD OFF) - endif() - if (${component} STREQUAL "DOUBLE") - # means we look for FFTW double precision (fftw3) - set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF) - set(FFTW_LOOK_FOR_FFTW_DOUBLE ON) - set(FFTW_LOOK_FOR_FFTW_LONG OFF) - set(FFTW_LOOK_FOR_FFTW_QUAD OFF) - endif() - if (${component} STREQUAL "LONG") - # means we look for FFTW long double precision (fftw3l) - set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF) - set(FFTW_LOOK_FOR_FFTW_DOUBLE OFF) - set(FFTW_LOOK_FOR_FFTW_LONG ON) - set(FFTW_LOOK_FOR_FFTW_QUAD OFF) - endif() - if (${component} STREQUAL "QUAD") - # means we look for FFTW quad precision (fftw3q) - set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF) - set(FFTW_LOOK_FOR_FFTW_DOUBLE OFF) - set(FFTW_LOOK_FOR_FFTW_LONG OFF) - set(FFTW_LOOK_FOR_FFTW_QUAD ON) - endif() - if (${component} STREQUAL "MKL") - # means we look for the Intel MKL version of FFTW - set(FFTW_LOOK_FOR_MKL ON) - if (FFTW_LOOK_FOR_FFTW_LONG) - message(WARNING "Looking for FFTW -- long precision functions do not exist in MKL FFTW") - set(FFTW_LOOK_FOR_FFTW_LONG OFF) - endif() - if (FFTW_LOOK_FOR_FFTW_QUAD) - message(WARNING "Looking for FFTW -- quadruple functions do not exist in MKL FFTW") - set(FFTW_LOOK_FOR_FFTW_QUAD OFF) - endif() - endif() - endforeach() -endif() - -if (FFTW_LOOK_FOR_THREADS) - if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_THREADS) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() -endif() - -if (FFTW_LOOK_FOR_MKL) - if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() -endif() - -if (FFTW_LOOK_FOR_OMP) - if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_OMP) - find_package(OpenMP REQUIRED) - else() - find_package(OpenMP) - endif() -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_MKLROOT "$ENV{MKLROOT}") -set(ENV_FFTW_DIR "$ENV{FFTW_DIR}") -set(ENV_FFTW_INCDIR "$ENV{FFTW_INCDIR}") -if(ENV_FFTW_INCDIR) - list(APPEND _inc_env "${ENV_FFTW_INCDIR}") -elseif(ENV_FFTW_DIR) - list(APPEND _inc_env "${ENV_FFTW_DIR}") - list(APPEND _inc_env "${ENV_FFTW_DIR}/include") - list(APPEND _inc_env "${ENV_FFTW_DIR}/include/fftw") -else() - if (ENV_MKLROOT) - list(APPEND _inc_env "${ENV_MKLROOT}/include/fftw") - endif() - # system variables - if(WIN32) - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - -# set paths where to look for -set(PATH_TO_LOOK_FOR "${_inc_env}") - -# Try to find the fftw header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(FFTW_INCDIR) - set(FFTW_fftw3.h_DIRS "FFTW_fftw3.h_DIRS-NOTFOUND") - find_path(FFTW_fftw3.h_DIRS - NAMES fftw3.h - HINTS ${FFTW_INCDIR}) -else() - if(FFTW_DIR) - set(FFTW_fftw3.h_DIRS "FFTW_fftw3.h_DIRS-NOTFOUND") - find_path(FFTW_fftw3.h_DIRS - NAMES fftw3.h - HINTS ${FFTW_DIR} - PATH_SUFFIXES "include" "include/fftw") - else() - set(FFTW_fftw3.h_DIRS "FFTW_fftw3.h_DIRS-NOTFOUND") - find_path(FFTW_fftw3.h_DIRS - NAMES fftw3.h - HINTS ${PATH_TO_LOOK_FOR} - PATH_SUFFIXES "fftw") - endif() -endif() -mark_as_advanced(FFTW_fftw3.h_DIRS) - -# Add path to cmake variable -# ------------------------------------ -if (FFTW_fftw3.h_DIRS) - set(FFTW_INCLUDE_DIRS "${FFTW_fftw3.h_DIRS}") -else () - set(FFTW_INCLUDE_DIRS "FFTW_INCLUDE_DIRS-NOTFOUND") - if(NOT FFTW_FIND_QUIETLY) - message(STATUS "Looking for FFTW -- fftw3.h not found") - endif() -endif () - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_FFTW_LIBDIR "$ENV{FFTW_LIBDIR}") -if(ENV_FFTW_LIBDIR) - list(APPEND _lib_env "${ENV_FFTW_LIBDIR}") -elseif(ENV_FFTW_DIR) - list(APPEND _lib_env "${ENV_FFTW_DIR}") - list(APPEND _lib_env "${ENV_FFTW_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _lib_env "${ENV_FFTW_DIR}/lib64") - list(APPEND _lib_env "${ENV_FFTW_DIR}/lib/intel64") - else() - list(APPEND _lib_env "${ENV_FFTW_DIR}/lib32") - list(APPEND _lib_env "${ENV_FFTW_DIR}/lib/ia32") - endif() -else() - if (ENV_MKLROOT) - list(APPEND _lib_env "${ENV_MKLROOT}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _lib_env "${ENV_MKLROOT}/lib64") - list(APPEND _lib_env "${ENV_MKLROOT}/lib/intel64") - else() - list(APPEND _lib_env "${ENV_MKLROOT}/lib32") - list(APPEND _lib_env "${ENV_MKLROOT}/lib/ia32") - endif() - endif() - if(WIN32) - string(REPLACE ":" ";" _lib_env2 "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env2 "$ENV{DYLD_LIBRARY_PATH}") - else() - string(REPLACE ":" ";" _lib_env2 "$ENV{LD_LIBRARY_PATH}") - endif() - list(APPEND _lib_env "${_lib_env2}") - list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# set paths where to look for -set(PATH_TO_LOOK_FOR "${_lib_env}") - -if(FFTW_LOOK_FOR_FFTW_SIMPLE) - set(FFTW_PREC "f") - set(FFTW_PREC_TESTFUNC "s") -elseif(FFTW_LOOK_FOR_FFTW_DOUBLE) - set(FFTW_PREC "") - set(FFTW_PREC_TESTFUNC "d") -elseif(FFTW_LOOK_FOR_FFTW_LONG) - set(FFTW_PREC "l") - set(FFTW_PREC_TESTFUNC "l") -elseif(FFTW_LOOK_FOR_FFTW_QUAD) - set(FFTW_PREC "q") - set(FFTW_PREC_TESTFUNC "q") -endif() - -if (FFTW_LOOK_FOR_MKL) - - set(FFTW_libs_to_find "mkl_intel_lp64;mkl_sequential;mkl_core") - - # Try to find the MKL fftw lib in the given paths - # ----------------------------------------------- - - # call cmake macro to find the lib path - if(FFTW_LIBDIR) - foreach(fftw_lib ${FFTW_libs_to_find}) - set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND") - find_library(FFTW_${fftw_lib}_LIBRARY - NAMES ${fftw_lib} - HINTS ${FFTW_LIBDIR}) - endforeach() - else() - if(FFTW_DIR) - foreach(fftw_lib ${FFTW_libs_to_find}) - set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND") - find_library(FFTW_${fftw_lib}_LIBRARY - NAMES ${fftw_lib} - HINTS ${FFTW_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(fftw_lib ${FFTW_libs_to_find}) - set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND") - find_library(FFTW_${fftw_lib}_LIBRARY - NAMES ${fftw_lib} - HINTS ${PATH_TO_LOOK_FOR}) - endforeach() - endif() - endif() - -else(FFTW_LOOK_FOR_MKL) - - if (FFTW_LOOK_FOR_THREADS) - set(FFTW_libs_to_find "fftw3${FFTW_PREC}_threads;fftw3${FFTW_PREC}") - elseif (FFTW_LOOK_FOR_OMP) - set(FFTW_libs_to_find "fftw3${FFTW_PREC}_omp;fftw3${FFTW_PREC}") - else() - set(FFTW_libs_to_find "fftw3${FFTW_PREC}") - endif() - - # Try to find the fftw lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(FFTW_LIBDIR) - foreach(fftw_lib ${FFTW_libs_to_find}) - set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND") - find_library(FFTW_${fftw_lib}_LIBRARY - NAMES ${fftw_lib} - HINTS ${FFTW_LIBDIR}) - endforeach() - else() - if(FFTW_DIR) - foreach(fftw_lib ${FFTW_libs_to_find}) - set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND") - find_library(FFTW_${fftw_lib}_LIBRARY - NAMES ${fftw_lib} - HINTS ${FFTW_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(fftw_lib ${FFTW_libs_to_find}) - set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND") - find_library(FFTW_${fftw_lib}_LIBRARY - NAMES ${fftw_lib} - HINTS ${PATH_TO_LOOK_FOR}) - endforeach() - endif() - endif() - -endif(FFTW_LOOK_FOR_MKL) - -# If found, add path to cmake variable -# ------------------------------------ -set(FFTW_LIBRARIES "") -set(FFTW_LIBRARY_DIRS "") -foreach(fftw_lib ${FFTW_libs_to_find}) - - if (FFTW_${fftw_lib}_LIBRARY) - get_filename_component(${fftw_lib}_lib_path "${FFTW_${fftw_lib}_LIBRARY}" PATH) - # set cmake variables - list(APPEND FFTW_LIBRARIES "${FFTW_${fftw_lib}_LIBRARY}") - list(APPEND FFTW_LIBRARY_DIRS "${${fftw_lib}_lib_path}") - else () - list(APPEND FFTW_LIBRARIES "${FFTW_${fftw_lib}_LIBRARY}") - if (NOT FFTW_FIND_QUIETLY) - message(STATUS "Looking for FFTW -- lib ${fftw_lib} not found") - endif() - endif () - mark_as_advanced(FFTW_${fftw_lib}_LIBRARY) - -endforeach() - -list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS) -list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS) - -# check a function to validate the find -if(FFTW_LIBRARIES) - - set(REQUIRED_FLAGS) - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # FFTW - if (FFTW_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${FFTW_INCLUDE_DIRS}") - endif() - if (FFTW_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${FFTW_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${FFTW_LIBRARIES}") - # THREADS - if (FFTW_LOOK_FOR_THREADS) - list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}") - endif() - # OMP - if(FFTW_LOOK_FOR_OMP) - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - # either gomp ... - #set(REQUIRED_FLAGS "-fopenmp") - #list(APPEND REQUIRED_LIBS "-lgomp") - # or iomp5 - list(APPEND REQUIRED_LIBS "-liomp5") - elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel") - list(APPEND REQUIRED_LIBS "-liomp5") - endif() - endif() - # MKL - if(FFTW_LOOK_FOR_MKL) - list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT};-lm") - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") - list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed") - endif() - endif() - if(UNIX OR WIN32) - list(APPEND REQUIRED_LIBS "-lm") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(FFTW_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute_ FFTW_WORKS) - mark_as_advanced(FFTW_WORKS) - - if(FFTW_WORKS) - # save link with dependencies - set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(FFTW_C_FLAGS "${REQUIRED_FLAGS}") - set(FFTW_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES FFTW_LINKER_FLAGS) - else() - if(NOT FFTW_FIND_QUIETLY) - message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails") - message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - endif() - else() - set(FFTW_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(FFTW_LIBRARIES) - -if (FFTW_LIBRARIES) - list(GET FFTW_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(FFTW_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of FFTW library" FORCE) - else() - set(FFTW_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of FFTW library" FORCE) - endif() -endif() - -# check that FFTW has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FFTW DEFAULT_MSG - FFTW_LIBRARIES - FFTW_INCLUDE_DIRS - FFTW_WORKS) diff --git a/cmake_modules/morse/find/FindFXT.cmake b/cmake_modules/morse/find/FindFXT.cmake deleted file mode 100644 index 639da8b7b745cadcab65c62d6dfbf2a7cdd72e66..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindFXT.cmake +++ /dev/null @@ -1,308 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find FXT include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(FXT -# [REQUIRED]) # Fail with error if fxt is not found -# -# This module finds headers and fxt library. -# Results are reported in variables: -# FXT_FOUND - True if headers and requested libraries were found -# FXT_INCLUDE_DIRS - fxt include directories -# FXT_LIBRARY_DIRS - Link directories for fxt libraries -# FXT_LIBRARIES - fxt component libraries to be linked -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DFXT_DIR=path/to/fxt): -# FXT_DIR - Where to find the base directory of fxt -# FXT_INCDIR - Where to find the header files -# FXT_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: FXT_DIR, FXT_INCDIR, FXT_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT FXT_FOUND) - set(FXT_DIR "" CACHE PATH "Installation directory of FXT library") - if (NOT FXT_FIND_QUIETLY) - message(STATUS "A cache variable, namely FXT_DIR, has been set to specify the install directory of FXT") - endif() -endif() - -set(ENV_FXT_DIR "$ENV{FXT_DIR}") -set(ENV_FXT_INCDIR "$ENV{FXT_INCDIR}") -set(ENV_FXT_LIBDIR "$ENV{FXT_LIBDIR}") -set(FXT_GIVEN_BY_USER "FALSE") -if ( FXT_DIR OR ( FXT_INCDIR AND FXT_LIBDIR) OR ENV_FXT_DIR OR (ENV_FXT_INCDIR AND ENV_FXT_LIBDIR) ) - set(FXT_GIVEN_BY_USER "TRUE") -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER) - - pkg_search_module(FXT fxt) - if (NOT FXT_FIND_QUIETLY) - if (FXT_FOUND AND FXT_LIBRARIES) - message(STATUS "Looking for FXT - found using PkgConfig") - #if(NOT FXT_INCLUDE_DIRS) - # message("${Magenta}FXT_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to fxt headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for FXT - not found using PkgConfig." - "Perhaps you should add the directory containing fxt.pc to the" - "PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - -endif(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER) - -if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) ) - - if (NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for FXT - PkgConfig not used") - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_FXT_DIR "$ENV{FXT_DIR}") - set(ENV_FXT_INCDIR "$ENV{FXT_INCDIR}") - if(ENV_FXT_INCDIR) - list(APPEND _inc_env "${ENV_FXT_INCDIR}") - elseif(ENV_FXT_DIR) - list(APPEND _inc_env "${ENV_FXT_DIR}") - list(APPEND _inc_env "${ENV_FXT_DIR}/include") - list(APPEND _inc_env "${ENV_FXT_DIR}/include/fxt") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # Try to find the fxt header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(FXT_INCDIR) - set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") - find_path(FXT_fxt.h_DIRS - NAMES fxt.h - HINTS ${FXT_INCDIR}) - else() - if(FXT_DIR) - set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") - find_path(FXT_fxt.h_DIRS - NAMES fxt.h - HINTS ${FXT_DIR} - PATH_SUFFIXES "include" "include/fxt") - else() - set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") - find_path(FXT_fxt.h_DIRS - NAMES fxt.h - HINTS ${_inc_env} - PATH_SUFFIXES "fxt") - endif() - endif() - mark_as_advanced(FXT_fxt.h_DIRS) - - # Add path to cmake variable - # ------------------------------------ - if (FXT_fxt.h_DIRS) - set(FXT_INCLUDE_DIRS "${FXT_fxt.h_DIRS}") - else () - set(FXT_INCLUDE_DIRS "FXT_INCLUDE_DIRS-NOTFOUND") - if(NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for fxt -- fxt.h not found") - endif() - endif () - - if (FXT_INCLUDE_DIRS) - list(REMOVE_DUPLICATES FXT_INCLUDE_DIRS) - endif () - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_FXT_LIBDIR "$ENV{FXT_LIBDIR}") - if(ENV_FXT_LIBDIR) - list(APPEND _lib_env "${ENV_FXT_LIBDIR}") - elseif(ENV_FXT_DIR) - list(APPEND _lib_env "${ENV_FXT_DIR}") - list(APPEND _lib_env "${ENV_FXT_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the fxt lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(FXT_LIBDIR) - set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") - find_library(FXT_fxt_LIBRARY - NAMES fxt - HINTS ${FXT_LIBDIR}) - else() - if(FXT_DIR) - set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") - find_library(FXT_fxt_LIBRARY - NAMES fxt - HINTS ${FXT_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") - find_library(FXT_fxt_LIBRARY - NAMES fxt - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(FXT_fxt_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (FXT_fxt_LIBRARY) - get_filename_component(fxt_lib_path ${FXT_fxt_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(FXT_LIBRARIES "${FXT_fxt_LIBRARY}") - set(FXT_LIBRARY_DIRS "${fxt_lib_path}") - else () - set(FXT_LIBRARIES "FXT_LIBRARIES-NOTFOUND") - set(FXT_LIBRARY_DIRS "FXT_LIBRARY_DIRS-NOTFOUND") - if(NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for fxt -- lib fxt not found") - endif() - endif () - - if (FXT_LIBRARY_DIRS) - list(REMOVE_DUPLICATES FXT_LIBRARY_DIRS) - endif () - - # check a function to validate the find - if(FXT_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # FXT - if (FXT_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${FXT_INCLUDE_DIRS}") - endif() - if (FXT_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${FXT_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${FXT_LIBRARIES}") - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(FXT_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(fut_keychange FXT_WORKS) - mark_as_advanced(FXT_WORKS) - - if(NOT FXT_WORKS) - if(NOT FXT_FIND_QUIETLY) - message(STATUS "Looking for fxt : test of fut_keychange with fxt 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(FXT_LIBRARIES) - -endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) ) - -if (FXT_LIBRARIES) - if (FXT_LIBRARY_DIRS) - list(GET FXT_LIBRARY_DIRS 0 first_lib_path) - else() - list(GET FXT_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - endif() - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(FXT_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of FXT library" FORCE) - else() - set(FXT_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of FXT library" FORCE) - endif() -endif() - -# check that FXT has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_EXECUTABLE AND FXT_FOUND) - find_package_handle_standard_args(FXT DEFAULT_MSG - FXT_LIBRARIES) -else() - find_package_handle_standard_args(FXT DEFAULT_MSG - FXT_LIBRARIES - FXT_WORKS) -endif() diff --git a/cmake_modules/morse/find/FindHWLOC.cmake b/cmake_modules/morse/find/FindHWLOC.cmake deleted file mode 100644 index 01e086bb70df28a58df80999e14c3b39eee33403..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindHWLOC.cmake +++ /dev/null @@ -1,321 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find HWLOC include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(HWLOC -# [REQUIRED]) # Fail with error if hwloc is not found -# -# This module finds headers and hwloc library. -# Results are reported in variables: -# HWLOC_FOUND - True if headers and requested libraries were found -# HWLOC_INCLUDE_DIRS - hwloc include directories -# HWLOC_LIBRARY_DIRS - Link directories for hwloc libraries -# HWLOC_LIBRARIES - hwloc component libraries to be linked -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DHWLOC_DIR=path/to/hwloc): -# HWLOC_DIR - Where to find the base directory of hwloc -# HWLOC_INCDIR - Where to find the header files -# HWLOC_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: HWLOC_DIR, HWLOC_INCDIR, HWLOC_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -include(CheckStructHasMember) -include(CheckCSourceCompiles) - -if (NOT HWLOC_FOUND) - set(HWLOC_DIR "" CACHE PATH "Installation directory of HWLOC library") - if (NOT HWLOC_FIND_QUIETLY) - message(STATUS "A cache variable, namely HWLOC_DIR, has been set to specify the install directory of HWLOC") - endif() -endif() - -set(ENV_HWLOC_DIR "$ENV{HWLOC_DIR}") -set(ENV_HWLOC_INCDIR "$ENV{HWLOC_INCDIR}") -set(ENV_HWLOC_LIBDIR "$ENV{HWLOC_LIBDIR}") -set(HWLOC_GIVEN_BY_USER "FALSE") -if ( HWLOC_DIR OR ( HWLOC_INCDIR AND HWLOC_LIBDIR) OR ENV_HWLOC_DIR OR (ENV_HWLOC_INCDIR AND ENV_HWLOC_LIBDIR) ) - set(HWLOC_GIVEN_BY_USER "TRUE") -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER ) - - pkg_search_module(HWLOC hwloc) - if (NOT HWLOC_FIND_QUIETLY) - if (HWLOC_FOUND AND HWLOC_LIBRARIES) - message(STATUS "Looking for HWLOC - found using PkgConfig") - #if(NOT HWLOC_INCLUDE_DIRS) - # message("${Magenta}HWLOC_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to hwloc headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for HWLOC - not found using PkgConfig." - "Perhaps you should add the directory containing hwloc.pc to" - "the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - -endif( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER ) - -if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) ) - - if (NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for HWLOC - PkgConfig not used") - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - if(ENV_HWLOC_INCDIR) - list(APPEND _inc_env "${ENV_HWLOC_INCDIR}") - elseif(ENV_HWLOC_DIR) - list(APPEND _inc_env "${ENV_HWLOC_DIR}") - list(APPEND _inc_env "${ENV_HWLOC_DIR}/include") - list(APPEND _inc_env "${ENV_HWLOC_DIR}/include/hwloc") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_inc_env}") - - # Try to find the hwloc header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(HWLOC_INCDIR) - set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND") - find_path(HWLOC_hwloc.h_DIRS - NAMES hwloc.h - HINTS ${HWLOC_INCDIR}) - else() - if(HWLOC_DIR) - set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND") - find_path(HWLOC_hwloc.h_DIRS - NAMES hwloc.h - HINTS ${HWLOC_DIR} - PATH_SUFFIXES "include" "include/hwloc") - else() - set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND") - find_path(HWLOC_hwloc.h_DIRS - NAMES hwloc.h - HINTS ${PATH_TO_LOOK_FOR} - PATH_SUFFIXES "hwloc") - endif() - endif() - mark_as_advanced(HWLOC_hwloc.h_DIRS) - - # Add path to cmake variable - # ------------------------------------ - if (HWLOC_hwloc.h_DIRS) - set(HWLOC_INCLUDE_DIRS "${HWLOC_hwloc.h_DIRS}") - else () - set(HWLOC_INCLUDE_DIRS "HWLOC_INCLUDE_DIRS-NOTFOUND") - if(NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for hwloc -- hwloc.h not found") - endif() - endif () - - if (HWLOC_INCLUDE_DIRS) - list(REMOVE_DUPLICATES HWLOC_INCLUDE_DIRS) - endif () - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - if(ENV_HWLOC_LIBDIR) - list(APPEND _lib_env "${ENV_HWLOC_LIBDIR}") - elseif(ENV_HWLOC_DIR) - list(APPEND _lib_env "${ENV_HWLOC_DIR}") - list(APPEND _lib_env "${ENV_HWLOC_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # set paths where to look for - set(PATH_TO_LOOK_FOR "${_lib_env}") - - # Try to find the hwloc lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(HWLOC_LIBDIR) - set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND") - find_library(HWLOC_hwloc_LIBRARY - NAMES hwloc - HINTS ${HWLOC_LIBDIR}) - else() - if(HWLOC_DIR) - set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND") - find_library(HWLOC_hwloc_LIBRARY - NAMES hwloc - HINTS ${HWLOC_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND") - find_library(HWLOC_hwloc_LIBRARY - NAMES hwloc - HINTS ${PATH_TO_LOOK_FOR}) - endif() - endif() - mark_as_advanced(HWLOC_hwloc_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (HWLOC_hwloc_LIBRARY) - get_filename_component(hwloc_lib_path ${HWLOC_hwloc_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(HWLOC_LIBRARIES "${HWLOC_hwloc_LIBRARY}") - set(HWLOC_LIBRARY_DIRS "${hwloc_lib_path}") - else () - set(HWLOC_LIBRARIES "HWLOC_LIBRARIES-NOTFOUND") - set(HWLOC_LIBRARY_DIRS "HWLOC_LIBRARY_DIRS-NOTFOUND") - if(NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for hwloc -- lib hwloc not found") - endif() - endif () - - if (HWLOC_LIBRARY_DIRS) - list(REMOVE_DUPLICATES HWLOC_LIBRARY_DIRS) - endif () - - # check a function to validate the find - if(HWLOC_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # HWLOC - if (HWLOC_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") - endif() - if (HWLOC_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${HWLOC_LIBRARIES}") - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(HWLOC_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(hwloc_topology_init HWLOC_WORKS) - mark_as_advanced(HWLOC_WORKS) - - # test headers to guess the version - check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER ) - check_struct_has_member( "struct hwloc_cache_attr_s" size hwloc.h HAVE_HWLOC_CACHE_ATTR ) - check_c_source_compiles( "#include <hwloc.h> - int main(void) { hwloc_obj_t o; o->type = HWLOC_OBJ_PU; return 0;}" HAVE_HWLOC_OBJ_PU) - check_library_exists(${HWLOC_LIBRARIES} hwloc_bitmap_free "" HAVE_HWLOC_BITMAP) - - if(NOT HWLOC_WORKS) - if(NOT HWLOC_FIND_QUIETLY) - message(STATUS "Looking for hwloc : test of hwloc_topology_init with hwloc 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(HWLOC_LIBRARIES) - -endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) ) - -if (HWLOC_LIBRARIES) - if (HWLOC_LIBRARY_DIRS) - list(GET HWLOC_LIBRARY_DIRS 0 first_lib_path) - else() - list(GET HWLOC_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - endif() - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(HWLOC_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of HWLOC library" FORCE) - else() - set(HWLOC_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of HWLOC library" FORCE) - endif() -endif() - -# check that HWLOC has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_EXECUTABLE AND HWLOC_FOUND) - find_package_handle_standard_args(HWLOC DEFAULT_MSG - HWLOC_LIBRARIES) -else() - find_package_handle_standard_args(HWLOC DEFAULT_MSG - HWLOC_LIBRARIES - HWLOC_WORKS) -endif() diff --git a/cmake_modules/morse/find/FindLAPACK.cmake b/cmake_modules/morse/find/FindLAPACK.cmake deleted file mode 100644 index 43c6b30e6087fcb6f08ddaaacf827fc0af24b59a..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindLAPACK.cmake +++ /dev/null @@ -1,563 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find LAPACK library -# This module finds an installed fortran library that implements the LAPACK -# linear-algebra interface (see http://www.netlib.org/lapack/). -# -# The approach follows that taken for the autoconf macro file, acx_lapack.m4 -# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). -# -# This module sets the following variables: -# LAPACK_FOUND - set to true if a library implementing the LAPACK interface -# is found -# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l -# and -L). -# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use LAPACK -# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use LAPACK95 -# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 -# interface is found -# BLA_STATIC if set on this determines what kind of linkage we do (static) -# BLA_VENDOR if set checks only the specified vendor, if not set checks -# all the possibilities -# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DLAPACK_DIR=path/to/lapack): -# LAPACK_DIR - Where to find the base directory of lapack -# LAPACK_INCDIR - Where to find the header files -# LAPACK_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: LAPACK_DIR, LAPACK_INCDIR, LAPACK_LIBDIR -# For MKL case and if no paths are given as hints, we will try to use the MKLROOT -# environment variable -# Note that if BLAS_DIR is set, it will also look for lapack in it -### List of vendors (BLA_VENDOR) valid in this module -## Intel(mkl), ACML,Apple, NAS, Generic - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file 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 CMake, substitute the full -# License text for the above reference.) - - -# 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() - -## Some macros to print status when search for headers and libs -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "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}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the installation directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -if (NOT LAPACK_FOUND) - set(LAPACK_DIR "" CACHE PATH "Installation directory of LAPACK library") - if (NOT LAPACK_FIND_QUIETLY) - message(STATUS "A cache variable, namely LAPACK_DIR, has been set to specify the install directory of LAPACK") - endif() -endif (NOT LAPACK_FOUND) - -option(LAPACK_VERBOSE "Print some additional information during LAPACK -libraries detection" OFF) -if (BLAS_VERBOSE) - set(LAPACK_VERBOSE ON) -endif () -set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) - -set(LAPACK_FOUND FALSE) -set(LAPACK95_FOUND FALSE) - -# TODO: move this stuff to separate module - -macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - -set(_libraries_work TRUE) -set(${LIBRARIES}) -set(_combined_name) -set(ENV_MKLROOT "$ENV{MKLROOT}") -set(ENV_BLAS_DIR "$ENV{BLAS_DIR}") -set(ENV_BLAS_LIBDIR "$ENV{BLAS_LIBDIR}") -set(ENV_LAPACK_DIR "$ENV{LAPACK_DIR}") -set(ENV_LAPACK_LIBDIR "$ENV{LAPACK_LIBDIR}") -if (NOT _libdir) - if (BLAS_LIBDIR) - list(APPEND _libdir "${BLAS_LIBDIR}") - elseif (BLAS_DIR) - 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") - else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") - endif() - elseif(ENV_BLAS_LIBDIR) - list(APPEND _libdir "${ENV_BLAS_LIBDIR}") - elseif(ENV_BLAS_DIR) - 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") - else() - list(APPEND _libdir "${ENV_BLAS_DIR}/lib32") - list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32") - endif() - endif() - if (LAPACK_LIBDIR) - list(APPEND _libdir "${LAPACK_LIBDIR}") - elseif (LAPACK_DIR) - list(APPEND _libdir "${LAPACK_DIR}") - list(APPEND _libdir "${LAPACK_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${LAPACK_DIR}/lib64") - list(APPEND _libdir "${LAPACK_DIR}/lib/intel64") - else() - list(APPEND _libdir "${LAPACK_DIR}/lib32") - list(APPEND _libdir "${LAPACK_DIR}/lib/ia32") - endif() - elseif(ENV_LAPACK_LIBDIR) - list(APPEND _libdir "${ENV_LAPACK_LIBDIR}") - elseif(ENV_LAPACK_DIR) - list(APPEND _libdir "${ENV_LAPACK_DIR}") - list(APPEND _libdir "${ENV_LAPACK_DIR}/lib") - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${ENV_LAPACK_DIR}/lib64") - list(APPEND _libdir "${ENV_LAPACK_DIR}/lib/intel64") - else() - list(APPEND _libdir "${ENV_LAPACK_DIR}/lib32") - list(APPEND _libdir "${ENV_LAPACK_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() - endif() - if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${_libdir2}") - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif () -endif () - -if (LAPACK_VERBOSE) - message("${Cyan}Try to find LAPACK libraries: ${_list}") -endif () - -foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - 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) - else (BLA_STATIC) - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf 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} - ) - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - # Print status if not found - # ------------------------- - if (NOT ${_prefix}_${_library}_LIBRARY AND NOT LAPACK_FIND_QUIETLY AND LAPACK_VERBOSE) - Print_Find_Library_Blas_Status(lapack ${_library} ${_libdir}) - endif () - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) -endforeach(_library ${_list}) - -if(_libraries_work) - # Test this combination of libraries. - if(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads}) - else(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) - endif(UNIX AND BLA_STATIC) - if (LAPACK_VERBOSE) - message("${Cyan}LAPACK libs found. Try to compile symbol ${_name} with" - "following libraries: ${CMAKE_REQUIRED_LIBRARIES}") - endif () - if(NOT LAPACK_FOUND) - unset(${_prefix}${_combined_name}_WORKS CACHE) - endif() - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -endif(_libraries_work) - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads}) - else(_libraries_work) - set(${LIBRARIES} FALSE) - endif(_libraries_work) - -endmacro(Check_Lapack_Libraries) - - -set(LAPACK_LINKER_FLAGS) -set(LAPACK_LIBRARIES) -set(LAPACK95_LIBRARIES) - -if (NOT BLAS_FOUND) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(BLAS) - else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(BLAS REQUIRED) - endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) -endif () - -if(BLAS_FOUND) - set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if ($ENV{BLA_VENDOR} MATCHES ".+") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - else ($ENV{BLA_VENDOR} MATCHES ".+") - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif(NOT BLA_VENDOR) - endif ($ENV{BLA_VENDOR} MATCHES ".+") - -#intel lapack -if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if (UNIX AND NOT WIN32) - set(LM "-lm") - endif () - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_PACKAGE(Threads) - else() - find_package(Threads REQUIRED) - endif() - - set(LAPACK_SEARCH_LIBS "") - - set(additional_flags "") - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(additional_flags "-Wl,--no-as-needed") - endif() - - if (BLA_F95) - set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV") - set(_LIBRARIES LAPACK95_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_c") - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_lp64") - else() - set(LAPACK_mkl_SEARCH_SYMBOL "cheev") - set(_LIBRARIES LAPACK_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_gf_lp64") - endif() - - # First try empty lapack libs - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - BLAS - ${LAPACK_mkl_SEARCH_SYMBOL} - "${additional_flags}" - "" - "${_BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - if(_LIBRARIES) - set(LAPACK_LINKER_FLAGS "${additional_flags}") - endif() - endif () - # Then try the search libs - foreach (IT ${LAPACK_SEARCH_LIBS}) - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - BLAS - ${LAPACK_mkl_SEARCH_SYMBOL} - "${additional_flags}" - "${IT}" - "${_BLAS_LIBRARIES}" - "${CMAKE_THREAD_LIBS_INIT};${LM}" - ) - if(_LIBRARIES) - set(LAPACK_LINKER_FLAGS "${additional_flags}") - endif() - endif () - endforeach () - endif () -endif() - -#goto lapack -if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "goto2" - "${BLAS_LIBRARIES}" - "" - ) - endif(NOT LAPACK_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - - -#acml lapack - if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") - if (BLAS_LIBRARIES MATCHES ".+acml.+") - set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - endif () - endif () - -# Apple LAPACK library? -if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "${BLAS_LIBRARIES}" - "" - ) - endif(NOT LAPACK_LIBRARIES) -endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") -if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "${BLAS_LIBRARIES}" - "" - ) - endif ( NOT LAPACK_LIBRARIES ) -endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") -# Generic LAPACK library? -if (BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "ATLAS" OR - BLA_VENDOR STREQUAL "All") - if ( NOT LAPACK_LIBRARIES ) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack" - "${BLAS_LIBRARIES}" - "" - ) - endif ( NOT LAPACK_LIBRARIES ) -endif () -else(BLAS_FOUND) - message(STATUS "LAPACK requires BLAS") -endif(BLAS_FOUND) - -if(BLA_F95) - if(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND TRUE) - else(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND FALSE) - endif(LAPACK95_LIBRARIES) - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK95_FOUND) - message(STATUS "A library with LAPACK95 API found.") - message(STATUS "LAPACK_LIBRARIES ${LAPACK_LIBRARIES}") - else(LAPACK95_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK 95 libraries could not be found or check of symbols failed." - "\nPlease indicate where to find LAPACK libraries. You have three options:\n" - "- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\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 -DLAPACK_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(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK95 API not found. Please specify library location." - ) - else(LAPACK_FIND_REQUIRED) - message(STATUS - "A library with LAPACK95 API not found. Please specify library location." - ) - endif(LAPACK_FIND_REQUIRED) - endif(LAPACK95_FOUND) - endif(NOT LAPACK_FIND_QUIETLY) - set(LAPACK_FOUND "${LAPACK95_FOUND}") - set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") -else(BLA_F95) - if(LAPACK_LIBRARIES) - set(LAPACK_FOUND TRUE) - else(LAPACK_LIBRARIES) - set(LAPACK_FOUND FALSE) - endif(LAPACK_LIBRARIES) - - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_FOUND) - message(STATUS "A library with LAPACK API found.") - message(STATUS "LAPACK_LIBRARIES ${LAPACK_LIBRARIES}") - else(LAPACK_FOUND) - message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK libraries could not be found or check of symbols failed." - "\nPlease indicate where to find LAPACK libraries. You have three options:\n" - "- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\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 -DLAPACK_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(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK API not found. Please specify library location." - ) - else(LAPACK_FIND_REQUIRED) - message(STATUS - "A library with LAPACK API not found. Please specify library location." - ) - endif(LAPACK_FIND_REQUIRED) - endif(LAPACK_FOUND) - endif(NOT LAPACK_FIND_QUIETLY) -endif(BLA_F95) - -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - -if (LAPACK_FOUND) - list(GET LAPACK_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(LAPACK_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of LAPACK library" FORCE) - else() - set(LAPACK_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of LAPACK library" FORCE) - endif() -endif() diff --git a/cmake_modules/morse/find/FindLAPACKE.cmake b/cmake_modules/morse/find/FindLAPACKE.cmake deleted file mode 100644 index c237e128b67f5a7d1e6671f995c17779838880f5..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindLAPACKE.cmake +++ /dev/null @@ -1,381 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find LAPACKE include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(LAPACKE -# [REQUIRED] # Fail with error if lapacke is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# LAPACKE depends on the following libraries: -# - LAPACK -# -# COMPONENTS are optional libraries LAPACKE could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS available: -# - LAPACKEXT: to activate detection of LAPACK with LAPACKEXT cmake module -# -# This module finds headers and lapacke library. -# Results are reported in variables: -# LAPACKE_FOUND - True if headers and requested libraries were found -# LAPACKE_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# LAPACKE_INCLUDE_DIRS - lapacke include directories -# LAPACKE_LIBRARY_DIRS - Link directories for lapacke libraries -# LAPACKE_LIBRARIES - lapacke component libraries to be linked -# LAPACKE_INCLUDE_DIRS_DEP - lapacke + dependencies include directories -# LAPACKE_LIBRARY_DIRS_DEP - lapacke + dependencies link directories -# LAPACKE_LIBRARIES_DEP - lapacke libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DLAPACKE_DIR=path/to/lapacke): -# LAPACKE_DIR - Where to find the base directory of lapacke -# LAPACKE_INCDIR - Where to find the header files -# LAPACKE_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: LAPACKE_DIR, LAPACKE_INCDIR, LAPACKE_LIBDIR -# -# LAPACKE could be directly embedded in LAPACK library (ex: Intel MKL) so that -# we test a lapacke function with the lapack libraries found and set LAPACKE -# variables to LAPACK ones if test is successful. To skip this feature and -# look for a stand alone lapacke, please add the following in your -# CMakeLists.txt before to call find_package(LAPACKE): -# set(LAPACKE_STANDALONE TRUE) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT LAPACKE_FOUND) - set(LAPACKE_DIR "" CACHE PATH "Installation directory of LAPACKE library") - if (NOT LAPACKE_FIND_QUIETLY) - message(STATUS "A cache variable, namely LAPACKE_DIR, has been set to specify the install directory of LAPACKE") - endif() -endif() - -# LAPACKE depends on LAPACKEXT -# try to find it specified as COMPONENTS during the call -if (LAPACKE_FIND_COMPONENTS) - foreach( component ${LAPACKE_FIND_COMPONENTS} ) - if(LAPACKE_FIND_REQUIRED_${component}) - find_package(${component} REQUIRED) - else() - find_package(${component}) - endif() - if(${component}_FOUND) - set(LAPACKE_${component}_FOUND TRUE) - else() - set(LAPACKE_${component}_FOUND FALSE) - endif() - endforeach() -endif () - -# LAPACKE depends on LAPACK anyway, try to find it -if (NOT LAPACK_FOUND) - if(LAPACKE_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() -endif() - -# LAPACKE depends on LAPACK -if (LAPACK_FOUND) - - if (NOT LAPACKE_STANDALONE) - # check if a lapacke function exists in the LAPACK lib - include(CheckFunctionExists) - set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LINKER_FLAGS};${LAPACK_LIBRARIES}") - unset(LAPACKE_WORKS CACHE) - check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS) - mark_as_advanced(LAPACKE_WORKS) - set(CMAKE_REQUIRED_LIBRARIES) - - if(LAPACKE_WORKS) - if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke: test with lapack succeeds") - endif() - # test succeeds: LAPACKE is in LAPACK - set(LAPACKE_LIBRARIES "${LAPACK_LIBRARIES}") - if (LAPACK_LIBRARY_DIRS) - set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}") - endif() - if(LAPACK_INCLUDE_DIRS) - set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}") - endif() - if (LAPACK_LINKER_FLAGS) - set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") - endif() - endif() - endif (NOT LAPACKE_STANDALONE) - - if (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS) - - if(NOT LAPACKE_WORKS AND NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke : test with lapack fails") - endif() - # test fails: try to find LAPACKE lib exterior to LAPACK - - # Try to find LAPACKE lib - ####################### - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_LAPACKE_DIR "$ENV{LAPACKE_DIR}") - set(ENV_LAPACKE_INCDIR "$ENV{LAPACKE_INCDIR}") - if(ENV_LAPACKE_INCDIR) - list(APPEND _inc_env "${ENV_LAPACKE_INCDIR}") - elseif(ENV_LAPACKE_DIR) - list(APPEND _inc_env "${ENV_LAPACKE_DIR}") - list(APPEND _inc_env "${ENV_LAPACKE_DIR}/include") - list(APPEND _inc_env "${ENV_LAPACKE_DIR}/include/lapacke") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the lapacke header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(LAPACKE_INCDIR) - set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND") - find_path(LAPACKE_lapacke.h_DIRS - NAMES lapacke.h - HINTS ${LAPACKE_INCDIR}) - else() - if(LAPACKE_DIR) - set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND") - find_path(LAPACKE_lapacke.h_DIRS - NAMES lapacke.h - HINTS ${LAPACKE_DIR} - PATH_SUFFIXES "include" "include/lapacke") - else() - set(LAPACKE_lapacke.h_DIRS "LAPACKE_lapacke.h_DIRS-NOTFOUND") - find_path(LAPACKE_lapacke.h_DIRS - NAMES lapacke.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(LAPACKE_lapacke.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (LAPACKE_lapacke.h_DIRS) - set(LAPACKE_INCLUDE_DIRS "${LAPACKE_lapacke.h_DIRS}") - else () - set(LAPACKE_INCLUDE_DIRS "LAPACKE_INCLUDE_DIRS-NOTFOUND") - if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke -- lapacke.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_LAPACKE_LIBDIR "$ENV{LAPACKE_LIBDIR}") - if(ENV_LAPACKE_LIBDIR) - list(APPEND _lib_env "${ENV_LAPACKE_LIBDIR}") - elseif(ENV_LAPACKE_DIR) - list(APPEND _lib_env "${ENV_LAPACKE_DIR}") - list(APPEND _lib_env "${ENV_LAPACKE_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the lapacke lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(LAPACKE_LIBDIR) - set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") - find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${LAPACKE_LIBDIR}) - else() - if(LAPACKE_DIR) - set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") - find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${LAPACKE_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") - find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(LAPACKE_lapacke_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (LAPACKE_lapacke_LIBRARY) - get_filename_component(lapacke_lib_path "${LAPACKE_lapacke_LIBRARY}" PATH) - # set cmake variables - set(LAPACKE_LIBRARIES "${LAPACKE_lapacke_LIBRARY}") - set(LAPACKE_LIBRARY_DIRS "${lapacke_lib_path}") - else () - set(LAPACKE_LIBRARIES "LAPACKE_LIBRARIES-NOTFOUND") - set(LAPACKE_LIBRARY_DIRS "LAPACKE_LIBRARY_DIRS-NOTFOUND") - if (NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke -- lib lapacke not found") - endif() - endif () - - # check a function to validate the find - if(LAPACKE_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # LAPACKE - if (LAPACKE_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}") - endif() - if (LAPACKE_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${LAPACKE_LIBRARIES}") - # LAPACK - if (LAPACK_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}") - endif() - if (LAPACK_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}") - if (LAPACK_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}") - endif() - # Fortran - if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND REQUIRED_LIBS "-lgfortran") - elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*") - list(APPEND REQUIRED_LIBS "-lifcore") - endif() - # m - if(UNIX OR WIN32) - list(APPEND REQUIRED_LIBS "-lm") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(LAPACKE_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS) - mark_as_advanced(LAPACKE_WORKS) - - if(LAPACKE_WORKS) - # save link with dependencies - set(LAPACKE_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(LAPACKE_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(LAPACKE_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(LAPACKE_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES LAPACKE_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES LAPACKE_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES LAPACKE_LINKER_FLAGS) - else() - if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails") - message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") - message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") - message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(LAPACKE_LIBRARIES) - - endif (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS) - -else(LAPACK_FOUND) - - if (NOT LAPACKE_FIND_QUIETLY) - message(STATUS "LAPACKE requires LAPACK but LAPACK has not been found." - "Please look for LAPACK first.") - endif() - -endif(LAPACK_FOUND) - -if (LAPACKE_LIBRARIES) - list(GET LAPACKE_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(LAPACKE_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of LAPACKE library" FORCE) - else() - set(LAPACKE_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of LAPACKE library" FORCE) - endif() -endif() - -# check that LAPACKE has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LAPACKE DEFAULT_MSG - LAPACKE_LIBRARIES - LAPACKE_WORKS) diff --git a/cmake_modules/morse/find/FindLAPACKEXT.cmake b/cmake_modules/morse/find/FindLAPACKEXT.cmake deleted file mode 100644 index dc608cc741221f20010cf11b5f42839ac7e3b0db..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindLAPACKEXT.cmake +++ /dev/null @@ -1,296 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find LAPACK EXTENDED for MORSE projects: find include dirs and libraries -# -# This module allows to find LAPACK libraries by calling the official FindLAPACK module -# and handles the creation of different library lists whether the user wishes to link -# with a sequential LAPACK or a multihreaded (LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES). -# LAPACK is detected with a FindLAPACK call then if the LAPACK vendor is in the following list, -# Intel mkl, Goto, Openlapack, ACML, IBMESSL -# then the module tries find the corresponding multithreaded libraries -# LAPACK_LIBRARIES does not exists anymore. -# -# 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) - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -# LAPACKEXT depends on BLASEXT -# call our extended module for BLAS -#---------------------------------- -if (NOT BLAS_FOUND) - if(LAPACKEXT_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) - else() - find_package(BLASEXT) - endif() -endif () - - -if(BLA_VENDOR MATCHES "Intel*") - - ### - # look for include path if the LAPACK 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}") - list(REMOVE_DUPLICATES _inc_env) - - if (BLAS_DIR) - set(LAPACK_DIR ${BLAS_DIR}) - endif () - if (BLAS_INCDIR) - set(LAPACK_INCDIR ${BLAS_INCDIR}) - endif () - # find mkl.h inside known include paths - set(LAPACK_mkl_lapack.h_INCLUDE_DIRS "LAPACK_mkl_lapack.h_INCLUDE_DIRS-NOTFOUND") - if(LAPACK_INCDIR) - find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS - NAMES mkl_lapack.h - HINTS ${LAPACK_INCDIR}) - else() - if(LAPACK_DIR) - find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS - 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}) - endif() - endif() - mark_as_advanced(LAPACK_mkl_lapack.h_INCLUDE_DIRS) - ## Print status if not found - ## ------------------------- - #if (NOT LAPACK_mkl_lapack.h_INCLUDE_DIRS) - # Print_Find_Header_Status(lapack mkl_lapack.h) - #endif () - set(LAPACK_INCLUDE_DIRS "") - if(LAPACK_mkl_lapack.h_INCLUDE_DIRS) - list(APPEND LAPACK_INCLUDE_DIRS "${LAPACK_mkl_lapack.h_INCLUDE_DIRS}" ) - endif() - - ### - # look for libs - ### - - if (BLA_VENDOR MATCHES "Intel10_64lp*") - ## look for the sequential version - set(BLA_VENDOR "Intel10_64lp_seq") - endif() - - if(LAPACKEXT_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() - - if (LAPACK_FOUND) - if(BLAS_SEQ_LIBRARIES) - set(LAPACK_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES}") - else() - set(LAPACK_SEQ_LIBRARIES "${LAPACK_SEQ_LIBRARIES-NOTFOUND}") - endif() - # 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}") - else() - set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}") - endif() - endif() - endif() - -elseif(BLA_VENDOR MATCHES "ACML*") - - ### - # look for libs - ### - if(LAPACKEXT_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() - - if (LAPACK_FOUND) - if(BLAS_SEQ_LIBRARIES) - set(LAPACK_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES}") - else() - set(LAPACK_SEQ_LIBRARIES "${LAPACK_SEQ_LIBRARIES-NOTFOUND}") - endif() - if(BLAS_PAR_LIBRARIES) - set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}") - else() - set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}") - endif() - endif() - -else() - - ## look for a sequential version - # call to the cmake official FindLAPACK module - # This module sets the following variables: - # LAPACK_FOUND - set to true if a library implementing the LAPACK interface - # is found - # LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l - # and -L). - # LAPACK_LIBRARIES - uncached list of libraries (using full path name) to - # link against to use LAPACK - # LAPACK95_LIBRARIES - uncached list of libraries (using full path name) - # to link against to use LAPACK95 interface - # LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 interface - # is found - # BLA_STATIC if set on this determines what kind of linkage we do (static) - # BLA_VENDOR if set checks only the specified vendor, if not set checks - # all the possibilities - # BLA_F95 if set on tries to find the f95 interfaces for LAPACK/LAPACK - # Remark: it looks only into paths contained in the system environment variables - if(LAPACKEXT_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() - - if(LAPACK_FOUND) - set(LAPACK_SEQ_LIBRARIES "${LAPACK_LIBRARIES}") - else() - set(LAPACK_SEQ_LIBRARIES "${LAPACK_SEQ_LIBRARIES-NOTFOUND}") - endif() - set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}") - -endif() - -if (LAPACK_SEQ_LIBRARIES) - set(LAPACK_LIBRARIES "${LAPACK_SEQ_LIBRARIES}") -endif() - -# extract libs paths -# remark: because it is not given by find_package(LAPACK) -set(LAPACK_LIBRARY_DIRS "") -foreach(lapack_lib ${LAPACK_LIBRARIES}) - get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH) - list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" ) -endforeach() -if (LAPACK_LIBRARY_DIRS) - list(REMOVE_DUPLICATES LAPACK_LIBRARY_DIRS) -endif () - - -# message(STATUS "LAPACK_FOUND: ${LAPACK_FOUND}") -# message(STATUS "LAPACK_VENDOR: ${LAPACK_VENDOR}") -# message(STATUS "LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}") -# message(STATUS "LAPACK_SEQ_LIBRARIES: ${LAPACK_SEQ_LIBRARIES}") -# message(STATUS "LAPACK_PAR_LIBRARIES: ${LAPACK_PAR_LIBRARIES}") -# message(STATUS "LAPACK_INCLUDE_DIRS: ${LAPACK_INCLUDE_DIRS}") -# message(STATUS "LAPACK_LIBRARY_DIRS: ${LAPACK_LIBRARY_DIRS}") - -# check that LAPACK has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -if(BLA_VENDOR MATCHES "Intel*") - if(BLA_VENDOR MATCHES "Intel10_64lp*") - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK found is Intel MKL:" - "we manage two lists of libs," - " one sequential and one parallel (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 - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS - LAPACK_INCLUDE_DIRS) - if(LAPACK_PAR_LIBRARIES) - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK parallel libraries stored in" - "LAPACK_PAR_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_PAR_LIBRARIES) - endif() - - else() - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK sequential libraries stored in" - "LAPACK_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS - LAPACK_INCLUDE_DIRS) - endif() -elseif(BLA_VENDOR MATCHES "ACML*") - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK found is ACML:" - "we manage two lists of libs," - " one sequential and one parallel (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 - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS - LAPACK_INCLUDE_DIRS) - if(LAPACK_PAR_LIBRARIES) - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK parallel libraries stored in" - "LAPACK_PAR_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_PAR_LIBRARIES) - endif() -else() - if(NOT LAPACKEXT_FIND_QUIETLY) - message(STATUS "LAPACK sequential libraries stored in" - "LAPACK_SEQ_LIBRARIES") - endif() - find_package_handle_standard_args(LAPACK DEFAULT_MSG - LAPACK_SEQ_LIBRARIES - LAPACK_LIBRARY_DIRS) -endif() diff --git a/cmake_modules/morse/find/FindMAGMA.cmake b/cmake_modules/morse/find/FindMAGMA.cmake deleted file mode 100644 index e8bdd072ddf18c8ccf7cd0d2282efe3919278218..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindMAGMA.cmake +++ /dev/null @@ -1,436 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find MAGMA include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(MAGMA -# [REQUIRED] # Fail with error if magma is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# MAGMA depends on the following libraries: -# - CUDA/cuBLAS -# - LAPACK -# - CBLAS -# -# COMPONENTS are optional libraries MAGMA could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - no components are available for now: maybe PLASMA in the future? -# -# Results are reported in variables: -# MAGMA_FOUND - True if headers and requested libraries were found -# MAGMA_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# MAGMA_INCLUDE_DIRS - magma include directories -# MAGMA_LIBRARY_DIRS - Link directories for magma libraries -# MAGMA_LIBRARIES - magma libraries -# MAGMA_INCLUDE_DIRS_DEP - magma + dependencies include directories -# MAGMA_LIBRARY_DIRS_DEP - magma + dependencies link directories -# MAGMA_LIBRARIES_DEP - magma libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DMAGMA_DIR=path/to/magma): -# MAGMA_DIR - Where to find the base directory of magma -# MAGMA_INCDIR - Where to find the header files -# MAGMA_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: MAGMA_DIR, MAGMA_INCDIR, MAGMA_LIBDIR -# -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if(NOT MAGMA_FOUND) - set(MAGMA_DIR "" CACHE PATH "Installation directory of MAGMA library") - if (NOT MAGMA_FIND_QUIETLY) - message(STATUS "A cache variable, namely MAGMA_DIR, has been set to specify the install directory of MAGMA") - endif() -endif(NOT MAGMA_FOUND) - -# MAGMA depends on CUDA anyway, try to find it -if (NOT CUDA_FOUND) - if(MAGMA_FIND_REQUIRED) - find_package(CUDA REQUIRED) - else() - find_package(CUDA) - endif() -endif() -# MAGMA depends on cuBLAS which should come with CUDA, if not found -> error -if (NOT CUDA_CUBLAS_LIBRARIES) - if(MAGMA_FIND_REQUIRED) - message(FATAL_ERROR "Looking for MAGMA - MAGMA depends on cuBLAS which has " - "not been found (should come with cuda install)") - endif() -endif() -# MAGMA depends on LAPACK anyway, try to find it -if (NOT LAPACK_FOUND) - if(MAGMA_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() -endif() -# MAGMA depends on CBLAS anyway, try to find it -if (NOT CBLAS_FOUND) - if(MAGMA_FIND_REQUIRED) - find_package(CBLAS REQUIRED) - else() - find_package(CBLAS) - endif() -endif() - -set(ENV_MAGMA_DIR "$ENV{MAGMA_DIR}") -set(ENV_MAGMA_INCDIR "$ENV{MAGMA_INCDIR}") -set(ENV_MAGMA_LIBDIR "$ENV{MAGMA_LIBDIR}") -set(MAGMA_GIVEN_BY_USER "FALSE") -if ( MAGMA_DIR OR ( MAGMA_INCDIR AND MAGMA_LIBDIR) OR ENV_MAGMA_DIR OR (ENV_MAGMA_INCDIR AND ENV_MAGMA_LIBDIR) ) - set(MAGMA_GIVEN_BY_USER "TRUE") -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) -if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER) - - pkg_search_module(MAGMA magma) - if (NOT MAGMA_FIND_QUIETLY) - if (MAGMA_FOUND AND MAGMA_LIBRARIES) - message(STATUS "Looking for MAGMA - found using PkgConfig") - #if(NOT MAGMA_INCLUDE_DIRS) - # message("${Magenta}MAGMA_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to magma headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for MAGMA - not found using PkgConfig. " - "Perhaps you should add the directory containing magma.pc " - "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) ) - if(NOT MAGMA_FIND_QUIETLY) - 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) ) - if(NOT MAGMA_FIND_QUIETLY) - message(FATAL_ERROR - "MAGMA version found is ${MAGMA_VERSION_STRING} " - "when required is ${MAGMA_FIND_VERSION} or newer") - endif() - endif() - endif() - - # if pkg-config is used: these variables are empty - # the pkg_search_module call will set the following: - # MAGMA_LDFLAGS: all required linker flags - # MAGMA_CFLAGS: all required cflags - set(MAGMA_INCLUDE_DIRS_DEP "") - set(MAGMA_LIBRARY_DIRS_DEP "") - set(MAGMA_LIBRARIES_DEP "") - # replace it anyway: we should update it with dependencies given by pkg-config - set(MAGMA_INCLUDE_DIRS_DEP "${MAGMA_INCLUDE_DIRS}") - set(MAGMA_LIBRARY_DIRS_DEP "${MAGMA_LIBRARY_DIRS}") - set(MAGMA_LIBRARIES_DEP "${MAGMA_LIBRARIES}") - -endif(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER) - -# if MAGMA is not found using pkg-config -if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR (MAGMA_GIVEN_BY_USER) ) - - if (NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for MAGMA - PkgConfig not used") - endif() - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_MAGMA_DIR "$ENV{MAGMA_DIR}") - set(ENV_MAGMA_INCDIR "$ENV{MAGMA_INCDIR}") - if(ENV_MAGMA_INCDIR) - list(APPEND _inc_env "${ENV_MAGMA_INCDIR}") - elseif(ENV_MAGMA_DIR) - list(APPEND _inc_env "${ENV_MAGMA_DIR}") - list(APPEND _inc_env "${ENV_MAGMA_DIR}/include") - list(APPEND _inc_env "${ENV_MAGMA_DIR}/include/magma") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - - # Try to find the magma header in the given paths - # ------------------------------------------------- - # call cmake macro to find the header path - if(MAGMA_INCDIR) - set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND") - find_path(MAGMA_magma.h_DIRS - NAMES magma.h - HINTS ${MAGMA_INCDIR}) - else() - 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") - else() - set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND") - find_path(MAGMA_magma.h_DIRS - NAMES magma.h - HINTS ${_inc_env}) - endif() - endif() - mark_as_advanced(MAGMA_magma.h_DIRS) - - # If found, add path to cmake variable - # ------------------------------------ - if (MAGMA_magma.h_DIRS) - set(MAGMA_INCLUDE_DIRS "${MAGMA_magma.h_DIRS}") - else () - set(MAGMA_INCLUDE_DIRS "MAGMA_INCLUDE_DIRS-NOTFOUND") - if(NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for magma -- magma.h not found") - endif() - endif() - - - # Looking for lib - # --------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_MAGMA_LIBDIR "$ENV{MAGMA_LIBDIR}") - if(ENV_MAGMA_LIBDIR) - list(APPEND _lib_env "${ENV_MAGMA_LIBDIR}") - elseif(ENV_MAGMA_DIR) - list(APPEND _lib_env "${ENV_MAGMA_DIR}") - list(APPEND _lib_env "${ENV_MAGMA_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the magma lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(MAGMA_LIBDIR) - set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND") - find_library(MAGMA_magma_LIBRARY - NAMES magma - HINTS ${MAGMA_LIBDIR}) - else() - 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) - else() - set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND") - find_library(MAGMA_magma_LIBRARY - NAMES magma - HINTS ${_lib_env}) - endif() - endif() - mark_as_advanced(MAGMA_magma_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (MAGMA_magma_LIBRARY) - get_filename_component(magma_lib_path "${MAGMA_magma_LIBRARY}" PATH) - # set cmake variables - set(MAGMA_LIBRARIES "${MAGMA_magma_LIBRARY}") - set(MAGMA_LIBRARY_DIRS "${magma_lib_path}") - else () - set(MAGMA_LIBRARIES "MAGMA_LIBRARIES-NOTFOUND") - set(MAGMA_LIBRARY_DIRS "MAGMA_LIBRARY_DIRS-NOTFOUND") - if(NOT MAGMA_FIND_QUIETLY) - message(STATUS "Looking for magma -- lib magma not found") - endif() - endif () - - # check a function to validate the find - if (MAGMA_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # MAGMA - if (MAGMA_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}") - endif() - if (MAGMA_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${MAGMA_LIBRARIES}") - # CBLAS - if (CBLAS_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS_DEP}") - elseif (CBLAS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}") - endif() - if(CBLAS_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS_DEP}") - elseif(CBLAS_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}") - endif() - if (CBLAS_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES_DEP}") - elseif(CBLAS_LIBRARIES) - list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES}") - endif() - if (BLAS_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") - endif() - # LAPACK - if (LAPACK_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}") - endif() - if(LAPACK_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}") - if (LAPACK_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}") - endif() - # CUDA - if (CUDA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}") - endif() - if(CUDA_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(MAGMA_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(magma_dgetrf MAGMA_WORKS) - mark_as_advanced(MAGMA_WORKS) - - if(MAGMA_WORKS) - # save link with dependencies - set(MAGMA_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(MAGMA_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(MAGMA_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(MAGMA_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES MAGMA_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES MAGMA_INCLUDE_DIRS_DEP) - 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") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(MAGMA_LIBRARIES) - -endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR (MAGMA_GIVEN_BY_USER) ) - -if (MAGMA_LIBRARIES) - if (MAGMA_LIBRARY_DIRS) - foreach(dir ${MAGMA_LIBRARY_DIRS}) - if ("${dir}" MATCHES "magma") - set(first_lib_path "${dir}") - endif() - endforeach() - else() - list(GET MAGMA_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - endif() - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(MAGMA_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of MAGMA library" FORCE) - else() - set(MAGMA_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of MAGMA library" FORCE) - endif() -endif() - -# check that MAGMA has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_EXECUTABLE AND MAGMA_FOUND) - find_package_handle_standard_args(MAGMA DEFAULT_MSG - MAGMA_LIBRARIES) -else() - find_package_handle_standard_args(MAGMA DEFAULT_MSG - MAGMA_LIBRARIES - MAGMA_WORKS) -endif() diff --git a/cmake_modules/morse/find/FindMETIS.cmake b/cmake_modules/morse/find/FindMETIS.cmake deleted file mode 100644 index 9d026b7852d9ce2f3a19e64743e2321be9fd37af..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindMETIS.cmake +++ /dev/null @@ -1,260 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find METIS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(METIS -# [REQUIRED] # Fail with error if metis is not found -# ) -# -# This module finds headers and metis library. -# Results are reported in variables: -# METIS_FOUND - True if headers and requested libraries were found -# METIS_INCLUDE_DIRS - metis include directories -# METIS_LIBRARY_DIRS - Link directories for metis libraries -# METIS_LIBRARIES - metis component libraries to be linked -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DMETIS_DIR=path/to/metis): -# METIS_DIR - Where to find the base directory of metis -# METIS_INCDIR - Where to find the header files -# METIS_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: METIS_DIR, METIS_INCDIR, METIS_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT METIS_FOUND) - set(METIS_DIR "" CACHE PATH "Installation directory of METIS library") - if (NOT METIS_FIND_QUIETLY) - message(STATUS "A cache variable, namely METIS_DIR, has been set to specify the install directory of METIS") - endif() -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_METIS_DIR "$ENV{METIS_DIR}") -set(ENV_METIS_INCDIR "$ENV{METIS_INCDIR}") -if(ENV_METIS_INCDIR) - list(APPEND _inc_env "${ENV_METIS_INCDIR}") -elseif(ENV_METIS_DIR) - list(APPEND _inc_env "${ENV_METIS_DIR}") - list(APPEND _inc_env "${ENV_METIS_DIR}/include") - list(APPEND _inc_env "${ENV_METIS_DIR}/include/metis") -else() - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the metis header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(METIS_INCDIR) - set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND") - find_path(METIS_metis.h_DIRS - NAMES metis.h - HINTS ${METIS_INCDIR}) -else() - if(METIS_DIR) - set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND") - find_path(METIS_metis.h_DIRS - NAMES metis.h - HINTS ${METIS_DIR} - PATH_SUFFIXES "include" "include/metis") - else() - set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND") - find_path(METIS_metis.h_DIRS - NAMES metis.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(METIS_metis.h_DIRS) - - -# If found, add path to cmake variable -# ------------------------------------ -if (METIS_metis.h_DIRS) - set(METIS_INCLUDE_DIRS "${METIS_metis.h_DIRS}") -else () - set(METIS_INCLUDE_DIRS "METIS_INCLUDE_DIRS-NOTFOUND") - if(NOT METIS_FIND_QUIETLY) - message(STATUS "Looking for metis -- metis.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_METIS_LIBDIR "$ENV{METIS_LIBDIR}") -if(ENV_METIS_LIBDIR) - list(APPEND _lib_env "${ENV_METIS_LIBDIR}") -elseif(ENV_METIS_DIR) - list(APPEND _lib_env "${ENV_METIS_DIR}") - list(APPEND _lib_env "${ENV_METIS_DIR}/lib") -else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the metis lib in the given paths -# ---------------------------------------------- -# call cmake macro to find the lib path -if(METIS_LIBDIR) - set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND") - find_library(METIS_metis_LIBRARY - NAMES metis - HINTS ${METIS_LIBDIR}) -else() - if(METIS_DIR) - set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND") - find_library(METIS_metis_LIBRARY - NAMES metis - HINTS ${METIS_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND") - find_library(METIS_metis_LIBRARY - NAMES metis - HINTS ${_lib_env}) - endif() -endif() -mark_as_advanced(METIS_metis_LIBRARY) - - -# If found, add path to cmake variable -# ------------------------------------ -if (METIS_metis_LIBRARY) - get_filename_component(metis_lib_path "${METIS_metis_LIBRARY}" PATH) - # set cmake variables - set(METIS_LIBRARIES "${METIS_metis_LIBRARY}") - set(METIS_LIBRARY_DIRS "${metis_lib_path}") -else () - set(METIS_LIBRARIES "METIS_LIBRARIES-NOTFOUND") - set(METIS_LIBRARY_DIRS "METIS_LIBRARY_DIRS-NOTFOUND") - if(NOT METIS_FIND_QUIETLY) - message(STATUS "Looking for metis -- lib metis not found") - endif() -endif () - -# check a function to validate the find -if(METIS_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # METIS - if (METIS_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}") - endif() - if (METIS_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${METIS_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${METIS_LIBRARIES}") - # m - if(UNIX OR WIN32) - list(APPEND REQUIRED_LIBS "-lm") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(METIS_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(METIS_NodeND METIS_WORKS) - mark_as_advanced(METIS_WORKS) - - if(NOT METIS_WORKS) - if(NOT METIS_FIND_QUIETLY) - message(STATUS "Looking for METIS : test of METIS_NodeND with METIS 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(METIS_LIBRARIES) - -if (METIS_LIBRARIES) - list(GET METIS_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(METIS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of METIS library" FORCE) - else() - set(METIS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of METIS library" FORCE) - endif() -endif() - -# check that METIS has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(METIS DEFAULT_MSG - METIS_LIBRARIES - METIS_WORKS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindMPIEXT.cmake b/cmake_modules/morse/find/FindMPIEXT.cmake deleted file mode 100644 index 68520a478eb4bef8943830a93830a73994b3ad07..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindMPIEXT.cmake +++ /dev/null @@ -1,120 +0,0 @@ -# - Find MPI EXTENDED for MORSE projects: -# -# 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 - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -# add a cache variable to let the user specify the BLAS vendor -if (NOT MPI_FOUND) - if(MPIEXT_FIND_REQUIRED) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() -endif () - -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}) - # Set flags for building test program - set(CMAKE_REQUIRED_INCLUDES ${MPI_INCLUDE_PATH}) - set(CMAKE_REQUIRED_LIBRARIES ${MPI_LIBRARIES}) - set(CMAKE_REQUIRED_FLAGS ${MPI_COMPILE_FLAGS}) - - include(CheckCSourceRuns) - set(MPI_C_TEST_MULTIPLE_SOURCE " -#include <stdio.h> -#include <mpi.h> - -int main(int argc, char **argv) { - int provided; - - MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); - - if (MPI_THREAD_MULTIPLE > provided) { - fprintf(stderr,\"MPI implementation is not supporting MPI_THREAD_MULTIPLE\"); - MPI_Finalize(); - return 1000+MPI_THREAD_MULTIPLE-provided; - } - MPI_Finalize(); - return 0; -} -") - - set(MPI_C_TEST_SERIALIZED_SOURCE " -#include <stdio.h> -#include <mpi.h> - -int main(int argc, char **argv) { - int provided; - - MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &provided); - - if (MPI_THREAD_SERIALIZED > provided) { - printf(\"MPI implementation is not supporting MPI_THREAD_SERIALIZED\"); - MPI_Finalize(); - return 1; - } - MPI_Finalize(); - return 0; -} -") - - set(MPI_C_TEST_FUNNELED_SOURCE " -#include <stdio.h> -#include <mpi.h> - -int main(int argc, char **argv) { - int provided; - - MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided); - - if (MPI_THREAD_FUNNELED > provided) { - printf(\"MPI implementation is not supporting MPI_THREAD_FUNNELED\"); - MPI_Finalize(); - return 1; - } - MPI_Finalize(); - return 0; -} -") - - check_c_source_runs("${MPI_C_TEST_MULTIPLE_SOURCE}" MULTIPLE_TEST_RUNS) - if(NOT MULTIPLE_TEST_RUNS) - check_c_source_runs("${MPI_C_TEST_SERIALIZED_SOURCE}" SERIALIZED_TEST_RUNS) - 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") - else(NOT FUNNELED_TEST_RUNS) - 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") - endif(NOT SERIALIZED_TEST_RUNS) - else(NOT MULTIPLE_TEST_RUNS) - set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_MULTIPLE") - endif(NOT MULTIPLE_TEST_RUNS) - # Set flags for building test program - 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) \ No newline at end of file diff --git a/cmake_modules/morse/find/FindMUMPS.cmake b/cmake_modules/morse/find/FindMUMPS.cmake deleted file mode 100644 index 5655aab20c1603c5c5e70c95e9cf046a7470b690..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindMUMPS.cmake +++ /dev/null @@ -1,641 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find MUMPS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(MUMPS -# [REQUIRED] # Fail with error if mumps is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# MUMPS depends on the following libraries: -# - Threads -# - BLAS -# -# COMPONENTS are optional libraries MUMPS could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - MPI: to activate detection of the parallel MPI version (default) -# it looks for Threads, BLAS, MPI and ScaLAPACK libraries -# - SEQ: to activate detection of sequential version (exclude MPI version) -# it looks for Threads and BLAS libraries -# - SCOTCH: to activate detection of MUMPS linked with SCOTCH -# - METIS: to activate detection of MUMPS linked with METIS -# -# This module finds headers and mumps library. -# Results are reported in variables: -# MUMPS_FOUND - True if headers and requested libraries were found -# MUMPS_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# MUMPS_INCLUDE_DIRS - mumps include directories -# MUMPS_LIBRARY_DIRS - Link directories for mumps libraries -# MUMPS_LIBRARIES - mumps libraries -# MUMPS_INCLUDE_DIRS_DEP - mumps + dependencies include directories -# MUMPS_LIBRARY_DIRS_DEP - mumps + dependencies link directories -# MUMPS_LIBRARIES_DEP - mumps libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DMUMPS_DIR=path/to/mumps): -# MUMPS_DIR - Where to find the base directory of mumps -# The module can also look for the following environment variables if paths -# are not given as cmake variable: MUMPS_DIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT MUMPS_FOUND) - set(MUMPS_DIR "" CACHE PATH "Installation directory of MUMPS library") - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "A cache variable, namely MUMPS_DIR, has been set to specify the install directory of MUMPS") - endif() -endif() - -# Set the version to find -set(MUMPS_LOOK_FOR_MPI ON) -set(MUMPS_LOOK_FOR_SEQ OFF) -set(MUMPS_LOOK_FOR_SCOTCH OFF) -set(MUMPS_LOOK_FOR_METIS OFF) - -if( MUMPS_FIND_COMPONENTS ) - foreach( component ${MUMPS_FIND_COMPONENTS} ) - if (${component} STREQUAL "SEQ") - # means we look for the sequential version of MUMPS (without MPI) - set(MUMPS_LOOK_FOR_SEQ ON) - set(MUMPS_LOOK_FOR_MPI OFF) - endif() - if (${component} STREQUAL "MPI") - # means we look for the MPI version of MUMPS (default) - set(MUMPS_LOOK_FOR_MPI ON) - set(MUMPS_LOOK_FOR_SEQ OFF) - endif() - if (${component} STREQUAL "SCOTCH") - set(MUMPS_LOOK_FOR_SCOTCH ON) - endif() - if (${component} STREQUAL "METIS") - set(MUMPS_LOOK_FOR_METIS ON) - endif() - endforeach() -endif() - -if (NOT MUMPS_FIND_QUIETLY) - if (MUMPS_LOOK_FOR_SEQ) - message(STATUS "Looking for MUMPS - sequential version (without MPI)") - else() - message(STATUS "Looking for MUMPS - MPI version -" - " if you want to force detection of a sequential " - "version use find_package(MUMPS [REQUIRED] COMPONENTS SEQ [...])") - endif() -endif() - -if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - PkgConfig not used") -endif() - -# Dependencies detection -# ---------------------- - - -# Required dependencies -# --------------------- - -if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect pthread") -endif() -if (NOT Threads_FOUND) - if (MUMPS_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() -endif() -set(MUMPS_EXTRA_LIBRARIES "") -if( THREADS_FOUND ) - list(APPEND MUMPS_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -endif () - -# MUMPS depends on BLAS -#---------------------- -if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect BLAS") -endif() -if (NOT BLASEXT_FOUND) - if (MUMPS_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) - else() - find_package(BLASEXT) - endif() -endif() - -# Optional dependencies -# --------------------- - -# MUMPS may depend on MPI -#------------------------ -if (NOT MPI_FOUND AND MUMPS_LOOK_FOR_MPI) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect MPI") - endif() - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_MPI) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() -endif (NOT MPI_FOUND AND MUMPS_LOOK_FOR_MPI) - -# MUMPS may depend on ScaLAPACK (if MPI version) -#----------------------------------------------- -if (NOT SCALAPACK_FOUND AND MUMPS_LOOK_FOR_MPI) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect SCALAPACK") - endif() - # SCALAPACK is a required dependency if MPI is used - if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_MPI) - find_package(SCALAPACK REQUIRED) - else() - find_package(SCALAPACK) - endif() -endif (NOT SCALAPACK_FOUND AND MUMPS_LOOK_FOR_MPI) - -# MUMPS may depends on SCOTCH -#---------------------------- -if (NOT SCOTCH_FOUND AND MUMPS_LOOK_FOR_SCOTCH) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect SCOTCH") - endif() - if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_SCOTCH) - find_package(SCOTCH REQUIRED) - else() - find_package(SCOTCH) - endif() -endif() - -# MUMPS may depends on METIS -#--------------------------- -if (NOT METIS_FOUND AND MUMPS_LOOK_FOR_METIS) - if (NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS - Try to detect METIS") - endif() - if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_METIS) - find_package(METIS REQUIRED) - else() - find_package(METIS) - endif() -endif() - - -# Looking for MUMPS -# ----------------- - -# Looking for include -# ------------------- - -# Try to find the mumps header in the given path -# ---------------------------------------------- -# call cmake macro to find the header path -if(MUMPS_DIR) - set(MUMPS_smumps_c.h_DIRS "MUMPS_smumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_smumps_c.h_DIRS - NAMES smumps_c.h - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES "include") - set(MUMPS_dmumps_c.h_DIRS "MUMPS_dmumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_dmumps_c.h_DIRS - NAMES dmumps_c.h - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES "include") - set(MUMPS_cmumps_c.h_DIRS "MUMPS_cmumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_cmumps_c.h_DIRS - NAMES cmumps_c.h - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES "include") - set(MUMPS_zmumps_c.h_DIRS "MUMPS_zmumps_c.h_DIRS-NOTFOUND") - find_path(MUMPS_zmumps_c.h_DIRS - NAMES zmumps_c.h - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES "include") -else() - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - endif() - endif() -endif() - -# If found, add path to cmake variable -# ------------------------------------ -# detect which precisions are available -if (MUMPS_smumps_c.h_DIRS) - mark_as_advanced(MUMPS_smumps_c.h_DIRS) - set(MUMPS_PREC_S ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_smumps_c.h_DIRS}") -else () - set(MUMPS_PREC_S OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- smumps_c.h not found") - endif() -endif() -if (MUMPS_dmumps_c.h_DIRS) - mark_as_advanced(MUMPS_dmumps_c.h_DIRS) - set(MUMPS_PREC_D ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_dmumps_c.h_DIRS}") -else () - set(MUMPS_PREC_D OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- dmumps_c.h not found") - endif() -endif() -if (MUMPS_cmumps_c.h_DIRS) - mark_as_advanced(MUMPS_cmumps_c.h_DIRS) - set(MUMPS_PREC_C ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_cmumps_c.h_DIRS}") -else () - set(MUMPS_PREC_C OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- cmumps_c.h not found") - endif() -endif() -if (MUMPS_zmumps_c.h_DIRS) - mark_as_advanced(MUMPS_zmumps_c.h_DIRS) - set(MUMPS_PREC_Z ON) - set(MUMPS_INCLUDE_DIRS "${MUMPS_zmumps_c.h_DIRS}") -else () - set(MUMPS_PREC_Z OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- zmumps_c.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Try to find the mumps lib in the given paths -# -------------------------------------------- - -# call cmake macro to find the lib path -if(MUMPS_DIR) - set(MUMPS_smumps_LIBRARY "MUMPS_smumps_LIBRARY-NOTFOUND") - find_library(MUMPS_smumps_LIBRARY - NAMES smumps - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES lib) - set(MUMPS_dmumps_LIBRARY "MUMPS_dmumps_LIBRARY-NOTFOUND") - find_library(MUMPS_dmumps_LIBRARY - NAMES dmumps - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES lib) - set(MUMPS_cmumps_LIBRARY "MUMPS_cmumps_LIBRARY-NOTFOUND") - find_library(MUMPS_cmumps_LIBRARY - NAMES cmumps - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES lib) - set(MUMPS_zmumps_LIBRARY "MUMPS_zmumps_LIBRARY-NOTFOUND") - find_library(MUMPS_zmumps_LIBRARY - NAMES zmumps - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES lib) - set(MUMPS_mumps_common_LIBRARY "MUMPS_mumps_common_LIBRARY-NOTFOUND") - find_library(MUMPS_mumps_common_LIBRARY - NAMES mumps_common - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES lib) - set(MUMPS_mpiseq_LIBRARY "MUMPS_mpiseq_LIBRARY-NOTFOUND") - find_library(MUMPS_mpiseq_LIBRARY - NAMES mpiseq - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES libseq) - set(MUMPS_pord_LIBRARY "MUMPS_pord_LIBRARY-NOTFOUND") - find_library(MUMPS_pord_LIBRARY - NAMES pord - HINTS "${MUMPS_DIR}" "$ENV{MUMPS_DIR}" - PATH_SUFFIXES lib) -else() - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- MUMPS_DIR is not set, to find" - " MUMPS please set MUMPS_DIR, the path to MUMPS installation where" - " sub-directories include/ and lib/ are located") - endif() - endif() -endif() - -# If found, add path to cmake variable -# ------------------------------------ -set(MUMPS_LIBRARIES "") -set(MUMPS_LIBRARY_DIRS "") -# detect which precisions are available -if (MUMPS_smumps_LIBRARY) - mark_as_advanced(MUMPS_smumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_smumps_LIBRARY}") - get_filename_component(smumps_lib_path ${MUMPS_smumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${smumps_lib_path}") -else () - set(MUMPS_PREC_S OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libsmumps.a not found") - endif() -endif() -if (MUMPS_dmumps_LIBRARY) - mark_as_advanced(MUMPS_dmumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_dmumps_LIBRARY}") - get_filename_component(dmumps_lib_path ${MUMPS_dmumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${dmumps_lib_path}") -else () - set(MUMPS_PREC_D OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libdmumps.a not found") - endif() -endif() -if (MUMPS_cmumps_LIBRARY) - mark_as_advanced(MUMPS_cmumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_cmumps_LIBRARY}") - get_filename_component(cmumps_lib_path ${MUMPS_cmumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${cmumps_lib_path}") -else () - set(MUMPS_PREC_C OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libcmumps.a not found") - endif() -endif() -if (MUMPS_zmumps_LIBRARY) - mark_as_advanced(MUMPS_zmumps_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_zmumps_LIBRARY}") - get_filename_component(zmumps_lib_path ${MUMPS_zmumps_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${zmumps_lib_path}") -else () - set(MUMPS_PREC_Z OFF) - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libzmumps.a not found") - endif() -endif() - -# check that one precision arithmetic at least has been discovered -if (NOT MUMPS_PREC_S AND NOT MUMPS_PREC_D AND NOT MUMPS_PREC_C AND NOT MUMPS_PREC_S) - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- " - "no lib[sdcz]mumps.a have been found in ${MUMPS_DIR}/lib when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- no lib[sdcz]mumps.a have been found") - endif() - endif() -endif() -# other MUMPS libraries -if (MUMPS_mumps_common_LIBRARY) - mark_as_advanced(MUMPS_mumps_common_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_mumps_common_LIBRARY}") - get_filename_component(mumps_common_lib_path ${MUMPS_mumps_common_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${mumps_common_lib_path}") -else () - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- " - "libmumps_common.a not found in ${MUMPS_DIR}/lib when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libmumps_common.a not found") - endif() - endif() -endif() -if (MUMPS_mpiseq_LIBRARY) - mark_as_advanced(MUMPS_mpiseq_LIBRARY) - if (MUMPS_LOOK_FOR_SEQ) - list(APPEND MUMPS_LIBRARIES "${MUMPS_mpiseq_LIBRARY}") - get_filename_component(mpiseq_lib_path ${MUMPS_mpiseq_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${mpiseq_lib_path}") - list(APPEND MUMPS_INCLUDE_DIRS "${mpiseq_lib_path}") - endif() -else () - if (MUMPS_FIND_REQUIRED AND MUMPS_LOOK_FOR_SEQ) - message(FATAL_ERROR "Looking for mumps -- " - "libmpiseq.a not found in ${MUMPS_DIR}/libseq when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libmpiseq.a not found") - endif() - endif() -endif() -if (MUMPS_pord_LIBRARY) - mark_as_advanced(MUMPS_pord_LIBRARY) - list(APPEND MUMPS_LIBRARIES "${MUMPS_pord_LIBRARY}") - get_filename_component(pord_lib_path ${MUMPS_pord_LIBRARY} PATH) - list(APPEND MUMPS_LIBRARY_DIRS "${pord_lib_path}") -else () - if (MUMPS_FIND_REQUIRED) - message(FATAL_ERROR "Looking for mumps -- " - "libpord.a not found in ${MUMPS_DIR}/lib when required") - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for mumps -- libpord.a not found") - endif() - endif() -endif() -list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS) -list(REMOVE_DUPLICATES MUMPS_INCLUDE_DIRS) - -# check a function to validate the find -if(MUMPS_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # MUMPS - if (MUMPS_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${MUMPS_INCLUDE_DIRS}") - endif() - foreach(libdir ${MUMPS_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - set(REQUIRED_LIBS "${MUMPS_LIBRARIES}") - # SCALAPACK - if (MUMPS_LOOK_FOR_MPI AND SCALAPACK_FOUND) - if (SCALAPACK_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${SCALAPACK_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCALAPACK_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${SCALAPACK_LIBRARIES}") - if (SCALAPACK_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${SCALAPACK_LINKER_FLAGS}") - endif() - endif() - # MPI - if (MUMPS_LOOK_FOR_MPI AND MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}") - endif() - if (MPI_Fortran_LINK_FLAGS) - if (${MPI_Fortran_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_Fortran_LINK_FLAGS ${MPI_Fortran_LINK_FLAGS}) - endif() - list(APPEND REQUIRED_LDFLAGS "${MPI_Fortran_LINK_FLAGS}") - endif() - list(APPEND REQUIRED_LIBS "${MPI_Fortran_LIBRARIES}") - endif() - # BLAS - if (BLAS_FOUND) - if (BLAS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") - endif() - foreach(libdir ${BLAS_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") - if (BLAS_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") - endif() - endif() - # SCOTCH - if (MUMPS_LOOK_FOR_SCOTCH AND SCOTCH_FOUND) - if (SCOTCH_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${SCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCOTCH_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}") - endif() - # METIS - if (MUMPS_LOOK_FOR_METIS AND METIS_FOUND) - if (METIS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}") - endif() - foreach(libdir ${METIS_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}") - endif() - # Fortran - if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND REQUIRED_LIBS "-lgfortran") - elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*") - list(APPEND REQUIRED_LIBS "-lifcore") - endif() - # EXTRA LIBS such that pthread, m, rt - list(APPEND REQUIRED_LIBS ${MUMPS_EXTRA_LIBRARIES}) - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - include(CheckFortranFunctionExists) - unset(MUMPS_PREC_S_WORKS CACHE) - check_fortran_function_exists(smumps MUMPS_PREC_S_WORKS) - mark_as_advanced(MUMPS_PREC_S_WORKS) - unset(MUMPS_PREC_D_WORKS CACHE) - check_fortran_function_exists(dmumps MUMPS_PREC_D_WORKS) - mark_as_advanced(MUMPS_PREC_D_WORKS) - unset(MUMPS_PREC_C_WORKS CACHE) - check_fortran_function_exists(cmumps MUMPS_PREC_C_WORKS) - mark_as_advanced(MUMPS_PREC_C_WORKS) - unset(MUMPS_PREC_Z_WORKS CACHE) - check_fortran_function_exists(zmumps MUMPS_PREC_Z_WORKS) - mark_as_advanced(MUMPS_PREC_Z_WORKS) - - set(MUMPS_WORKS FALSE) - if(MUMPS_PREC_S_WORKS OR MUMPS_PREC_D_WORKS OR MUMPS_PREC_C_WORKS OR MUMPS_PREC_Z_WORKS) - set(MUMPS_WORKS TRUE) - endif() - - if(MUMPS_WORKS) - # save link with dependencies - set(MUMPS_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(MUMPS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(MUMPS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(MUMPS_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES MUMPS_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES MUMPS_LINKER_FLAGS) - else() - if(NOT MUMPS_FIND_QUIETLY) - message(STATUS "Looking for MUMPS : test of [sdcz]mumps() 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 "Maybe MUMPS is linked with specific libraries. " - "Have you tried with COMPONENTS (MPI/SEQ, SCOTCH, METIS)? " - "See the explanation in FindMUMPS.cmake.") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(MUMPS_LIBRARIES) - -if (MUMPS_LIBRARIES) - list(GET MUMPS_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(MUMPS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of MUMPS library" FORCE) - else() - set(MUMPS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of MUMPS library" FORCE) - endif() -endif() - -# check that MUMPS has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MUMPS DEFAULT_MSG - MUMPS_LIBRARIES - MUMPS_WORKS) diff --git a/cmake_modules/morse/find/FindPARMETIS.cmake b/cmake_modules/morse/find/FindPARMETIS.cmake deleted file mode 100644 index 36235d868fb98212d0438af3ebf77db8f382ed13..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindPARMETIS.cmake +++ /dev/null @@ -1,260 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find PARMETIS include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(PARMETIS -# [REQUIRED] # Fail with error if parmetis is not found -# ) -# -# This module finds headers and parmetis library. -# Results are reported in variables: -# PARMETIS_FOUND - True if headers and requested libraries were found -# PARMETIS_INCLUDE_DIRS - parmetis include directories -# PARMETIS_LIBRARY_DIRS - Link directories for parmetis libraries -# PARMETIS_LIBRARIES - parmetis component libraries to be linked -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DPARMETIS_DIR=path/to/parmetis): -# PARMETIS_DIR - Where to find the base directory of parmetis -# PARMETIS_INCDIR - Where to find the header files -# PARMETIS_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: PARMETIS_DIR, PARMETIS_INCDIR, PARMETIS_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT PARMETIS_FOUND) - set(PARMETIS_DIR "" CACHE PATH "Installation directory of PARMETIS library") - if (NOT PARMETIS_FIND_QUIETLY) - message(STATUS "A cache variable, namely PARMETIS_DIR, has been set to specify the install directory of PARMETIS") - endif() -endif() - - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_PARMETIS_DIR "$ENV{PARMETIS_DIR}") -set(ENV_PARMETIS_INCDIR "$ENV{PARMETIS_INCDIR}") -if(ENV_PARMETIS_INCDIR) - list(APPEND _inc_env "${ENV_PARMETIS_INCDIR}") -elseif(ENV_PARMETIS_DIR) - list(APPEND _inc_env "${ENV_PARMETIS_DIR}") - list(APPEND _inc_env "${ENV_PARMETIS_DIR}/include") - list(APPEND _inc_env "${ENV_PARMETIS_DIR}/include/parmetis") -else() - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the parmetis header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(PARMETIS_INCDIR) - set(PARMETIS_parmetis.h_DIRS "PARMETIS_parmetis.h_DIRS-NOTFOUND") - find_path(PARMETIS_parmetis.h_DIRS - NAMES parmetis.h - HINTS ${PARMETIS_INCDIR}) -else() - if(PARMETIS_DIR) - set(PARMETIS_parmetis.h_DIRS "PARMETIS_parmetis.h_DIRS-NOTFOUND") - find_path(PARMETIS_parmetis.h_DIRS - NAMES parmetis.h - HINTS ${PARMETIS_DIR} - PATH_SUFFIXES "include" "include/parmetis") - else() - set(PARMETIS_parmetis.h_DIRS "PARMETIS_parmetis.h_DIRS-NOTFOUND") - find_path(PARMETIS_parmetis.h_DIRS - NAMES parmetis.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(PARMETIS_parmetis.h_DIRS) - - -# If found, add path to cmake variable -# ------------------------------------ -if (PARMETIS_parmetis.h_DIRS AND NOT PARMETIS_FIND_QUIETLY) - set(PARMETIS_INCLUDE_DIRS "${PARMETIS_parmetis.h_DIRS}") -else () - set(PARMETIS_INCLUDE_DIRS "PARMETIS_INCLUDE_DIRS-NOTFOUND") - if(NOT PARMETIS_FIND_QUIETLY) - message(STATUS "Looking for parmetis -- parmetis.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_PARMETIS_LIBDIR "$ENV{PARMETIS_LIBDIR}") -if(ENV_PARMETIS_LIBDIR) - list(APPEND _lib_env "${ENV_PARMETIS_LIBDIR}") -elseif(ENV_PARMETIS_DIR) - list(APPEND _lib_env "${ENV_PARMETIS_DIR}") - list(APPEND _lib_env "${ENV_PARMETIS_DIR}/lib") -else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the parmetis lib in the given paths -# ---------------------------------------------- -# call cmake macro to find the lib path -if(PARMETIS_LIBDIR) - set(PARMETIS_parmetis_LIBRARY "PARMETIS_parmetis_LIBRARY-NOTFOUND") - find_library(PARMETIS_parmetis_LIBRARY - NAMES parmetis - HINTS ${PARMETIS_LIBDIR}) -else() - if(PARMETIS_DIR) - set(PARMETIS_parmetis_LIBRARY "PARMETIS_parmetis_LIBRARY-NOTFOUND") - find_library(PARMETIS_parmetis_LIBRARY - NAMES parmetis - HINTS ${PARMETIS_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(PARMETIS_parmetis_LIBRARY "PARMETIS_parmetis_LIBRARY-NOTFOUND") - find_library(PARMETIS_parmetis_LIBRARY - NAMES parmetis - HINTS ${_lib_env}) - endif() -endif() -mark_as_advanced(PARMETIS_parmetis_LIBRARY) - -# If found, add path to cmake variable -# ------------------------------------ -if (PARMETIS_parmetis_LIBRARY) - get_filename_component(parmetis_lib_path "${PARMETIS_parmetis_LIBRARY}" PATH) - # set cmake variables - set(PARMETIS_LIBRARIES "${PARMETIS_parmetis_LIBRARY}") - set(PARMETIS_LIBRARY_DIRS "${parmetis_lib_path}") -else () - set(PARMETIS_LIBRARIES "PARMETIS_LIBRARIES-NOTFOUND") - set(PARMETIS_LIBRARY_DIRS "PARMETIS_LIBRARY_DIRS-NOTFOUND") - if (NOT PARMETIS_FIND_QUIETLY) - message(STATUS "Looking for parmetis -- lib parmetis not found") - endif() -endif () - -# check a function to validate the find -if(PARMETIS_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # PARMETIS - if (PARMETIS_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${PARMETIS_INCLUDE_DIRS}") - endif() - if (PARMETIS_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${PARMETIS_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${PARMETIS_LIBRARIES}") - # m - if(UNIX OR WIN32) - list(APPEND REQUIRED_LIBS "-lm") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(PARMETIS_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(ParMETIS_V3_NodeND PARMETIS_WORKS) - mark_as_advanced(PARMETIS_WORKS) - - if(NOT PARMETIS_WORKS) - if(NOT PARMETIS_FIND_QUIETLY) - message(STATUS "Looking for PARMETIS : test of ParMETIS_V3_NodeND with PARMETIS 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(PARMETIS_LIBRARIES) - -if (PARMETIS_LIBRARIES) - list(GET PARMETIS_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(PARMETIS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PARMETIS library" FORCE) - else() - set(PARMETIS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PARMETIS library" FORCE) - endif() -endif() - -# check that PARMETIS has been found -# ---------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PARMETIS DEFAULT_MSG - PARMETIS_LIBRARIES - PARMETIS_WORKS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindPASTIX.cmake b/cmake_modules/morse/find/FindPASTIX.cmake deleted file mode 100644 index c2ee44cf386270cd64a0c4d8b57528fdba06dad2..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindPASTIX.cmake +++ /dev/null @@ -1,685 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find PASTIX include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(PASTIX -# [REQUIRED] # Fail with error if pastix is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# PASTIX depends on the following libraries: -# - Threads, m, rt -# - HWLOC -# - BLAS -# -# COMPONENTS are optional libraries PASTIX could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - 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) -# - 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 -# - STARPU_CUDA: to activate detection of StarPU with CUDA -# - STARPU_FXT: to activate detection of StarPU with FxT -# - SCOTCH: to activate detection of PASTIX linked with SCOTCH -# - PTSCOTCH: to activate detection of PASTIX linked with SCOTCH -# - METIS: to activate detection of PASTIX linked with SCOTCH -# -# This module finds headers and pastix library. -# Results are reported in variables: -# PASTIX_FOUND - True if headers and requested libraries were found -# PASTIX_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# PASTIX_INCLUDE_DIRS - pastix include directories -# PASTIX_LIBRARY_DIRS - Link directories for pastix libraries -# PASTIX_LIBRARIES - pastix libraries -# PASTIX_INCLUDE_DIRS_DEP - pastix + dependencies include directories -# PASTIX_LIBRARY_DIRS_DEP - pastix + dependencies link directories -# PASTIX_LIBRARIES_DEP - pastix libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DPASTIX_DIR=path/to/pastix): -# PASTIX_DIR - Where to find the base directory of pastix -# PASTIX_INCDIR - Where to find the header files -# PASTIX_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: PASTIX_DIR, PASTIX_INCDIR, PASTIX_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT PASTIX_FOUND) - set(PASTIX_DIR "" CACHE PATH "Installation directory of PASTIX library") - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "A cache variable, namely PASTIX_DIR, has been set to specify the install directory of PASTIX") - endif() -endif() - -# Set the version to find -set(PASTIX_LOOK_FOR_MPI ON) -set(PASTIX_LOOK_FOR_SEQ OFF) -set(PASTIX_LOOK_FOR_STARPU OFF) -set(PASTIX_LOOK_FOR_STARPU_CUDA OFF) -set(PASTIX_LOOK_FOR_STARPU_FXT OFF) -set(PASTIX_LOOK_FOR_SCOTCH ON) -set(PASTIX_LOOK_FOR_PTSCOTCH OFF) -set(PASTIX_LOOK_FOR_METIS OFF) - -if( PASTIX_FIND_COMPONENTS ) - foreach( component ${PASTIX_FIND_COMPONENTS} ) - if (${component} STREQUAL "SEQ") - # means we look for the sequential version of PaStiX (without MPI) - set(PASTIX_LOOK_FOR_SEQ ON) - set(PASTIX_LOOK_FOR_MPI OFF) - endif() - if (${component} STREQUAL "MPI") - # means we look for the MPI version of PaStiX (default) - set(PASTIX_LOOK_FOR_SEQ OFF) - set(PASTIX_LOOK_FOR_MPI ON) - endif() - if (${component} STREQUAL "STARPU") - # means we look for PaStiX with StarPU - set(PASTIX_LOOK_FOR_STARPU ON) - endif() - if (${component} STREQUAL "STARPU_CUDA") - # means we look for PaStiX with StarPU + CUDA - set(PASTIX_LOOK_FOR_STARPU ON) - set(PASTIX_LOOK_FOR_STARPU_CUDA ON) - endif() - if (${component} STREQUAL "STARPU_FXT") - # means we look for PaStiX with StarPU + FxT - set(PASTIX_LOOK_FOR_STARPU_FXT ON) - endif() - if (${component} STREQUAL "SCOTCH") - set(PASTIX_LOOK_FOR_SCOTCH ON) - endif() - if (${component} STREQUAL "SCOTCH") - set(PASTIX_LOOK_FOR_PTSCOTCH ON) - endif() - if (${component} STREQUAL "METIS") - set(PASTIX_LOOK_FOR_METIS ON) - endif() - endforeach() -endif() - -# Dependencies detection -# ---------------------- - - -# Required dependencies -# --------------------- - -if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect pthread") -endif() -if (PASTIX_FIND_REQUIRED) - find_package(Threads REQUIRED) -else() - find_package(Threads) -endif() -set(PASTIX_EXTRA_LIBRARIES "") -if( THREADS_FOUND ) - list(APPEND PASTIX_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -endif () - -# Add math library to the list of extra -# it normally exists on all common systems provided with a C compiler -if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect libm") -endif() -set(PASTIX_M_LIBRARIES "") -if(UNIX OR WIN32) - find_library( - PASTIX_M_m_LIBRARY - NAMES m - ) - mark_as_advanced(PASTIX_M_m_LIBRARY) - if (PASTIX_M_m_LIBRARY) - list(APPEND PASTIX_M_LIBRARIES "${PASTIX_M_m_LIBRARY}") - list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_M_m_LIBRARY}") - 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?") - endif() - endif() -endif() - -# Try to find librt (libposix4 - POSIX.1b Realtime Extensions library) -# on Unix systems except Apple ones because it does not exist on it -if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect librt") -endif() -set(PASTIX_RT_LIBRARIES "") -if(UNIX AND NOT APPLE) - find_library( - PASTIX_RT_rt_LIBRARY - NAMES rt - ) - mark_as_advanced(PASTIX_RT_rt_LIBRARY) - if (PASTIX_RT_rt_LIBRARY) - list(APPEND PASTIX_RT_LIBRARIES "${PASTIX_RT_rt_LIBRARY}") - list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_RT_rt_LIBRARY}") - else() - if (PASTIX_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find librt on your system") - endif() - endif() -endif() - -# PASTIX depends on HWLOC -#------------------------ -if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect HWLOC") -endif() -if (PASTIX_FIND_REQUIRED) - find_package(HWLOC REQUIRED) -else() - find_package(HWLOC) -endif() - -# PASTIX depends on BLAS -#----------------------- -if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect BLAS") -endif() -if (PASTIX_FIND_REQUIRED) - find_package(BLASEXT REQUIRED) -else() - find_package(BLASEXT) -endif() - -# Optional dependencies -# --------------------- - -# PASTIX may depend on MPI -#------------------------- -if (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI) - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect MPI") - endif() - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_MPI) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() -endif (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI) - -# PASTIX may depend on STARPU -#---------------------------- -if( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU) - - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect StarPU") - endif() - - set(PASTIX_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired") - - # create list of components in order to make a single call to find_package(starpu...) - # we explicitly need a StarPU version built with hwloc - set(STARPU_COMPONENT_LIST "HWLOC") - - # StarPU may depend on MPI - # allows to use an external mpi compilation by setting compilers with - # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90 - # at cmake configure - if (PASTIX_LOOK_FOR_MPI) - if(NOT MPI_C_COMPILER) - set(MPI_C_COMPILER mpicc) - endif() - list(APPEND STARPU_COMPONENT_LIST "MPI") - endif() - if (PASTIX_LOOK_FOR_STARPU_CUDA) - list(APPEND STARPU_COMPONENT_LIST "CUDA") - endif() - if (PASTIX_LOOK_FOR_STARPU_FXT) - list(APPEND STARPU_COMPONENT_LIST "FXT") - endif() - # set the list of optional dependencies we may discover - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_STARPU) - find_package(STARPU ${PASTIX_STARPU_VERSION} REQUIRED - COMPONENTS ${STARPU_COMPONENT_LIST}) - else() - find_package(STARPU ${PASTIX_STARPU_VERSION} - COMPONENTS ${STARPU_COMPONENT_LIST}) - endif() - -endif( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU) - -# PASTIX may depends on SCOTCH -#----------------------------- -if (NOT SCOTCH_FOUND AND PASTIX_LOOK_FOR_SCOTCH) - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect SCOTCH") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_SCOTCH) - find_package(SCOTCH REQUIRED) - else() - find_package(SCOTCH) - endif() -endif() - -# PASTIX may depends on PTSCOTCH -#------------------------------- -if (NOT PTSCOTCH_FOUND AND PASTIX_LOOK_FOR_PTSCOTCH) - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect PTSCOTCH") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_PTSCOTCH) - find_package(PTSCOTCH REQUIRED) - else() - find_package(PTSCOTCH) - endif() -endif() - -# PASTIX may depends on METIS -#---------------------------- -if (NOT METIS_FOUND AND PASTIX_LOOK_FOR_METIS) - if (NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX - Try to detect METIS") - endif() - if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_METIS) - find_package(METIS REQUIRED) - else() - find_package(METIS) - endif() -endif() - -# Error if pastix required and no partitioning lib found -if (PASTIX_FIND_REQUIRED AND NOT SCOTCH_FOUND AND NOT PTSCOTCH_FOUND AND NOT METIS_FOUND) - message(FATAL_ERROR "Could NOT find any partitioning library on your system" - " (install scotch, ptscotch or metis)") -endif() - - -# Looking for PaStiX -# ------------------ - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_PASTIX_DIR "$ENV{PASTIX_DIR}") -set(ENV_PASTIX_INCDIR "$ENV{PASTIX_INCDIR}") -if(ENV_PASTIX_INCDIR) - list(APPEND _inc_env "${ENV_PASTIX_INCDIR}") -elseif(ENV_PASTIX_DIR) - list(APPEND _inc_env "${ENV_PASTIX_DIR}") - list(APPEND _inc_env "${ENV_PASTIX_DIR}/include") - list(APPEND _inc_env "${ENV_PASTIX_DIR}/include/pastix") -else() - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the pastix header in the given paths -# --------------------------------------------------- -# call cmake macro to find the header path -if(PASTIX_INCDIR) - set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND") - find_path(PASTIX_pastix.h_DIRS - NAMES pastix.h - HINTS ${PASTIX_INCDIR}) -else() - if(PASTIX_DIR) - set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND") - find_path(PASTIX_pastix.h_DIRS - NAMES pastix.h - HINTS ${PASTIX_DIR} - PATH_SUFFIXES "include" "include/pastix") - else() - set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND") - find_path(PASTIX_pastix.h_DIRS - NAMES pastix.h - HINTS ${_inc_env} - PATH_SUFFIXES "pastix") - endif() -endif() -mark_as_advanced(PASTIX_pastix.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (PASTIX_pastix.h_DIRS) - set(PASTIX_INCLUDE_DIRS "${PASTIX_pastix.h_DIRS}") -else () - set(PASTIX_INCLUDE_DIRS "PASTIX_INCLUDE_DIRS-NOTFOUND") - if(NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for pastix -- pastix.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_PASTIX_LIBDIR "$ENV{PASTIX_LIBDIR}") -if(ENV_PASTIX_LIBDIR) - list(APPEND _lib_env "${ENV_PASTIX_LIBDIR}") -elseif(ENV_PASTIX_DIR) - list(APPEND _lib_env "${ENV_PASTIX_DIR}") - list(APPEND _lib_env "${ENV_PASTIX_DIR}/lib") -else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the pastix lib in the given paths -# ------------------------------------------------ - -# create list of libs to find -set(PASTIX_libs_to_find "pastix_murge;pastix") - -# call cmake macro to find the lib path -if(PASTIX_LIBDIR) - 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_LIBDIR}) - endforeach() -else() - if(PASTIX_DIR) - 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) - 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}) - endforeach() - endif() -endif() - -# If found, add path to cmake variable -# ------------------------------------ -foreach(pastix_lib ${PASTIX_libs_to_find}) - - get_filename_component(${pastix_lib}_lib_path ${PASTIX_${pastix_lib}_LIBRARY} PATH) - # set cmake variables (respects naming convention) - if (PASTIX_LIBRARIES) - list(APPEND PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}") - else() - set(PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}") - endif() - if (PASTIX_LIBRARY_DIRS) - list(APPEND PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}") - else() - set(PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}") - endif() - mark_as_advanced(PASTIX_${pastix_lib}_LIBRARY) - -endforeach(pastix_lib ${PASTIX_libs_to_find}) - -# check a function to validate the find -if(PASTIX_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # PASTIX - if (PASTIX_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${PASTIX_INCLUDE_DIRS}") - endif() - foreach(libdir ${PASTIX_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - set(REQUIRED_LIBS "${PASTIX_LIBRARIES}") - # STARPU - if (PASTIX_LOOK_FOR_STARPU AND STARPU_FOUND) - if (STARPU_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS_DEP}") - elseif (STARPU_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS}") - endif() - if(STARPU_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS_DEP}") - elseif(STARPU_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS}") - endif() - if (STARPU_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}") - elseif (STARPU_LIBRARIES) - foreach(lib ${STARPU_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - endif() - # CUDA - if (PASTIX_LOOK_FOR_STARPU_CUDA AND CUDA_FOUND) - if (CUDA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}") - endif() - foreach(libdir ${CUDA_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - endif() - # MPI - if (PASTIX_LOOK_FOR_MPI AND MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}") - endif() - if (MPI_C_LINK_FLAGS) - if (${MPI_C_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS}) - endif() - list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}") - endif() - list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}") - endif() - # HWLOC - if (HWLOC_FOUND) - if (HWLOC_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") - endif() - foreach(libdir ${HWLOC_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - foreach(lib ${HWLOC_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - # BLAS - if (BLAS_FOUND) - if (BLAS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") - endif() - foreach(libdir ${BLAS_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") - if (BLAS_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") - endif() - endif() - # SCOTCH - if (PASTIX_LOOK_FOR_SCOTCH AND SCOTCH_FOUND) - if (SCOTCH_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${SCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${SCOTCH_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}") - endif() - # PTSCOTCH - if (PASTIX_LOOK_FOR_PTSCOTCH AND PTSCOTCH_FOUND) - if (PTSCOTCH_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${PTSCOTCH_INCLUDE_DIRS}") - endif() - foreach(libdir ${PTSCOTCH_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}") - endif() - # METIS - if (PASTIX_LOOK_FOR_METIS AND METIS_FOUND) - if (METIS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}") - endif() - foreach(libdir ${METIS_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}") - endif() - # Fortran - if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND REQUIRED_LIBS "-lgfortran") - elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*") - list(APPEND REQUIRED_LIBS "-lifcore") - endif() - # EXTRA LIBS such that pthread, m, rt - list(APPEND REQUIRED_LIBS ${PASTIX_EXTRA_LIBRARIES}) - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(PASTIX_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(pastix PASTIX_WORKS) - mark_as_advanced(PASTIX_WORKS) - - if(PASTIX_WORKS) - # save link with dependencies - set(PASTIX_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(PASTIX_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(PASTIX_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(PASTIX_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES PASTIX_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES PASTIX_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES PASTIX_LINKER_FLAGS) - else() - if(NOT PASTIX_FIND_QUIETLY) - message(STATUS "Looking for PASTIX : test of pastix() 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 "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.") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(PASTIX_LIBRARIES) - -if (PASTIX_LIBRARIES) - list(GET PASTIX_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(PASTIX_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PASTIX library" FORCE) - else() - set(PASTIX_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PASTIX library" FORCE) - endif() -endif() - -# check that PASTIX has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PASTIX DEFAULT_MSG - PASTIX_LIBRARIES - PASTIX_WORKS) diff --git a/cmake_modules/morse/find/FindPTSCOTCH.cmake b/cmake_modules/morse/find/FindPTSCOTCH.cmake deleted file mode 100644 index e457dcac9a49f9f226d0e5f4f2531768ac9ddfc4..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindPTSCOTCH.cmake +++ /dev/null @@ -1,383 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find PTSCOTCH include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(PTSCOTCH -# [REQUIRED] # Fail with error if ptscotch is not found -# ) -# -# PTSCOTCH depends on the following libraries: -# - Threads -# - MPI -# -# This module finds headers and ptscotch library. -# Results are reported in variables: -# PTSCOTCH_FOUND - True if headers and requested libraries were found -# PTSCOTCH_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# PTSCOTCH_INCLUDE_DIRS - ptscotch include directories -# PTSCOTCH_LIBRARY_DIRS - Link directories for ptscotch libraries -# PTSCOTCH_LIBRARIES - ptscotch component libraries to be linked -# PTSCOTCH_INCLUDE_DIRS_DEP - ptscotch + dependencies include directories -# PTSCOTCH_LIBRARY_DIRS_DEP - ptscotch + dependencies link directories -# PTSCOTCH_LIBRARIES_DEP - ptscotch libraries + dependencies -# PTSCOTCH_INTSIZE - Number of octets occupied by a SCOTCH_Num -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DPTSCOTCH=path/to/ptscotch): -# PTSCOTCH_DIR - Where to find the base directory of ptscotch -# PTSCOTCH_INCDIR - Where to find the header files -# PTSCOTCH_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: PTSCOTCH_DIR, PTSCOTCH_INCDIR, PTSCOTCH_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT PTSCOTCH_FOUND) - set(PTSCOTCH_DIR "" CACHE PATH "Installation directory of PTSCOTCH library") - if (NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "A cache variable, namely PTSCOTCH_DIR, has been set to specify the install directory of PTSCOTCH") - endif() -endif() - -# PTSCOTCH may depend on Threads, try to find it -if (NOT THREADS_FOUND) - if (PTSCOTCH_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() -endif() - -# PTSCOTCH may depend on MPI, try to find it -if (NOT MPI_FOUND) - if (PTSCOTCH_FIND_REQUIRED) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_PTSCOTCH_DIR "$ENV{PTSCOTCH_DIR}") -set(ENV_PTSCOTCH_INCDIR "$ENV{PTSCOTCH_INCDIR}") -if(ENV_PTSCOTCH_INCDIR) - list(APPEND _inc_env "${ENV_PTSCOTCH_INCDIR}") -elseif(ENV_PTSCOTCH_DIR) - list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}") - list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}/include") - list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}/include/ptscotch") -else() - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the ptscotch header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(PTSCOTCH_INCDIR) - set(PTSCOTCH_ptscotch.h_DIRS "PTSCOTCH_ptscotch.h_DIRS-NOTFOUND") - find_path(PTSCOTCH_ptscotch.h_DIRS - NAMES ptscotch.h - HINTS ${PTSCOTCH_INCDIR}) -else() - if(PTSCOTCH_DIR) - set(PTSCOTCH_ptscotch.h_DIRS "PTSCOTCH_ptscotch.h_DIRS-NOTFOUND") - find_path(PTSCOTCH_ptscotch.h_DIRS - NAMES ptscotch.h - HINTS ${PTSCOTCH_DIR} - PATH_SUFFIXES "include" "include/ptscotch") - else() - set(PTSCOTCH_ptscotch.h_DIRS "PTSCOTCH_ptscotch.h_DIRS-NOTFOUND") - find_path(PTSCOTCH_ptscotch.h_DIRS - NAMES ptscotch.h - HINTS ${_inc_env} - PATH_SUFFIXES "scotch") - endif() -endif() -mark_as_advanced(PTSCOTCH_ptscotch.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (PTSCOTCH_ptscotch.h_DIRS) - set(PTSCOTCH_INCLUDE_DIRS "${PTSCOTCH_ptscotch.h_DIRS}") -else () - set(PTSCOTCH_INCLUDE_DIRS "PTSCOTCH_INCLUDE_DIRS-NOTFOUND") - if (NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "Looking for ptscotch -- ptscotch.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_PTSCOTCH_LIBDIR "$ENV{PTSCOTCH_LIBDIR}") -if(ENV_PTSCOTCH_LIBDIR) - list(APPEND _lib_env "${ENV_PTSCOTCH_LIBDIR}") -elseif(ENV_PTSCOTCH_DIR) - list(APPEND _lib_env "${ENV_PTSCOTCH_DIR}") - list(APPEND _lib_env "${ENV_PTSCOTCH_DIR}/lib") -else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the ptscotch lib in the given paths -# ---------------------------------------------- - -set(PTSCOTCH_libs_to_find "ptscotch;scotch;scotcherrexit") - -# call cmake macro to find the lib path -if(PTSCOTCH_LIBDIR) - foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") - find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY - NAMES ${ptscotch_lib} - HINTS ${PTSCOTCH_LIBDIR}) - endforeach() -else() - if(PTSCOTCH_DIR) - foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") - find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY - NAMES ${ptscotch_lib} - HINTS ${PTSCOTCH_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND") - find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY - NAMES ${ptscotch_lib} - HINTS ${_lib_env}) - endforeach() - endif() -endif() - -set(PTSCOTCH_LIBRARIES "") -set(PTSCOTCH_LIBRARY_DIRS "") -# If found, add path to cmake variable -# ------------------------------------ -foreach(ptscotch_lib ${PTSCOTCH_libs_to_find}) - - if (PTSCOTCH_${ptscotch_lib}_LIBRARY) - get_filename_component(${ptscotch_lib}_lib_path "${PTSCOTCH_${ptscotch_lib}_LIBRARY}" PATH) - # set cmake variables - list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}") - list(APPEND PTSCOTCH_LIBRARY_DIRS "${${ptscotch_lib}_lib_path}") - else () - list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}") - if (NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "Looking for ptscotch -- lib ${ptscotch_lib} not found") - endif() - endif () - - mark_as_advanced(PTSCOTCH_${ptscotch_lib}_LIBRARY) - -endforeach() - -# check a function to validate the find -if(PTSCOTCH_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # PTSCOTCH - if (PTSCOTCH_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${PTSCOTCH_INCLUDE_DIRS}") - endif() - if (PTSCOTCH_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${PTSCOTCH_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}") - # MPI - if (MPI_FOUND) - if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") - endif() - if (MPI_C_LINK_FLAGS) - if (${MPI_C_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS}) - endif() - list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}") - endif() - list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}") - endif() - # THREADS - if(CMAKE_THREAD_LIBS_INIT) - list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}") - endif() - set(Z_LIBRARY "Z_LIBRARY-NOTFOUND") - find_library(Z_LIBRARY NAMES z) - if(Z_LIBRARY) - list(APPEND REQUIRED_LIBS "-lz") - endif() - set(M_LIBRARY "M_LIBRARY-NOTFOUND") - find_library(M_LIBRARY NAMES m) - if(M_LIBRARY) - list(APPEND REQUIRED_LIBS "-lm") - endif() - set(RT_LIBRARY "RT_LIBRARY-NOTFOUND") - find_library(RT_LIBRARY NAMES rt) - if(RT_LIBRARY) - list(APPEND REQUIRED_LIBS "-lrt") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(PTSCOTCH_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(SCOTCH_dgraphInit PTSCOTCH_WORKS) - mark_as_advanced(PTSCOTCH_WORKS) - - if(PTSCOTCH_WORKS) - # save link with dependencies - set(PTSCOTCH_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(PTSCOTCH_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(PTSCOTCH_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(PTSCOTCH_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES PTSCOTCH_LINKER_FLAGS) - else() - if(NOT PTSCOTCH_FIND_QUIETLY) - message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(PTSCOTCH_LIBRARIES) - -if (PTSCOTCH_LIBRARIES) - list(GET PTSCOTCH_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(PTSCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE) - else() - set(PTSCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE) - endif() -endif() - -# Check the size of SCOTCH_Num -# --------------------------------- -set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS}) - -include(CheckCSourceRuns) -#stdio.h and stdint.h should be included by scotch.h directly -set(PTSCOTCH_C_TEST_SCOTCH_Num_4 " -#include <stdio.h> -#include <stdint.h> -#include <ptscotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 4) - return 0; - else - return 1; -} -") - -set(PTSCOTCH_C_TEST_SCOTCH_Num_8 " -#include <stdio.h> -#include <stdint.h> -#include <ptscotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 8) - return 0; - else - return 1; -} -") -check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_4}" PTSCOTCH_Num_4) -if(NOT PTSCOTCH_Num_4) - check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8) - if(NOT PTSCOTCH_Num_8) - set(PTSCOTCH_INTSIZE -1) - else() - set(PTSCOTCH_INTSIZE 8) - endif() -else() - set(PTSCOTCH_INTSIZE 4) -endif() -set(CMAKE_REQUIRED_INCLUDES "") - -# check that PTSCOTCH has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG - PTSCOTCH_LIBRARIES - PTSCOTCH_WORKS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake deleted file mode 100644 index 119d00f8f56fbdbabd518ebc06f614cea1bf8962..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindQUARK.cmake +++ /dev/null @@ -1,323 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find QUARK include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(QUARK -# [REQUIRED] # Fail with error if quark is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# QUARK depends on the following libraries: -# - Threads -# -# COMPONENTS are optional libraries QUARK could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - HWLOC: to activate detection of QUARK linked with hwloc -# -# This module finds headers and quark library. -# Results are reported in variables: -# QUARK_FOUND - True if headers and requested libraries were found -# QUARK_INCLUDE_DIRS - quark include directories -# QUARK_LIBRARY_DIRS - Link directories for quark libraries -# QUARK_LIBRARIES - quark component libraries to be linked -# QUARK_INCLUDE_DIRS_DEP - quark + dependencies include directories -# QUARK_LIBRARY_DIRS_DEP - quark + dependencies link directories -# QUARK_LIBRARIES_DEP - quark libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DQUARK=path/to/quark): -# QUARK_DIR - Where to find the base directory of quark -# QUARK_INCDIR - Where to find the header files -# QUARK_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: QUARK_DIR, QUARK_INCDIR, QUARK_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT QUARK_FOUND) - set(QUARK_DIR "" CACHE PATH "Installation directory of QUARK library") - if (NOT QUARK_FIND_QUIETLY) - message(STATUS "A cache variable, namely QUARK_DIR, has been set to specify the install directory of QUARK") - endif() -endif() - -# QUARK may depend on HWLOC -# try to find it specified as COMPONENTS during the call -set(QUARK_LOOK_FOR_HWLOC FALSE) - -if( QUARK_FIND_COMPONENTS ) - foreach( component ${QUARK_FIND_COMPONENTS} ) - if(${component} STREQUAL "HWLOC") - set(QUARK_LOOK_FOR_HWLOC TRUE) - endif() - endforeach() -endif() - -# QUARK may depend on Threads, try to find it -if (NOT Threads_FOUND) - if (QUARK_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() -endif() - -# QUARK may depend on HWLOC, try to find it -if (NOT HWLOC_FOUND AND QUARK_LOOK_FOR_HWLOC) - if (QUARK_FIND_REQUIRED AND QUARK_FIND_REQUIRED_HWLOC) - find_package(HWLOC REQUIRED) - else() - find_package(HWLOC) - endif() -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_QUARK_DIR "$ENV{QUARK_DIR}") -set(ENV_QUARK_INCDIR "$ENV{QUARK_INCDIR}") -if(ENV_QUARK_INCDIR) - list(APPEND _inc_env "${ENV_QUARK_INCDIR}") -elseif(ENV_QUARK_DIR) - list(APPEND _inc_env "${ENV_QUARK_DIR}") - list(APPEND _inc_env "${ENV_QUARK_DIR}/include") - list(APPEND _inc_env "${ENV_QUARK_DIR}/include/quark") - list(APPEND _inc_env "${ENV_QUARK_DIR}/include/plasma") -else() - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the quark header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(QUARK_INCDIR) - set(QUARK_quark.h_DIRS "QUARK_quark.h_DIRS-NOTFOUND") - find_path(QUARK_quark.h_DIRS - NAMES quark.h - HINTS ${QUARK_INCDIR}) -else() - if(QUARK_DIR) - set(QUARK_quark.h_DIRS "QUARK_quark.h_DIRS-NOTFOUND") - find_path(QUARK_quark.h_DIRS - NAMES quark.h - HINTS ${QUARK_DIR} - PATH_SUFFIXES "include" "include/quark" "include/plasma") - else() - set(QUARK_quark.h_DIRS "QUARK_quark.h_DIRS-NOTFOUND") - find_path(QUARK_quark.h_DIRS - NAMES quark.h - HINTS ${_inc_env}) - endif() -endif() -mark_as_advanced(QUARK_quark.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (QUARK_quark.h_DIRS) - set(QUARK_INCLUDE_DIRS "${QUARK_quark.h_DIRS}") -else () - set(QUARK_INCLUDE_DIRS "QUARK_INCLUDE_DIRS-NOTFOUND") - if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for quark -- quark.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_QUARK_LIBDIR "$ENV{QUARK_LIBDIR}") -if(ENV_QUARK_LIBDIR) - list(APPEND _lib_env "${ENV_QUARK_LIBDIR}") -elseif(ENV_QUARK_DIR) - list(APPEND _lib_env "${ENV_QUARK_DIR}") - list(APPEND _lib_env "${ENV_QUARK_DIR}/lib") -else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the quark lib in the given paths -# ---------------------------------------------- - -# call cmake macro to find the lib path -if(QUARK_LIBDIR) - set(QUARK_quark_LIBRARY "QUARK_quark_LIBRARY-NOTFOUND") - find_library(QUARK_quark_LIBRARY - NAMES quark - HINTS ${QUARK_LIBDIR}) -else() - if(QUARK_DIR) - set(QUARK_quark_LIBRARY "QUARK_quark_LIBRARY-NOTFOUND") - find_library(QUARK_quark_LIBRARY - NAMES quark - HINTS ${QUARK_DIR} - PATH_SUFFIXES lib lib32 lib64) - else() - set(QUARK_quark_LIBRARY "QUARK_quark_LIBRARY-NOTFOUND") - find_library(QUARK_quark_LIBRARY - NAMES quark - HINTS ${_lib_env}) - endif() -endif() -mark_as_advanced(QUARK_quark_LIBRARY) - -# If found, add path to cmake variable -# ------------------------------------ -if (QUARK_quark_LIBRARY) - get_filename_component(quark_lib_path "${QUARK_quark_LIBRARY}" PATH) - # set cmake variables - set(QUARK_LIBRARIES "${QUARK_quark_LIBRARY}") - set(QUARK_LIBRARY_DIRS "${quark_lib_path}") -else () - set(QUARK_LIBRARIES "QUARK_LIBRARIES-NOTFOUND") - set(QUARK_LIBRARY_DIRS "QUARK_LIBRARY_DIRS-NOTFOUND") - if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for quark -- lib quark not found") - endif() -endif () - -# check a function to validate the find -if(QUARK_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # QUARK - if (QUARK_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS}") - endif() - if (QUARK_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${QUARK_LIBRARIES}") - # HWLOC - if (HWLOC_FOUND AND QUARK_LOOK_FOR_HWLOC) - if (HWLOC_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") - endif() - if (HWLOC_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}") - endif() - foreach(lib ${HWLOC_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - # THREADS - list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}") - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(QUARK_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(QUARK_New QUARK_WORKS) - mark_as_advanced(QUARK_WORKS) - - if(QUARK_WORKS) - # save link with dependencies - set(QUARK_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(QUARK_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(QUARK_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - list(REMOVE_DUPLICATES QUARK_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES QUARK_INCLUDE_DIRS_DEP) - else() - if(NOT QUARK_FIND_QUIETLY) - message(STATUS "Looking for QUARK : test of QUARK_New with QUARK 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 "Maybe QUARK is linked with specific libraries like. " - "Have you tried with COMPONENTS (HWLOC)? See the explanation in FindQUARK.cmake.") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(QUARK_LIBRARIES) - -if (QUARK_LIBRARIES) - list(GET QUARK_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(QUARK_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of QUARK library" FORCE) - else() - set(QUARK_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of QUARK library" FORCE) - endif() -endif() - -# check that QUARK has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(QUARK DEFAULT_MSG - QUARK_LIBRARIES - QUARK_WORKS) diff --git a/cmake_modules/morse/find/FindSCALAPACK.cmake b/cmake_modules/morse/find/FindSCALAPACK.cmake deleted file mode 100644 index fc0c4273523e3de645a85ccffb9ed8da4c019ff6..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindSCALAPACK.cmake +++ /dev/null @@ -1,501 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find SCALAPACK library -# This module finds an installed fortran library that implements the SCALAPACK -# linear-algebra interface. -# -# This module sets the following variables: -# SCALAPACK_FOUND - set to true if a library implementing the SCALAPACK interface -# is found -# SCALAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l -# and -L). -# SCALAPACK_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use SCALAPACK -# SCALAPACK95_LIBRARIES - uncached list of libraries (using full path name) to -# link against to use SCALAPACK95 -# SCALAPACK95_FOUND - set to true if a library implementing the SCALAPACK f95 -# interface is found -# BLA_STATIC if set on this determines what kind of linkage we do (static) -# BLA_VENDOR if set checks only the specified vendor, if not set checks -# all the possibilities -# BLA_F95 if set on tries to find the f95 interfaces for BLAS/SCALAPACK -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DSCALAPACK_DIR=path/to/scalapack): -# SCALAPACK_DIR - Where to find the base directory of scalapack -# SCALAPACK_INCDIR - Where to find the header files -# SCALAPACK_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: SCALAPACK_DIR, SCALAPACK_INCDIR, SCALAPACK_LIBDIR -# Note that if BLAS_DIR is set, it will also look for scalapack in it -### List of vendors (BLA_VENDOR) valid in this module -## Intel(mkl), ACML, Apple, NAS, Generic - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file 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 CMake, substitute the full -# License text for the above reference.) - - -# 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() - -## Some macros to print status when search for headers and libs -# This macro informs why the _lib_to_find file has not been found -macro(Print_Find_Library_Blas_Status _libname _lib_to_find) - - # save _libname upper/lower case - string(TOUPPER ${_libname} LIBNAME) - string(TOLOWER ${_libname} libname) - - # print status - #message(" ") - if(${LIBNAME}_LIBDIR) - message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") - else() - if(${LIBNAME}_DIR) - message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "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}") - if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") - endif() - endif() - endif() - message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" - "- Option 1: Provide the installation directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n" - "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n" - "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" - "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}") - -endmacro() - -if (NOT SCALAPACK_FOUND) - set(SCALAPACK_DIR "" CACHE PATH "Installation directory of SCALAPACK library") - if (NOT SCALAPACK_FIND_QUIETLY) - message(STATUS "A cache variable, namely SCALAPACK_DIR, has been set to specify the install directory of SCALAPACK") - endif() -endif (NOT SCALAPACK_FOUND) - -option(SCALAPACK_VERBOSE "Print some additional information during SCALAPACK -libraries detection" OFF) -if (BLAS_VERBOSE) - set(SCALAPACK_VERBOSE ON) -endif () -set(_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) -include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) - -set(SCALAPACK_FOUND FALSE) -set(SCALAPACK95_FOUND FALSE) - -# TODO: move this stuff to separate module - -macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack _mpi _threads) -# This macro checks for the existence of the combination of fortran libraries -# given by _list. If the combination is found, this macro checks (using the -# Check_Fortran_Function_Exists macro) whether can link against that library -# combination using the name of a routine given by _name using the linker -# flags given by _flags. If the combination of libraries is found and passes -# the link test, LIBRARIES is set to the list of complete library paths that -# have been found. Otherwise, LIBRARIES is set to FALSE. - -# N.B. _prefix is the prefix applied to the names of all cached variables that -# are generated internally and marked advanced by this macro. - -set(_libraries_work TRUE) -set(${LIBRARIES}) -set(_combined_name) -set(ENV_MKLROOT "$ENV{MKLROOT}") -set(ENV_BLAS_DIR "$ENV{BLAS_DIR}") -set(ENV_BLAS_LIBDIR "$ENV{BLAS_LIBDIR}") -set(ENV_SCALAPACK_DIR "$ENV{SCALAPACK_DIR}") -set(ENV_SCALAPACK_LIBDIR "$ENV{SCALAPACK_LIBDIR}") -if (NOT _libdir) - if (BLAS_LIBDIR) - list(APPEND _libdir "${BLAS_LIBDIR}") - elseif (BLAS_DIR) - 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") - else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") - endif() - elseif(ENV_BLAS_LIBDIR) - list(APPEND _libdir "${ENV_BLAS_LIBDIR}") - elseif(ENV_BLAS_DIR) - 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") - else() - list(APPEND _libdir "${ENV_BLAS_DIR}/lib32") - list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32") - endif() - endif() - if (SCALAPACK_LIBDIR) - list(APPEND _libdir "${SCALAPACK_LIBDIR}") - elseif (SCALAPACK_DIR) - 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") - else() - list(APPEND _libdir "${SCALAPACK_DIR}/lib32") - list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32") - endif() - elseif(ENV_SCALAPACK_LIBDIR) - list(APPEND _libdir "${ENV_SCALAPACK_LIBDIR}") - elseif(ENV_SCALAPACK_DIR) - 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") - else() - 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() - endif() - if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") - elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") - else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") - endif () - list(APPEND _libdir "${_libdir2}") - list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") - list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") - endif () -endif () - -if (SCALAPACK_VERBOSE) - message("${Cyan}Try to find SCALAPACK libraries: ${_list}") -endif () - -foreach(_library ${_list}) - set(_combined_name ${_combined_name}_${_library}) - - 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) - 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 () - endif (BLA_STATIC) - find_library(${_prefix}_${_library}_LIBRARY - 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}) - endif () - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) - endif(_libraries_work) -endforeach(_library ${_list}) - -if(_libraries_work) - # Test this combination of libraries. - if(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blaslapack} "-Wl,--end-group" ${_mpi} ${_threads}) - else(UNIX AND BLA_STATIC) - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blaslapack} ${_mpi} ${_threads}) - endif(UNIX AND BLA_STATIC) - if (SCALAPACK_VERBOSE) - message("${Cyan}SCALAPACK libs found. Try to compile symbol ${_name} with" - "following libraries: ${CMAKE_REQUIRED_LIBRARIES}") - endif () - if(NOT SCALAPACK_FOUND) - unset(${_prefix}${_combined_name}_WORKS CACHE) - endif() - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) - set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) -endif(_libraries_work) - - if(_libraries_work) - set(${LIBRARIES} ${${LIBRARIES}} ${_blaslapack} ${_mpi} ${_threads}) - else(_libraries_work) - set(${LIBRARIES} FALSE) - endif(_libraries_work) - -endmacro(Check_Scalapack_Libraries) - - -set(SCALAPACK_LINKER_FLAGS) -set(SCALAPACK_LIBRARIES) -set(SCALAPACK95_LIBRARIES) - -if (NOT BLAS_FOUND) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_package(BLAS) - else() - find_package(BLAS REQUIRED) - endif() -endif () - -if (NOT LAPACK_FOUND) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_package(LAPACK) - else() - find_package(LAPACK REQUIRED) - endif() -endif () - -if (NOT MPI_FOUND) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_package(MPI) - else() - find_package(MPI REQUIRED) - endif() -endif () - -if(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND) - set(SCALAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - list(APPEND SCALAPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) - if ($ENV{BLA_VENDOR} MATCHES ".+") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - else ($ENV{BLA_VENDOR} MATCHES ".+") - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - 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) - set(LM "-lm") - endif () - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) - if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED) - find_PACKAGE(Threads) - else() - 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") - else() - 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}" - "mkl_blacs_intelmpi_lp64" - "${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}" - "${_BLAS_LIBRARIES}" - "mkl_blacs_intelmpi_lp64" - "${MPI_Fortran_LIBRARIES}" - ) - endif () - endforeach () - endif () -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) - -if(BLA_F95) - if(SCALAPACK95_LIBRARIES) - set(SCALAPACK95_FOUND TRUE) - else(SCALAPACK95_LIBRARIES) - set(SCALAPACK95_FOUND FALSE) - endif(SCALAPACK95_LIBRARIES) - if(NOT SCALAPACK_FIND_QUIETLY) - if(SCALAPACK95_FOUND) - message(STATUS "A library with SCALAPACK95 API found.") - 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") - if(SCALAPACK_FIND_REQUIRED) - 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." - ) - endif(SCALAPACK_FIND_REQUIRED) - endif(SCALAPACK95_FOUND) - endif(NOT SCALAPACK_FIND_QUIETLY) - set(SCALAPACK_FOUND "${SCALAPACK95_FOUND}") - set(SCALAPACK_LIBRARIES "${SCALAPACK95_LIBRARIES}") -else(BLA_F95) - if(SCALAPACK_LIBRARIES) - set(SCALAPACK_FOUND TRUE) - else(SCALAPACK_LIBRARIES) - set(SCALAPACK_FOUND FALSE) - endif(SCALAPACK_LIBRARIES) - - if(NOT SCALAPACK_FIND_QUIETLY) - if(SCALAPACK_FOUND) - message(STATUS "A library with SCALAPACK API found.") - 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") - if(SCALAPACK_FIND_REQUIRED) - 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." - ) - endif(SCALAPACK_FIND_REQUIRED) - endif(SCALAPACK_FOUND) - endif(NOT SCALAPACK_FIND_QUIETLY) -endif(BLA_F95) - -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - -if (SCALAPACK_LIBRARIES) - list(GET SCALAPACK_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(SCALAPACK_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of SCALAPACK library" FORCE) - else() - set(SCALAPACK_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of SCALAPACK library" FORCE) - endif() -endif() diff --git a/cmake_modules/morse/find/FindSCOTCH.cmake b/cmake_modules/morse/find/FindSCOTCH.cmake deleted file mode 100644 index c24242ce6fbd44465962f1521a0068fb50ff3a87..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindSCOTCH.cmake +++ /dev/null @@ -1,344 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find SCOTCH include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(SCOTCH -# [REQUIRED] # Fail with error if scotch is not found -# ) -# -# This module finds headers and scotch library. -# Results are reported in variables: -# SCOTCH_FOUND - True if headers and requested libraries were found -# SCOTCH_INCLUDE_DIRS - scotch include directories -# SCOTCH_LIBRARY_DIRS - Link directories for scotch libraries -# SCOTCH_LIBRARIES - scotch component libraries to be linked -# SCOTCH_INTSIZE - Number of octets occupied by a SCOTCH_Num -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DSCOTCH=path/to/scotch): -# SCOTCH_DIR - Where to find the base directory of scotch -# SCOTCH_INCDIR - Where to find the header files -# SCOTCH_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: SCOTCH_DIR, SCOTCH_INCDIR, SCOTCH_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT SCOTCH_FOUND) - set(SCOTCH_DIR "" CACHE PATH "Installation directory of SCOTCH library") - if (NOT SCOTCH_FIND_QUIETLY) - message(STATUS "A cache variable, namely SCOTCH_DIR, has been set to specify the install directory of SCOTCH") - endif() -endif() - -# SCOTCH may depend on Threads, try to find it -if (NOT THREADS_FOUND) - if (SCOTCH_FIND_REQUIRED) - find_package(Threads REQUIRED) - else() - find_package(Threads) - endif() -endif() - -# Looking for include -# ------------------- - -# Add system include paths to search include -# ------------------------------------------ -unset(_inc_env) -set(ENV_SCOTCH_DIR "$ENV{SCOTCH_DIR}") -set(ENV_SCOTCH_INCDIR "$ENV{SCOTCH_INCDIR}") -if(ENV_SCOTCH_INCDIR) - list(APPEND _inc_env "${ENV_SCOTCH_INCDIR}") -elseif(ENV_SCOTCH_DIR) - list(APPEND _inc_env "${ENV_SCOTCH_DIR}") - list(APPEND _inc_env "${ENV_SCOTCH_DIR}/include") - list(APPEND _inc_env "${ENV_SCOTCH_DIR}/include/scotch") -else() - 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() -endif() -list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") -list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") -list(REMOVE_DUPLICATES _inc_env) - - -# Try to find the scotch header in the given paths -# ------------------------------------------------- -# call cmake macro to find the header path -if(SCOTCH_INCDIR) - set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND") - find_path(SCOTCH_scotch.h_DIRS - NAMES scotch.h - HINTS ${SCOTCH_INCDIR}) -else() - if(SCOTCH_DIR) - set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND") - find_path(SCOTCH_scotch.h_DIRS - NAMES scotch.h - HINTS ${SCOTCH_DIR} - PATH_SUFFIXES "include" "include/scotch") - else() - set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND") - find_path(SCOTCH_scotch.h_DIRS - NAMES scotch.h - HINTS ${_inc_env} - PATH_SUFFIXES "scotch") - endif() -endif() -mark_as_advanced(SCOTCH_scotch.h_DIRS) - -# If found, add path to cmake variable -# ------------------------------------ -if (SCOTCH_scotch.h_DIRS) - set(SCOTCH_INCLUDE_DIRS "${SCOTCH_scotch.h_DIRS}") -else () - set(SCOTCH_INCLUDE_DIRS "SCOTCH_INCLUDE_DIRS-NOTFOUND") - if (NOT SCOTCH_FIND_QUIETLY) - message(STATUS "Looking for scotch -- scotch.h not found") - endif() -endif() - - -# Looking for lib -# --------------- - -# Add system library paths to search lib -# -------------------------------------- -unset(_lib_env) -set(ENV_SCOTCH_LIBDIR "$ENV{SCOTCH_LIBDIR}") -if(ENV_SCOTCH_LIBDIR) - list(APPEND _lib_env "${ENV_SCOTCH_LIBDIR}") -elseif(ENV_SCOTCH_DIR) - list(APPEND _lib_env "${ENV_SCOTCH_DIR}") - list(APPEND _lib_env "${ENV_SCOTCH_DIR}/lib") -else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() -endif() -list(REMOVE_DUPLICATES _lib_env) - -# Try to find the scotch lib in the given paths -# ---------------------------------------------- - -set(SCOTCH_libs_to_find "scotch;scotcherrexit") - -# call cmake macro to find the lib path -if(SCOTCH_LIBDIR) - foreach(scotch_lib ${SCOTCH_libs_to_find}) - set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND") - find_library(SCOTCH_${scotch_lib}_LIBRARY - NAMES ${scotch_lib} - HINTS ${SCOTCH_LIBDIR}) - endforeach() -else() - if(SCOTCH_DIR) - foreach(scotch_lib ${SCOTCH_libs_to_find}) - set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND") - find_library(SCOTCH_${scotch_lib}_LIBRARY - NAMES ${scotch_lib} - HINTS ${SCOTCH_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(scotch_lib ${SCOTCH_libs_to_find}) - set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND") - find_library(SCOTCH_${scotch_lib}_LIBRARY - NAMES ${scotch_lib} - HINTS ${_lib_env}) - endforeach() - endif() -endif() - -set(SCOTCH_LIBRARIES "") -set(SCOTCH_LIBRARY_DIRS "") -# If found, add path to cmake variable -# ------------------------------------ -foreach(scotch_lib ${SCOTCH_libs_to_find}) - - if (SCOTCH_${scotch_lib}_LIBRARY) - get_filename_component(${scotch_lib}_lib_path "${SCOTCH_${scotch_lib}_LIBRARY}" PATH) - # set cmake variables - list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}") - list(APPEND SCOTCH_LIBRARY_DIRS "${${scotch_lib}_lib_path}") - else () - list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}") - if (NOT SCOTCH_FIND_QUIETLY) - message(STATUS "Looking for scotch -- lib ${scotch_lib} not found") - endif() - endif () - - mark_as_advanced(SCOTCH_${scotch_lib}_LIBRARY) - -endforeach() - -# check a function to validate the find -if(SCOTCH_LIBRARIES) - - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # SCOTCH - if (SCOTCH_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${SCOTCH_INCLUDE_DIRS}") - endif() - if (SCOTCH_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${SCOTCH_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${SCOTCH_LIBRARIES}") - # THREADS - if(CMAKE_THREAD_LIBS_INIT) - list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}") - endif() - set(Z_LIBRARY "Z_LIBRARY-NOTFOUND") - find_library(Z_LIBRARY NAMES z) - if(Z_LIBRARY) - list(APPEND REQUIRED_LIBS "-lz") - endif() - set(M_LIBRARY "M_LIBRARY-NOTFOUND") - find_library(M_LIBRARY NAMES m) - if(M_LIBRARY) - list(APPEND REQUIRED_LIBS "-lm") - endif() - set(RT_LIBRARY "RT_LIBRARY-NOTFOUND") - find_library(RT_LIBRARY NAMES rt) - if(RT_LIBRARY) - list(APPEND REQUIRED_LIBS "-lrt") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(SCOTCH_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(SCOTCH_graphInit SCOTCH_WORKS) - mark_as_advanced(SCOTCH_WORKS) - - if(SCOTCH_WORKS) - # save link with dependencies - set(SCOTCH_LIBRARIES "${REQUIRED_LIBS}") - else() - if(NOT SCOTCH_FIND_QUIETLY) - message(STATUS "Looking for SCOTCH : test of SCOTCH_graphInit with SCOTCH 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) -endif(SCOTCH_LIBRARIES) - -if (SCOTCH_LIBRARIES) - list(GET SCOTCH_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(SCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of SCOTCH library" FORCE) - else() - set(SCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of SCOTCH library" FORCE) - endif() -endif() - -# Check the size of SCOTCH_Num -# --------------------------------- -set(CMAKE_REQUIRED_INCLUDES ${SCOTCH_INCLUDE_DIRS}) - -include(CheckCSourceRuns) -#stdio.h and stdint.h should be included by scotch.h directly -set(SCOTCH_C_TEST_SCOTCH_Num_4 " -#include <stdio.h> -#include <stdint.h> -#include <scotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 4) - return 0; - else - return 1; -} -") - -set(SCOTCH_C_TEST_SCOTCH_Num_8 " -#include <stdio.h> -#include <stdint.h> -#include <scotch.h> -int main(int argc, char **argv) { - if (sizeof(SCOTCH_Num) == 8) - return 0; - else - return 1; -} -") -check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_4}" SCOTCH_Num_4) -if(NOT SCOTCH_Num_4) - check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8) - if(NOT SCOTCH_Num_8) - set(SCOTCH_INTSIZE -1) - else() - set(SCOTCH_INTSIZE 8) - endif() -else() - set(SCOTCH_INTSIZE 4) -endif() -set(CMAKE_REQUIRED_INCLUDES "") - -# check that SCOTCH has been found -# --------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SCOTCH DEFAULT_MSG - SCOTCH_LIBRARIES - SCOTCH_WORKS) -# -# TODO: Add possibility to check for specific functions in the library -# diff --git a/cmake_modules/morse/find/FindSTARPU.cmake b/cmake_modules/morse/find/FindSTARPU.cmake deleted file mode 100644 index a98926b168d87c9604975c3ef272a605ded35c13..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindSTARPU.cmake +++ /dev/null @@ -1,859 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find STARPU include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(STARPU -# [version] [EXACT] # Minimum or EXACT version e.g. 1.1 -# [REQUIRED] # Fail with error if starpu is not found -# [COMPONENTS <comp1> <comp2> ...] # dependencies -# ) -# -# COMPONENTS are optional libraries STARPU could be linked with, -# Use it to drive detection of a specific compilation chain -# COMPONENTS can be some of the following: -# - HWLOC: to activate the detection of StarPU linked with HWLOC -# - CUDA: to activate the detection of StarPU linked with CUDA -# - MPI: to activate the detection of StarPU linked with MPI -# - BLAS: to activate the detection of StarPU linked with BLAS -# - MAGMA: to activate the detection of StarPU linked with MAGMA -# - FXT: to activate the detection of StarPU linked with FxT -# -# Results are reported in variables: -# STARPU_FOUND - True if headers and requested libraries were found -# STARPU_C_FLAGS - list of required compilation flags (excluding -I) -# STARPU_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# STARPU_INCLUDE_DIRS - starpu include directories -# STARPU_LIBRARY_DIRS - Link directories for starpu libraries -# STARPU_LIBRARIES - starpu libraries -# STARPU_SHM_LIBRARIES - starpu libraries without libstarpumpi -# STARPU_MPI_LIBRARIES - starpu libraries with libstarpumpi -# STARPU_INCLUDE_DIRS_DEP - starpu + dependencies include directories -# STARPU_LIBRARY_DIRS_DEP - starpu + dependencies link directories -# STARPU_LIBRARIES_DEP - starpu libraries + dependencies -# STARPU_VERSION_STRING - A human-readable string containing the version of the package found -# STARPU_VERSION_MAJOR - The major version of the package found -# STARPU_VERSION_MINOR - The minor version of the package found -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DSTARPU=path/to/starpu): -# STARPU_DIR - Where to find the base directory of starpu -# STARPU_INCDIR - Where to find the header files -# STARPU_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: STARPU_DIR, STARPU_INCDIR, STARPU_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - -if (NOT STARPU_FOUND) - set(STARPU_DIR "" CACHE PATH "Installation directory of STARPU library") - if (NOT STARPU_FIND_QUIETLY) - message(STATUS "A cache variable, namely STARPU_DIR, has been set to specify the install directory of STARPU") - endif() -endif() - -# STARPU may depend on other packages (HWLOC, MPI, CUDA, BLAS, MAGMA, FXT, ...) -# try to find them if specified as COMPONENTS during the call -set(STARPU_LOOK_FOR_HWLOC FALSE) -set(STARPU_LOOK_FOR_CUDA FALSE) -set(STARPU_LOOK_FOR_MPI FALSE) -set(STARPU_LOOK_FOR_BLAS FALSE) -set(STARPU_LOOK_FOR_MAGMA FALSE) -set(STARPU_LOOK_FOR_FXT FALSE) - -if( STARPU_FIND_COMPONENTS ) - foreach( component ${STARPU_FIND_COMPONENTS} ) - if(${component} STREQUAL "HWLOC") - set(STARPU_LOOK_FOR_HWLOC TRUE) - elseif(${component} STREQUAL "CUDA") - set(STARPU_LOOK_FOR_CUDA TRUE) - elseif(${component} STREQUAL "MPI") - set(STARPU_LOOK_FOR_MPI TRUE) - elseif(${component} STREQUAL "BLAS") - set(STARPU_LOOK_FOR_BLAS TRUE) - elseif(${component} STREQUAL "MAGMA") - set(STARPU_LOOK_FOR_MAGMA TRUE) - elseif(${component} STREQUAL "FXT") - set(STARPU_LOOK_FOR_FXT TRUE) - endif() - endforeach() -endif() - -# STARPU may depend on HWLOC, try to find it -if (NOT HWLOC_FOUND AND STARPU_LOOK_FOR_HWLOC) - if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_HWLOC) - find_package(HWLOC REQUIRED) - else() - find_package(HWLOC) - endif() -endif() - -# STARPU may depend on CUDA, try to find it -if (NOT CUDA_FOUND AND STARPU_LOOK_FOR_CUDA) - if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_CUDA) - find_package(CUDA REQUIRED) - else() - find_package(CUDA) - endif() - if (CUDA_FOUND) - mark_as_advanced(CUDA_BUILD_CUBIN) - mark_as_advanced(CUDA_BUILD_EMULATION) - mark_as_advanced(CUDA_SDK_ROOT_DIR) - mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR) - mark_as_advanced(CUDA_VERBOSE_BUILD) - endif() -endif() - -# STARPU may depend on MPI, try to find it -if (NOT MPI_FOUND AND STARPU_LOOK_FOR_MPI) - if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_MPI) - find_package(MPI REQUIRED) - else() - find_package(MPI) - endif() - if (MPI_FOUND) - mark_as_advanced(MPI_LIBRARY) - mark_as_advanced(MPI_EXTRA_LIBRARY) - endif() -endif() - -# STARPU may depend on BLAS, try to find it -if (NOT BLAS_FOUND AND STARPU_LOOK_FOR_BLAS) - if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_BLAS) - find_package(BLAS REQUIRED) - else() - find_package(BLAS) - endif() -endif() - -# STARPU may depend on MAGMA, try to find it -if (NOT MAGMA_FOUND AND STARPU_LOOK_FOR_MAGMA) - if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_MAGMA) - find_package(MAGMA REQUIRED) - else() - find_package(MAGMA) - endif() -endif() - -# STARPU may depend on FXT, try to find it -if (NOT FXT_FOUND AND STARPU_LOOK_FOR_FXT) - if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_FXT) - find_package(FXT REQUIRED) - else() - find_package(FXT) - endif() -endif() - -set(ENV_STARPU_DIR "$ENV{STARPU_DIR}") -set(ENV_STARPU_INCDIR "$ENV{STARPU_INCDIR}") -set(ENV_STARPU_LIBDIR "$ENV{STARPU_LIBDIR}") -set(STARPU_GIVEN_BY_USER "FALSE") -if ( STARPU_DIR OR ( STARPU_INCDIR AND STARPU_LIBDIR) OR ENV_STARPU_DIR OR (ENV_STARPU_INCDIR AND ENV_STARPU_LIBDIR) ) - set(STARPU_GIVEN_BY_USER "TRUE") -endif() - -# Optionally use pkg-config to detect include/library dirs (if pkg-config is available) -# ------------------------------------------------------------------------------------- -include(FindPkgConfig) -find_package(PkgConfig QUIET) - -if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) - - pkg_search_module(STARPU_SHM libstarpu) - set(STARPU_INCLUDE_DIRS "${STARPU_SHM_INCLUDE_DIRS}") - set(STARPU_LIBRARY_DIRS "${STARPU_SHM_LIBRARY_DIRS}") - if(STARPU_LOOK_FOR_MPI AND MPI_FOUND) - pkg_search_module(STARPU_MPI libstarpumpi) - endif() - if (NOT STARPU_FIND_QUIETLY) - if (STARPU_SHM_FOUND AND STARPU_SHM_LIBRARIES) - message(STATUS "Looking for STARPU - found using PkgConfig") - #if(NOT STARPU_SHM_INCLUDE_DIRS) - # message("${Magenta}STARPU_SHM_INCLUDE_DIRS is empty using PkgConfig." - # "Perhaps the path to starpu headers is already present in your" - # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") - #endif() - else() - message("${Magenta}Looking for STARPU - not found using PkgConfig." - "Perhaps you should add the directory containing libstarpu.pc" - "to the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - if (STARPU_LOOK_FOR_MPI) - if (STARPU_MPI_FOUND AND STARPU_MPI_LIBRARIES) - message(STATUS "Looking for STARPU MPI - found using PkgConfig") - else() - message("${Magenta}Looking for STARPU MPI - not found using PkgConfig." - "Perhaps you should add the directory containing libstarpumpi.pc to" - "the PKG_CONFIG_PATH environment variable.${ColourReset}") - endif() - endif() - endif() - - if (STARPU_FIND_VERSION_EXACT) - if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR - NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING}" - "when required is ${STARPU_FIND_VERSION}") - endif() - endif() - else() - # if the version found is older than the required then error - if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR - (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING}" - "when required is ${STARPU_FIND_VERSION} or newer") - endif() - endif() - endif() - - if(STARPU_MPI_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_MPI_LIBRARIES}") - elseif(STARPU_SHM_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_SHM_LIBRARIES}") - else() - set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND") - endif() - set(STARPU_INCLUDE_DIRS_DEP "${STARPU_INCLUDE_DIRS}") - set(STARPU_LIBRARY_DIRS_DEP "${STARPU_LIBRARY_DIRS}") - set(STARPU_LIBRARIES_DEP "${STARPU_LIBRARIES}") - if (STARPU_SHM_FOUND) - set(STARPU_FOUND "TRUE") - else() - set(STARPU_FOUND "FALSE") - endif() - if (STARPU_LOOK_FOR_MPI AND NOT STARPU_MPI_FOUND) - set(STARPU_FOUND "FALSE") - endif() -endif(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) - - -if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR (STARPU_GIVEN_BY_USER) ) - - # Looking for include - # ------------------- - - # Add system include paths to search include - # ------------------------------------------ - unset(_inc_env) - set(ENV_STARPU_DIR "$ENV{STARPU_DIR}") - set(ENV_STARPU_INCDIR "$ENV{STARPU_INCDIR}") - if(ENV_STARPU_INCDIR) - list(APPEND _inc_env "${ENV_STARPU_INCDIR}") - elseif(ENV_STARPU_DIR) - list(APPEND _inc_env "${ENV_STARPU_DIR}") - list(APPEND _inc_env "${ENV_STARPU_DIR}/include") - list(APPEND _inc_env "${ENV_STARPU_DIR}/include/starpu/1.0") - list(APPEND _inc_env "${ENV_STARPU_DIR}/include/starpu/1.1") - list(APPEND _inc_env "${ENV_STARPU_DIR}/include/starpu/1.2") - list(APPEND _inc_env "${ENV_STARPU_DIR}/include/starpu/1.3") - else() - 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() - endif() - list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") - list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") - list(REMOVE_DUPLICATES _inc_env) - - # Try to find the version of StarPU in starpu_config.h file - set(STARPU_hdrs_to_find "starpu_config.h") - - # call cmake macro to find the header path - if(STARPU_INCDIR) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_INCDIR}) - endforeach() - else() - if(STARPU_DIR) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_DIR} - PATH_SUFFIXES "include" - "include/starpu/1.0" - "include/starpu/1.1" - "include/starpu/1.2" - "include/starpu/1.3") - endforeach() - else() - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${_inc_env} - PATH_SUFFIXES - "starpu/1.0" - "starpu/1.1" - "starpu/1.2" - "starpu/1.3") - endforeach() - endif() - endif() - mark_as_advanced(STARPU_starpu_config.h_INCLUDE_DIRS) - - ### - # - # GET_VERSION: Get the version of the software by parsing a file - # - ### - MACRO(GET_VERSION _PACKAGE _filepath) - - #message(STATUS "Looking for ${_PACKAGE} version in the file ${_filepath}") - file(READ "${_filepath}" _file) - string(REGEX REPLACE - "(.*)define([ \t]*)${_PACKAGE}_MAJOR_VERSION([ \t]*)([0-9]+)(.*)" - "\\4" ${_PACKAGE}_VERSION_MAJOR "${_file}") - string(REGEX REPLACE - "(.*)define([ \t]*)${_PACKAGE}_MINOR_VERSION([ \t]*)([0-9]+)(.*)" - "\\4" ${_PACKAGE}_VERSION_MINOR "${_file}") - set(${_PACKAGE}_VERSION_STRING - "${${_PACKAGE}_VERSION_MAJOR}.${${_PACKAGE}_VERSION_MINOR}" CACHE PATH "StarPU version found in starpu_config.h") - #message(STATUS "${_PACKAGE}_VERSION_MAJOR = -${${_PACKAGE}_VERSION_MAJOR}-") - #message(STATUS "${_PACKAGE}_VERSION_MINOR = -${${_PACKAGE}_VERSION_MINOR}-") - - ENDMACRO(GET_VERSION) - - # Find the version of StarPU in starpu_config.h file - # remark: the version is defined in this file since the STARPU 1.0 version - if (STARPU_starpu_config.h_INCLUDE_DIRS) - GET_VERSION("STARPU" "${STARPU_starpu_config.h_INCLUDE_DIRS}/starpu_config.h") - if (STARPU_VERSION_MAJOR AND STARPU_VERSION_MINOR) - if (STARPU_FIND_VERSION_EXACT) - if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR) - if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR - NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING} " - "when required is ${STARPU_FIND_VERSION}") - endif() - endif() - endif() - else() - if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR) - # if the version found is older than the required then error - if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR - (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) ) - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version found is ${STARPU_VERSION_STRING} " - "when required is ${STARPU_FIND_VERSION} or newer") - endif() - endif() - endif() - endif() - else() - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "STARPU version has not been found using starpu_config.h" - "located in ${STARPU_starpu_config.h_INCLUDE_DIRS}") - endif() - endif() - else() - if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY) - message(FATAL_ERROR - "starpu_config.h has not been found while required to get StarPU version") - endif() - endif() - - - # Try to find the starpu headers in the given paths - # ------------------------------------------------- - - # create list of headers to find - list(APPEND STARPU_hdrs_to_find "starpu.h;starpu_profiling.h") - if(STARPU_LOOK_FOR_MPI AND MPI_FOUND) - list(APPEND STARPU_hdrs_to_find "starpu_mpi.h") - endif() - if(STARPU_LOOK_FOR_CUDA AND CUDA_FOUND) - list(APPEND STARPU_hdrs_to_find "starpu_cuda.h;starpu_scheduler.h") - endif() - - # call cmake macro to find the header path - if(STARPU_INCDIR) - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_INCDIR}) - endforeach() - else() - if(STARPU_DIR) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${STARPU_DIR} - PATH_SUFFIXES "include/starpu/${STARPU_VERSION_STRING}") - endforeach() - else() - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS - NAMES ${starpu_hdr} - HINTS ${_inc_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - set(STARPU_INCLUDE_DIRS "") - foreach(starpu_hdr ${STARPU_hdrs_to_find}) - - if (STARPU_${starpu_hdr}_INCLUDE_DIRS) - # set cmake variables using the pkg-config naming convention - list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) - else () - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- ${starpu_hdr} not found") - endif() - if(starpu_hdr STREQUAL "starpu_mpi.h") - if(NOT STARPU_FIND_REQUIRED_MPI) - if (NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- ${starpu_hdr} not required") - endif() - else() - list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) - endif() - elseif( (starpu_hdr STREQUAL "starpu_cuda.h") OR (starpu_hdr STREQUAL "starpu_scheduler.h") ) - if(NOT STARPU_FIND_REQUIRED_CUDA) - if (NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- ${starpu_hdr} not required") - endif() - else() - list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" ) - endif() - endif() - endif () - mark_as_advanced(STARPU_${starpu_hdr}_INCLUDE_DIRS) - - endforeach(starpu_hdr ${STARPU_hdrs_to_find}) - - if (STARPU_INCLUDE_DIRS) - list(REMOVE_DUPLICATES STARPU_INCLUDE_DIRS) - endif () - - if (STARPU_starpu_config.h_INCLUDE_DIRS) - # Looking for lib - # --------------- - - set(STARPU_SHM_LIBRARIES "") - set(STARPU_MPI_LIBRARIES "") - set(STARPU_LIBRARY_DIRS "") - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_STARPU_LIBDIR "$ENV{STARPU_LIBDIR}") - if(ENV_STARPU_LIBDIR) - list(APPEND _lib_env "${ENV_STARPU_LIBDIR}") - elseif(ENV_STARPU_DIR) - list(APPEND _lib_env "${ENV_STARPU_DIR}") - list(APPEND _lib_env "${ENV_STARPU_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the starpu libs in the given paths - # ---------------------------------------------- - - # create list of libs to find - set(STARPU_libs_to_find "starpu-${STARPU_VERSION_STRING}") - set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION_STRING}") - if (STARPU_LOOK_FOR_MPI OR MPI_FOUND) - list(INSERT STARPU_libs_to_find 0 "starpumpi-${STARPU_VERSION_STRING}") - set(STARPU_MPI_libs_to_find "${STARPU_libs_to_find}") - endif() - - # call cmake macro to find the lib path - if(STARPU_LIBDIR) - foreach(starpu_lib ${STARPU_libs_to_find}) - set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND") - find_library(STARPU_${starpu_lib}_LIBRARY - NAMES ${starpu_lib} - HINTS ${STARPU_LIBDIR}) - endforeach() - else() - if(STARPU_DIR) - foreach(starpu_lib ${STARPU_libs_to_find}) - set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND") - find_library(STARPU_${starpu_lib}_LIBRARY - NAMES ${starpu_lib} - HINTS ${STARPU_DIR} - PATH_SUFFIXES lib lib32 lib64) - endforeach() - else() - foreach(starpu_lib ${STARPU_libs_to_find}) - set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND") - find_library(STARPU_${starpu_lib}_LIBRARY - NAMES ${starpu_lib} - HINTS ${_lib_env}) - endforeach() - endif() - endif() - - # If found, add path to cmake variable - # ------------------------------------ - foreach(starpu_lib ${STARPU_libs_to_find}) - - if (STARPU_${starpu_lib}_LIBRARY) - - get_filename_component(${starpu_lib}_lib_path ${STARPU_${starpu_lib}_LIBRARY} PATH) - # set cmake variables (respects naming convention) - - foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find}) - if(starpu_shm_lib STREQUAL starpu_lib) - list(APPEND STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endforeach() - if (STARPU_LOOK_FOR_MPI AND MPI_FOUND) - foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find}) - if(starpu_mpi_lib STREQUAL starpu_lib) - list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endforeach() - endif () - list(APPEND STARPU_LIBRARY_DIRS "${${starpu_lib}_lib_path}") - - else (STARPU_${starpu_lib}_LIBRARY) - - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- lib ${starpu_lib} not found") - endif() - if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION_STRING}" AND - NOT STARPU_FIND_REQUIRED_MPI) - # if MPI optional, not a problem: no NOTFOUND in list of MPI LIBRARIES - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu -- lib ${starpu_lib} not required") - endif() - else() - # for any other lib, add NOTFOUND in the proper list of LIBRARIES - foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find}) - if(starpu_shm_lib STREQUAL starpu_lib) - set(STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}") - endif() - endforeach() - if (STARPU_LOOK_FOR_MPI AND MPI_FOUND) - foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find}) - if(starpu_mpi_lib STREQUAL starpu_lib) - list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_mpi_lib}_LIBRARY}") - endif() - endforeach() - endif () - endif() - - endif (STARPU_${starpu_lib}_LIBRARY) - - mark_as_advanced(STARPU_${starpu_lib}_LIBRARY) - - endforeach(starpu_lib ${STARPU_libs_to_find}) - - list(REMOVE_DUPLICATES STARPU_SHM_LIBRARIES) - list(REMOVE_DUPLICATES STARPU_MPI_LIBRARIES) - if (STARPU_LIBRARY_DIRS) - list(REMOVE_DUPLICATES STARPU_LIBRARY_DIRS) - endif () - - if (STARPU_SHM_LIBRARIES AND STARPU_LIBRARY_DIRS AND STARPU_INCLUDE_DIRS) - set(STARPU_SHM_FOUND TRUE) - if(STARPU_MPI_LIBRARIES) - set(STARPU_MPI_FOUND TRUE) - endif() - endif() - - else(STARPU_starpu_config.h_INCLUDE_DIRS) - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "The version of StarPU is not known so that we do not search libraries") - endif() - endif(STARPU_starpu_config.h_INCLUDE_DIRS) - - foreach(lib ${STARPU_SHM_LIBRARIES}) - if (NOT lib) - set(STARPU_SHM_LIBRARIES "STARPU_SHM_LIBRARIES-NOTFOUND") - endif() - endforeach() - foreach(lib ${STARPU_MPI_LIBRARIES}) - if (NOT lib) - set(STARPU_MPI_LIBRARIES "STARPU_MPI_LIBRARIES-NOTFOUND") - endif() - endforeach() - if(STARPU_LOOK_FOR_MPI) - set(STARPU_LIBRARIES "${STARPU_MPI_LIBRARIES}") - else() - set(STARPU_LIBRARIES "${STARPU_SHM_LIBRARIES}") - endif() - - # check a function to validate the find - if(STARPU_LIBRARIES) - - set(REQUIRED_FLAGS) - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # STARPU - if (STARPU_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS}") - endif() - set(CMAKE_REQUIRED_FLAGS) - foreach(libdir ${STARPU_LIBRARY_DIRS}) - if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") - endif() - endforeach() - set(REQUIRED_LIBS "${STARPU_LIBRARIES}") - # HWLOC - if (HWLOC_FOUND AND STARPU_LOOK_FOR_HWLOC) - if (HWLOC_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") - endif() - if (HWLOC_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}") - endif() - foreach(lib ${HWLOC_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - # MPI - if (MPI_FOUND AND STARPU_LOOK_FOR_MPI) - if (MPI_C_INCLUDE_PATH) - list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}") - endif() - if (MPI_C_LINK_FLAGS) - if (${MPI_C_LINK_FLAGS} MATCHES " -") - string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS}) - endif() - list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}") - endif() - list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}") - endif() - # MAGMA - if (MAGMA_FOUND AND STARPU_LOOK_FOR_MAGMA) - if (MAGMA_INCLUDE_DIRS_DEP) - list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS_DEP}") - elseif(MAGMA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}") - endif() - if (MAGMA_LIBRARY_DIRS_DEP) - list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS_DEP}") - elseif(MAGMA_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}") - endif() - if (MAGMA_LIBRARIES_DEP) - list(APPEND REQUIRED_LIBS "${MAGMA_LIBRARIES_DEP}") - elseif(MAGMA_LIBRARIES) - foreach(lib ${MAGMA_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - if (MAGMA_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${MAGMA_LINKER_FLAGS}") - endif() - endif() - # CUDA - if (CUDA_FOUND AND STARPU_LOOK_FOR_CUDA) - if (CUDA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}") - endif() - if (CUDA_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}") - endif() - # FXT - if (FXT_FOUND AND STARPU_LOOK_FOR_FXT) - if (FXT_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${FXT_INCLUDE_DIRS}") - endif() - if (FXT_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${FXT_LIBRARY_DIRS}") - endif() - foreach(lib ${FXT_LIBRARIES}) - if (EXISTS ${lib} OR ${lib} MATCHES "^-") - list(APPEND REQUIRED_LIBS "${lib}") - else() - list(APPEND REQUIRED_LIBS "-l${lib}") - endif() - endforeach() - endif() - # BLAS - if (BLAS_FOUND AND STARPU_LOOK_FOR_BLAS) - if (BLAS_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") - endif() - if (BLAS_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") - if (BLAS_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") - endif() - endif() - # Fortran - if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*") - list(APPEND REQUIRED_LIBS "-lgfortran") - elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*") - list(APPEND REQUIRED_LIBS "-lifcore") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(STARPU_WORKS CACHE) - include(CheckFunctionExists) - check_function_exists(starpu_init STARPU_WORKS) - mark_as_advanced(STARPU_WORKS) - - if(STARPU_WORKS) - # save link with dependencies - if (REQUIRED_FLAGS) - set(STARPU_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}") - else() - set(STARPU_LIBRARIES_DEP "${REQUIRED_LIBS}") - endif() - set(STARPU_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(STARPU_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(STARPU_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES STARPU_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES STARPU_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES STARPU_LINKER_FLAGS) - else() - if(NOT STARPU_FIND_QUIETLY) - message(STATUS "Looking for starpu : test of starpu_init 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 "Maybe STARPU is linked with specific libraries. " - "Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT)? " - "See the explanation in FindSTARPU.cmake.") - endif() - endif() - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(STARPU_LIBRARIES) - -endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR (STARPU_GIVEN_BY_USER) ) - -if (STARPU_LIBRARIES) - if (STARPU_LIBRARY_DIRS) - foreach(dir ${STARPU_LIBRARY_DIRS}) - if ("${dir}" MATCHES "starpu") - set(first_lib_path "${dir}") - endif() - endforeach() - else() - list(GET STARPU_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - endif() - if (${first_lib_path} MATCHES "/lib(32|64)?$") - string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") - set(STARPU_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of STARPU library" FORCE) - else() - set(STARPU_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of STARPU library" FORCE) - endif() -endif() - -# check that STARPU has been found -# -------------------------------- -include(FindPackageHandleStandardArgs) -if(NOT STARPU_FIND_QUIETLY) - if(STARPU_SHM_FOUND) - message(STATUS "StarPU has been found.") - if(STARPU_MPI_LIBRARIES) - message(STATUS "The mpi version of StarPU has been found so that we manage" - "two lists of libs, one sequential and one parallel (see" - "STARPU_SHM_LIBRARIES and STARPU_MPI_LIBRARIES).") - endif() - message(STATUS "StarPU shared memory libraries stored in STARPU_SHM_LIBRARIES") - endif() -endif() -if (PKG_CONFIG_EXECUTABLE AND STARPU_SHM_FOUND) - find_package_handle_standard_args(STARPU DEFAULT_MSG - STARPU_SHM_LIBRARIES) -else() - find_package_handle_standard_args(STARPU DEFAULT_MSG - STARPU_SHM_LIBRARIES - STARPU_WORKS) -endif() -if(STARPU_LOOK_FOR_MPI) - if(STARPU_MPI_LIBRARIES AND NOT STARPU_FIND_QUIETLY) - message(STATUS "StarPU mpi libraries stored in STARPU_MPI_LIBRARIES") - endif() - if (PKG_CONFIG_EXECUTABLE AND STARPU_MPI_FOUND) - find_package_handle_standard_args(STARPU DEFAULT_MSG - STARPU_MPI_LIBRARIES) - else() - find_package_handle_standard_args(STARPU DEFAULT_MSG - STARPU_MPI_LIBRARIES - STARPU_WORKS) - endif() -endif() diff --git a/cmake_modules/morse/find/FindTMG.cmake b/cmake_modules/morse/find/FindTMG.cmake deleted file mode 100644 index 24e8cc9d6208e57b15c9b168577a62cba3efa4e7..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/FindTMG.cmake +++ /dev/null @@ -1,304 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Find TMG include dirs and libraries -# Use this module by invoking find_package with the form: -# find_package(TMG -# [REQUIRED] # Fail with error if tmg is not found -# ) -# -# This module finds headers and tmg library. -# Results are reported in variables: -# TMG_FOUND - True if headers and requested libraries were found -# TMG_LINKER_FLAGS - list of required linker flags (excluding -l and -L) -# TMG_INCLUDE_DIRS - tmg include directories -# TMG_LIBRARY_DIRS - Link directories for tmg libraries -# TMG_LIBRARIES - tmg component libraries to be linked -# TMG_INCLUDE_DIRS_DEP - tmg + dependencies include directories -# TMG_LIBRARY_DIRS_DEP - tmg + dependencies link directories -# TMG_LIBRARIES_DEP - tmg libraries + dependencies -# -# The user can give specific paths where to find the libraries adding cmake -# options at configure (ex: cmake path/to/project -DTMG=path/to/tmg): -# TMG_DIR - Where to find the base directory of tmg -# TMG_INCDIR - Where to find the header files -# TMG_LIBDIR - Where to find the library files -# The module can also look for the following environment variables if paths -# are not given as cmake variable: TMG_DIR, TMG_INCDIR, TMG_LIBDIR - -#============================================================================= -# Copyright 2012-2013 Inria -# Copyright 2012-2013 Emmanuel Agullo -# Copyright 2012-2013 Mathieu Faverge -# Copyright 2012 Cedric Castagnede -# Copyright 2013 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.) - - -if (NOT TMG_FOUND) - set(TMG_DIR "" CACHE PATH "Installation directory of TMG library") - if (NOT TMG_FIND_QUIETLY) - message(STATUS "A cache variable, namely TMG_DIR, has been set to specify the install directory of TMG") - endif() -endif() - - -# used to test a TMG function after -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) - include(CheckFunctionExists) -else (NOT _LANGUAGES_ MATCHES Fortran) - include(CheckFortranFunctionExists) -endif (NOT _LANGUAGES_ MATCHES Fortran) - -# TMG depends on LAPACK anyway, try to find it -if (NOT LAPACK_FOUND) - if(TMG_FIND_REQUIRED) - find_package(LAPACK REQUIRED) - else() - find_package(LAPACK) - endif() -endif() - -# TMG depends on LAPACK -if (LAPACK_FOUND) - - # check if a tmg function exists in the LAPACK lib - set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LINKER_FLAGS};${LAPACK_LIBRARIES}") - include(CheckFunctionExists) - include(CheckFortranFunctionExists) - unset(TMG_WORKS CACHE) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlarnv TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlarnv TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - if (TMG_WORKS) - unset(TMG_WORKS CACHE) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlagsy TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlagsy TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - mark_as_advanced(TMG_WORKS) - endif() - set(CMAKE_REQUIRED_LIBRARIES) - - if(TMG_WORKS) - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg: test with lapack succeeds") - endif() - # test succeeds: TMG is in LAPACK - set(TMG_LIBRARIES "${LAPACK_LIBRARIES}") - if (LAPACK_LIBRARY_DIRS) - set(TMG_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}") - endif() - if(LAPACK_INCLUDE_DIRS) - set(TMG_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}") - endif() - if (LAPACK_LINKER_FLAGS) - set(TMG_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") - endif() - else() - - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg : test with lapack fails") - message(STATUS "Looking for tmg : try to find it elsewhere") - endif() - # test fails: try to find TMG lib exterior to LAPACK - - # Looking for lib tmg - # ------------------- - - # Add system library paths to search lib - # -------------------------------------- - unset(_lib_env) - set(ENV_TMG_DIR "$ENV{TMG_DIR}") - set(ENV_TMG_LIBDIR "$ENV{TMG_LIBDIR}") - if(ENV_TMG_LIBDIR) - list(APPEND _lib_env "${ENV_TMG_LIBDIR}") - elseif(ENV_TMG_DIR) - list(APPEND _lib_env "${ENV_TMG_DIR}") - list(APPEND _lib_env "${ENV_TMG_DIR}/lib") - else() - if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") - else() - if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") - else() - 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}") - endif() - endif() - list(REMOVE_DUPLICATES _lib_env) - - # Try to find the tmg lib in the given paths - # ---------------------------------------------- - - # call cmake macro to find the lib path - if(TMG_LIBDIR) - set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND") - find_library(TMG_tmg_LIBRARY - NAMES tmglib - HINTS ${TMG_LIBDIR} ) - else() - if(TMG_DIR) - set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND") - find_library(TMG_tmg_LIBRARY - NAMES tmglib - HINTS ${TMG_DIR} - PATH_SUFFIXES lib lib32 lib64 ) - else() - set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND") - find_library(TMG_tmg_LIBRARY - NAMES tmglib - HINTS ${_lib_env} ) - endif() - endif() - mark_as_advanced(TMG_tmg_LIBRARY) - - # If found, add path to cmake variable - # ------------------------------------ - if (TMG_tmg_LIBRARY) - get_filename_component(tmg_lib_path ${TMG_tmg_LIBRARY} PATH) - # set cmake variables (respects naming convention) - set(TMG_LIBRARIES "${TMG_tmg_LIBRARY}") - set(TMG_LIBRARY_DIRS "${tmg_lib_path}") - else () - set(TMG_LIBRARIES "TMG_LIBRARIES-NOTFOUND") - set(TMG_LIBRARY_DIRS "TMG_LIBRARY_DIRS-NOTFOUND") - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg -- lib tmg not found") - endif() - endif () - - if (TMG_LIBRARY_DIRS) - list(REMOVE_DUPLICATES TMG_LIBRARY_DIRS) - endif () - - # check a function to validate the find - if(TMG_LIBRARIES) - - set(REQUIRED_LDFLAGS) - set(REQUIRED_INCDIRS) - set(REQUIRED_LIBDIRS) - set(REQUIRED_LIBS) - - # TMG - if (TMG_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS}") - endif() - if (TMG_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS}") - endif() - set(REQUIRED_LIBS "${TMG_LIBRARIES}") - # LAPACK - if (LAPACK_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}") - endif() - if (LAPACK_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}") - endif() - list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}") - if (LAPACK_LINKER_FLAGS) - list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}") - endif() - - # set required libraries for link - set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") - set(CMAKE_REQUIRED_LIBRARIES) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") - foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") - endforeach() - list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}") - string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - # test link - unset(TMG_WORKS CACHE) - include(CheckFunctionExists) - include(CheckFortranFunctionExists) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlarnv TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlarnv TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - if (TMG_WORKS) - unset(TMG_WORKS CACHE) - if (NOT _LANGUAGES_ MATCHES Fortran) - check_function_exists(dlagsy TMG_WORKS) - else (NOT _LANGUAGES_ MATCHES Fortran) - check_fortran_function_exists(dlagsy TMG_WORKS) - endif (NOT _LANGUAGES_ MATCHES Fortran) - mark_as_advanced(TMG_WORKS) - endif() - - if(TMG_WORKS) - # save link with dependencies - set(TMG_LIBRARIES_DEP "${REQUIRED_LIBS}") - set(TMG_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") - set(TMG_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") - set(TMG_LINKER_FLAGS "${REQUIRED_LDFLAGS}") - list(REMOVE_DUPLICATES TMG_LIBRARY_DIRS_DEP) - list(REMOVE_DUPLICATES TMG_INCLUDE_DIRS_DEP) - list(REMOVE_DUPLICATES TMG_LINKER_FLAGS) - else() - if(NOT TMG_FIND_QUIETLY) - message(STATUS "Looking for tmg: test of dlarnv and dlagsy with tmg 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) - set(CMAKE_REQUIRED_FLAGS) - set(CMAKE_REQUIRED_LIBRARIES) - endif(TMG_LIBRARIES) - - endif() - -else() - - if(NOT TMG_FIND_QUIETLY) - message(STATUS "TMG requires LAPACK but LAPACK has not been found." - "Please look for LAPACK first.") - endif() - -endif() - -if (TMG_LIBRARIES) - list(GET TMG_LIBRARIES 0 first_lib) - get_filename_component(first_lib_path "${first_lib}" PATH) - if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") - string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") - set(TMG_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of TMG library" FORCE) - else() - set(TMG_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of TMG library" FORCE) - endif() -endif() - -# check that TMG has been found -# ------------------------------- -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(TMG DEFAULT_MSG - TMG_LIBRARIES - TMG_WORKS) diff --git a/cmake_modules/morse/find/InstallPackage.cmake b/cmake_modules/morse/find/InstallPackage.cmake deleted file mode 100644 index ee82030996934eb8b4495c482eb2b35c67edc17d..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/InstallPackage.cmake +++ /dev/null @@ -1,153 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2015 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# - Install a library -# This module installs a version of BLAS library from either: -# a tarball downloaded (requires an internet access) -# or from sources already present on the system -# -# We handle two different modes: -# -# - Install from a tarball downloaded on internet (we decide the distribution to ensure compatibility) -# - activate it with BLAS_DOWNLOAD=ON -# - will download and build NETLIB BLAS: http://netlib.org/blas/blas.tgz -# - the resulting library is blas_LINUX.a, see their make.inc ! -# -# - Install from sources somewhere on the system: -# - activate it with BLAS_SOURCE_DIR=path/to/sources, note you manage your build configuration through the make.inc -# - we check for blas_LINUX.a library by default, set BLAS_SOURCE_LIBNAME=your_blas_lib_name if different -# - for now we handle the NETLIB blas only, see http://netlib.org/blas/blas.tgz, maybe more in the future -# -# Note: if BLAS_DOWNLOAD=ON then BLAS_SOURCE mode is not considered -# turn it OFF to install sources using BLAS_SOURCE_DIR and optionnaly BLAS_SOURCE_LIBNAME - -# List of libraries handle for now -set(MORSE_INSTALL_LIBRARY_LIST - BLAS - CBLAS - CHAMELEON - FFTW - FXT - HWLOC - LAPACK - LAPACKE - MAGMA - METIS - MUMPS - PARMETIS - PASTIX - PTSCOTCH - QUARK - SCALAPACK - SCOTCH - STARPU - TMG - ) - -# Set list if URLs to libraries -set(BLAS_TAR_URL "http://netlib.org/blas/blas.tgz") -set(CBLAS_TAR_URL "http://www.netlib.org/blas/blast-forum/cblas.tgz") -set(CHAMELEON_TAR_URL "") -set(FFTW_TAR_URL "") -set(FXT_TAR_URL "") -set(HWLOC_TAR_URL "") -set(LAPACK_TAR_URL "") -set(LAPACKE_TAR_URL "") -set(MAGMA_TAR_URL "") -set(METIS_TAR_URL "") -set(MUMPS_TAR_URL "") -set(PARMETIS_TAR_URL "") -set(PASTIX_TAR_URL "") -set(PTSCOTCH_TAR_URL "") -set(QUARK_TAR_URL "") -set(SCALAPACK_TAR_URL "") -set(SCOTCH_TAR_URL "") -set(STARPU_TAR_URL "") -set(TMG_TAR_URL "") - -# Set buildtool for each library -set(BLAS_BUILDTOOL "make") -set(CBLAS_BUILDTOOL "make") -set(CHAMELEON_BUILDTOOL "cmake") -set(FFTW_BUILDTOOL "") -set(FXT_BUILDTOOL "autotools") -set(HWLOC_BUILDTOOL "autotools") -set(LAPACK_BUILDTOOL "cmake") -set(LAPACKE_BUILDTOOL "cmake") -set(MAGMA_BUILDTOOL "make") -set(METIS_BUILDTOOL "make") -set(MUMPS_BUILDTOOL "make") -set(PARMETIS_BUILDTOOL "make") -set(PASTIX_BUILDTOOL "cmake") -set(PTSCOTCH_BUILDTOOL "make") -set(QUARK_BUILDTOOL "make") -set(SCALAPACK_BUILDTOOL "make") -set(SCOTCH_BUILDTOOL "make") -set(STARPU_BUILDTOOL "autotools") -set(TMG_BUILDTOOL "cmake") - -# Macro to install a library -macro(install_package _libname) - -message(STATUS "Install package ${_libname}") - -# _libname must be one we manage, check the list: LIBRARY_LIST -if (NOT MORSE_INSTALL_LIBRARY_LIST MATCHES "${_libname}") - message(FATAL_ERROR "First argument for library name, ${_libname}," - " is not managed in Morse for now. Check MORSE_INSTALL_LIBRARY_LIST list.") -endif() - -message("ARGV: ${ARGV}") - -# if download mode: call the corresponding macro -if (ARGV MATCHES "DOWNLOAD") - - # Download the tarball - message(STATUS "Download: ${${_libname}_TAR_URL}") - - get_filename_component(tarball_name "${${_libname}_TAR_URL}" NAME) - - if (NOT EXISTS "${CMAKE_SOURCE_DIR}/externals/${tarball_name}") - file(DOWNLOAD ${${_libname}_TAR_URL} - ${CMAKE_SOURCE_DIR}/externals/${tarball_name} - STATUS IS_GOT - SHOW_PROGRESS - TIMEOUT 30 - ) - if (EXISTS "${CMAKE_SOURCE_DIR}/externals/${tarball_name}") - message(STATUS "${tarball_name} downloaded: ${CMAKE_SOURCE_DIR}/externals/${tarball_name}") - else() - message(WARNING "${${_libname}_TAR_URL} download has failed") - endif() - endif() - - # Untar - if (NOT EXISTS "${CMAKE_SOURCE_DIR}/externals/${_libname}/") - message(STATUS "Untar ${tarball_name}") - execute_process( - COMMAND tar xvf ${CMAKE_SOURCE_DIR}/externals/${tarball_name} ${_libname} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/externals - ) - if (EXISTS "${CMAKE_SOURCE_DIR}/externals/${_libname}/") - message(STATUS "${_libname} untared: ${CMAKE_SOURCE_DIR}/externals/${_libname}/") - else() - message(WARNING "${_libname} untar has failed") - endif() - endif() - -endif() - - -endmacro(install_package) - -# Macro to install a library from a downloaded tarball -#macro(install_library_from_download) -#endmacro() - diff --git a/cmake_modules/morse/find/MORSE-Copyright.txt b/cmake_modules/morse/find/MORSE-Copyright.txt deleted file mode 100644 index 1e5650e0a1901ce186d621f6b1977482133a4b33..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/find/MORSE-Copyright.txt +++ /dev/null @@ -1,41 +0,0 @@ -### -# -# @copyright (c) 2009-2014 The University of Tennessee and The University -# of Tennessee Research Foundation. -# All rights reserved. -# @copyright (c) 2012-2014 Inria. All rights reserved. -# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. -# -### -# -# This software is a computer program whose purpose is to process -# Matrices Over Runtime Systems @ Exascale (MORSE). More information -# can be found on the following website: http://www.inria.fr/en/teams/morse. -# -# This software is governed by the CeCILL-C license under French law and -# abiding by the rules of distribution of free software. You can use, -# modify and/ or redistribute the software under the terms of the CeCILL-C -# license as circulated by CEA, CNRS and INRIA at the following URL -# "http://www.cecill.info". -# -# As a counterpart to the access to the source code and rights to copy, -# modify and redistribute granted by the license, users are provided only -# with a limited warranty and the software's author, the holder of the -# economic rights, and the successive licensors have only limited -# liability. -# -# In this respect, the user's attention is drawn to the risks associated -# with loading, using, modifying and/or developing or reproducing the -# software by the user in light of its specific status of free software, -# that may mean that it is complicated to manipulate, and that also -# therefore means that it is reserved for developers and experienced -# professionals having in-depth computer knowledge. Users are therefore -# encouraged to load and test the software's suitability as regards their -# requirements in conditions enabling the security of their systems and/or -# data to be ensured and, more generally, to use and operate it in the -# same conditions as regards security. -# -# The fact that you are presently reading this means that you have had -# knowledge of the CeCILL-C license and that you accept its terms. -# -### diff --git a/cmake_modules/morse/precision_generator/Conversion.py b/cmake_modules/morse/precision_generator/Conversion.py deleted file mode 100644 index 00202d701620444b756ce211390fe22298e505f4..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/precision_generator/Conversion.py +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/env python -"""@package Tools - -This python script is responsible for precision generation replacements -as well as replacements of any kind in other files. Different types of -replacements can be defined such that no two sets can conflict. Multiple -types of replacements can, however, be specified for the same file. - -@author Wesley Alvaro -@date 2011-4-8 - -""" -__author__="alvaro" -__date__ ="$Sep 2, 2010 10:09:19 AM$" -__version__=11.0408 - -import sys; -import re; -import shlex; -import os; -import shutil; -from os import path; -from optparse import OptionParser,OptionGroup; -from subs import subs; -from datetime import datetime; - -"""Keyword used to signal replacement actions on a file""" -KEYWORD = '@precisions'; -"""Replace the above keyword with this one post-replacements""" -DONE_KEYWORD = '@generated'; -"""Regular expression for the replacement formatting""" -REGEX = '^.*'+KEYWORD+'\s+((\w+,?)+)\s+(\w+)\s+->\s*((\s\w+)+).*$'; -"""Default acceptable extensions for files during directory walking""" -EXTS = ['.c','.cpp','.h','.hpp','.f','.jdf','.f90','.F90','.f77','.F77','.cu','.cuf','.CUF','.jdf']; - -def check_gen(file, work, rex): - """Reads the file and determines if the file needs generation.""" - fd = open(path.realpath(file), 'r'); - lines = fd.readlines(); - fd.close(); - for line in lines: - m = rex.match(line); - if m is None: continue; - work.append((file, m.groups(), ''.join(lines))); - -def grep(string,list): - expr = re.compile(string) - return filter(expr.search,list) - -def hidden(file): - """Exclude hidden files""" - return not file.startswith('.'); - -def valid_extension(file): - """Exclude non-valid extensions""" - global EXTS; - for ext in EXTS: - if file.endswith(ext): - return True; - return False; - -def relpath(p): - """Get the relative path of a file.""" - p = path.realpath(p); - return p.replace(path.realpath('.')+'/',''); - -class Conversion: - """ - This class works on a single file to create generations - """ - """Static. Is the conversion in debug mode? More verbose.""" - debug = False; - """Static. Is the conversion in test mode? No real work.""" - test = False; - """Static. Is the conversion in make mode? Output make commands.""" - make = False; - """Static. What (if any) prefix is specified for the output folder? - If None, use the file's resident folder.""" - prefix = None; - required_precisions = []; - """Static. A running list of files that are input.""" - files_in = []; - """Static. A running list of files that are output.""" - files_out = []; - """Static. A running list of files that are output.""" - dependencies = []; - def __init__(self, file = None, match = None, content = None): - """Constructor that takes a file, match, and content. - @param file The file name of the input. - @param match The regular expression matches - @param content The ASCII content of the file. - """ - if file is None: return; - self.content = content; - #file = path.realpath(file); - rel = relpath(file); - self.file = list(path.split(file)); - self.date = path.getmtime(file); - if sys.platform!="win32" and path.samefile(path.join(self.file[0],self.file[1]),sys.argv[0]): - raise ValueError('Let\'s just forget codegen.py'); - try: - """['normal','all','mixed'] for example. This(ese) are the replacement types to be used.""" - self.types = match[0].split(','); - """'z' for example. This is the current file's `type`.""" - self.precision = match[2].lower(); - """['c','d','s'] for example. This is the current file's destination `types`.""" - self.precisions = match[3].lower().split(); - if len(self.required_precisions): - self.precstmp = []; - for prec in self.required_precisions: - if prec in self.precisions or prec == self.precision: - self.precstmp.append(prec); - self.precisions = self.precstmp; - except: - raise ValueError(path.join(self.file[0],self.file[1])+' : Invalid conversion string'); - self.files_in.append(rel); - - def run(self): - """Does the appropriate work, if in test mode, this is limited to only converting names.""" - if self.convert_names() and not self.test: - """If not in test mode, actually make changes and export to disk.""" - self.convert_data(); - self.export_data(); - - def convert_names(self): - """Investigate file name and make appropriate changes.""" - self.names = []; - self.dates = []; - self.copy = []; - self.converted = []; - load = False; - if self.debug: print '|'.join(self.types), self.precision, relpath(path.join(self.file[0],self.file[1])); - for precision in self.precisions: - """For each destination precision, make the appropriate changes to the file name/data.""" - new_file = self.convert(self.file[1], precision); - if self.debug: print precision,':', - copy = False; - if new_file <> self.file[1] or self.prefix is not None: - if self.prefix is None: - """If no prefix is specified, use the file's current folder.""" - prefix = '' - makeprefix = ''; - else: - """If a prefix is specified, set it up.""" - prefix = self.prefix; - makeprefix = '--prefix '+prefix; - if new_file == self.file[1]: - copy = True; - """Where the destination file will reside.""" - conversion = path.join(prefix, new_file); - file_out = relpath(conversion); - if self.make: - """If in GNU Make mode, write the rule to create the file.""" - file_in = relpath(path.join(self.file[0],self.file[1])); - print file_out+':',file_in; - print "\t$(PYTHON)",path.realpath(sys.argv[0]),makeprefix,'-p',precision,"--file",file_in; - self.names.append(new_file); - self.files_out.append(file_out); - self.dependencies.append( (path.join(self.file[0],self.file[1]), precision, file_out) ); - if self.debug: print relpath(conversion), ':', - try: - """Try to emulate Make like time based dependencies.""" - date = path.getmtime(conversion); - diff = self.date - date; - self.dates.append(diff); - if self.debug: - if diff > 0: print 'Old', - else: print 'Current', - print diff; - if diff > 0: load = True; - except: - if self.debug: print 'Missing'; - self.dates.append(None); - load = True; - elif precision <> self.precision : - """There was no change in the file's name, thus, - no work can be done without overwriting the original.""" - if self.debug: print '<No Change>',':'; - else: print >> sys.stderr, new_file, 'had no change for', precision; - self.names.append(None); - self.dates.append(None); - self.copy.append(copy); - return load; - - def export_data(self): - """After all of the conversions are complete, - this will write the output file contents to the disk.""" - for i in range(len(self.names)): - name = self.names[i]; - data = self.converted[i]; - copy = self.copy[i]; - if copy: - shutil.copy(self.files_in[i], self.files_out[i]); - continue; - if data is None or name is None: continue; - fd = open(self.files_out[i], 'w'); - fd.write(data); - fd.close(); - - - def convert_data(self): - """Convert the data in the files by making the - appropriate replacements for each destination precision.""" - for i in range(len(self.precisions)): - precision = self.precisions[i]; - name = self.names[i]; - date = self.dates[i]; - copy = self.copy[i]; - if name is not None and not copy and (date is None or date > 0): - self.converted.append(self.convert(self.content, precision)); - else: self.converted.append(None); - - def substitute(self, sub_type, data, precision): - """This operates on a single replacement type. - @param sub_type The name of the replacement set. - @param data The content subject for replacments. - @param precision The target precision for replacements. - """ - try: - """Try to select the requested replacements.""" - work = subs[sub_type]; - prec_to = work[0].index(precision); - prec_from = work[0].index(self.precision); - except: - """If requested replacement type does not exist, - return unaltered contents.""" - return data; - for i in range(1,len(work)): - """Requested replacements were found, - execute replacements for each entry.""" - try: - search = work[i][prec_from]; - replace = work[i][prec_to]; - if not search: continue; - replace = replace.replace('\*','*'); - if sub_type != 'tracing' : - replace = replace.replace('\(','('); - replace = replace.replace('\)',')'); - data = re.sub(search, replace, data); - except: - print 'Bad replacement pair ',i,'in',sub_type; - continue; - return data; - - def convert(self, data, precision): - """Select appropriate replacements for the current file. - @param data The content subject for the replacements. - @param precision The target precision for generation. - """ - global KEYWORD, DONE_KEYWORD; - try: - """All files undergo the "all" replacements.""" - data = self.substitute('all', data, precision); - except: pass; - for sub_type in self.types: - """For all the other types of conversion for the current file, - make the correct replacements.""" - if sub_type == 'all': continue; - try: - data = self.substitute(sub_type, data, precision); - except Exception, e: - raise ValueError('I encountered an unrecoverable error while working in subtype:',sub_type+'.'); - """Replace the replacement keywork with one that signifies this is an output file, - to prevent multiple replacement issues if run again.""" - data = re.sub(KEYWORD+' '+','.join(self.types)+'.*', DONE_KEYWORD+' '+precision+' '+datetime.now().ctime(), data); - return data; diff --git a/cmake_modules/morse/precision_generator/codegen.py b/cmake_modules/morse/precision_generator/codegen.py deleted file mode 100755 index 8b0322361cee09e5fec0a4f26e6948e73b403763..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/precision_generator/codegen.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -"""@package Tools - -This python script is responsible for precision generation replacements -as well as replacements of any kind in other files. Different types of -replacements can be defined such that no two sets can conflict. Multiple -types of replacements can, however, be specified for the same file. - -@author Wesley Alvaro -@date 2011-4-8 - -""" -__author__="alvaro" -__date__ ="$Sep 2, 2010 10:09:19 AM$" -__version__=11.0408 - -import sys; -import re; -import shlex; -import os; -import shutil; -from os import path; -from optparse import OptionParser,OptionGroup; -from datetime import datetime; -from Conversion import KEYWORD,DONE_KEYWORD,REGEX,EXTS,Conversion,check_gen,subs; - -def main(): - """Create option parser, set static variables of the converter and manage printing options/order.""" - global REGEX, EXTS; - """The compiled regular expression for detecting proper files.""" - rex = re.compile(REGEX); - """Files found to be workable.""" - work = []; - - """Create the options parser for detecting options on the command line.""" - parser = OptionParser(usage="Usage: %prog [options]",version='%prog '+str(__version__)); - group = OptionGroup(parser,"Printing Options","These options control the printing output."); - group.add_option("-i", "--in-files", help='Print the filenames of files for precision generation.', action='store_true', dest='in_print', default=False); - group.add_option("-o", "--out-files", help='Print the filenames for the precision generated files.', action='store_true', dest='out_print', default=False); - group.add_option("-m", "--make", help='Spew a GNU Make friendly file to standard out.', action='store_true', dest='make', default=False); - group.add_option("-d", "--debug", help='Print debugging messages.', action='store_true', dest='debug', default=False); - parser.add_option_group(group); - group = OptionGroup(parser,"Operating Mode Options","These options alter the way the program operates on the input/output files."); - group.add_option("-c", "--clean", help='Remove the files that are the product of generation.', action='store_true', dest='out_clean', default=False); - group.add_option("-T", "--test", help='Don\'t actually do any work.', action='store_true', dest='test', default=False); - parser.add_option_group(group); - group = OptionGroup(parser,"Settings","These options specify how the work should be done."); - group.add_option("-P", "--prefix", help='The output directory if different from the input directory.', action='store', dest='prefix', default=None); - group.add_option("-f", "--file", help='Specify a file(s) on which to operate.', action='store', dest='fileslst', type='string', default=""); - group.add_option("-p", "--prec", help='Specify a precision(s) on which to operate.', action='store', dest='precslst', type='string', default=""); - group.add_option("-e", "--filetypes", help='Specify file extensions on which to operate when walking.', action='store', dest='fileexts', type='string', default=""); - parser.add_option_group(group); - - (options, args) = parser.parse_args(); - - """If file extensions are specified, override defaults.""" - if options.fileexts: - EXTS = options.fileexts.split(); - - """Fill the 'work' array with files found to be operable.""" - if options.fileslst: - """If files to examine are specified on the command line""" - for file in options.fileslst.split(): - check_gen(file, work, rex); - else: - """Begin directory walking in the current directory.""" - startDir = '.'; - for root, dirs, files in os.walk(startDir, True, None): - dirs = filter(hidden,dirs); - files = filter(hidden,files); - files = filter(valid_extension,files); - for file in files: - check_gen(path.join(root,file), work, rex); - - """Set static options for conversion.""" - Conversion.debug = options.debug; - Conversion.make = options.make; - Conversion.prefix = options.prefix; - Conversion.required_precisions = options.precslst.split(); - if options.out_print or options.out_clean or options.in_print or options.make or options.test: - Conversion.test = True; - - if options.make: - """If the program should be GNU Make friendly.""" - print '## Automatically generated Makefile'; - print 'PYTHON ?= python'; - - c = Conversion(); """This initializes the variable for static member access.""" - - for tuple in work: - """For each valid conversion file found.""" - try: - """Try creating and executing a converter.""" - c = Conversion(tuple[0], tuple[1], tuple[2]); - c.run(); - except Exception, e: - print >> sys.stderr, str(e); - continue; - - if options.make: - """If the program should be GNU Make friendly.""" - print 'gen = ',' '+' '.join(c.files_out); - print 'cleangen:'; - print '\trm -f $(gen)'; - print 'generate: $(gen)'; - print '.PHONY: cleangen generate'; - if options.in_print: - """Should we print the input files?""" - print ' '.join(c.files_in); - if options.out_print: - """Should we print the output files?""" - print ' '.join(c.files_out); - if options.out_clean: - """Clean generated files""" - for file in c.files_out: - if not path.exists(file): continue; - os.remove(file); - -if __name__ == "__main__": - main(); diff --git a/cmake_modules/morse/precision_generator/genDependencies.py b/cmake_modules/morse/precision_generator/genDependencies.py deleted file mode 100755 index 973e5aa29138d4e6ead48454951d9793717bcdd4..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/precision_generator/genDependencies.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python -"""@package Tools - -This python script is responsible for precision generation replacements -as well as replacements of any kind in other files. Different types of -replacements can be defined such that no two sets can conflict. Multiple -types of replacements can, however, be specified for the same file. - -@author Wesley Alvaro -@date 2011-4-8 - -""" -__author__="alvaro" -__date__ ="$Sep 2, 2010 10:09:19 AM$" -__version__=11.0408 - -import sys; -import re; -import shlex; -import os; -import shutil; -import imp; -from os import path; -from optparse import OptionParser,OptionGroup; -from datetime import datetime; -from Conversion import KEYWORD,DONE_KEYWORD,REGEX,EXTS,Conversion,check_gen,relpath,subs; - -class GenConversion: - """ - This class works on a single file to create generations - """ - """Static. Source directory where to find the input files""" - srcdir = None; - """Static. What (if any) prefix is specified for the output folder? - If None, use the file's resident folder.""" - prefix = None; - """Static. Precisions asked by the user.""" - required_precisions = []; - """The compiled regular expression for detecting proper files.""" - rex = re.compile(REGEX); - - def run(self, file = None): - match = None; - """Local complete """ - if self.srcdir is None: - lfile = file; - else: - lfile = path.join(self.srcdir, file); - """Reads the file and determines if the file needs generation.""" - for line in open(path.realpath(lfile), 'r'): - m = self.rex.match(line); - if m is None: continue; - else: - match = m.groups(); - break; - - """This file need to go through precision generation script""" - if match is None: - return ""; - else: - try: - """['normal','all','mixed'] for example. This(ese) are the replacement types to be used.""" - self.types = match[0].split(','); - """'z' for example. This is the current file's `type`.""" - self.precision = match[2].lower(); - """['c','d','s'] for example. This is the current file's destination `types`.""" - self.precisions = set(match[3].lower().split()); - """Add the local precision to the list if not present""" - self.precisions.add(self.precision); - """Take only the intersection of the available precision and the requested ones""" - self.precisions.intersection_update(self.required_precisions); - except: - raise ValueError(lfile+' : Invalid conversion string'); - - filename = list(path.split(lfile))[1]; - result = ""; - for precision in self.precisions: - """For each destination precision, make the appropriate changes to the file name/data.""" - new_file = self.convert(filename, precision); - if new_file <> filename or self.prefix is not None: - if self.prefix is None: - """If no prefix is specified, use the file's current folder.""" - prefix = '' - else: - """If a prefix is specified, set it up.""" - prefix = self.prefix; - """Where the destination file will reside.""" - conversion = path.join(prefix, new_file); - file_out = relpath(conversion); - result = result+file+","+precision+","+file_out+";"; - return result; - - def substitute(self, sub_type, data, precision): - """This operates on a single replacement type. - @param sub_type The name of the replacement set. - @param data The content subject for replacments. - @param precision The target precision for replacements. - """ - try: - """Try to select the requested replacements.""" - work = subs[sub_type]; - prec_to = work[0].index(precision); - prec_from = work[0].index(self.precision); - except: - """If requested replacement type does not exist, - return unaltered contents.""" - return data; - for i in range(1,len(work)): - """Requested replacements were found, - execute replacements for each entry.""" - try: - search = work[i][prec_from]; - replace = work[i][prec_to]; - if not search: continue; - replace = replace.replace('\*','*'); - if sub_type != 'tracing' : - replace = replace.replace('\(','('); - replace = replace.replace('\)',')'); - data = re.sub(search, replace, data); - except: - print 'Bad replacement pair ',i,'in',sub_type; - continue; - return data; - - def convert(self, data, precision): - """Select appropriate replacements for the current file. - @param data The content subject for the replacements. - @param precision The target precision for generation. - """ - global KEYWORD, DONE_KEYWORD; - try: - """All files undergo the "all" replacements.""" - data = self.substitute('all', data, precision); - except: pass; - for sub_type in self.types: - """For all the other types of conversion for the current file, - make the correct replacements.""" - if sub_type == 'all': continue; - try: - data = self.substitute(sub_type, data, precision); - except Exception, e: - raise ValueError('I encountered an unrecoverable error while working in subtype:',sub_type+'.'); - return data; - - -def main(): - """Create option parser, set static variables of the converter and manage printing options/order.""" - global REGEX, EXTS; - """The compiled regular expression for detecting proper files.""" - rex = re.compile(REGEX); - """Files found to be workable.""" - work = []; - - """Create the options parser for detecting options on the command line.""" - parser = OptionParser(usage="Usage: %prog [options]",version='%prog '+str(__version__)); - group = OptionGroup(parser,"Printing Options","These options control the printing output."); - group.add_option("-i", "--in-files", help='Print the filenames of files for precision generation.', action='store_true', dest='in_print', default=False); - group.add_option("-o", "--out-files", help='Print the filenames for the precision generated files.', action='store_true', dest='out_print', default=False); - group.add_option("-d", "--debug", help='Print debugging messages.', action='store_true', dest='debug', default=False); - parser.add_option_group(group); - group = OptionGroup(parser,"Settings","These options specify how the work should be done."); - group.add_option("-s", "--srcdir", help='The input source directory.', action='store', dest='srcdir', default=None); - group.add_option("-P", "--prefix", help='The output directory if different from the input directory.', action='store', dest='prefix', default=None); - group.add_option("-f", "--file", help='Specify a file(s) on which to operate.', action='store', dest='fileslst', type='string', default=""); - group.add_option("-p", "--prec", help='Specify a precision(s) on which to operate.', action='store', dest='precslst', type='string', default=""); - group.add_option("-e", "--filetypes", help='Specify file extensions on which to operate when walking.', action='store', dest='fileexts', type='string', default=""); - group.add_option("-D", "--dictionnary", help='Specify the dictionnary to use in names conversion.', action='store', dest='dictionnary', type='string', default=""); - parser.add_option_group(group); - - (options, args) = parser.parse_args(); - - """If file extensions are specified, override defaults.""" - if options.fileexts: - EXTS = options.fileexts.split(); - - """Fill the 'work' array with files found to be operable.""" - # if options.fileslst: - # """If files to examine are specified on the command line""" - # for file in options.fileslst.split(): - # check_gen(file, work, rex); - # else: - # """Begin directory walking in the current directory.""" - # startDir = '.'; - # for root, dirs, files in os.walk(startDir, True, None): - # dirs = filter(hidden,dirs); - # files = filter(hidden,files); - # files = filter(valid_extension,files); - # for file in files: - # check_gen(path.join(root,file), work, rex); - - """Set static options for conversion.""" - GenConversion.srcdir = options.srcdir; - GenConversion.prefix = options.prefix; - GenConversion.required_precisions = options.precslst.split(); - - c = GenConversion(); """This initializes the variable for static member access.""" - - result = "" - for file in options.fileslst.split(): - """For each valid conversion file found.""" - try: - """Try creating and executing a converter.""" - result += c.run(file); - except Exception, e: - print >> sys.stderr, str(e); - continue; - - print result; - -if __name__ == "__main__": - main(); diff --git a/cmake_modules/morse/precision_generator/subs.py b/cmake_modules/morse/precision_generator/subs.py deleted file mode 100644 index fe0d0effd93ab6b2970f1cb17a4a63b42ee7bdfb..0000000000000000000000000000000000000000 --- a/cmake_modules/morse/precision_generator/subs.py +++ /dev/null @@ -1,968 +0,0 @@ -#!/usr/bin/env python -# Substitutions are applied in the order listed. This is important in cases -# where multiple substitutions could match, or when one substitution matches -# the result of a previous substitution. For example, these rules are correct -# in this order: -# -# ('real', 'double precision', 'real', 'double precision' ), # before double -# ('float', 'double', 'float', 'double' ), -# -# but if switched would translate 'double precision' -> 'float precision', -# which is wrong. -# -# Reorganized 5/2012 Mark Gates - -# Dictionary is keyed on substitution type (mixed, normal, etc.) -subs = { - # ------------------------------------------------------------ - # replacements applied to ALL files. - 'all' : [ - [None, None] - ], - - # ------------------------------------------------------------ - # replacements applied to mixed precision files. - 'mixed' : [ - # ----- Special line indicating column types - ['ds', 'zc' ], - - # ----- Mixed precisions - ('DS', 'ZC' ), - ('ds', 'zc' ), - - # ----- Preprocessor - ('#define PRECISION_d', '#define PRECISION_z' ), - ('#define PRECISION_s', '#define PRECISION_c' ), - ('#undef PRECISION_d', '#undef PRECISION_z' ), - ('#undef PRECISION_s', '#undef PRECISION_c' ), - - # ----- Fortran Types - ('real\(kind=c_double\)', 'complex\(kind=c_double_complex\)' ), - ('real\(kind=c_float\)', 'real\(kind=c_float_complex\)' ), - - # ----- Data types - ('double', 'double2' ), - ('float', 'float2' ), - ('double', 'cuDoubleComplex' ), - ('float', 'cuFloatComplex' ), - ('DOUBLE PRECISION', 'COMPLEX_16' ), - ('SINGLE PRECISION', 'COMPLEX' ), - ('real', 'complex' ), - ('float', 'MORSE_Complex32_t' ), - ('double', 'MORSE_Complex64_t' ), - ('float', 'MORSE_voidComplex32_t' ), - ('double', 'MORSE_voidComplex64_t' ), - ('MorseRealFloat', 'MorseComplexFloat' ), - ('MorseRealDouble', 'MorseComplexDouble' ), - - # ----- CBLAS - ('', 'CBLAS_SADDR' ), - - # ----- Prefixes - ('blasf77_d', 'blasf77_z' ), - ('blasf77_s', 'blasf77_c' ), - ('cublasIdamax', 'cublasIzamax' ), - ('cublasD', 'cublasZ' ), - ('cublasS', 'cublasC' ), - ('lapackf77_d', 'lapackf77_z' ), - ('lapackf77_s', 'lapackf77_c' ), - ('MAGMA_D', 'MAGMA_Z' ), - ('MAGMA_S', 'MAGMA_C' ), - ('magmablas_d', 'magmablas_z' ), - ('magmablas_s', 'magmablas_c' ), - ('magma_d', 'magma_z' ), - ('magma_s', 'magma_c' ), - ('magma_get_d', 'magma_get_z' ), - ('magma_get_s', 'magma_get_c' ), - - # ----- Prefixes MORSE - ('MORSE_D', 'MORSE_Z' ), - ('MORSE_S', 'MORSE_C' ), - ('morse_get_d', 'morse_get_z' ), - ('morse_get_s', 'morse_get_c' ), - ('TASK_S', 'TASK_C' ), - ('TASK_D', 'TASK_Z' ), - ('RUNTIME_S', 'RUNTIME_C' ), - ('RUNTIME_D', 'RUNTIME_Z' ), - - # ----- Complex numbers - ('(double)', 'cuComplexFloatToDouble' ), - ('(float)', 'cuComplexDoubleToFloat' ), - ('', 'cuCrealf' ), - ('', 'cuCimagf' ), - ('', 'cuCreal' ), - ('', 'cuCimag' ), - ('', 'cuConj' ), - ('abs', 'cuCabs' ), - ('absf', 'cuCabsf' ), - - # ----- PLASMA / MAGMA - ('magma_sdgetrs', 'magma_czgetrs' ), - - # ----- MORSE - ('morse_sdgetrs', 'morse_czgetrs' ), - - # ----- Constants - ('CblasTrans', 'CblasConjTrans' ), - ('MagmaTrans', 'MagmaConjTrans' ), - ('MorseTrans', 'MorseConjTrans' ), - - # ----- BLAS and LAPACK, lowercase, alphabetic order - # copy & paste these to uppercase below and fix case. - # mixed precision - ('dsaxpy', 'zcaxpy' ), - ('dslaswp', 'zclaswp' ), - - # regular - ('daxpy', 'zaxpy' ), - ('dgemm', 'zgemm' ), - ('dgesv', 'zgesv' ), - ('dlacpy', 'zlacpy' ), - ('dlange', 'zlange' ), - ('dlansy', 'zlansy' ), - ('dlarnv', 'zlarnv' ), - ('dpotrf', 'zpotrf' ), - ('dsytrf', 'zsytrf' ), - ('dtrmm', 'ztrmm' ), - ('dtrsm', 'ztrsm' ), - ('dtrsv', 'ztrsv' ), - ('idamax', 'izamax' ), - ('spotrf', 'cpotrf' ), - ('ssytrf', 'csytrf' ), - ('strmm', 'ctrmm' ), - ('strsm', 'ctrsm' ), - ('strsv', 'ctrsv' ), - - # ----- BLAS and LAPACK, where complex base name != real base name - # with precision - ('dlag2s', 'zlag2c' ), - ('dlagsy', 'zlaghe' ), - ('dlansy', 'zlanhe' ), - ('dlat2s', 'zlat2c' ), - ('dormqr', 'zunmqr' ), - ('dsymm', 'zhemm' ), - ('dsymv', 'zhemv' ), - ('dsyrk', 'zherk' ), - ('slag2d', 'clag2z' ), - ('slansy', 'clanhe' ), - ('slat2d', 'clat2z' ), - - # without precision - ('lag2s', 'lag2c' ), - ('lagsy', 'laghe' ), - ('lansy', 'lanhe' ), - ('lat2s', 'lat2c' ), - ('ormqr', 'unmqr' ), - ('symm', 'hemm' ), - ('symv', 'hemv' ), - ('syrk', 'herk' ), - ('lag2d', 'lag2z' ), - ('lansy', 'lanhe' ), - ('lat2d', 'lat2z' ), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_L-AG2C', 'DAG_CORE_LAG2C' ), - - # ----- BLAS AND LAPACK, UPPERCASE, ALPHABETIC ORDER - # COPY & PASTE THESE TO UPPERCASE BELOW AND FIX CASE. - # MIXED PRECISION - ('DSAXPY', 'ZCAXPY' ), - ('DSLASWP', 'ZCLASWP' ), - - # REGULAR - ('DAXPY', 'ZAXPY' ), - ('DGEMM', 'ZGEMM' ), - ('DGESV', 'ZGESV' ), - ('DLACPY', 'ZLACPY' ), - ('DLANGE', 'ZLANGE' ), - ('DLANSY', 'ZLANSY' ), - ('DLARNV', 'ZLARNV' ), - ('DPOTRF', 'ZPOTRF' ), - ('DSYTRF', 'ZSYTRF' ), - ('DTRMM', 'ZTRMM' ), - ('DTRSM', 'ZTRSM' ), - ('DTRSV', 'ZTRSV' ), - ('IDAMAX', 'IZAMAX' ), - ('SPOTRF', 'CPOTRF' ), - ('SSYTRF', 'CSYTRF' ), - ('STRMM', 'CTRMM' ), - ('STRSM', 'CTRSM' ), - ('STRSV', 'CTRSV' ), - - # ----- BLAS AND LAPACK, WHERE COMPLEX BASE NAME != REAL BASE NAME - # WITH PRECISION - ('DLAG2S', 'ZLAG2C' ), - ('DLAGSY', 'ZLAGHE' ), - ('DLANSY', 'ZLANHE' ), - ('DLAT2S', 'ZLAT2C' ), - ('DORMQR', 'ZUNMQR' ), - ('DSYMM', 'ZHEMM' ), - ('DSYMV', 'ZHEMV' ), - ('DSYRK', 'ZHERK' ), - ('SLAG2D', 'CLAG2Z' ), - ('SLANSY', 'CLANHE' ), - ('SLAT2D', 'CLAT2Z' ), - - # WITHOUT PRECISION - ('LAG2S', 'LAG2C' ), - ('LAGSY', 'LAGHE' ), - ('LANSY', 'LANHE' ), - ('LAT2S', 'LAT2C' ), - ('ORMQR', 'UNMQR' ), - ('SYMM', 'HEMM' ), - ('SYMV', 'HEMV' ), - ('SYRK', 'HERK' ), - ('LAG2D', 'LAG2Z' ), - ('LANSY', 'LANHE' ), - ('LAT2D', 'LAT2Z' ), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_LAG2C', 'DAG_CORE_L-AG2C' ), -], - - # ------------------------------------------------------------ - # replacements applied to most files. - 'normal' : [ - # ----- Special line indicating column types - # old python (2.4) requires this line to be list [] rather than tuple () to use index() function. - ['s', 'd', 'c', 'z' ], - - # ----- Preprocessor - ('#define PRECISION_s', '#define PRECISION_d', '#define PRECISION_c', '#\s*define PRECISION_z' ), - ('#undef PRECISION_s', '#undef PRECISION_d', '#undef PRECISION_c', '#undef PRECISION_z' ), - ('#define REAL', '#define REAL', '#define COMPLEX', '#define COMPLEX' ), - ('#undef COMPLEX', '#undef COMPLEX', '#undef REAL', '#undef REAL' ), - ('#define SINGLE', '#define DOUBLE', '#define SINGLE', '#define DOUBLE' ), - ('#undef DOUBLE', '#undef SINGLE', '#undef DOUBLE', '#undef SINGLE' ), - - # ----- Fortran Types - ('real\(kind=c_float\)', 'real\(kind=c_double\)', 'complex\(kind=c_float_complex\)', 'complex\(kind=c_double_complex\)' ), - ('real(kind=c_float\)', 'real\(kind=c_double\)', 'real\(kind=c_float\)', 'real\(kind=c_double\)' ), - ('real', 'double precision', 'complex', 'complex\(kind=wp\)' ), - - # ----- Data types - ('real', 'double precision', 'real', r'\bdouble precision' ), # before double - ('float', 'double', 'float _Complex', r'\bdouble _Complex' ), - ('float', 'double', 'cuFloatComplex', r'\bcuDoubleComplex' ), - ('float', 'double', 'make_cuFloatComplex', 'make_cuDoubleComplex' ), - ('float', 'double', 'magmaFloatComplex', r'\bmagmaDoubleComplex' ), - ('float', 'double', 'PLASMA_Complex32_t', r'\bPLASMA_Complex64_t' ), - ('float', 'double', 'PLASMA_voidComplex32_t', r'\bPLASMA_voidComplex64_t' ), - ('PlasmaRealFloat', 'PlasmaRealDouble', 'PlasmaComplexFloat', r'\bPlasmaComplexDouble' ), - ('float', 'double', 'MORSE_Complex32_t', r'\bMORSE_Complex64_t' ), - ('float', 'double', 'MORSE_voidComplex32_t', r'\bMORSE_voidComplex64_t' ), - ('MorseRealFloat', 'MorseRealDouble', 'MorseComplexFloat', r'\bMorseComplexDouble' ), - ('real', 'double precision', 'complex', r'\bcomplex\*16' ), - ('REAL', 'DOUBLE_PRECISION', 'COMPLEX', r'\bCOMPLEX_16' ), - ('REAL', 'DOUBLE PRECISION', 'COMPLEX', r'\bDOUBLE COMPLEX' ), - ('REAL', 'DOUBLE PRECISION', 'REAL', r'\bDOUBLE PRECISION' ), - ('sizeof_real', 'sizeof_double', 'sizeof_complex', r'\bsizeof_complex_16' ), # before complex - ('float', 'double', 'pastix_complex32_t', r'\bpastix_complex64_t' ), - ('real', 'real', 'complex', r'\bcomplex' ), - ('float', 'double', 'float2', r'\bdouble2' ), - ('float', 'double', 'float', r'\bdouble' ), - ('ipt_s', 'ipt_d', 'ipt_c', 'ipt_z' ), - - # ----- Text - ('symmetric', 'symmetric', 'Hermitian', 'Hermitian' ), - ('\*\*T', '\*\*T', '\*\*H', '\*\*H' ), - ('%f', '%lf', '%f', '%lf' ), # for scanf - ('%g', '%lg', '%g', '%lg' ), # for scanf - - # ----- CBLAS - ('cblas_sasum', 'cblas_dasum', 'cblas_scasum', 'cblas_dzasum' ), - ('cblas_snrm2', 'cblas_dnrm2', 'cblas_scnrm2', 'cblas_dznrm2' ), - ('', '', 'CBLAS_SADDR', 'CBLAS_SADDR' ), - ('cblas_ssyr', 'cblas_dsyr', 'cblas_cher', 'cblas_zher' ), - - # ----- Core BLAS - ('CORE_sasum', 'CORE_dasum', 'CORE_scasum', 'CORE_dzasum' ), - ('core_sasum', 'core_dasum', 'core_scasum', 'core_dzasum' ), - ('CORE_ssyrfb', 'CORE_dsyrfb', 'CORE_cherfb', 'CORE_zherfb' ), - ('core_ssyrfb', 'core_dsyrfb', 'core_cherfb', 'core_zherfb' ), - ('CORE_stsmlq_sy', 'CORE_dtsmlq_sy', 'CORE_ctsmlq_he', 'CORE_ztsmlq_he' ), - ('core_stsmlq_sy', 'core_dtsmlq_sy', 'core_ctsmlq_he', 'core_ztsmlq_he' ), - ('CORE_stsmqr_sy', 'CORE_dtsmqr_sy', 'CORE_ctsmqr_he', 'CORE_ztsmqr_he' ), - ('core_stsmqr_sy', 'core_dtsmqr_sy', 'core_ctsmqr_he', 'core_ztsmqr_he' ), - - # ----- Prefixes - # Changing prefixes first requires some calls to be fixed without precision, - # e.g., her2k -> syr2k instead of zher2k -> ssyr2k. - # See BLAS and LAPACK without precision, below. - ('blasf77_s', 'blasf77_d', 'blasf77_c', 'blasf77_z' ), - ('blasf77_s', 'blasf77_d', 'blasf77_s', 'blasf77_d' ), - ('BLAS_S', 'BLAS_D', 'BLAS_C', 'BLAS_Z' ), - ('BLAS_s', 'BLAS_d', 'BLAS_c', 'BLAS_z' ), - ('BLAS_s', 'BLAS_d', 'BLAS_s', 'BLAS_d' ), - ('blas_is', 'blas_id', 'blas_ic', 'blas_iz' ), - ('blas_s', 'blas_d', 'blas_c', 'blas_z' ), - ('cl_ps', 'cl_pd', 'cl_pc', 'cl_pz' ), - ('cl_s', 'cl_d', 'cl_c', 'cl_z' ), - ('cl_s', 'cl_d', 'cl_sc', 'cl_dz' ), - ('CODELETS_S', 'CODELETS_D', 'CODELETS_C', 'CODELETS_Z' ), - ('codelet_s', 'codelet_d', 'codelet_c', 'codelet_z' ), - ('compute_s', 'compute_d', 'compute_c', 'compute_z' ), - ('control_s', 'control_d', 'control_c', 'control_z' ), - ('coreblas_s', 'coreblas_d', 'coreblas_c', 'coreblas_z' ), - ('CORE_S', 'CORE_D', 'CORE_C', 'CORE_Z' ), - ('CORE_s', 'CORE_d', 'CORE_c', 'CORE_z' ), - ('core_s', 'core_d', 'core_c', 'core_z' ), - ('CORE_s', 'CORE_d', 'CORE_s', 'CORE_d' ), - ('cpu_gpu_s', 'cpu_gpu_d', 'cpu_gpu_c', 'cpu_gpu_z' ), - ('cublasS', 'cublasD', 'cublasC', 'cublasZ' ), - ('example_s', 'example_d', 'example_c', 'example_z' ), - ('ipt_s', 'ipt_d', 'ipt_c', 'ipt_z' ), - ('LAPACKE_s', 'LAPACKE_d', 'LAPACKE_c', 'LAPACKE_z' ), - ('lapackf77_s', 'lapackf77_d', 'lapackf77_c', 'lapackf77_z' ), - ('lapackf77_s', 'lapackf77_d', 'lapackf77_s', 'lapackf77_d' ), - ('lapack_s', 'lapack_d', 'lapack_c', 'lapack_z' ), - ('lapack_s', 'lapack_d', 'lapack_s', 'lapack_d' ), - ('MAGMABLAS_S', 'MAGMABLAS_D', 'MAGMABLAS_C', 'MAGMABLAS_Z' ), - ('magmablas_s', 'magmablas_d', 'magmablas_c', 'magmablas_z' ), - ('magmaf_s', 'magmaf_d', 'magmaf_c', 'magmaf_z' ), - ('magma_get_s', 'magma_get_d', 'magma_get_c', 'magma_get_z' ), - ('magma_ps', 'magma_pd', 'magma_pc', 'magma_pz' ), - ('MAGMA_S', 'MAGMA_D', 'MAGMA_C', 'MAGMA_Z' ), - ('MAGMA_s', 'MAGMA_d', 'MAGMA_c', 'MAGMA_z' ), - ('magma_s', 'magma_d', 'magma_c', 'magma_z' ), - ('QUARK_S', 'QUARK_D', 'QUARK_C', 'QUARK_Z' ), - ('QUARK_s', 'QUARK_d', 'QUARK_c', 'QUARK_z' ), - ('quark_s', 'quark_d', 'quark_c', 'quark_z' ), - ('QUARK_s', 'QUARK_d', 'QUARK_s', 'QUARK_d' ), - ('plasma_ps', 'plasma_pd', 'plasma_pc', 'plasma_pz' ), - ('PLASMA_S', 'PLASMA_D', 'PLASMA_C', 'PLASMA_Z' ), - ('PLASMA_sor', 'PLASMA_dor', 'PLASMA_cun', 'PLASMA_zun' ), - ('PLASMA_s', 'PLASMA_d', 'PLASMA_c', 'PLASMA_z' ), - ('plasma_s', 'plasma_d', 'plasma_c', 'plasma_z' ), - ('PROFILE_S', 'PROFILE_D', 'PROFILE_C', 'PROFILE_Z' ), - ('profile_s', 'profile_d', 'profile_c', 'profile_z' ), - ('SCHED_s', 'SCHED_d', 'SCHED_c', 'SCHED_z' ), - ('starpu_s', 'starpu_d', 'starpu_c', 'starpu_z' ), - ('testing_ds', 'testing_ds', 'testing_zc', 'testing_zc' ), - ('TESTING_S', 'TESTING_D', 'TESTING_C', 'TESTING_Z' ), - ('testing_s', 'testing_d', 'testing_c', 'testing_z' ), - ('time_s', 'time_d', 'time_c', 'time_z' ), - ('WRAPPER_S', 'WRAPPER_D', 'WRAPPER_C', 'WRAPPER_Z' ), - ('wrapper_s', 'wrapper_d', 'wrapper_c', 'wrapper_z' ), - ('Workspace_s', 'Workspace_d', 'Workspace_c', 'Workspace_z' ), - ('workspace_s', 'workspace_d', 'workspace_c', 'workspace_z' ), - - ('csc_s', 'csc_d', 'csc_c', 'csc_z' ), - ('sequential_s', 'sequential_d', 'sequential_c', 'sequential_z' ), - ('coeftab_s', 'coeftab_d', 'coeftab_c', 'coeftab_z' ), - - # ----- Prefixes MORSE - ('MORSE_S', 'MORSE_D', 'MORSE_C', 'MORSE_Z' ), - ('MORSE_sor', 'MORSE_dor', 'MORSE_cun', 'MORSE_zun' ), - ('MORSE_s', 'MORSE_d', 'MORSE_c', 'MORSE_z' ), - ('morse_get_s', 'morse_get_d', 'morse_get_c', 'morse_get_z' ), - ('morse_ps', 'morse_pd', 'morse_pc', 'morse_pz' ), - ('morse_s', 'morse_d', 'morse_c', 'morse_z' ), - ('morse_sdesc', 'morse_ddesc', 'morse_sdesc', 'morse_ddesc' ), - ('TASK_sasum', 'TASK_dasum', 'TASK_scasum', 'TASK_dzasum' ), - ('TASK_ssyrfb', 'TASK_dsyrfb', 'TASK_cherfb', 'TASK_zherfb' ), - ('TASK_stsmlq_sy', 'TASK_dtsmlq_sy', 'TASK_ctsmlq_he', 'TASK_ztsmlq_he' ), - ('TASK_stsmqr_sy', 'TASK_dtsmqr_sy', 'TASK_ctsmqr_he', 'TASK_ztsmqr_he' ), - ('TASK_sor', 'TASK_dor', 'TASK_cun', 'TASK_zun' ), - ('TASK_s', 'TASK_d', 'TASK_c', 'TASK_z' ), - ('TASK_slan', 'TASK_dlan', 'TASK_slan', 'TASK_dlan' ), - ('RUNTIME_S', 'RUNTIME_D', 'RUNTIME_C', 'RUNTIME_Z' ), - ('RUNTIME_s', 'RUNTIME_d', 'RUNTIME_c', 'RUNTIME_z' ), - - # ----- Complex numbers - # \b regexp here avoids conjugate -> conjfugate, - # assuming we always translate from z, not to z. - ('', '', 'conjf', 'conj\b' ), - ('fabsf', 'fabs', 'cabsf', 'cabs' ), - ('', '', 'cuCrealf', 'cuCreal' ), - ('', '', 'cuCimagf', 'cuCimag' ), - ('', '', 'cuConjf', 'cuConj' ), - ('fabsf', 'fabs', 'cuCabsf', 'cuCabs' ), - ('', '', 'crealf', 'creal' ), - ('sqrtf', 'sqrt', 'csqrtf', 'csqrt' ), - - # ----- CUDA - ('cublasIsamax', 'cublasIdamax', 'cublasIcamax', 'cublasIzamax' ), - ('cublasIsamax', 'cublasIdamax', 'cublasIsamax', 'cublasIdamax' ), - ('cublasSnrm2', 'cublasDnrm2', 'cublasScnrm2', 'cublasDznrm2' ), - - # ----- PLASMA / MAGMA / MORSE - ('bsy2trc', 'bsy2trc', 'bhe2trc', 'bhe2trc' ), - ('magma_ssqrt', 'magma_dsqrt', 'magma_ssqrt', 'magma_dsqrt' ), - ('morse_ssqrt', 'morse_dsqrt', 'morse_ssqrt', 'morse_dsqrt' ), - ('SAUXILIARY', 'DAUXILIARY', 'CAUXILIARY', 'ZAUXILIARY' ), - ('sauxiliary', 'dauxiliary', 'cauxiliary', 'zauxiliary' ), - ('sbcyclic', 'dbcyclic', 'cbcyclic', 'zbcyclic' ), - ('sbulge', 'dbulge', 'cbulge', 'zbulge' ), - ('SCODELETS', 'DCODELETS', 'CCODELETS', 'ZCODELETS' ), - ('sgetmatrix', 'dgetmatrix', 'cgetmatrix', 'zgetmatrix' ), - ('sinplace', 'dinplace', 'cinplace', 'zinplace' ), - ('slocality', 'dlocality', 'clocality', 'zlocality' ), - ('slapack', 'dlapack', 'clapack', 'zlapack' ), - ('SLAPACK', 'DLAPACK', 'CLAPACK', 'ZLAPACK' ), - ('smalloc', 'dmalloc', 'cmalloc', 'zmalloc' ), - ('smalloc', 'dmalloc', 'smalloc', 'dmalloc' ), - ('spanel_to_q', 'dpanel_to_q', 'cpanel_to_q', 'zpanel_to_q' ), - ('spermute', 'dpermute', 'cpermute', 'zpermute' ), - ('sprint', 'dprint', 'cprint', 'zprint' ), - ('sprint', 'dprint', 'sprint', 'dprint' ), - ('sprofiling', 'dprofiling', 'cprofiling', 'zprofiling' ), - ('sq_to_panel', 'dq_to_panel', 'cq_to_panel', 'zq_to_panel' ), - ('sset', 'dset', 'cset', 'zset' ), - ('ssetmatrix', 'dsetmatrix', 'csetmatrix', 'zsetmatrix' ), - ('SSIZE', 'DSIZE', 'CSIZE', 'ZSIZE' ), - ('ssplit', 'dsplit', 'csplit', 'zsplit' ), - ('stile', 'dtile', 'ctile', 'ztile' ), - ('STILE', 'DTILE', 'CTILE', 'ZTILE' ), - ('stranspose', 'dtranspose', 'ctranspose', 'ztranspose' ), - ('szero', 'dzero', 'czero', 'zzero' ), - ('sy2sb', 'sy2sb', 'he2hb', 'he2hb' ), - - # ----- Constants - ('CblasTrans', 'CblasTrans', 'CblasConjTrans', 'CblasConjTrans' ), - ('MagmaTrans', 'MagmaTrans', 'MagmaConjTrans', 'MagmaConjTrans' ), - ('MorseTrans', 'MorseTrans', 'MorseConjTrans', 'MorseConjTrans' ), - ('PlasmaTrans', 'PlasmaTrans', 'PlasmaConjTrans','PlasmaConjTrans' ), - ('symmetric', 'symmetric', 'Hermitian', 'Hermitian' ), - - # ----- BLAS and LAPACK, lowercase, alphabetic order - # copy & paste these to uppercase below and fix case. - # used for filenames lacking magma_z, etc. prefix - ('isamax', 'idamax', 'icamax', 'izamax' ), - ('isamax', 'idamax', 'isamax', 'idamax' ), - ('saxpy', 'daxpy', 'caxpy', 'zaxpy' ), - ('scopy', 'dcopy', 'ccopy', 'zcopy' ), - ('sgecfi', 'dgecfi', 'cgecfi', 'zgecfi' ), - ('sgemm', 'dgemm', 'cgemm', 'zgemm' ), - ('sgemdm', 'dgemdm', 'cgemdm', 'zgemdm' ), - ('SGEMDM', 'DGEMDM', 'CGEMDM', 'ZGEMDM' ), - ('sgemv', 'dgemv', 'cgemv', 'zgemv' ), - ('sscal', 'dscal', 'cscal', 'zscal' ), - ('sscal', 'dscal', 'csscal', 'zdscal' ), - ('sscal', 'dscal', 'sscal', 'dscal' ), # zdscal -> csscal - ('sswap', 'dswap', 'cswap', 'zswap' ), - ('ssymm', 'dsymm', 'csymm', 'zsymm' ), - ('ssymv', 'dsymv', 'csymv', 'zsymv' ), - ('ssyr2k', 'dsyr2k', 'csyr2k', 'zsyr2k' ), - ('ssyrk', 'dsyrk', 'csyrk', 'zsyrk' ), - ('strmm', 'dtrmm', 'ctrmm', 'ztrmm' ), - ('strmv', 'dtrmv', 'ctrmv', 'ztrmv' ), - ('strsm', 'dtrsm', 'ctrsm', 'ztrsm' ), - ('strsv', 'dtrsv', 'ctrsv', 'ztrsv' ), - -# ADD FOR NEW VERSION OF CHAMELEON - ('sgeadd', 'dgeadd', 'cgeadd', 'zgeadd' ), - ('shbcpy', 'dhbcpy', 'chbcpy', 'zhbcpy' ), - ('ssyrbt', 'dsyrbt', 'cherbt', 'zherbt' ), - ('ssygv', 'dsygv', 'chegv', 'zhegv' ), -# END ADD - - # LAPACK - ('sbarrier', 'dbarrier', 'cbarrier', 'zbarrier' ), - ('sbdsqr', 'dbdsqr', 'cbdsqr', 'zbdsqr' ), - ('sbdt01', 'dbdt01', 'cbdt01', 'zbdt01' ), - ('scheck', 'dcheck', 'ccheck', 'zcheck' ), - ('sgebak', 'dgebak', 'cgebak', 'zgebak' ), - ('sgebal', 'dgebal', 'cgebal', 'zgebal' ), - ('sgebd2', 'dgebd2', 'cgebd2', 'zgebd2' ), - ('sgebrd', 'dgebrd', 'cgebrd', 'zgebrd' ), - ('sgeev', 'dgeev', 'cgeev', 'zgeev' ), - ('sgehd2', 'dgehd2', 'cgehd2', 'zgehd2' ), - ('sgehrd', 'dgehrd', 'cgehrd', 'zgehrd' ), - ('sgelq2', 'dgelq2', 'cgelq2', 'zgelq2' ), - ('sgelqf', 'dgelqf', 'cgelqf', 'zgelqf' ), - ('sgelqs', 'dgelqs', 'cgelqs', 'zgelqs' ), - ('sgelqt', 'dgelqt', 'cgelqt', 'zgelqt' ), - ('sgels', 'dgels', 'cgels', 'zgels' ), - ('sgeqlf', 'dgeqlf', 'cgeqlf', 'zgeqlf' ), - ('sgeqp3', 'dgeqp3', 'cgeqp3', 'zgeqp3' ), - ('sgeqr2', 'dgeqr2', 'cgeqr2', 'zgeqr2' ), - ('sgeqrf', 'dgeqrf', 'cgeqrf', 'zgeqrf' ), - ('sgeqrs', 'dgeqrs', 'cgeqrs', 'zgeqrs' ), - ('sgeqrt', 'dgeqrt', 'cgeqrt', 'zgeqrt' ), - ('sgessm', 'dgessm', 'cgessm', 'zgessm' ), - ('sgessq', 'dgessq', 'cgessq', 'zgessq' ), - ('sgesv', 'dgesv', 'cgesv', 'zgesv' ), - ('sgesv', 'sgesv', 'cgesv', 'cgesv' ), - ('sget22', 'dget22', 'cget22', 'zget22' ), - ('sgetf2', 'dgetf2', 'cgetf2', 'zgetf2' ), - ('sgetmi', 'dgetmi', 'cgetmi', 'zgetmi' ), - ('sgetmo', 'dgetmo', 'cgetmo', 'zgetmo' ), - ('sgetrf', 'dgetrf', 'cgetrf', 'zgetrf' ), - ('sgetri', 'dgetri', 'cgetri', 'zgetri' ), - ('sgetrl', 'dgetrl', 'cgetrl', 'zgetrl' ), - ('sgetrs', 'dgetrs', 'cgetrs', 'zgetrs' ), - ('shseqr', 'dhseqr', 'chseqr', 'zhseqr' ), - ('shst01', 'dhst01', 'chst01', 'zhst01' ), - ('slabad', 'dlabad', 'slabad', 'dlabad' ), - ('slabrd', 'dlabrd', 'clabrd', 'zlabrd' ), - ('slacgv', 'dlacgv', 'clacgv', 'zlacgv' ), - ('slacpy', 'dlacpy', 'clacpy', 'zlacpy' ), - ('slaed', 'dlaed', 'slaed', 'dlaed' ), - ('slaex', 'dlaex', 'slaex', 'dlaex' ), - ('slagsy', 'dlagsy', 'clagsy', 'zlagsy' ), - ('slahr', 'dlahr', 'clahr', 'zlahr' ), - ('slamc3', 'dlamc3', 'slamc3', 'dlamc3' ), - ('slamch', 'dlamch', 'slamch', 'dlamch' ), - ('slamrg', 'dlamrg', 'slamrg', 'dlamrg' ), - ('slange', 'dlange', 'clange', 'zlange' ), - ('slanst', 'dlanst', 'clanht', 'zlanht' ), - ('slansy', 'dlansy', 'clansy', 'zlansy' ), - ('slantr', 'dlantr', 'clantr', 'zlantr' ), - ('slaqps', 'dlaqps', 'claqps', 'zlaqps' ), - ('slaqp2', 'dlaqp2', 'claqp2', 'zlaqp2' ), - ('slarfb', 'dlarfb', 'clarfb', 'zlarfb' ), - ('slarfg', 'dlarfg', 'clarfg', 'zlarfg' ), - ('slarft', 'dlarft', 'clarft', 'zlarft' ), - ('slarfx', 'dlarfx', 'clarfx', 'zlarfx' ), - ('slarfy', 'dlarfy', 'clarfy', 'zlarfy' ), - ('slarnv', 'dlarnv', 'clarnv', 'zlarnv' ), - ('slarnv', 'dlarnv', 'slarnv', 'dlarnv' ), - ('slartg', 'dlartg', 'clartg', 'zlartg' ), - ('slascl', 'dlascl', 'clascl', 'zlascl' ), - ('slaset', 'dlaset', 'claset', 'zlaset' ), - ('slaswp', 'dlaswp', 'claswp', 'zlaswp' ), - ('slatrd', 'dlatrd', 'clatrd', 'zlatrd' ), - ('slauum', 'dlauum', 'clauum', 'zlauum' ), - ('spack', 'dpack', 'cpack', 'zpack' ), - ('splgsy', 'dplgsy', 'cplgsy', 'zplgsy' ), - ('splrnt', 'dplrnt', 'cplrnt', 'zplrnt' ), - ('splssq', 'dplssq', 'cplssq', 'zplssq' ), - ('sposv', 'dposv', 'cposv', 'zposv' ), - ('ssysv', 'dsysv', 'csysv', 'zsysv' ), - ('sposv', 'sposv', 'cposv', 'cposv' ), - ('spotrf', 'dpotrf', 'cpotrf', 'zpotrf' ), - ('ssytrf', 'dsytrf', 'csytrf', 'zsytrf' ), - ('spotri', 'dpotri', 'cpotri', 'zpotri' ), - ('spotrs', 'dpotrs', 'cpotrs', 'zpotrs' ), - ('ssytrs', 'dsytrs', 'csytrs', 'zsytrs' ), - ('sqpt01', 'dqpt01', 'cqpt01', 'zqpt01' ), - ('sqrt02', 'dqrt02', 'cqrt02', 'zqrt02' ), - ('sshift', 'dshift', 'cshift', 'zshift' ), - ('sssssm', 'dssssm', 'cssssm', 'zssssm' ), - ('sstebz', 'dstebz', 'sstebz', 'dstebz' ), - ('sstedc', 'dstedc', 'cstedc', 'zstedc' ), - ('sstedx', 'dstedx', 'cstedx', 'zstedx' ), - ('sstedx', 'dstedx', 'sstedx', 'dstedx' ), - ('sstein', 'dstein', 'cstein', 'zstein' ), - ('sstemr', 'dstemr', 'cstemr', 'zstemr' ), - ('ssteqr', 'dsteqr', 'csteqr', 'zsteqr' ), - ('ssterf', 'dsterf', 'ssterf', 'dsterf' ), - ('ssterm', 'dsterm', 'csterm', 'zsterm' ), - ('sstt21', 'dstt21', 'cstt21', 'zstt21' ), - ('strasm', 'dtrasm', 'ctrasm', 'ztrasm' ), - ('strevc', 'dtrevc', 'ctrevc', 'ztrevc' ), - ('strsmpl', 'dtrsmpl', 'ctrsmpl', 'ztrsmpl' ), - ('strssq', 'dtrssq', 'ctrssq', 'ztrssq' ), - ('strtri', 'dtrtri', 'ctrtri', 'ztrtri' ), - ('stslqt', 'dtslqt', 'ctslqt', 'ztslqt' ), - ('stsmlq_sy', 'dtsmlq_sy', 'ctsmlq_he', 'ztsmlq_he' ), - ('stsmqr_sy', 'dtsmqr_sy', 'ctsmqr_he', 'ztsmqr_he' ), - ('stsmqr', 'dtsmqr', 'ctsmqr', 'ztsmqr' ), - ('stsmlq', 'dtsmlq', 'ctsmlq', 'ztsmlq' ), - ('stsqrt', 'dtsqrt', 'ctsqrt', 'ztsqrt' ), - ('stslqt', 'dtslqt', 'ctslqt', 'ztslqt' ), - ('ststrf', 'dtstrf', 'ctstrf', 'ztstrf' ), - ('sttlqt', 'dttlqt', 'cttlqt', 'zttlqt' ), - ('sttmlq', 'dttmlq', 'cttmlq', 'zttmlq' ), - ('sttmqr', 'dttmqr', 'cttmqr', 'zttmqr' ), - ('sttqrt', 'dttqrt', 'cttqrt', 'zttqrt' ), - ('sungesv', 'sungesv', 'cungesv', 'cungesv' ), - ('sstegr', 'dstegr', 'cstegr', 'zstegr' ), - ('ssyssq', 'dsyssq', 'csyssq', 'zsyssq' ), - - # ----- BLAS and LAPACK, where complex base name != real base name - # BLAS, with precision - ('sasum', 'dasum', 'scasum', 'dzasum' ), - ('sasum', 'dasum', 'casum', 'zasum' ), - ('sdot', 'ddot', 'cdotc', 'zdotc' ), - ('sdot_sub', 'ddot_sub', 'cdotc_sub', 'zdotc_sub' ), - ('sdot_sub', 'ddot_sub', 'cdotu_sub', 'zdotu_sub' ), - ('sger', 'dger', 'cgerc', 'zgerc' ), - ('sger', 'dger', 'cgeru', 'zgeru' ), - ('snrm2', 'dnrm2', 'scnrm2', 'dznrm2' ), - ('ssymm', 'dsymm', 'chemm', 'zhemm' ), - ('ssymv', 'dsymv', 'chemv', 'zhemv' ), - ('ssyr2', 'dsyr2', 'cher2', 'zher2' ), - ('ssyr2k', 'dsyr2k', 'cher2k', 'zher2k' ), - ('ssyrk', 'dsyrk', 'cherk', 'zherk' ), - ('ssyr', 'dsyr', 'cher', 'zher' ), - - # LAPACK, with precision - ('slag2d', 'dlag2s', 'clag2z', 'zlag2c' ), - ('slagsy', 'dlagsy', 'claghe', 'zlaghe' ), - ('slasyf', 'dlasyf', 'clahef', 'zlahef' ), - ('slansy', 'dlansy', 'clanhe', 'zlanhe' ), - ('slavsy', 'dlavsy', 'clavhe', 'zlavhe' ), - ('sorg2r', 'dorg2r', 'cung2r', 'zung2r' ), - ('sorgbr', 'dorgbr', 'cungbr', 'zungbr' ), - ('sorghr', 'dorghr', 'cunghr', 'zunghr' ), - ('sorglq', 'dorglq', 'cunglq', 'zunglq' ), - ('sorgql', 'dorgql', 'cungql', 'zungql' ), - ('sorgqr', 'dorgqr', 'cungqr', 'zungqr' ), - ('sorgtr', 'dorgtr', 'cungtr', 'zungtr' ), - ('sorm2r', 'dorm2r', 'cunm2r', 'zunm2r' ), - ('sormbr', 'dormbr', 'cunmbr', 'zunmbr' ), - ('sormlq', 'dormlq', 'cunmlq', 'zunmlq' ), - ('sormql', 'dormql', 'cunmql', 'zunmql' ), - ('sormqr', 'dormqr', 'cunmqr', 'zunmqr' ), - ('sormr2', 'dormr2', 'cunmr2', 'zunmr2' ), - ('sormtr', 'dormtr', 'cunmtr', 'zunmtr' ), - ('sort01', 'dort01', 'cunt01', 'zunt01' ), - ('splgsy', 'dplgsy', 'cplghe', 'zplghe' ), - ('ssbtrd', 'dsbtrd', 'chbtrd', 'zhbtrd' ), - ('ssybbd', 'dsybbd', 'chebbd', 'zhebbd' ), - ('ssyev', 'dsyev', 'cheev', 'zheev' ), - ('ssyevd', 'dsyevd', 'cheevd', 'zheevd' ), - ('ssygs2', 'dsygs2', 'chegs2', 'zhegs2' ), - ('ssygst', 'dsygst', 'chegst', 'zhegst' ), - ('ssygvd', 'dsygvd', 'chegvd', 'zhegvd' ), - ('ssygvr', 'dsygvr', 'chegvr', 'zhegvr' ), - ('ssygvx', 'dsygvx', 'chegvx', 'zhegvx' ), - ('ssyssq', 'dsyssq', 'chessq', 'zhessq' ), - ('ssyt21', 'dsyt21', 'chet21', 'zhet21' ), - ('ssytd2', 'dsytd2', 'chetd2', 'zhetd2' ), - ('ssytrd', 'dsytrd', 'chetrd', 'zhetrd' ), - ('ssytrf', 'dsytrf', 'chetrf', 'zhetrf' ), - - # BLAS, without precision - # must be after BLAS with precision - # Ex: cublasZhemm -> cublasShemm -> cublasSsymm - ('dot', 'dot', 'dotc', 'dotc' ), - ('dot_sub', 'dot_sub', 'dotc_sub', 'dotc_sub' ), - ('dot_sub', 'dot_sub', 'dotu_sub', 'dotu_sub' ), - ('ger', 'ger', 'gerc', 'gerc' ), - ('ger', 'ger', 'geru', 'geru' ), - ('nrm2', 'nrm2', 'cnrm2', 'znrm2' ), # dznrm2 -> dnrm2 - ('symm', 'symm', 'hemm', 'hemm' ), - ('symv', 'symv', 'hemv', 'hemv' ), - ('syr2', 'syr2', 'her2', 'her2' ), - ('syr2k', 'syr2k', 'her2k', 'her2k' ), - ('syrk', 'syrk', 'herk', 'herk' ), - - # LAPACK, without precision - ('lag2d', 'lag2s', 'lag2z', 'lag2c' ), - ('lagsy', 'lagsy', 'laghe', 'laghe' ), - ('lasyf', 'lasyf', 'lahef', 'lahef' ), - ('lansy', 'lansy', 'lanhe', 'lanhe' ), - ('lanst', 'lanst', 'lanht', 'lanht' ), - ('lavsy', 'lavsy', 'lavhe', 'lavhe' ), - ('org2r', 'org2r', 'ung2r', 'ung2r' ), - ('orgbr', 'orgbr', 'ungbr', 'ungbr' ), - ('orghr', 'orghr', 'unghr', 'unghr' ), - ('orglq', 'orglq', 'unglq', 'unglq' ), - ('orgql', 'orgql', 'ungql', 'ungql' ), - ('orgqr', 'orgqr', 'ungqr', 'ungqr' ), - ('orgtr', 'orgtr', 'ungtr', 'ungtr' ), - ('orm2r', 'orm2r', 'unm2r', 'unm2r' ), - ('ormbr', 'ormbr', 'unmbr', 'unmbr' ), - ('ormlq', 'ormlq', 'unmlq', 'unmlq' ), - ('ormql', 'ormql', 'unmql', 'unmql' ), - ('ormqr', 'ormqr', 'unmqr', 'unmqr' ), - ('ormr2', 'ormr2', 'unmr2', 'unmr2' ), - ('ormtr', 'ormtr', 'unmtr', 'unmtr' ), - ('ort01', 'ort01', 'unt01', 'unt01' ), - ('plgsy', 'plgsy', 'plghe', 'plghe' ), - ('sbtrd', 'sbtrd', 'hbtrd', 'hbtrd' ), - ('sybbd', 'sybbd', 'hebbd', 'hebbd' ), - ('syev', 'syev', 'heev', 'heev' ), - ('syevd', 'syevd', 'heevd', 'heevd' ), - ('sygs2', 'sygs2', 'hegs2', 'hegs2' ), - ('sygst', 'sygst', 'hegst', 'hegst' ), - ('sygvd', 'sygvd', 'hegvd', 'hegvd' ), - ('sygvr', 'sygvr', 'hegvr', 'hegvr' ), - ('sygvx', 'sygvx', 'hegvx', 'hegvx' ), - ('syssq', 'syssq', 'hessq', 'hessq' ), - ('syt21', 'syt21', 'het21', 'het21' ), - ('sytd2', 'sytd2', 'hetd2', 'hetd2' ), - ('sytrd', 'sytrd', 'hetrd', 'hetrd' ), - ('sytrf', 'sytrf', 'hetrf', 'hetrf' ), - - # ----- For norms: compute result in Real or Double - ('sgeadd', 'dgeadd', 'sgeadd', 'dgeadd' ), - ('slange', 'dlange', 'slange', 'dlange' ), - ('slaset', 'dlaset', 'slaset', 'dlaset' ), - ('splssq', 'dplssq', 'splssq', 'dplssq' ), - ('slacpy', 'dlacpy', 'slacpy', 'dlacpy' ), - ('saxpy', 'daxpy', 'saxpy', 'daxpy' ), - ('MorseRealFloat', 'MorseRealDouble', 'MorseRealFloat', 'MorseRealDouble'), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_U-NG2R', 'DAG_CORE_U-NG2R', 'DAG_CORE_UNG2R', 'DAG_CORE_UNG2R' ), - ('DAG_CORE_U-NGBR', 'DAG_CORE_U-NGBR', 'DAG_CORE_UNGBR', 'DAG_CORE_UNGBR' ), - ('DAG_CORE_U-NGHR', 'DAG_CORE_U-NGHR', 'DAG_CORE_UNGHR', 'DAG_CORE_UNGHR' ), - ('DAG_CORE_U-NGLQ', 'DAG_CORE_U-NGLQ', 'DAG_CORE_UNGLQ', 'DAG_CORE_UNGLQ' ), - ('DAG_CORE_U-NGQL', 'DAG_CORE_U-NGQL', 'DAG_CORE_UNGQL', 'DAG_CORE_UNGQL' ), - ('DAG_CORE_U-NGQR', 'DAG_CORE_U-NGQR', 'DAG_CORE_UNGQR', 'DAG_CORE_UNGQR' ), - ('DAG_CORE_U-NGTR', 'DAG_CORE_U-NGTR', 'DAG_CORE_UNGTR', 'DAG_CORE_UNGTR' ), - ('DAG_CORE_U-NM2R', 'DAG_CORE_U-NM2R', 'DAG_CORE_UNM2R', 'DAG_CORE_UNM2R' ), - ('DAG_CORE_U-NMBR', 'DAG_CORE_U-NMBR', 'DAG_CORE_UNMBR', 'DAG_CORE_UNMBR' ), - ('DAG_CORE_U-NMLQ', 'DAG_CORE_U-NMLQ', 'DAG_CORE_UNMLQ', 'DAG_CORE_UNMLQ' ), - ('DAG_CORE_U-NMQL', 'DAG_CORE_U-NMQL', 'DAG_CORE_UNMQL', 'DAG_CORE_UNMQL' ), - ('DAG_CORE_U-NMQR', 'DAG_CORE_U-NMQR', 'DAG_CORE_UNMQR', 'DAG_CORE_UNMQR' ), - - # ----- BLAS AND LAPACK, UPPERCASE, ALPHABETIC ORDER - # COPY & PASTE THESE TO UPPERCASE BELOW AND FIX CASE. - # USED FOR FILENAMES LACKING MAGMA_Z, ETC. PREFIX - ('ISAMAX', 'IDAMAX', 'ICAMAX', 'IZAMAX' ), - ('ISAMAX', 'IDAMAX', 'ISAMAX', 'IDAMAX' ), - ('SAXPY', 'DAXPY', 'CAXPY', 'ZAXPY' ), - ('SCOPY', 'DCOPY', 'CCOPY', 'ZCOPY' ), - ('SGEMV', 'DGEMV', 'CGEMV', 'ZGEMV' ), - ('SSCAL', 'DSCAL', 'CSCAL', 'ZSCAL' ), - ('SSCAL', 'DSCAL', 'CSSCAL', 'ZDSCAL' ), - ('SSCAL', 'DSCAL', 'SSCAL', 'DSCAL' ), # ZDSCAL -> CSSCAL - ('SSWAP', 'DSWAP', 'CSWAP', 'ZSWAP' ), - ('SSYMM', 'DSYMM', 'CSYMM', 'ZSYMM' ), - ('SSYMV', 'DSYMV', 'CSYMV', 'ZSYMV' ), - ('SSYR2K', 'DSYR2K', 'CSYR2K', 'ZSYR2K' ), - ('SSYRK', 'DSYRK', 'CSYRK', 'ZSYRK' ), - ('STRMM', 'DTRMM', 'CTRMM', 'ZTRMM' ), - ('STRMV', 'DTRMV', 'CTRMV', 'ZTRMV' ), - ('STRSM', 'DTRSM', 'CTRSM', 'ZTRSM' ), - ('STRSV', 'DTRSV', 'CTRSV', 'ZTRSV' ), - - # LAPACK - ('SBDSQR', 'DBDSQR', 'CBDSQR', 'ZBDSQR' ), - ('SBDT01', 'DBDT01', 'CBDT01', 'ZBDT01' ), - ('SCHECK', 'DCHECK', 'CCHECK', 'ZCHECK' ), - ('SGEBAK', 'DGEBAK', 'CGEBAK', 'ZGEBAK' ), - ('SGEBAL', 'DGEBAL', 'CGEBAL', 'ZGEBAL' ), - ('SGEBD2', 'DGEBD2', 'CGEBD2', 'ZGEBD2' ), - ('SGEBRD', 'DGEBRD', 'CGEBRD', 'ZGEBRD' ), - ('SGEEV', 'DGEEV', 'CGEEV', 'ZGEEV' ), - ('SGEHD2', 'DGEHD2', 'CGEHD2', 'ZGEHD2' ), - ('SGEHRD', 'DGEHRD', 'CGEHRD', 'ZGEHRD' ), - ('SGELQ2', 'DGELQ2', 'CGELQ2', 'ZGELQ2' ), - ('SGELQF', 'DGELQF', 'CGELQF', 'ZGELQF' ), - ('SGELQS', 'DGELQS', 'CGELQS', 'ZGELQS' ), - ('SGELS', 'DGELS', 'CGELS', 'ZGELS' ), - ('SGEMM', 'DGEMM', 'CGEMM', 'ZGEMM' ), - ('SGEQLF', 'DGEQLF', 'CGEQLF', 'ZGEQLF' ), - ('SGEQP3', 'DGEQP3', 'CGEQP3', 'ZGEQP3' ), - ('SGEQR2', 'DGEQR2', 'CGEQR2', 'ZGEQR2' ), - ('SGEQRF', 'DGEQRF', 'CGEQRF', 'ZGEQRF' ), - ('SGEQRS', 'DGEQRS', 'CGEQRS', 'ZGEQRS' ), - ('SGESSM', 'DGESSM', 'CGESSM', 'ZGESSM' ), - ('SGESV', 'DGESV', 'CGESV', 'ZGESV' ), - ('SGESV', 'SGESV', 'CGESV', 'CGESV' ), - ('SGET22', 'DGET22', 'CGET22', 'ZGET22' ), - ('SGETF2', 'DGETF2', 'CGETF2', 'ZGETF2' ), - ('SGETRF', 'DGETRF', 'CGETRF', 'ZGETRF' ), - ('SGETRI', 'DGETRI', 'CGETRI', 'ZGETRI' ), - ('SGETRL', 'DGETRL', 'CGETRL', 'ZGETRL' ), - ('SGETRS', 'DGETRS', 'CGETRS', 'ZGETRS' ), - ('SHSEQR', 'DHSEQR', 'CHSEQR', 'ZHSEQR' ), - ('SHST01', 'DHST01', 'CHST01', 'ZHST01' ), - ('SLABAD', 'DLABAD', 'SLABAD', 'DLABAD' ), - ('SLABRD', 'DLABRD', 'CLABRD', 'ZLABRD' ), - ('SLACGV', 'DLACGV', 'CLACGV', 'ZLACGV' ), - ('SLACPY', 'DLACPY', 'CLACPY', 'ZLACPY' ), - ('SLAED', 'DLAED', 'SLAED', 'DLAED' ), - ('SLAEX', 'DLAEX', 'SLAEX', 'DLAEX' ), - ('SLAGSY', 'DLAGSY', 'CLAGSY', 'ZLAGSY' ), - ('SLAHR', 'DLAHR', 'CLAHR', 'ZLAHR' ), - ('SLAMC3', 'DLAMC3', 'SLAMC3', 'DLAMC3' ), - ('SLAMCH', 'DLAMCH', 'SLAMCH', 'DLAMCH' ), - ('SLAMRG', 'DLAMRG', 'SLAMRG', 'DLAMRG' ), - ('SLANGE', 'DLANGE', 'CLANGE', 'ZLANGE' ), - ('SLANST', 'DLANST', 'CLANHT', 'ZLANHT' ), - ('SLANSY', 'DLANSY', 'CLANSY', 'ZLANSY' ), - ('SLANTR', 'DLANTR', 'CLANTR', 'ZLANTR' ), - ('SLAQPS', 'DLAQPS', 'CLAQPS', 'ZLAQPS' ), - ('SLAQP2', 'DLAQP2', 'CLAQP2', 'ZLAQP2' ), - ('SLARFB', 'DLARFB', 'CLARFB', 'ZLARFB' ), - ('SLARFG', 'DLARFG', 'CLARFG', 'ZLARFG' ), - ('SLARFT', 'DLARFT', 'CLARFT', 'ZLARFT' ), - ('SLARFX', 'DLARFX', 'CLARFX', 'ZLARFX' ), - ('SLARFY', 'DLARFY', 'CLARFY', 'ZLARFY' ), - ('SLARNV', 'DLARNV', 'CLARNV', 'ZLARNV' ), - ('SLARNV', 'DLARNV', 'SLARNV', 'DLARNV' ), - ('SLARTG', 'DLARTG', 'CLARTG', 'ZLARTG' ), - ('SLASCL', 'DLASCL', 'CLASCL', 'ZLASCL' ), - ('SLASET', 'DLASET', 'CLASET', 'ZLASET' ), - ('SLASWP', 'DLASWP', 'CLASWP', 'ZLASWP' ), - ('SLATRD', 'DLATRD', 'CLATRD', 'ZLATRD' ), - ('SLAUUM', 'DLAUUM', 'CLAUUM', 'ZLAUUM' ), - ('SPOSV', 'DPOSV', 'CPOSV', 'ZPOSV' ), - ('SSYSV', 'DSYSV', 'CSYSV', 'ZSYSV' ), - ('SPOSV', 'SPOSV', 'CPOSV', 'CPOSV' ), - ('SPOTRF', 'DPOTRF', 'CPOTRF', 'ZPOTRF' ), - ('SSYTRF', 'DSYTRF', 'CSYTRF', 'ZSYTRF' ), - ('SPOTRI', 'DPOTRI', 'CPOTRI', 'ZPOTRI' ), - ('SPOTRS', 'DPOTRS', 'CPOTRS', 'ZPOTRS' ), - ('SSYTRS', 'DSYTRS', 'CSYTRS', 'ZSYTRS' ), - ('SQPT01', 'DQPT01', 'CQPT01', 'ZQPT01' ), - ('SQRT02', 'DQRT02', 'CQRT02', 'ZQRT02' ), - ('SSSSSM', 'DSSSSM', 'CSSSSM', 'ZSSSSM' ), - ('SSTEBZ', 'DSTEBZ', 'SSTEBZ', 'DSTEBZ' ), - ('SSTEDC', 'DSTEDC', 'CSTEDC', 'ZSTEDC' ), - ('SSTEDX', 'DSTEDX', 'CSTEDX', 'ZSTEDX' ), - ('SSTEDX', 'DSTEDX', 'SSTEDX', 'DSTEDX' ), - ('SSTEIN', 'DSTEIN', 'CSTEIN', 'ZSTEIN' ), - ('SSTEMR', 'DSTEMR', 'CSTEMR', 'ZSTEMR' ), - ('SSTEQR', 'DSTEQR', 'CSTEQR', 'ZSTEQR' ), - ('SSTERF', 'DSTERF', 'SSTERF', 'DSTERF' ), - ('SSTERM', 'DSTERM', 'CSTERM', 'ZSTERM' ), - ('SSTT21', 'DSTT21', 'CSTT21', 'ZSTT21' ), - ('STREVC', 'DTREVC', 'CTREVC', 'ZTREVC' ), - ('STRSMPL', 'DTRSMPL', 'CTRSMPL', 'ZTRSMPL' ), - ('STRTRI', 'DTRTRI', 'CTRTRI', 'ZTRTRI' ), - ('STSQRT', 'DTSQRT', 'CTSQRT', 'ZTSQRT' ), - ('STSTRF', 'DTSTRF', 'CTSTRF', 'ZTSTRF' ), - ('SUNGESV', 'SUNGESV', 'CUNGESV', 'CUNGESV' ), - ('SSTEGR', 'DSTEGR', 'CSTEGR', 'ZSTEGR' ), - - # ----- BLAS AND LAPACK, WHERE COMPLEX BASE NAME != REAL BASE NAME - # BLAS, WITH PRECISION - ('SDOT', 'DDOT', 'CDOTC', 'ZDOTC' ), - ('SDOT_SUB', 'DDOT_SUB', 'CDOTC_SUB', 'ZDOTC_SUB' ), - ('SDOT_SUB', 'DDOT_SUB', 'CDOTU_SUB', 'ZDOTU_SUB' ), - ('SGER', 'DGER', 'CGERC', 'ZGERC' ), - ('SGER', 'DGER', 'CGERU', 'ZGERU' ), - ('SNRM2', 'DNRM2', 'SCNRM2', 'DZNRM2' ), - ('SSYMM', 'DSYMM', 'CHEMM', 'ZHEMM' ), - ('SSYMV', 'DSYMV', 'CHEMV', 'ZHEMV' ), - ('SSYR2', 'DSYR2', 'CHER2', 'ZHER2' ), - ('SSYR2K', 'DSYR2K', 'CHER2K', 'ZHER2K' ), - ('SSYRK', 'DSYRK', 'CHERK', 'ZHERK' ), - ('SSYR', 'DSYR', 'CHER', 'ZHER' ), - - # LAPACK, WITH PRECISION - ('SLAG2D', 'DLAG2S', 'CLAG2Z', 'ZLAG2C' ), - ('SLAGSY', 'DLAGSY', 'CLAGHE', 'ZLAGHE' ), - ('SLASYF', 'DLASYF', 'CLAHEF', 'ZLAHEF' ), - ('SLANSY', 'DLANSY', 'CLANHE', 'ZLANHE' ), - ('SLAVSY', 'DLAVSY', 'CLAVHE', 'ZLAVHE' ), - ('SORG2R', 'DORG2R', 'CUNG2R', 'ZUNG2R' ), - ('SORGBR', 'DORGBR', 'CUNGBR', 'ZUNGBR' ), - ('SORGHR', 'DORGHR', 'CUNGHR', 'ZUNGHR' ), - ('SORGLQ', 'DORGLQ', 'CUNGLQ', 'ZUNGLQ' ), - ('SORGQL', 'DORGQL', 'CUNGQL', 'ZUNGQL' ), - ('SORGQR', 'DORGQR', 'CUNGQR', 'ZUNGQR' ), - ('SORGTR', 'DORGTR', 'CUNGTR', 'ZUNGTR' ), - ('SORM2R', 'DORM2R', 'CUNM2R', 'ZUNM2R' ), - ('SORMBR', 'DORMBR', 'CUNMBR', 'ZUNMBR' ), - ('SORMLQ', 'DORMLQ', 'CUNMLQ', 'ZUNMLQ' ), - ('SORMQL', 'DORMQL', 'CUNMQL', 'ZUNMQL' ), - ('SORMQR', 'DORMQR', 'CUNMQR', 'ZUNMQR' ), - ('SORMR2', 'DORMR2', 'CUNMR2', 'ZUNMR2' ), - ('SORMTR', 'DORMTR', 'CUNMTR', 'ZUNMTR' ), - ('SORT01', 'DORT01', 'CUNT01', 'ZUNT01' ), - ('SPLGSY', 'DPLGSY', 'CPLGHE', 'ZPLGHE' ), - ('SSBTRD', 'DSBTRD', 'CHBTRD', 'ZHBTRD' ), - ('SSYBBD', 'DSYBBD', 'CHEBBD', 'ZHEBBD' ), - ('SSYEV', 'DSYEV', 'CHEEV', 'ZHEEV' ), - ('SSYEVD', 'DSYEVD', 'CHEEVD', 'ZHEEVD' ), - ('SSYGS2', 'DSYGS2', 'CHEGS2', 'ZHEGS2' ), - ('SSYGST', 'DSYGST', 'CHEGST', 'ZHEGST' ), - ('SSYGVD', 'DSYGVD', 'CHEGVD', 'ZHEGVD' ), - ('SSYGVR', 'DSYGVR', 'CHEGVR', 'ZHEGVR' ), - ('SSYGVX', 'DSYGVX', 'CHEGVX', 'ZHEGVX' ), - ('SSYT21', 'DSYT21', 'CHET21', 'ZHET21' ), - ('SSYTD2', 'DSYTD2', 'CHETD2', 'ZHETD2' ), - ('SSYTRD', 'DSYTRD', 'CHETRD', 'ZHETRD' ), - ('SSYTRF', 'DSYTRF', 'CHETRF', 'ZHETRF' ), - - # BLAS, WITHOUT PRECISION - # MUST BE AFTER BLAS WITH PRECISION - # EX: CUBLASZHEMM -> CUBLASSHEMM -> CUBLASSSYMM - ('DOT', 'DOT', 'DOTC', 'DOTC' ), - ('DOT_SUB', 'DOT_SUB', 'DOTC_SUB', 'DOTC_SUB' ), - ('DOT_SUB', 'DOT_SUB', 'DOTU_SUB', 'DOTU_SUB' ), - ('GER', 'GER', 'GERC', 'GERC' ), - ('GER', 'GER', 'GERU', 'GERU' ), - ('NRM2', 'NRM2', 'CNRM2', 'ZNRM2' ), # DZNRM2 -> DNRM2 - ('SYMM', 'SYMM', 'HEMM', 'HEMM' ), - ('SYMV', 'SYMV', 'HEMV', 'HEMV' ), - ('SYR2', 'SYR2', 'HER2', 'HER2' ), - ('SYR2K', 'SYR2K', 'HER2K', 'HER2K' ), - ('SYRK', 'SYRK', 'HERK', 'HERK' ), - - # LAPACK, WITHOUT PRECISION - ('LAG2D', 'LAG2S', 'LAG2Z', 'LAG2C' ), - ('LAGSY', 'LAGSY', 'LAGHE', 'LAGHE' ), - ('LASYF', 'LASYF', 'LAHEF', 'LAHEF' ), - ('LANSY', 'LANSY', 'LANHE', 'LANHE' ), - ('LAVSY', 'LAVSY', 'LAVHE', 'LAVHE' ), - ('ORG2R', 'ORG2R', 'UNG2R', 'UNG2R' ), - ('ORGBR', 'ORGBR', 'UNGBR', 'UNGBR' ), - ('ORGHR', 'ORGHR', 'UNGHR', 'UNGHR' ), - ('ORGLQ', 'ORGLQ', 'UNGLQ', 'UNGLQ' ), - ('ORGQL', 'ORGQL', 'UNGQL', 'UNGQL' ), - ('ORGQR', 'ORGQR', 'UNGQR', 'UNGQR' ), - ('ORGTR', 'ORGTR', 'UNGTR', 'UNGTR' ), - ('ORM2R', 'ORM2R', 'UNM2R', 'UNM2R' ), - ('ORMBR', 'ORMBR', 'UNMBR', 'UNMBR' ), - ('ORMLQ', 'ORMLQ', 'UNMLQ', 'UNMLQ' ), - ('ORMQL', 'ORMQL', 'UNMQL', 'UNMQL' ), - ('ORMQR', 'ORMQR', 'UNMQR', 'UNMQR' ), - ('ORMR2', 'ORMR2', 'UNMR2', 'UNMR2' ), - ('ORMTR', 'ORMTR', 'UNMTR', 'UNMTR' ), - ('ORT01', 'ORT01', 'UNT01', 'UNT01' ), - ('PLGSY', 'PLGSY', 'PLGHE', 'PLGHE' ), - ('SBTRD', 'SBTRD', 'HBTRD', 'HBTRD' ), - ('SYBBD', 'SYBBD', 'HEBBD', 'HEBBD' ), - ('SYEV', 'SYEV', 'HEEV', 'HEEV' ), - ('SYEVD', 'SYEVD', 'HEEVD', 'HEEVD' ), - ('SYGS2', 'SYGS2', 'HEGS2', 'HEGS2' ), - ('SYGST', 'SYGST', 'HEGST', 'HEGST' ), - ('SYGVD', 'SYGVD', 'HEGVD', 'HEGVD' ), - ('SYGVR', 'SYGVR', 'HEGVR', 'HEGVR' ), - ('SYGVX', 'SYGVX', 'HEGVX', 'HEGVX' ), - ('SYT21', 'SYT21', 'HET21', 'HET21' ), - ('SYTD2', 'SYTD2', 'HETD2', 'HETD2' ), - ('SYTRD', 'SYTRD', 'HETRD', 'HETRD' ), - ('SYTRF', 'SYTRF', 'HETRF', 'HETRF' ), - - # QUARK codelets protection (to prevent conversion with LAPACK WITH PRECISION) - ('DAG_CORE_UNG2R', 'DAG_CORE_UNG2R', 'DAG_CORE_UNG2R', 'DAG_CORE_U-NG2R' ), - ('DAG_CORE_UNGBR', 'DAG_CORE_UNGBR', 'DAG_CORE_UNGBR', 'DAG_CORE_U-NGBR' ), - ('DAG_CORE_UNGHR', 'DAG_CORE_UNGHR', 'DAG_CORE_UNGHR', 'DAG_CORE_U-NGHR' ), - ('DAG_CORE_UNGLQ', 'DAG_CORE_UNGLQ', 'DAG_CORE_UNGLQ', 'DAG_CORE_U-NGLQ' ), - ('DAG_CORE_UNGQL', 'DAG_CORE_UNGQL', 'DAG_CORE_UNGQL', 'DAG_CORE_U-NGQL' ), - ('DAG_CORE_UNGQR', 'DAG_CORE_UNGQR', 'DAG_CORE_UNGQR', 'DAG_CORE_U-NGQR' ), - ('DAG_CORE_UNGTR', 'DAG_CORE_UNGTR', 'DAG_CORE_UNGTR', 'DAG_CORE_U-NGTR' ), - ('DAG_CORE_UNM2R', 'DAG_CORE_UNM2R', 'DAG_CORE_UNM2R', 'DAG_CORE_U-NM2R' ), - ('DAG_CORE_UNMBR', 'DAG_CORE_UNMBR', 'DAG_CORE_UNMBR', 'DAG_CORE_U-NMBR' ), - ('DAG_CORE_UNMLQ', 'DAG_CORE_UNMLQ', 'DAG_CORE_UNMLQ', 'DAG_CORE_U-NMLQ' ), - ('DAG_CORE_UNMQL', 'DAG_CORE_UNMQL', 'DAG_CORE_UNMQL', 'DAG_CORE_U-NMQL' ), - ('DAG_CORE_UNMQR', 'DAG_CORE_UNMQR', 'DAG_CORE_UNMQR', 'DAG_CORE_U-NMQR' ), - - # PaStiX - ('sutils.h', 'dutils.h', 'cutils.h', 'zutils.h' ), - ('SMURGE_', 'DMURGE_', 'CMURGE_', 'ZMURGE_' ), - ('smurge_', 'dmurge_', 'cmurge_', 'zmurge_' ), - ('smurge.h', 'dmurge.h', 'cmurge.h', 'zmurge.h' ), - ('smurge.inc', 'dmurge.inc', 'cmurge.inc', 'zmurge.inc' ), - ('smurge.c', 'dmurge.c', 'cmurge.c', 'zmurge.c' ), - ('ssimple', 'dsimple', 'csimple', 'zsimple' ), - ('sstep-by-step', 'dstep-by-step', 'cstep-by-step', 'zstep-by-step' ), - ('starpu_s', 'starpu_d', 'starpu_c', 'starpu_z' ), - ('STARPU_S', 'STARPU_D', 'STARPU_C', 'STARPU_Z' ), - ('pastix_s', 'pastix_d', 'pastix_c', 'pastix_z' ), - ('s_', 'd_', 'c_', 'z_' ), - ('S_', 'D_', 'C_', 'Z_' ), - ('FLT_EPSILON', 'DBL_EPSILON', 'FLT_EPSILON', 'DBL_EPSILON' ), - ('s_RAFF_FLOAT', 'd_RAFF_FLOAT', 'c_RAFF_FLOAT', 'z_RAFF_FLOAT' ), - ('MPI_FLOAT', 'MPI_DOUBLE', 'MPI_COMPLEX', 'MPI_DOUBLE_COMPLEX'), - ('MPI_FLOAT', 'MPI_DOUBLE', 'MPI_FLOAT', 'MPI_DOUBLE' ), - # ----- unused? - ('s_check', 'd_check', 'c_check', 'z_check' ), - ('s_get_idparm', 'd_get_idparm', 's_get_idparm', 'd_get_idparm', ), - #('stesting', 'dtesting', 'ctesting', 'ztesting' ), - #('SAUXILIARY', 'DAUXILIARY', 'CAUXILIARY', 'ZAUXILIARY' ), - ], - - # ------------------------------------------------------------ - # replacements applied for profiling with tau - 'tracing' :[ - # ----- Special line indicating column types - ['plain', 'tau'], - - # ----- Replacements - ('(\w+\*?)\s+(\w+)\s*\(([a-z* ,A-Z_0-9]*)\)\s*{\s+(.*)\s*#pragma tracing_start\s+(.*)\s+#pragma tracing_end\s+(.*)\s+}', - r'\1 \2(\3){\n\4tau("\2");\5tau();\6}'), - ('\.c','.c.tau'), - ], -};