diff --git a/CMakeLists.txt b/CMakeLists.txt index 03300f2..c01c54d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,151 +1,150 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# cmake_minimum_required (VERSION 2.8.8) #cmake_policy(SET CMP0053 NEW) project(bsplines_root Fortran C) #enable_language(Fortran) enable_testing() option(BSPLINES_USE_MUMPS "Activate the mumps interface" ON) if(NOT DEFINED BSPLINES_EXAMPLES) option(BSPLINES_EXAMPLES "Compiles the examples" ON) endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") # Assume we are on CRAY if ftn is the Fortran compiler if (${CMAKE_Fortran_COMPILER} MATCHES "ftn$") set(CRAY TRUE) if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Cray") set(cray_suffix cray) elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI") set(cray_suffix pgi) elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set(cray_suffix intel) elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") set(cray_suffix gnu) endif() else() set(CRAY FALSE) endif() if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() include(CMakeFlagsHandling) # Compiler flags for debug/optimization if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Cray") elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set(CMAKE_AR ${XIAR}) add_flags(LANG Fortran TYPE DEBUG -traceback "-check bounds" "-warn unused") add_flags(LANG Fortran TYPE RELEASE -xHost) elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") add_flags(LANG Fortran TYPE DEBUG -fbounds-check -fbacktrace) endif() if(NOT MUMPS) set(MUMPS $ENV{MUMPS_ROOT}) endif() # Installation root directory if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(PREFIX $ENV{PREFIX}) if(PREFIX) set(${CMAKE_INSTALL_PREFIX} ${PREFIX}) else() set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "..." FORCE) endif() message(STATUS "CMAKE_INSTALL_PREFIX is " ${CMAKE_INSTALL_PREFIX}) endif() # Search and load the FUTILS configuration file if(NOT TARGET futils) find_package(futils PATHS ${FUTILS}/lib/cmake REQUIRED) endif() if(BSPLINES_USE_MUMPS) find_package(Mumps REQUIRED) set(HAS_MUMPS ${MUMPS_FOUND}) else() set(HAS_MUMPS FALSE) endif() # Find lapack/blas. Skip it if on CRAY! if(CRAY) set(BSPLINES_USE_PARDISO OFF) endif() include(blas) if(NOT BSPLINES_EXPORT_TARGETS) set(BSPLINES_EXPORT_TARGETS bsplines-targets) endif() find_package(MPI COMPONENTS Fortran REQUIRED) include(GNUInstallDirs) add_subdirectory(pppack) add_subdirectory(pputils2) add_subdirectory(fft) add_subdirectory(src) if(HAS_MUMPS AND BSPLINES_EXAMPLES) add_subdirectory(multigrid) endif() if(BSPLINES_EXAMPLES) add_subdirectory(examples) add_subdirectory(wk) endif() export(TARGETS pppack pputils2 bsplines fft FILE "${CMAKE_BINARY_DIR}/bsplinesLibraryDepends.cmake") export(PACKAGE bsplines) # install configuration files if(BSPLINES_EXPORT_TARGETS MATCHES "bsplines-targets") install(EXPORT bsplines-targets DESTINATION lib/cmake ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/bsplines-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/bsplines-config.cmake @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/bsplines-config.cmake DESTINATION lib/cmake ) endif() # enable packaging with CPack include(CPack) - diff --git a/cmake/CMakeFlagsHandling.cmake b/cmake/CMakeFlagsHandling.cmake index 56b5fae..d9955fe 100644 --- a/cmake/CMakeFlagsHandling.cmake +++ b/cmake/CMakeFlagsHandling.cmake @@ -1,100 +1,100 @@ -/** - * @file CMakeFlagsHandling.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ +# +# @file CMakeFlagsHandling.cmake +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# if(_CMAKE_FLAGS_HANDLING) return() endif() set(_CMAKE_FLAGS_HANDLING TRUE) #=============================================================================== # Compilation options handling #=============================================================================== macro(_get_flags_message lang type desc) if(${lang} MATCHES "C.." OR ${lang} MATCHES "Fortran") set(${desc} "Flags used by the compiler") elseif(${lang} MATCHES ".*_LINKER") set(${desc} "Flags used by the linker") endif() if(${lang} MATCHES "SHARED_LINKER") set(${desc} "${desc} during the creation of shared libraries") elseif(${lang} MATCHES "MODULE_LINKER") set(${desc} "${desc} during the creation of modules") elseif(${lang} MATCHES "STATIC_LINKER") set(${desc} "${desc} linker during the creation of static libraries") endif() if(${type} MATCHES "ALL") set(${desc} "${desc} during all build types") else() set(${desc} "${desc} during ${type} builds") endif() endmacro() #=============================================================================== function(handle_flags) include(CMakeParseArguments) cmake_parse_arguments(_flags "ADD;REMOVE" "LANG;TYPE" "" ${ARGN} ) if(NOT _flags_LANG) set(_flags_LANG ${FLAGS_HANDLING_DEFAULT_LANGUAGE}) endif() set(_variable CMAKE_${_flags_LANG}_FLAGS) if (_flags_TYPE) set(_variable ${_variable}_${_flags_TYPE}) else() set(_flags_TYPE "ALL") endif() _get_flags_message(${_flags_LANG} ${_flags_TYPE} _desc) foreach(flag ${_flags_UNPARSED_ARGUMENTS}) if (_flags_ADD) string(REPLACE "${flag}" "match" _temp_var "${${_variable}}") if(NOT _temp_var MATCHES "match") set(${_variable} "${flag} ${${_variable}}" CACHE STRING ${_desc} FORCE) endif() elseif(_flags_REMOVE) string(REPLACE "${flag} " "" ${_variable} "${${_variable}}") set(${_variable} "${${_variable}}" CACHE STRING ${_desc} FORCE) endif() endforeach() endfunction() #=============================================================================== function(add_flags) handle_flags(ADD ${ARGN}) endfunction() #=============================================================================== function(remove_flags) handle_flags(REMOVE ${ARGN}) endfunction() #=============================================================================== diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake index 1fba7ca..855fa81 100644 --- a/cmake/FindFFTW.cmake +++ b/cmake/FindFFTW.cmake @@ -1,46 +1,46 @@ -/** - * @file FindFFTW.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ +# +# @file FindFFTW.cmake +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# if(CMAKE_C_COMPILER_ID MATCHES "Cray") set(_cray TRUE) endif() # Find FFTW2 if (${_cray}) # set(FFTW_LIBRARY "-ldfftw") set(FFTW_LIBRARY "${FFTW_DIR}/libdfftw.a") else() find_library(FFTW_LIBRARY NAMES fftw PATHS ${FFTW}/lib) find_library(FFTW_LIBRARY NAMES fftw3 PATHS ${FFTW}/lib) find_path(FFTW_INCLUDES fftw_f77.h ${FFTW}/include) find_path(FFTW_INCLUDES fftw_f77.i ${FFTW}/include) find_path(FFTW_INCLUDES fftw.h ${FFTW}/include) find_path(FFTW_INCLUDES fftw3.h ${FFTW}/include) endif() mark_as_advanced(FFTW_LIBRARY FFTW_INCLUDES) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FFTW DEFAULT_MSG FFTW_LIBRARY) diff --git a/cmake/FindMETIS.cmake b/cmake/FindMETIS.cmake index 2207580..879b0a9 100644 --- a/cmake/FindMETIS.cmake +++ b/cmake/FindMETIS.cmake @@ -1,62 +1,62 @@ -/** - * @file FindMETIS.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ +# +# @file FindMETIS.cmake +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# find_path(METIS_INCLUDE_DIR metis.h PATHS "${METIS_DIR}" ENV METIS_DIR PATH_SUFFIXES include ) find_library(METIS_LIBRARY NAMES metis PATHS "${METIS_DIR}" ENV METIS_DIR PATH_SUFFIXES lib ) mark_as_advanced(METIS_LIBRARY METIS_INCLUDE_DIR) #=============================================================================== include(FindPackageHandleStandardArgs) if(CMAKE_VERSION VERSION_GREATER 2.8.12) if(METIS_INCLUDE_DIR) file(STRINGS ${METIS_INCLUDE_DIR}/metis.h _versions REGEX "^#define\ +METIS_VER_(MAJOR|MINOR|SUBMINOR) .*") foreach(_ver ${_versions}) string(REGEX MATCH "METIS_VER_(MAJOR|MINOR|SUBMINOR) *([0-9.]+)" _tmp "${_ver}") set(_metis_${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) endforeach() set(METIS_VERSION "${_metis_MAJOR}.${_metis_MINOR}" CACHE INTERNAL "") endif() find_package_handle_standard_args(METIS REQUIRED_VARS METIS_LIBRARY METIS_INCLUDE_DIR VERSION_VAR METIS_VERSION) else() find_package_handle_standard_args(METIS DEFAULT_MSG METIS_LIBRARY METIS_INCLUDE_DIR) endif() diff --git a/cmake/FindMumps.cmake b/cmake/FindMumps.cmake index 8d8e76d..01b22a4 100644 --- a/cmake/FindMumps.cmake +++ b/cmake/FindMumps.cmake @@ -1,314 +1,289 @@ -/** - * @file FindMumps.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ #=============================================================================== # @file FindMumps.cmake # # @author Nicolas Richart # # @date creation: Fri Oct 24 2014 # @date last modification: Wed Jan 13 2016 # # @brief The find_package file for the Mumps solver # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== set(_MUMPS_COMPONENTS "sequential" "parallel" "double" "float" "complex_double" "complex_float") if(NOT Mumps_FIND_COMPONENTS) set(Mumps_FIND_COMPONENTS "parallel" "double" "float" "complex_double" "complex_float") endif() #=============================================================================== enable_language(Fortran) set(MUMPS_PRECISIONS) set(MUMPS_PLAT) foreach(_comp ${Mumps_FIND_COMPONENTS}) if("${_comp}" STREQUAL "sequential") set(MUMPS_PLAT _seq) #default plat on debian based distribution endif() if("${_comp}" STREQUAL "float") list(APPEND MUMPS_PRECISIONS s) endif() if("${_comp}" STREQUAL "double") list(APPEND MUMPS_PRECISIONS d) endif() if("${_comp}" STREQUAL "complex_float") list(APPEND MUMPS_PRECISIONS c) endif() if("${_comp}" STREQUAL "complex_double") list(APPEND MUMPS_PRECISIONS z) endif() endforeach() if(NOT MUMPS_PRECISIONS) set(MUMPS_PRECISIONS s d c z) endif() list(GET MUMPS_PRECISIONS 0 _first_precision) string(TOUPPER "${_first_precision}" _u_first_precision) find_path(MUMPS_INCLUDE_DIR ${_first_precision}mumps_c.h PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES include ) mark_as_advanced(MUMPS_INCLUDE_DIR) set(_mumps_required_vars) foreach(_precision ${MUMPS_PRECISIONS}) string(TOUPPER "${_precision}" _u_precision) find_library(MUMPS_LIBRARY_${_u_precision}MUMPS NAMES ${_precision}mumps${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) mark_as_advanced(MUMPS_LIBRARY_${_u_precision}MUMPS) list(APPEND _mumps_required_vars MUMPS_LIBRARY_${_u_precision}MUMPS) list(APPEND MUMPS_LIBRARIES_ALL ${MUMPS_LIBRARY_${_u_precision}MUMPS}) endforeach() if(MUMPS_LIBRARY_${_u_first_precision}MUMPS MATCHES ".*${_first_precision}mumps.*${CMAKE_STATIC_LIBRARY_SUFFIX}") # Assuming mumps was compiled as a static library set(MUMPS_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE) if (CMAKE_Fortran_COMPILER MATCHES ".*gfortran") set(_compiler_specific gfortran) elseif (CMAKE_Fortran_COMPILER MATCHES ".*ifort") set(_compiler_specific ifcore) else() message("Compiler ${CMAKE_Fortran_COMPILER} is not known, you will probably " "have to add semething instead of this message to be able to test mumps " "install") endif() else() set(MUMPS_LIBRARY_TYPE SHARED CACHE INTERNAL "" FORCE) endif() function(mumps_add_dependency _pdep _libs) string(TOUPPER ${_pdep} _u_pdep) if(_pdep STREQUAL "mumps_common") find_library(MUMPS_LIBRARY_COMMON mumps_common${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) set(${_libs} ${MUMPS_LIBRARY_COMMON} PARENT_SCOPE) mark_as_advanced(MUMPS_LIBRARY_COMMON) elseif(_pdep STREQUAL "pord") find_library(MUMPS_LIBRARY_PORD pord${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) set(${_libs} ${MUMPS_LIBRARY_PORD} PARENT_SCOPE) mark_as_advanced(MUMPS_LIBRARY_PORD) elseif(_pdep MATCHES "Scotch") find_package(Scotch REQUIRED ${ARGN} QUIET) if(ARGN) list(GET ARGN 1 _comp) string(TOUPPER ${_comp} _u_comp) set(${_libs} ${SCOTCH_LIBRARY_${_u_comp}} PARENT_SCOPE) else() set(${_libs} ${${_u_pdep}_LIBRARIES} PARENT_SCOPE) endif() elseif(_pdep MATCHES "MPI") if(MUMPS_PLAT STREQUAL "_seq") find_library(MUMPS_LIBRARY_MPISEQ mpiseq${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) set(${_libs} ${MUMPS_LIBRARY_MPISEQ} PARENT_SCOPE) mark_as_advanced(MUMPS_LIBRARY_MPISEQ) else() find_package(MPI REQUIRED C Fortran QUIET) set(${_libs} ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} PARENT_SCOPE) endif() else() find_package(${_pdep} REQUIRED QUIET) set(${_libs} ${${_u_pdep}_LIBRARIES} ${${_u_pdep}_LIBRARY} PARENT_SCOPE) endif() endfunction() function(mumps_find_dependencies) set(_libraries_all ${MUMPS_LIBRARIES_ALL}) set(_include_dirs ${MUMPS_INCLUDE_DIR}) set(_mumps_test_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}") file(READ ${CMAKE_CURRENT_LIST_DIR}/CheckFindMumps.c _output) file(WRITE "${_mumps_test_dir}/mumps_test_code.c" "#include <${_first_precision}mumps_c.h> ${_u_first_precision}MUMPS_STRUC_C id; #define mumps_c ${_first_precision}mumps_c #define Real ${_u_first_precision}MUMPS_REAL ") if(MUMPS_PLAT STREQUAL _seq) file(APPEND "${_mumps_test_dir}/mumps_test_code.c" "#define MUMPS_SEQ ") else() file(APPEND "${_mumps_test_dir}/mumps_test_code.c" "// #undef MUMPS_SEQ ") find_package(MPI REQUIRED) list(APPEND _compiler_specific ${MPI_C_LIBRARIES}) list(APPEND _include_dirs ${MPI_C_INCLUDE_PATH} ${MPI_INCLUDE_DIR}) endif() file(APPEND "${_mumps_test_dir}/mumps_test_code.c" "${_output}") #=============================================================================== set(_mumps_dep_symbol_BLAS ${_first_precision}gemm) set(_mumps_dep_symbol_ScaLAPACK numroc) set(_mumps_dep_symbol_MPI mpi_send) set(_mumps_dep_symbol_Scotch SCOTCH_graphInit) set(_mumps_dep_symbol_Scotch_ptscotch scotchfdgraphexit) set(_mumps_dep_symbol_Scotch_esmumps esmumps) set(_mumps_dep_symbol_mumps_common mumps_abort) set(_mumps_dep_symbol_pord SPACE_ordering) set(_mumps_dep_symbol_METIS metis_nodend) set(_mumps_dep_symbol_ParMETIS ParMETIS_V3_NodeND) # added for fucking macosx that cannot fail at link set(_mumps_run_dep_symbol_mumps_common mumps_fac_descband) set(_mumps_run_dep_symbol_MPI mpi_bcast) set(_mumps_run_dep_symbol_ScaLAPACK idamax) set(_mumps_dep_comp_Scotch_ptscotch COMPONENTS ptscotch) set(_mumps_dep_comp_Scotch_esmumps COMPONENTS esmumps) set(_mumps_potential_dependencies mumps_common pord BLAS ScaLAPACK MPI Scotch Scotch_ptscotch Scotch_esmumps METIS ParMETIS) #=============================================================================== set(_retry_try_run TRUE) set(_retry_count 0) # trying only as long as we add dependencies to avoid inifinte loop in case of an unkown dependency while (_retry_try_run AND _retry_count LESS 100) try_run(_mumps_run _mumps_compiles "${_mumps_test_dir}" "${_mumps_test_dir}/mumps_test_code.c" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_include_dirs}" LINK_LIBRARIES ${_libraries_all} ${_libraries_all} ${_compiler_specific} RUN_OUTPUT_VARIABLE _run COMPILE_OUTPUT_VARIABLE _out) set(_retry_compile FALSE) #message("COMPILATION outputs: \n${_out} \n RUN OUTPUT \n${_run}") if(_mumps_compiles AND NOT (_mumps_run STREQUAL "FAILED_TO_RUN")) break() endif() foreach(_pdep ${_mumps_potential_dependencies}) #message("CHECKING ${_pdep}") set(_add_pdep FALSE) if (NOT _mumps_compiles AND _out MATCHES "undefined reference.*${_mumps_dep_symbol_${_pdep}}") set(_add_pdep TRUE) #message("NEED COMPILE ${_pdep}") elseif(_mumps_run STREQUAL "FAILED_TO_RUN" AND DEFINED _mumps_run_dep_symbol_${_pdep} AND _run MATCHES "${_mumps_run_dep_symbol_${_pdep}}") set(_add_pdep TRUE) #message("NEED RUN ${_pdep}") endif() if(_add_pdep) mumps_add_dependency(${_pdep} _libs ${_mumps_dep_comp_${_pdep}}) #message("ADDING ${_libs}") if(NOT _libs) message(FATAL_ERROR "MUMPS depends on ${_pdep} but no libraries where found") endif() list(APPEND _libraries_all ${_libs}) set(_retry_try_run TRUE) endif() endforeach() math(EXPR _retry_count "${_retry_count} + 1") endwhile() if(_retry_count GREATER 10) message(FATAL_ERROR "Do not know what to do to link with mumps on your system, I give up!") endif() if(APPLE) # in doubt add some stuff because mumps was perhaps badly compiled mumps_add_dependency(pord _libs) list(APPEND _libraries_all ${_libs}) endif() set(MUMPS_LIBRARIES_ALL ${_libraries_all} PARENT_SCOPE) endfunction() mumps_find_dependencies() set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} CACHE INTERNAL "" FORCE) #=============================================================================== include(FindPackageHandleStandardArgs) if(CMAKE_VERSION VERSION_GREATER 2.8.12) if(MUMPS_INCLUDE_DIR) file(STRINGS ${MUMPS_INCLUDE_DIR}/dmumps_c.h _versions REGEX "^#define MUMPS_VERSION .*") foreach(_ver ${_versions}) string(REGEX MATCH "MUMPS_VERSION *\"([0-9.]+)\"" _tmp "${_ver}") set(_mumps_VERSION ${CMAKE_MATCH_1}) endforeach() set(MUMPS_VERSION "${_mumps_VERSION}" CACHE INTERNAL "") endif() find_package_handle_standard_args(Mumps REQUIRED_VARS ${_mumps_required_vars} MUMPS_INCLUDE_DIR VERSION_VAR MUMPS_VERSION ) else() find_package_handle_standard_args(Mumps DEFAULT_MSG ${_mumps_required_vars} MUMPS_INCLUDE_DIR) endif() diff --git a/cmake/FindPETSc.cmake b/cmake/FindPETSc.cmake index 04ad8d1..67cfc35 100644 --- a/cmake/FindPETSc.cmake +++ b/cmake/FindPETSc.cmake @@ -1,92 +1,92 @@ -/** - * @file FindPETSc.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ +# +# @file FindPETSc.cmake +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# # - Try to find PETSc # PETSC_FOUND - system has PETSc # PETSC_INCLUDE_DIRS - the PETSc include directories # PETSC_LIBRARIES - Link these to use PETSc # PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR) if(PETSc_FIND_REQUIRED) find_package(PkgConfig REQUIRED) else() find_package(PkgConfig QUIET) if(NOT PKG_CONFIG_FOUND) return() endif() endif() pkg_search_module(_petsc PETSc) # Some debug code #get_property(_vars DIRECTORY PROPERTY VARIABLES) #foreach(_var ${_vars}) # if ("${_var}" MATCHES "^_petsc") # message("${_var} -> ${${_var}}") # endif() #endforeach() if(_petsc_FOUND AND _petsc_VERSION) set(PETSC_VERSION ${_petsc_VERSION}) endif() if(_petsc_FOUND) set(_petsc_libs) foreach(_lib ${_petsc_LIBRARIES}) string(TOUPPER "${_lib}" _u_lib) find_library(PETSC_LIBRARY_${_u_lib} ${_lib} PATHS ${_petsc_LIBRARY_DIRS}) list(APPEND _petsc_libs ${PETSC_LIBRARY_${_u_lib}}) mark_as_advanced(PETSC_LIBRARY_${_u_lib}) endforeach() if (NOT _petsc_INCLUDE_DIRS) pkg_get_variable(_petsc_INCLUDE_DIRS ${_petsc_MODULE_NAME} includedir) #message(${_petsc_INCLUDE_DIRS}) endif() find_path(PETSC_Fortran_INCLUDE_DIRS "finclude/petsc.h" PATHS ${_petsc_INCLUDE_DIRS}/petsc NO_CMAKE_PATH NO_DEFAULT_PATH ) set(PETSC_LIBRARIES ${_petsc_libs} CACHE FILEPATH "") set(PETSC_INCLUDE_DIRS ${_petsc_INCLUDE_DIRS} CACHE PATH "") - + add_library(petsc::petsc INTERFACE IMPORTED) set_property(TARGET petsc::petsc PROPERTY INTERFACE_LINK_LIBRARIES ${PETSC_LIBRARIES}) set_property(TARGET petsc::petsc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PETSC_INCLUDE_DIRS}) add_library(petsc::petscf INTERFACE IMPORTED) target_link_libraries(petsc::petscf INTERFACE petsc::petsc) set_property(TARGET petsc::petscf PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PETSC_Fortran_INCLUDE_DIRS}) endif() include (FindPackageHandleStandardArgs) find_package_handle_standard_args(PETSc REQUIRED_VARS PETSC_LIBRARIES PETSC_INCLUDE_DIRS VERSION_VAR PETSC_VERSION) diff --git a/cmake/FindParMETIS.cmake b/cmake/FindParMETIS.cmake index 6a927e1..1f0c0df 100644 --- a/cmake/FindParMETIS.cmake +++ b/cmake/FindParMETIS.cmake @@ -1,62 +1,62 @@ -/** - * @file FindParMETIS.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ +# +# @file FindParMETIS.cmake +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# find_path(PARMETIS_INCLUDE_DIR parmetis.h PATHS "${PARMETIS_DIR}" ENV PARMETIS_DIR PATH_SUFFIXES include ) find_library(PARMETIS_LIBRARY NAMES parmetis PATHS "${PARMETIS_DIR}" ENV PARMETIS_DIR PATH_SUFFIXES lib ) mark_as_advanced(PARMETIS_LIBRARY PARMETIS_INCLUDE_DIR) #=============================================================================== include(FindPackageHandleStandardArgs) if(CMAKE_VERSION VERSION_GREATER 2.8.12) if(PARMETIS_INCLUDE_DIR) file(STRINGS ${PARMETIS_INCLUDE_DIR}/parmetis.h _versions REGEX "^#define\ +PARMETIS_(MAJOR|MINOR|SUBMINOR)_VERSION .*") foreach(_ver ${_versions}) string(REGEX MATCH "PARMETIS_(MAJOR|MINOR|SUBMINOR)_VERSION *([0-9.]+)" _tmp "${_ver}") set(_parmetis_${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) endforeach() set(PARMETIS_VERSION "${_parmetis_MAJOR}.${_parmetis_MINOR}" CACHE INTERNAL "") endif() find_package_handle_standard_args(ParMETIS REQUIRED_VARS PARMETIS_LIBRARY PARMETIS_INCLUDE_DIR VERSION_VAR PARMETIS_VERSION) else() find_package_handle_standard_args(ParMETIS DEFAULT_MSG PARMETIS_LIBRARY PARMETIS_INCLUDE_DIR) endif() diff --git a/cmake/FindScaLAPACK.cmake b/cmake/FindScaLAPACK.cmake index b3ef5ad..b695ed9 100644 --- a/cmake/FindScaLAPACK.cmake +++ b/cmake/FindScaLAPACK.cmake @@ -1,181 +1,156 @@ -/** - * @file FindScaLAPACK.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ #=============================================================================== # @file FindScaLAPACK.cmake # # @author Nicolas Richart # # @date creation: Tue Mar 31 2015 # @date last modification: Wed Jan 13 2016 # # @brief The find_package file for the Mumps solver # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== set(SCALAPACK_VENDOR "Auto" CACHE STRING "Vendor for scalapack (Auto, Netlib, Intel_(i?)lp64_(openmpi|intelmpi|sgimpt)") mark_as_advanced(SCALAPACK_VENDOR) set_property(CACHE SCALAPACK_VENDOR PROPERTY STRINGS Auto Netlib Intel_lp64_openmpi Intel_lp64_intelmpi Intel_lp64_sgimpt Intel_ilp64_openmpi Intel_ilp64_intelmpi Intel_ilp64_sgimpt) macro(scalapack_find_library prefix target name list_libraries list_headers) foreach(_lib ${list_libraries}) find_library(${prefix}_${_lib}_LIBRARY NAMES ${_lib} PATHS ${prefix}_DIR ) mark_as_advanced(${prefix}_${_lib}_LIBRARY) if(${prefix}_${_lib}_LIBRARY) list(APPEND ${prefix}_libraries ${${prefix}_${_lib}_LIBRARY}) get_filename_component(_ext ${${prefix}_${_lib}_LIBRARY} EXT) if(NOT TARGET ${target}) if("${_ext}" STREQUAL "${CMAKE_SHARED_LIBRARY_SUFFIX}") add_library(${target} SHARED IMPORTED) get_filename_component(_soname ${${prefix}_${_lib}_LIBRARY} NAME) set_property(TARGET ${target} PROPERTY IMPORTED_SONAME ${_soname}) else() add_library(${target}_${name} STATIC IMPORTED) endif() set_property(TARGET ${target} PROPERTY IMPORTED_LOCATION ${${prefix}_${_lib}_LIBRARY}) else() if("${_ext}" STREQUAL "${CMAKE_SHARED_LIBRARY_SUFFIX}") set_property(TARGET ${target} APPEND PROPERTY IMPORTED_LINK_DEPENDENT_LIBRARIES ${${prefix}_${_lib}_LIBRARY} ) else() set_property(TARGET ${target} APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ${${prefix}_${_lib}_LIBRARY} ) endif() endif() else() unset(${prefix}_${_lib}_LIBRARY CACHE) endif() endforeach() if(${prefix}_libraries) foreach(_hdr ${list_headers}) get_filename_component(_hdr_name ${_hdr} NAME_WE) find_path(${prefix}_${_hdr_name}_INCLUDE_DIR NAMES ${_hdr} PATHS ${prefix}_DIR) mark_as_advanced(${prefix}_${_hdr_name}_INCLUDE_DIR) if(${prefix}_${_hdr_name}_INCLUDE_DIR) list(APPEND ${prefix}_include_dir ${${prefix}_${_hdr_name}_INCLUDE_DIR}) set_property(TARGET ${target} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${${prefix}_${_lib}_INCLUDE_DIR} ) else() unset(${prefix}_${_lib}_INCLUDE_DIR CACHE) endif() endforeach() endif() endmacro() set(SCALAPACK_libraries) set(SCALAPACK_INCLUDE_DIR) if(SCALAPACK_VENDOR STREQUAL "Auto" OR SCALAPACK_VENDOR STREQUAL "Netlib") if(NOT SCALAPACK_libraries) scalapack_find_library( SCALAPACK ScaLAPACK "netlib" "scalapack;blacsC;blacsF77;blacs" "" ) endif() endif() foreach(_precision lp64 ilp64) foreach(_mpi intelmpi openmpi sgimpt) if(NOT SCALAPACK_libraries) if(SCALAPACK_VENDOR STREQUAL "Auto" OR SCALAPACK_VENDOR STREQUAL "Intel_${_precision}_${_mpi}") if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(_mkl_common "mkl_intel_${_precision}") else() set(_mkl_common "mkl_gf_${_precision}") endif() scalapack_find_library( SCALAPACK ScaLAPACK "intel_${_precision}_${_mpi}" "mkl_scalapack_${_precision};${_mkl_common};mkl_sequential;mkl_core;mkl_blacs_${_mpi}_${_precision}" "mkl_scalapack.h" ) if(SCALAPACK_libraries AND _precision STREQUAL "ilp64") set_property(TARGET ${target} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS MKL_ILP64} ) endif() if(EXISTS ${SCALAPACK_include_dir}/mkl_version.h) file(STRINGS ${SCALAPACK_include_dir}/mkl_version.h _versions REGEX "^#define\ +__INTEL_MKL(_MINOR|_UPDATE)?__ .*") foreach(_ver ${_versions}) string(REGEX MATCH "__INTEL_MKL(_MINOR|_UPDATE)?__ *([0-9.]+)" _tmp "${_ver}") set(_mkl${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) endforeach() set(SCALAPACK_VERSION "mkl:${_mkl}.${_mkl_MINOR}.${_mkl_UPDATE}" CACHE INTERNAL "") endif() endif() endif() endforeach() endforeach() set(SCALAPACK_LIBRARIES ${SCALAPACK_libraries} CACHE INTERNAL "") set(SCALAPACK_INCLUDE_DIR ${SCALAPACK_include_dir} CACHE INTERNAL "") #=============================================================================== include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ScaLAPACK REQUIRED_VARS SCALAPACK_LIBRARIES VERSION_VAR SCALAPACK_VERSION) diff --git a/cmake/FindScotch.cmake b/cmake/FindScotch.cmake index bc7829e..c931764 100644 --- a/cmake/FindScotch.cmake +++ b/cmake/FindScotch.cmake @@ -1,270 +1,245 @@ -/** - * @file FindScotch.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ #=============================================================================== # @file FindScotch.cmake # # @author Nicolas Richart # # @date creation: Fri Oct 24 2014 # @date last modification: Wed Jan 13 2016 # # @brief The find_package file for Scotch # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== set(_SCOTCH_COMPONENTS "metis" "parmetis" "esmumps" "ptscotch") if(NOT Scotch_FIND_COMPONENTS) set(Scotch_FIND_COMPONENTS) endif() find_path(SCOTCH_INCLUDE_DIR scotch.h PATHS "${SCOTCH_DIR}" ENV SCOTCH_DIR PATH_SUFFIXES include include/scotch ) find_library(SCOTCH_LIBRARY scotch PATHS "${SCOTCH_DIR}" ENV SCOTCH_DIR PATH_SUFFIXES lib) set(_scotch_test_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}") file(WRITE "${_scotch_test_dir}/scotch_test_code.c" "#include #include #include int main() { SCOTCH_Graph graph; SCOTCH_graphInit(&graph); return 0; } ") #=============================================================================== include(FindPackageHandleStandardArgs) if(CMAKE_VERSION VERSION_GREATER 2.8.12) if(SCOTCH_INCLUDE_DIR) file(STRINGS ${SCOTCH_INCLUDE_DIR}/scotch.h _versions REGEX "^#define\ +SCOTCH_(VERSION|RELEASE|PATCHLEVEL) .*") foreach(_ver ${_versions}) string(REGEX MATCH "SCOTCH_(VERSION|RELEASE|PATCHLEVEL) *([0-9.]+)" _tmp "${_ver}") set(_scotch_${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) endforeach() set(SCOTCH_VERSION "${_scotch_VERSION}.${_scotch_RELEASE}.${_scotch_PATCHLEVEL}" CACHE INTERNAL "") endif() find_package_handle_standard_args(Scotch REQUIRED_VARS SCOTCH_LIBRARY SCOTCH_INCLUDE_DIR VERSION_VAR SCOTCH_VERSION) else() find_package_handle_standard_args(Scotch DEFAULT_MSG SCOTCH_LIBRARY SCOTCH_INCLUDE_DIR) endif() set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY}) try_compile(_scotch_compiles "${_scotch_test_dir}" SOURCES "${_scotch_test_dir}/scotch_test_code.c" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SCOTCH_INCLUDE_DIR}" LINK_LIBRARIES ${SCOTCH_LIBRARY} OUTPUT_VARIABLE _out) get_filename_component(_scotch_hint "${SCOTCH_LIBRARY}" DIRECTORY) if(SCOTCH_LIBRARY MATCHES ".*scotch.*${CMAKE_STATIC_LIBRARY_SUFFIX}") # Assuming scotch was compiled as a static library set(SCOTCH_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE) else() set(SCOTCH_LIBRARY_TYPE SHARED CACHE INTERNAL "" FORCE) endif() if(NOT _scotch_compiles) if(_out MATCHES "SCOTCH_errorPrint") find_library(SCOTCH_LIBRARY_ERR scotcherr HINTS ${_scotch_hint}) find_library(SCOTCH_LIBRARY_ERREXIT scotcherrexit HINTS ${_scotch_hint}) if(NOT TARGET Scotch::err) add_library(Scotch::err ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() if(NOT TARGET Scotch::errexit) add_library(Scotch::errexit ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::errexit PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_ERREXIT}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C") set_target_properties(Scotch::err PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_ERR}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_LINK_LIBRARIES "Scotch::errexit") mark_as_advanced(SCOTCH_LIBRARY_ERR SCOTCH_LIBRARY_ERREXIT) list(APPEND SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY_ERR} ${SCOTCH_LIBRARY_ERREXIT}) set(_scotch_link_lib INTERFACE_LINK_LIBRARIES "Scotch::err") endif() endif() if(NOT TARGET Scotch::scotch) add_library(Scotch::scotch ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::scotch PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ${_scotch_link_lib}) set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for Scotch" FORCE) mark_as_advanced(SCOTCH_LIBRARY SCOTCH_INCLUDE_DIR SCOTCH_LIBRARIES) if("${Scotch_FIND_COMPONENTS}" MATCHES "esmumps") find_library(SCOTCH_LIBRARY_ESMUMPS esmumps HINTS ${_scotch_hint}) if(NOT TARGET Scotch::esmumps) add_library(Scotch::esmumps ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::esmumps PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_ESMUMPS}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C") mark_as_advanced(SCOTCH_LIBRARY_ESMUMPS) endif() if("${Scotch_FIND_COMPONENTS}" MATCHES "metis") find_library(SCOTCH_LIBRARY_METIS scotchmetis HINTS ${_scotch_hint}) if(NOT TARGET Scotch::metis) add_library(Scotch::metis ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::metis PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_METIS}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C") mark_as_advanced(SCOTCH_LIBRARY_METIS) endif() if("${Scotch_FIND_COMPONENTS}" MATCHES "parmetis") find_library(SCOTCH_LIBRARY_PARMETIS scotchparmetis HINTS ${_scotch_hint}) if(NOT TARGET Scotch::parmetis) add_library(Scotch::parmetis ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::parmetis PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_PARMETIS}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" INTERFACE_INCLUDE_DIRECTORIES "Scotch::metis") mark_as_advanced(SCOTCH_LIBRARY_PARMETIS) endif() # ##=============================================================================== if("${Scotch_FIND_COMPONENTS}" MATCHES "ptscotch") file(WRITE "${_scotch_test_dir}/ptscotch_test_code.c" "#include #include #include #include int main() { SCOTCH_Dgraph graph; SCOTCH_dgraphInit(&graph, MPI_COMM_WORLD); return 0; } ") find_package(MPI REQUIRED) find_library(SCOTCH_LIBRARY_PTSCOTCH ptscotch HINTS ${_scotch_hint}) try_compile(_scotch_compiles "${_scotch_test_dir}" SOURCES "${_scotch_test_dir}/ptscotch_test_code.c" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SCOTCH_INCLUDE_DIR};${MPI_C_INCLUDE_PATH}" LINK_LIBRARIES ${SCOTCH_LIBRARY_PTSCOTCH} ${MPI_C_LIBRARIES} OUTPUT_VARIABLE _out) if(NOT _scotch_compiles) if(_out MATCHES "SCOTCH_archExit") set(_scotch_link_lib INTERFACE_LINK_LIBRARIES "Scotch::scotch") endif() endif() if(NOT TARGET Scotch::ptscotch) add_library(Scotch::ptscotch ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::ptscotch PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_PTSCOTCH}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ${_scotch_link_lib}) set(PTSCOTCH_LIBRARIES ${SCOTCH_LIBRARY_PTSCOTCH} ${SCOTCH_LIBRARIES} CACHE INTERNAL "Libraries for PT-Scotch" FORCE) mark_as_advanced(SCOTCH_LIBRARY_PTSCOTCH PTSCOTCH_LIBRARIES) if("${Scotch_FIND_COMPONENTS}" MATCHES "esmumps") find_library(SCOTCH_LIBRARY_PTESMUMPS ptesmumps HINTS ${_scotch_hint} PATH_SUFFIXES lib .) if(NOT TARGET Scotch::ptesmumps) add_library(Scotch::ptesmumps ${SCOTCH_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(Scotch::ptesmumps PROPERTIES IMPORTED_LOCATION "${SCOTCH_LIBRARY_ESMUMPS}" INTERFACE_INCLUDE_DIRECTORIES "${SCOTCH_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C") mark_as_advanced(SCOTCH_LIBRARY_PTESMUMPS) endif() endif() diff --git a/cmake/blas.cmake b/cmake/blas.cmake index 9648874..f4ef4d5 100644 --- a/cmake/blas.cmake +++ b/cmake/blas.cmake @@ -1,63 +1,63 @@ -/** - * @file blas.cmake - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - */ +# +# @file blas.cmake +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# set(_default_blas $ENV{BLA_VENDOR}) if(NOT _default_blas) set(_default_blas All) endif() set(BSPLINES_USE_BLAS_VENDOR "${_default_blas}" CACHE STRING "Version of blas to use") mark_as_advanced(BSPLINES_USE_BLAS_VENDOR) set_property(CACHE BSPLINES_USE_BLAS_VENDOR PROPERTY STRINGS All ACML ACML_GPU ACML_MP ATLAS Apple CXML DXML Generic Goto IBMESSL Intel Intel10_32 Intel10_64lp Intel10_64lp_seq NAS OpenBLAS PhiPACK SCSL SGIMATH SunPerf ) if(BSPLINES_USE_PARDISO) set(BSPLINES_USE_BLAS_VENDOR Intel10_64lp CACHE STRING "" INTERNAL) endif() set(ENV{BLA_VENDOR} ${BSPLINES_USE_BLAS_VENDOR}) find_package(BLAS REQUIRED) find_package(LAPACK REQUIRED) diff --git a/cmake/bsplines-config.cmake.in b/cmake/bsplines-config.cmake.in index bd85d31..31605c5 100644 --- a/cmake/bsplines-config.cmake.in +++ b/cmake/bsplines-config.cmake.in @@ -1,54 +1,54 @@ -/** - * @file bsplines-config.cmake.in - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Trach-Minh Tran - */ +# +# @file bsplines-config.cmake.in +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Trach-Minh Tran +# # - Config file for the BSPLINES package # It defines the target the following variables: # FFLAGS - Fortran compile flags # BSPLINES_MODS - include directories for bsplines modules # BSPLINES_LIBS - bsplines library # BSPLINES_EXTRA_INCS - additional include directories # BSPLINES_EXTRA_LIBS - additional libraries # HAS_PARDISO - BSPLINES built with PARDISO # HAS_MUMPS - BSPLINES built with MUMPS # MPIEXEC - MPI launcher # MPIEXEC_NUMPROC_FLAG - Number of MPI processes flag # Compute paths get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(_prefix "${_dir}/../.." ABSOLUTE) # Import the targets include("${_prefix}/lib/cmake/bsplines-targets.cmake") # Report other information set(FFLAGS "@CMAKE_Fortran_FLAGS@") set(BSPLINES_MODS "${_prefix}/include") set(BSPLINES_LIBS fft bsplines pppack pputils2) set(BSPLINES_EXTRA_INCS "@EXTRA_INCS@") set(BSPLINES_EXTRA_LIBS "@EXTRA_LIBS@") set(HAS_PARDISO "@HAS_PARDISO@") set(HAS_MUMPS "@HAS_MUMPS@") set(MPIEXEC "@MPIEXEC@") set(MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 050fdcb..4169dde 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,77 +1,77 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# project(bsplines_tests) -add_library(local_util STATIC +add_library(local_util STATIC pde1dp_mod.f90 pde3d_mod.f90 ppde3d_mod.f90 ppde3d_pb_mod.f90 tcdsmat_mod.f90 meshdist.f90 dismat.f90 ibcmat.f90 disrhs.f90 ) target_link_libraries(local_util PUBLIC bsplines) set(BS_TESTS driv1 driv2 driv3 driv4 - pde1d pde1dp pde1dp_cmpl + pde1d pde1dp pde1dp_cmpl pde2d pde2d_pb - pde1dp_cmpl_dft + pde1dp_cmpl_dft pde3d ppde3d ppde3d_pb - fit1d fit1dbc fit1dp + fit1d fit1dbc fit1dp fit2d fit2d1d fit2d_cmpl fit2dbc fit2dbc_x fit2dbc_y moments optim1 optim2 optim3 tcdsmat tmassmat tbasfun tsparse1 basfun_perf getgrad_perf gridval_perf test_kron ) if(HAS_PARDISO) - set(BS_TESTS ${BS_TESTS} - pde1dp_cmpl_pardiso + set(BS_TESTS ${BS_TESTS} + pde1dp_cmpl_pardiso pde2d_pardiso pde2d_sym_pardiso pde2d_sym_pardiso_dft tsparse2 ) endif() if(HAS_MUMPS) set(BS_TESTS ${BS_TESTS} pde2d_mumps pde1dp_cmpl_mumps ) endif() foreach(test ${BS_TESTS}) add_executable(${test} ${test}.f90) target_link_libraries(${test} local_util ${LIBS} ${EXTRA_LIBS}) endforeach() diff --git a/fft/CMakeLists.txt b/fft/CMakeLists.txt index ca0d58b..82f6ec0 100644 --- a/fft/CMakeLists.txt +++ b/fft/CMakeLists.txt @@ -1,69 +1,69 @@ -/** - * @file CMakeLists.txt - * - * @brief Principal CMake configuration file for the fft library - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief Principal CMake configuration file for the fft library +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# project(fft) find_package(FFTW REQUIRED) set(fft_w $ENV{fft_w}) set(SRCS fft_fftw.F90 ) set(EXAMPLES tfft.f90) add_library(fft STATIC ${SRCS}) target_include_directories(fft PRIVATE $ ${FFTW_INCLUDES} INTERFACE $ $ ${FFTW_INCLUDES} ) if (${fft_w} MATCHES "fft_w2") target_compile_options(fft PRIVATE "-Dfft_w2") else() target_compile_options(fft PRIVATE "-Dfft_w3") endif() target_link_libraries(fft PUBLIC ${FFTW_LIBRARY} ${MPI_Fortran_LIBRARIES}) # set_property(TARGET fft PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/modules/fft.mod) add_executable(tfft tfft.f90) target_link_libraries(tfft fft ${MPI_Fortran_LIBRARIES}) #add_test(tfft ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 # ${CMAKE_CURRENT_BINARY_DIR}/tfft < ${fft_SOURCE_DIR}/in) install(TARGETS fft EXPORT ${BSPLINES_EXPORT_TARGETS} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/multigrid/CMakeLists.txt b/multigrid/CMakeLists.txt index cec61e0..27779d3 100644 --- a/multigrid/CMakeLists.txt +++ b/multigrid/CMakeLists.txt @@ -1,32 +1,32 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# add_subdirectory(src) if(BSPLINES_EXAMPLES) add_subdirectory(wk) endif() #add_subdirectory(halpern) diff --git a/multigrid/src/CMakeLists.txt b/multigrid/src/CMakeLists.txt index cacde7a..888ffc3 100644 --- a/multigrid/src/CMakeLists.txt +++ b/multigrid/src/CMakeLists.txt @@ -1,92 +1,92 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# project(multigrid_tests) if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") -# set(CMAKE_Fortran_FLAGS_RELEASE +# set(CMAKE_Fortran_FLAGS_RELEASE # "${CMAKE_Fortran_FLAGS_RELEASE} -profile-functions -profile-loops=outer" # ) - set(CMAKE_Fortran_FLAGS_DEBUG + set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fpe0" ) endif() set(MG_TESTS transfer1d test_relax test_mg test_mgp test_csr two_grid test_mg2d test_relax2d test_transf2d transfer1d_col test_relax2d_cyl - test_transf2d_cyl + test_transf2d_cyl test_mg2d_cyl ) foreach(test ${MG_TESTS}) add_executable(${test} ${test}.f90) target_link_libraries(${test} bsplines) endforeach() add_executable(poisson_fd poisson_fd.f90 fdmat_mod.f90 stencil_mod.f90 parmg_mod.f90 gvector_mod.f90) target_link_libraries(poisson_fd bsplines) set(TESTS ${TESTS} poisson_mg) add_executable(partition partition.f90 stencil_mod.f90 parmg_mod.f90 gvector_mod.f90) target_link_libraries(partition bsplines) # Fail to compile with crayftn 4.0.46 on ROSA/DAINT add_executable(test_stencil test_stencil.f90 stencil_mod.f90 gvector_mod.f90) target_link_libraries(test_stencil bsplines) add_executable(test_stencilg test_stencilg.f90 stencil_mod.f90 parmg_mod.f90 gvector_mod.f90) target_link_libraries(test_stencilg bsplines) # Fail to compile with crayftn 4.0.46 on ROSA/DAINT add_executable(test_jacobi test_jacobi.f90 stencil_mod.f90 parmg_mod.f90 gvector_mod.f90) target_link_libraries(test_jacobi bsplines) add_executable(test_jacobig test_jacobig.f90 fdmat_mod.f90 stencil_mod.f90 parmg_mod.f90 gvector_mod.f90) target_link_libraries(test_jacobig bsplines) add_executable(ppoisson_fd ppoisson_fd.f90 fdmat_mod.f90 stencil_mod.f90 parmg_mod.f90 gvector_mod.f90) target_link_libraries(ppoisson_fd bsplines) add_executable(test_gvec1d test_gvec1d.f90) target_link_libraries(test_gvec1d bsplines) add_executable(test_intergrid0 test_intergrid0.f90) target_link_libraries(test_intergrid0 bsplines) add_executable(test_intergrid1 test_intergrid1.f90 parmg_mod.f90 gvector_mod.f90 stencil_mod.f90) target_link_libraries(test_intergrid1 bsplines) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/multigrid/wk/CMakeLists.txt b/multigrid/wk/CMakeLists.txt index b784517..98a7017 100644 --- a/multigrid/wk/CMakeLists.txt +++ b/multigrid/wk/CMakeLists.txt @@ -1,53 +1,53 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Trach-Minh Tran +# project(multigrid_wk) set(MG_TESTS transfer1d test_relax test_mg test_mgp test_csr two_grid test_mg2d test_relax2d test_transf2d transfer1d_col test_relax2d_cyl - test_transf2d_cyl + test_transf2d_cyl test_mg2d_cyl poisson_fd ) set(RUNTESTS "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh") set(BIN_DIR "${multigrid_tests_BINARY_DIR}") set(INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") foreach(prog ${MG_TESTS}) - add_test(${prog} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 + add_test(${prog} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${RUNTESTS} ${BIN_DIR}/${prog} ${INPUT_DIR} ) endforeach() diff --git a/pppack/CMakeLists.txt b/pppack/CMakeLists.txt index a6796da..948a8ea 100644 --- a/pppack/CMakeLists.txt +++ b/pppack/CMakeLists.txt @@ -1,37 +1,37 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# set(SRCS bvalue.f90 interv.f90 ) add_library(pppack STATIC ${SRCS}) install(TARGETS pppack EXPORT ${BSPLINES_EXPORT_TARGETS} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/pputils2/CMakeLists.txt b/pputils2/CMakeLists.txt index d0e4592..1b0c5d6 100644 --- a/pputils2/CMakeLists.txt +++ b/pputils2/CMakeLists.txt @@ -1,74 +1,74 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# project(pputils2) set(SRCS pputils2.f90 ) set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules ) add_library(pputils2 STATIC ${SRCS}) target_include_directories(pputils2 PRIVATE $ ${MPI_Fortran_INCLUDE_PATH} INTERFACE $ $ ${MPI_Fortran_INCLUDE_PATH} ) target_compile_options(pputils2 PUBLIC ${MPI_Fortran_COMPILE_FLAGS}) target_link_libraries(pputils2 PUBLIC ${MPI_Fortran_LIBRARIES}) set_property(TARGET pputils2 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/modules/pputils.mod) include(GNUInstallDirs) install(TARGETS pputils2 EXPORT ${BSPLINES_EXPORT_TARGETS} LIBRARY DESTINATION ${CNAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CNAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if(BSPLINES_EXAMPLES) set(EXAMPLES ex1 ex2 ex3 ex4 ex5 ex6 ex7) foreach(ex ${EXAMPLES}) add_executable(pputils2_${ex} ${ex}.f90) target_link_libraries(pputils2_${ex} pputils2 futils) endforeach() add_test(ex1 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex1) add_test(ex2 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 9 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex2) add_test(ex3 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 5 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex3) add_test(ex4 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 12 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex4) add_test(ex5 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 8 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex5) add_test(ex6 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 12 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex6) add_test(ex7 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 6 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex7) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6c6dac0..b55fdb1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,111 +1,111 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# project(bsplines_src) set(SRCS bsplines.f90 matrix.f90 sparse_mod.f90 lapack_extra.f math_util.f90 ) set(SRCS_PP conmat.f90 ) set(PUBLIC_MODULES bsplines.mod matrix.mod math_util.mod conmat_mod.mod sparse.mod ) if(HAS_PARDISO) list(APPEND ${SRCS_PP} pardiso_mod.f90) endif() set_property(SOURCE conmat.f90 APPEND PROPERTY COMPILE_OPTIONS -DWSMP ${MKL_DEFINITIONS}) if(HAS_MUMPS) list(APPEND SRCS multigrid_mod.f90 ) list(APPEND SRCS_PP mumps_mod.f90 csr_mod.f90 cds_mod.f90 ) list(APPEND PUBLIC_MODULES cds.mod csr.mod mumps_bsplines.mod) set_property(SOURCE conmat.f90 APPEND PROPERTY COMPILE_OPTIONS -DMUMPS) endif() set(_public_headers) foreach(_modules ${PUBLIC_MODULES}) list(APPEND _public_headers ${CMAKE_CURRENT_BINARY_DIR}/${_modules}) endforeach() set_property(SOURCE ${SRCS_PP} APPEND PROPERTY COMPILE_OPTIONS -cpp) include(GNUInstallDirs) add_library(bsplines STATIC ${SRCS} ${SRCS_PP}) target_include_directories(bsplines PRIVATE $ ${MUMPS_INCLUDE_DIR} INTERFACE $ $ ) set_property(TARGET bsplines PROPERTY PUBLIC_HEADER ${_public_headers}) target_link_libraries(bsplines PUBLIC futils pppack pputils2 fft ${BLAS_LIBRARIES} ${MUMPS_LIBRARIES} ${LAPACK_LIBRARIES} ) if(MKL_Fortran_FLAGS) separate_arguments(MKL_Fortran_FLAGS) target_compile_options(bsplines PUBLIC ${MKL_Fortran_FLAGS}) target_link_options(bsplines PUBLIC ${MKL_Fortran_FLAGS}) endif() install(TARGETS bsplines EXPORT ${BSPLINES_EXPORT_TARGETS} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/wk/CMakeLists.txt b/wk/CMakeLists.txt index e24be22..64a12ba 100644 --- a/wk/CMakeLists.txt +++ b/wk/CMakeLists.txt @@ -1,79 +1,78 @@ -/** - * @file CMakeLists.txt - * - * @brief - * - * @copyright - * Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * SPC (Swiss Plasma Center) - * - * spclibs is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * spclibs is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * @authors - * (in alphabetical order) - * @author Nicolas Richart - * @author Trach-Minh Tran - */ +# +# @file CMakeLists.txt +# +# @brief +# +# @copyright +# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) +# SPC (Swiss Plasma Center) +# +# spclibs is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# @authors +# (in alphabetical order) +# @author Nicolas Richart +# @author Trach-Minh Tran +# set(BS_TESTS driv1 driv2 driv3 driv4 - pde1d pde1dp pde1dp_cmpl + pde1d pde1dp pde1dp_cmpl pde2d pde2d_pb - pde1dp_cmpl_dft + pde1dp_cmpl_dft pde3d - fit1d fit1dbc fit1dp + fit1d fit1dbc fit1dp fit2d fit2d1d fit2d_cmpl fit2dbc fit2dbc_x fit2dbc_y moments optim1 optim2 optim3 tcdsmat tmassmat tbasfun tsparse1 test_kron ) if(HAS_PARDISO) - set(BS_TESTS ${BS_TESTS} - pde1dp_cmpl_pardiso + set(BS_TESTS ${BS_TESTS} + pde1dp_cmpl_pardiso pde2d_pardiso pde2d_sym_pardiso pde2d_sym_pardiso_dft ) endif() if(HAS_MUMPS) set(BS_TESTS ${BS_TESTS} pde2d_mumps pde1dp_cmpl_mumps ) endif() set(RUNTESTS "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh") set(BIN_DIR "${bsplines_tests_BINARY_DIR}") set(INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") foreach(prog ${BS_TESTS}) - add_test(${prog} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 + add_test(${prog} ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${RUNTESTS} ${BIN_DIR}/${prog} ${INPUT_DIR} ) endforeach() # Special cases! if(HAS_PARDISO) - add_test(tsparse2 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 + add_test(tsparse2 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${BIN_DIR}/tsparse2 ) endif() add_test(ppde3d ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${BIN_DIR}/ppde3d ${INPUT_DIR}/ppde3d.in ) add_test(ppde3d_pb ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${BIN_DIR}/ppde3d ${INPUT_DIR}/ppde3d_pb.in ) -