diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d9cd0c998cd3ca1ebbba8f1a6ef279ade553bdcc..d5318def2b8ed3756c0e3fdb3ce6aae6d6fbaf7b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,52 @@ +image: hpclib/hiepacs +stages: + - build + - test + - sonar -utests: +build: + stage: build script: - - mkdir BuildTests - - cd BuildTests - - cmake -DSCALFMM_USE_LOG=ON -DSCALFMM_USE_BLAS=ON -DSCALFMM_USE_ASSERT=ON -DSCALFMM_BUILD_UTESTS=ON -DSCALFMM_BUILD_TESTS=ON -DSCALFMM_USE_FFT=ON .. - - make - - OMP_NUM_THREADS=2 make test - tags: - - gcc - - blas - - fftw + - cd Build && cmake .. + -DSCALFMM_USE_LOG=ON + -DSCALFMM_USE_ASSERT=ON + -DSCALFMM_USE_SSE=OFF + -DSCALFMM_USE_BLAS=ON + -DSCALFMM_USE_FFT=ON + -DSCALFMM_USE_MPI=ON + -DSCALFMM_BUILD_EXAMPLES=ON + -DSCALFMM_BUILD_TESTS=OFF + -DSCALFMM_BUILD_UTESTS=OFF + -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_C_COMPILER=gcc-6 + -DCMAKE_CXX_COMPILER=g++-6 + - make -j8 + +test: + stage: test + artifacts: + name: scalfmm_test + expire_in: 1 day + paths: + - scalfmm-build.log + - scalfmm.lcov + - scalfmm-coverage.xml + #- scalfmm-cppcheck.xml + - scalfmm-rats.xml + script: + - source ./Utils/scripts/analysis.sh + +sonar: + stage: sonar + dependencies: + - test + artifacts: + name: scalfmm_sonar + expire_in: 1 day + paths: + - sonar.log + script: + - sonar-scanner -X -Dsonar.login=c1416c617418f890576a747223ac9f6cd86353d6 > sonar.log + only: + - devel diff --git a/CMakeLists.txt b/CMakeLists.txt index 13a0646e081fb5fe769863b7c7b5d7aec39818d6..beedbcd576158fc51d3323ca7c4e0e2c5cf807e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -811,6 +811,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ string(STRIP ${lib_var} lib_var) LIST(APPEND SCALFMM_COMPILE_LIBS ${lib_var}) endforeach() + string(REPLACE " " ";" SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}") + string(REPLACE ";;" ";" SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}") + string(REPLACE " " ";" SCALFMM_INCLUDES "${SCALFMM_INCLUDES}") + string(REPLACE ";;" ";" SCALFMM_INCLUDES "${SCALFMM_INCLUDES}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Src/ScalFmmConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/Src/ScalFmmConfig.h ) # diff --git a/CMakeModules/morse/find/FindBLAS.cmake b/CMakeModules/morse/find/FindBLAS.cmake index 43132541ddcc0653822926aae4932ac84508a80a..9f74b07feb2b7cad89bd372c43639593fee150a9 100644 --- a/CMakeModules/morse/find/FindBLAS.cmake +++ b/CMakeModules/morse/find/FindBLAS.cmake @@ -30,6 +30,7 @@ # 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 +# BLAS_VENDOR_FOUND stores the BLAS vendor found # 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): @@ -687,18 +688,18 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") endif() endif() endforeach () - + if(NOT BLAS_FIND_QUIETLY) + if(${_LIBRARIES}) + message(STATUS "Looking for MKL BLAS: found") + else() + message(STATUS "Looking for MKL BLAS: not found") + endif() + endif() + if (${_LIBRARIES} AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Intel MKL") + endif() endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) endif(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*") - - if(NOT BLAS_FIND_QUIETLY) - if(${_LIBRARIES}) - message(STATUS "Looking for MKL BLAS: found") - else() - message(STATUS "Looking for MKL BLAS: not found") - endif() - endif() - endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") @@ -722,6 +723,9 @@ if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") endif() endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Goto") + endif() endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") @@ -747,6 +751,9 @@ if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All") endif() endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Openblas") + endif() endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All") @@ -765,7 +772,7 @@ if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All") "" ) if(NOT BLAS_FIND_QUIETLY) - if(BLAS_LIBRARIES) + if(BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) message(STATUS "Looking for Eigen BLAS: found") else() message(STATUS "Looking for Eigen BLAS: not found") @@ -791,6 +798,9 @@ if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All") endif() endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Eigen") + endif() endif (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All") @@ -816,6 +826,10 @@ if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Atlas") + endif() + endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All") @@ -840,6 +854,10 @@ if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "PhiPACK") + endif() + endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All") @@ -864,6 +882,10 @@ if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "CXML") + endif() + endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All") @@ -888,6 +910,10 @@ if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "DXML") + endif() + endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All") @@ -915,6 +941,10 @@ if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "SunPerf") + endif() + endif () @@ -939,6 +969,10 @@ if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "SunPerf") + endif() + endif () @@ -963,6 +997,10 @@ if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "SGIMATH") + endif() + endif () @@ -987,6 +1025,10 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "IBM ESSL") + endif() + endif () # BLAS in IBM ESSL_MT library (requires generic BLAS lib, too) @@ -1010,6 +1052,10 @@ if (BLA_VENDOR STREQUAL "IBMESSLMT" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "IBM ESSL MT") + endif() + endif () @@ -1179,6 +1225,10 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "ACML") + endif() + endif (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") # ACML @@ -1203,6 +1253,10 @@ if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") endif() endif() + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Apple Accelerate") + endif() + endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") @@ -1226,6 +1280,9 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") endif() endif () + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "NAS") + endif() endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") @@ -1255,6 +1312,10 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") endif() endforeach () + if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND) + set (BLAS_VENDOR_FOUND "Netlib or other Generic libblas") + endif() + endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") @@ -1293,9 +1354,6 @@ if(BLA_F95) set(BLAS_FOUND TRUE) set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") - if (NOT BLAS_LIBRARIES_DEP) - set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}") - endif() else(BLA_F95) diff --git a/CMakeModules/morse/find/FindCBLAS.cmake b/CMakeModules/morse/find/FindCBLAS.cmake index eb10586376230fd464c57ad49944d422ef8adcc8..550236a6ca8ecc235d463373959fcb08a4bcf09c 100644 --- a/CMakeModules/morse/find/FindCBLAS.cmake +++ b/CMakeModules/morse/find/FindCBLAS.cmake @@ -114,22 +114,24 @@ if (BLAS_FOUND) # Check for faster complex GEMM routine # (only C/Z, no S/D version) if ( CBLAS_ZGEMM3M_FOUND ) - add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M) + add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M) endif() if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas: test with blas succeeds") + message(STATUS "Looking for cblas: test with blas succeeds") endif() # test succeeds: CBLAS is in BLAS set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}") + set(CBLAS_LIBRARIES_DEP "${BLAS_LIBRARIES}") if (BLAS_LIBRARY_DIRS) - set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}") + set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}") endif() if(BLAS_INCLUDE_DIRS) - set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}") + set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}") + set(CBLAS_INCLUDE_DIRS_DEP "${BLAS_INCLUDE_DIRS_DEP}") endif() if (BLAS_LINKER_FLAGS) - set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") + set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") endif() endif() endif (NOT CBLAS_STANDALONE) @@ -160,17 +162,17 @@ if (BLAS_FOUND) list(APPEND _inc_env "${ENV_CBLAS_DIR}/include/cblas") else() if(WIN32) - string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}") - list(APPEND _inc_env "${_path_env}") + 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}") + 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}") @@ -184,21 +186,21 @@ if (BLAS_FOUND) 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}) + 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") + 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") + 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) @@ -210,7 +212,7 @@ if (BLAS_FOUND) else () set(CBLAS_INCLUDE_DIRS "CBLAS_INCLUDE_DIRS-NOTFOUND") if(NOT CBLAS_FIND_QUIETLY) - message(STATUS "Looking for cblas -- cblas.h not found") + message(STATUS "Looking for cblas -- cblas.h not found") endif() endif() @@ -229,15 +231,15 @@ if (BLAS_FOUND) list(APPEND _lib_env "${ENV_CBLAS_DIR}/lib") else() if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") + 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}") + 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) @@ -249,20 +251,20 @@ if (BLAS_FOUND) if(CBLAS_LIBDIR) set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND") find_library(CBLAS_cblas_LIBRARY - NAMES cblas - HINTS ${CBLAS_LIBDIR}) + 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) + 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}) + 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) @@ -278,7 +280,7 @@ if (BLAS_FOUND) 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") + message(STATUS "Looking for cblas -- lib cblas not found") endif() endif () @@ -292,22 +294,22 @@ if (BLAS_FOUND) # CBLAS if (CBLAS_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}") + set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}") endif() if (CBLAS_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${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}") + list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}") endif() if (BLAS_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${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}") + list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}") endif() # set required libraries for link @@ -315,7 +317,7 @@ if (BLAS_FOUND) set(CMAKE_REQUIRED_LIBRARIES) list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}") foreach(lib_dir ${REQUIRED_LIBDIRS}) - list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") + 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}") @@ -328,28 +330,28 @@ if (BLAS_FOUND) if(CBLAS_WORKS) - # Check for faster complex GEMM routine - # (only C/Z, no S/D version) - check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND) - if ( CBLAS_ZGEMM3M_FOUND ) - add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M) - endif() - - # 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) + # Check for faster complex GEMM routine + # (only C/Z, no S/D version) + check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND) + if ( CBLAS_ZGEMM3M_FOUND ) + add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M) + endif() + + # 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() + 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) diff --git a/CMakeModules/morse/find/FindCHAMELEON.cmake b/CMakeModules/morse/find/FindCHAMELEON.cmake index 9b581f5b908b590d612dbf5f235ae22e6977f4cc..3be331e5b8b2d3c163bc34dde4efcfeadfc3c3f3 100644 --- a/CMakeModules/morse/find/FindCHAMELEON.cmake +++ b/CMakeModules/morse/find/FindCHAMELEON.cmake @@ -37,6 +37,7 @@ # This module finds headers and chameleon library. # Results are reported in variables: # CHAMELEON_FOUND - True if headers and requested libraries were found +# CHAMELEON_C_FLAGS - list of required compilation flags (excluding -I) # 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 @@ -166,9 +167,10 @@ if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER) endif() endif() - set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_INCLUDE_DIRS}") - set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_LIBRARY_DIRS}") - set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_LIBRARIES}") + set(CHAMELEON_C_FLAGS "${CHAMELEON_CFLAGS_OTHER}") + set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_STATIC_INCLUDE_DIRS}") + set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_STATIC_LIBRARY_DIRS}") + set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_STATIC_LIBRARIES}") endif(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER) diff --git a/CMakeModules/morse/find/FindCPPCHECK.cmake b/CMakeModules/morse/find/FindCPPCHECK.cmake new file mode 100644 index 0000000000000000000000000000000000000000..0a97a8bb7afd190305e200bc46e00a0cceb94fe6 --- /dev/null +++ b/CMakeModules/morse/find/FindCPPCHECK.cmake @@ -0,0 +1,82 @@ +### +# +# @copyright (c) 2017 Inria. All rights reserved. +# +### +# +# - Find CPPCHECK bin directory +# Use this module by invoking find_package with the form: +# find_package(CPPCHECK +# [REQUIRED]) # Fail with error if cppcheck is not found +# +# This module finds headers and cppcheck library. +# Results are reported in variables: +# CPPCHECK_FOUND - True if cppcheck executable is found +# CPPCHECK_EXECUTABLE - cppcheck executable directory found +# +# The user can give specific paths where to find the libraries adding cmake +# options at configure (ex: cmake path/to/project -DCPPCHECK_DIR=path/to/cppcheck): +# CPPCHECK_DIR - Where to find the base directory of cppcheck +# CPPCHECK_BINDIR - Where to find the executable cppcheck +# The module can also look for the following environment variables if paths +# are not given as cmake variable: CPPCHECK_DIR, CPPCHECK_BINDIR + +if (NOT CPPCHECK_FOUND) + set(CPPCHECK_DIR "" CACHE PATH "Installation directory of CPPCHECK library") + mark_as_advanced(CPPCHECK_DIR) + if (NOT CPPCHECK_FIND_QUIETLY) + message(STATUS "A cache variable, namely CPPCHECK_DIR, has been set to specify the install directory of CPPCHECK") + endif() +endif() + +set(ENV_CPPCHECK_DIR "$ENV{CPPCHECK_DIR}") +set(ENV_CPPCHECK_BINDIR "$ENV{CPPCHECK_BINDIR}") +set(CPPCHECK_GIVEN_BY_USER "FALSE") +if ( CPPCHECK_DIR OR CPPCHECK_BINDIR OR ENV_CPPCHECK_DIR OR ENV_CPPCHECK_BINDIR ) + set(CPPCHECK_GIVEN_BY_USER "TRUE") +endif() + + +if (NOT CPPCHECK_FIND_QUIETLY) + message(STATUS "Looking for CPPCHECK") +endif() + +# Looking for executable +# ---------------------- + +# Add system include paths to search include +# ------------------------------------------ +unset(where_to_look) +if(CPPCHECK_BINDIR) + list(APPEND where_to_look "${CPPCHECK_BINDIR}") +elseif(CPPCHECK_DIR) + list(APPEND where_to_look "${CPPCHECK_DIR}") +elseif(ENV_CPPCHECK_BINDIR) + list(APPEND where_to_look "${ENV_CPPCHECK_BINDIR}") +elseif(ENV_CPPCHECK_DIR) + list(APPEND where_to_look "${ENV_CPPCHECK_DIR}/bin") +else() + string(REPLACE ":" ";" _path_env "$ENV{PATH}") + list(APPEND where_to_look "${_path_env}") +endif() +list(APPEND where_to_look "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}") +list(APPEND where_to_look "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") +list(REMOVE_DUPLICATES where_to_look) + +find_program(CPPCHECK_EXECUTABLE + NAMES cppcheck + HINTS ${where_to_look} +) +mark_as_advanced(CPPCHECK_EXECUTABLE) + +if(CPPCHECK_EXECUTABLE) + execute_process(COMMAND ${CPPCHECK_EXECUTABLE} "--version" OUTPUT_VARIABLE CPPCHECK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "Cppcheck " "" CPPCHECK_VERSION "${CPPCHECK_VERSION}") +endif() + +# check that CPPCHECK has been found +# ---------------------------------- +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CPPCHECK DEFAULT_MSG + CPPCHECK_EXECUTABLE + CPPCHECK_VERSION) diff --git a/CMakeModules/morse/find/FindEZTRACE.cmake b/CMakeModules/morse/find/FindEZTRACE.cmake index 7584c5e9f7f2d9ba42a272593134a1126c08d0f2..4c7447a86d581959ae81e502f46f49b62b65313e 100644 --- a/CMakeModules/morse/find/FindEZTRACE.cmake +++ b/CMakeModules/morse/find/FindEZTRACE.cmake @@ -20,6 +20,7 @@ # This module finds headers and eztrace library. # Results are reported in variables: # EZTRACE_FOUND - True if headers and requested libraries were found +# EZTRACE_C_FLAGS - list of required compilation flags (excluding -I) # EZTRACE_INCLUDE_DIRS - eztrace include directories # EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries # EZTRACE_LIBRARIES - eztrace component libraries to be linked @@ -86,6 +87,8 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER ) endif() endif() + set(EZTRACE_C_FLAGS "${EZTRACE_CFLAGS_OTHER}") + 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) ) diff --git a/CMakeModules/morse/find/FindFABULOUS.cmake b/CMakeModules/morse/find/FindFABULOUS.cmake new file mode 100644 index 0000000000000000000000000000000000000000..321ab43d01c662a915b8910f7f911ddbf9656241 --- /dev/null +++ b/CMakeModules/morse/find/FindFABULOUS.cmake @@ -0,0 +1,158 @@ +# - Try to find fabulous (C-api) +# +# If this script have difficulties to find fabulous, you can try to help +# it by setting the variable FABULOUS_DIR to the prefix path where fabulous +# was installed +# +# Once done this will define +# FABULOUS_FOUND - System has fabulous +# FABULOUS_INCLUDE_DIRS - The fabulous include directories +# FABULOUS_LIBRARIES - The libraries needed to use fabulous +# FABULOUS_DEFINITIONS - Compiler switches required for using fabulous + +include(FindPackageHandleStandardArgs) + +macro(FABULOUS_FIND_LIBRARIES_FROM_PKGCONFIG_RESULTS _prefix _pc_xprefix) + foreach(_library ${${_pc_xprefix}_LIBRARIES}) + get_filename_component(_library ${_library} NAME_WE) + unset(_library_path) + unset(_library_path CACHE) + find_library(_library_path NAMES ${_library} + HINTS ${${_pc_xprefix}_LIBDIR} ${${_pc_xprefix}_LIBRARY_DIRS} ) + if (_library_path) + list(APPEND ${_prefix}_LIBRARIES ${_library_path}) + else() + message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND") + endif() + unset(_library_path CACHE) + endforeach() +endmacro() + +macro(FABULOUS_CHECK_FUNCTION_EXISTS _prefix _function) + include(CheckFunctionExists) + unset(${_prefix}_WORKS) + unset(${_prefix}_WORKS CACHE) + set(CMAKE_REQUIRED_LIBRARIES ${${_prefix}_LIBRARIES}) + set(CMAKE_REQUIRED_INCLUDES ${${_prefix}_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_DEFINITIONS ${${_prefix}_DEFINITIONS}) + check_function_exists(${_function} ${_prefix}_WORKS) + set(CMAKE_REQUIRED_LIBRARIES "") + set(CMAKE_REQUIRED_INCLUDES "") + set(CMAKE_REQUIRED_DEFINITIONS "") + mark_as_advanced(${_prefix}_WORKS) +endmacro() + +find_package(PkgConfig QUIET) + +set(ENV_FABULOUS_DIR "$ENV{FABULOUS_DIR}") +set(ENV_FABULOUS_INCDIR "$ENV{FABULOUS_INCDIR}") +set(ENV_FABULOUS_LIBDIR "$ENV{FABULOUS_LIBDIR}") +set(FABULOUS_GIVEN_BY_USER "FALSE") +if ( FABULOUS_DIR OR ENV_FABULOUS_DIR + OR ( FABULOUS_INCDIR AND FABULOUS_LIBDIR ) + OR ( ENV_FABULOUS_INCDIR AND ENV_FABULOUS_LIBDIR ) ) + set(FABULOUS_GIVEN_BY_USER "TRUE") +endif() + +set(FABULOUS_STATIC_FIND_QUIETLY "TRUE") +set(FABULOUS_SHARED_FIND_QUIETLY "TRUE") + +if ((NOT FABULOUS_FOUND) AND (NOT FABULOUS_GIVEN_BY_USER) AND PKG_CONFIG_FOUND) + pkg_check_modules(PC_FABULOUS QUIET fabulous) + + find_path(FABULOUS_STATIC_INCLUDE_DIR NAMES fabulous.h + HINTS ${PC_FABULOUS_STATIC_INCLUDEDIR} ${PC_FABULOUS_STATIC_INCLUDE_DIRS} ) + find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a + HINTS ${PC_FABULOUS_STATIC_LIBDIR} ${PC_FABULOUS_STATIC_LIBRARY_DIRS} ) + + find_path(FABULOUS_SHARED_INCLUDE_DIR NAMES fabulous.h + HINTS ${PC_FABULOUS_INCLUDEDIR} ${PC_FABULOUS_INCLUDE_DIRS} ) + find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so + HINTS ${PC_FABULOUS_LIBDIR} ${PC_FABULOUS_LIBRARY_DIRS} ) + + # handle the QUIETLY and REQUIRED arguments and set FABULOUS_FOUND to TRUE + # if all listed variables are TRUE + + find_package_handle_standard_args( + FABULOUS_STATIC DEFAULT_MSG + FABULOUS_STATIC_LIBRARY FABULOUS_STATIC_INCLUDE_DIR) + mark_as_advanced(FABULOUS_STATIC_INCLUDE_DIR FABULOUS_STATIC_LIBRARY) + + find_package_handle_standard_args( + FABULOUS_SHARED DEFAULT_MSG + FABULOUS_SHARED_LIBRARY FABULOUS_SHARED_INCLUDE_DIR) + mark_as_advanced(FABULOUS_SHARED_INCLUDE_DIR FABULOUS_SHARED_LIBRARY) + + if (FABULOUS_STATIC_FOUND AND NOT FABULOUS_SHARED_FOUND) + set(FABULOUS_INCLUDE_DIRS ${FABULOUS_STATIC_INCLUDE_DIR} ) + set(FABULOUS_DEFINITIONS ${PC_FABULOUS_STATIC_CFLAGS_OTHER} ) + set(FABULOUS_LIBRARIES "") + fabulous_find_libraries_from_pkgconfig_results(FABULOUS PC_FABULOUS_STATIC) + elseif(FABULOUS_SHARED_FOUND) + set(FABULOUS_INCLUDE_DIRS ${FABULOUS_INCLUDE_DIR} ) + set(FABULOUS_DEFINITIONS ${PC_FABULOUS_CFLAGS_OTHER} ) + set(FABULOUS_LIBRARIES "") + fabulous_find_libraries_from_pkgconfig_results(FABULOUS PC_FABULOUS) + endif() + fabulous_check_function_exists(FABULOUS fabulous_create) + find_package_handle_standard_args( + FABULOUS DEFAULT_MSG + FABULOUS_LIBRARIES FABULOUS_INCLUDE_DIRS FABULOUS_WORKS) +endif() + +if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND))) + + # Currently the C-api (compiled version) does not depent on chameleon + # so the library only depends on CBLAS AND LAPACKE + + set(FABULOUS_DEFINITIONS "") + if ( ( FABULOUS_INCDIR AND FABULOUS_LIBDIR ) OR ( ENV_FABULOUS_INCDIR AND ENV_FABULOUS_LIBDIR ) ) + + if ((NOT FABULOUS_LIBDIR) AND (NOT FABULOUS_INCDIR) + AND (ENV_FABULOUS_INCDIR AND ENV_FABULOUS_LIBDIR) ) + set(FABULOUS_LIBDIR ${ENV_FABULOUS_LIBDIR}) + set(FABULOUS_INCDIR ${ENV_FABULOUS_INCDIR}) + endif() + + find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h HINTS ${FABULOUS_INCDIR}) + find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a HINTS ${FABULOUS_LIBDIR}) + find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so HINTS ${FABULOUS_LIBDIR}) + else() + if (ENV_FABULOUS_DIR AND NOT FABULOUS_DIR) + set(FABULOUS_DIR "${ENV_FABULOUS_DIR}" CACHE PATH "Installation prefix where fabulous is installed") + else() + set(FABULOUS_DIR "${FABULOUS_DIR}" CACHE PATH "Installation prefix where fabulous is installed") + endif() + + find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h + HINTS ${FABULOUS_DIR} + PATH_SUFFIXES include include/fabulous) + find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a + HINTS ${FABULOUS_DIR} + PATH_SUFFIXES lib lib32 lib64 lib/fabulous lib32/fabulous lib64/fabulous) + find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so + HINTS ${FABULOUS_DIR} + PATH_SUFFIXES lib lib32 lib64 lib/fabulous lib32/fabulous lib64/fabulous) + endif() + + find_package_handle_standard_args(FABULOUS_STATIC DEFAULT_MSG FABULOUS_STATIC_LIBRARY) + find_package_handle_standard_args(FABULOUS_SHARED DEFAULT_MSG FABULOUS_SHARED_LIBRARY) + mark_as_advanced(FABULOUS_STATIC_LIBRARY FABULOUS_SHARED_LIBRARY) + + if (FABULOUS_STATIC_FOUND AND NOT FABULOUS_SHARED_FOUND) + if (FABULOUS_FIND_REQUIRED) + find_package(CBLAS REQUIRED) + find_package(LAPACKE REQUIRED) + else() + find_package(CBLAS) + find_package(LAPACKE) + endif() + set(FABULOUS_LIBRARIES ${FABULOUS_STATIC_LIBRARY} ${CBLAS_LIBRARIES} ${LAPACKE_LIBRARIES}) + elseif(FABULOUS_SHARED_FOUND) + set(FABULOUS_LIBRARIES ${FABULOUS_SHARED_LIBRARY}) + endif() + fabulous_check_function_exists(FABULOUS fabulous_create) + find_package_handle_standard_args( + FABULOUS DEFAULT_MSG + FABULOUS_LIBRARIES FABULOUS_INCLUDE_DIRS FABULOUS_WORKS) +endif() diff --git a/CMakeModules/morse/find/FindFFTW.cmake b/CMakeModules/morse/find/FindFFTW.cmake index a9d8b1918a5a3be1e66efa20fd0df8c8abfef68a..14fbb7d2b94c17ce06ae5747f11642730c6ffdde 100644 --- a/CMakeModules/morse/find/FindFFTW.cmake +++ b/CMakeModules/morse/find/FindFFTW.cmake @@ -230,6 +230,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) pkg_search_module(FFTW3F fftw3f) pkg_search_module(FFTW3 fftw3) if (FFTW3F_FOUND) + set(FFTW_C_FLAGS "${FFTW3F_CFLAGS_OTHER}") if (NOT FFTW_FIND_QUIETLY) message(STATUS "Looking for FFTW3F - found using PkgConfig") endif() @@ -259,6 +260,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) pkg_search_module(FFTW3L fftw3l) pkg_search_module(FFTW3 fftw3) if (FFTW3L_FOUND) + set(FFTW_C_FLAGS "${FFTW3L_CFLAGS_OTHER}") if (NOT FFTW_FIND_QUIETLY) message(STATUS "Looking for FFTW3L - found using PkgConfig") endif() @@ -288,6 +290,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) pkg_search_module(FFTW3Q fftw3q) pkg_search_module(FFTW3 fftw3) if (FFTW3Q_FOUND) + set(FFTW_C_FLAGS "${FFTW3Q_CFLAGS_OTHER}") if (NOT FFTW_FIND_QUIETLY) message(STATUS "Looking for FFTW3Q - found using PkgConfig") endif() @@ -317,6 +320,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) pkg_search_module(FFTW3 fftw3) endif() if (FFTW3_FOUND) + set(FFTW_C_FLAGS "${FFTW3_CFLAGS_OTHER}") if (NOT FFTW_FIND_QUIETLY) message(STATUS "Looking for FFTW3 - found using PkgConfig") endif() @@ -324,7 +328,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) list(APPEND FFTW_LIBRARIES "${FFTW3_LIBRARIES}") endif() if(FFTW3_INCLUDE_DIRS) - list(APPEND FFTW_INCLUDE_DIRS "${FFTW3_INCLUDE_DIRS}") + list(APPEND FFTW_INCLUDE_DIRS "${FFTW3_INCLUDE_DIRS}") else() if (NOT FFTW_FIND_QUIETLY) message(WARNING "FFTW3_INCLUDE_DIRS is empty using PkgConfig." @@ -333,7 +337,7 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) endif() endif() if(FFTW3_LIBRARY_DIRS) - list(APPEND FFTW_LIBRARY_DIRS "${FFTW3_LIBRARY_DIRS}") + list(APPEND FFTW_LIBRARY_DIRS "${FFTW3_LIBRARY_DIRS}") endif() else(FFTW3_FOUND) if (NOT FFTW_FIND_QUIETLY) @@ -343,9 +347,9 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL) endif() endif(FFTW3_FOUND) - set(FFTW_INCLUDE_DIRS_DEP "${FFTW_INCLUDE_DIRS}") - set(FFTW_LIBRARY_DIRS_DEP "${FFTW_LIBRARY_DIRS}") - set(FFTW_LIBRARIES_DEP "${FFTW_LIBRARIES}" ) + set(FFTW_INCLUDE_DIRS_DEP "${FFTW_STATIC_INCLUDE_DIRS}") + set(FFTW_LIBRARY_DIRS_DEP "${FFTW_STATIC_LIBRARY_DIRS}") + set(FFTW_LIBRARIES_DEP "${FFTW_STATIC_LIBRARIES}" ) if (FFTW_LIBRARIES) set(FFTW_WORKS TRUE) @@ -763,8 +767,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}") message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") endif() - else() - set(FFTW_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) endif() set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_FLAGS) diff --git a/CMakeModules/morse/find/FindFXT.cmake b/CMakeModules/morse/find/FindFXT.cmake index 3fd9a6eb2d461ce3e86a7a515b570e30f98b6820..754ee7d651c2c792dbde76be087b171dd8ca9a33 100644 --- a/CMakeModules/morse/find/FindFXT.cmake +++ b/CMakeModules/morse/find/FindFXT.cmake @@ -16,6 +16,7 @@ # This module finds headers and fxt library. # Results are reported in variables: # FXT_FOUND - True if headers and requested libraries were found +# FXT_C_FLAGS - list of required compilation flags (excluding -I) # FXT_INCLUDE_DIRS - fxt include directories # FXT_LIBRARY_DIRS - Link directories for fxt libraries # FXT_LIBRARIES - fxt component libraries to be linked @@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER) endif() endif() + set(FXT_C_FLAGS "${FXT_CFLAGS_OTHER}") + 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) ) diff --git a/CMakeModules/morse/find/FindGTG.cmake b/CMakeModules/morse/find/FindGTG.cmake new file mode 100644 index 0000000000000000000000000000000000000000..dbdaf01d716e89bf3b053f3600e73003b0918659 --- /dev/null +++ b/CMakeModules/morse/find/FindGTG.cmake @@ -0,0 +1,313 @@ +### +# +# @copyright (c) 2009-2014 The University of Tennessee and The University +# of Tennessee Research Foundation. +# All rights reserved. +# @copyright (c) 2012-2017 Inria. All rights reserved. +# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. +# +### +# +# - Find GTG include dirs and libraries +# Use this module by invoking find_package with the form: +# find_package(GTG +# [REQUIRED]) # Fail with error if gtg is not found +# +# This module finds headers and gtg library. +# Results are reported in variables: +# GTG_FOUND - True if headers and requested libraries were found +# GTG_C_FLAGS - list of required compilation flags (excluding -I) +# GTG_INCLUDE_DIRS - gtg include directories +# GTG_LIBRARY_DIRS - Link directories for gtg libraries +# GTG_LIBRARIES - gtg 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 -DGTG_DIR=path/to/gtg): +# GTG_DIR - Where to find the base directory of gtg +# GTG_INCDIR - Where to find the header files +# GTG_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: GTG_DIR, GTG_INCDIR, GTG_LIBDIR + +#============================================================================= +# Copyright 2012-2017 Inria +# Copyright 2012-2013 Emmanuel Agullo +# Copyright 2012-2013 Mathieu Faverge +# Copyright 2012 Cedric Castagnede +# Copyright 2013-2017 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 GTG_FOUND) + set(GTG_DIR "" CACHE PATH "Installation directory of GTG library") + if (NOT GTG_FIND_QUIETLY) + message(STATUS "A cache variable, namely GTG_DIR, has been set to specify the install directory of GTG") + endif() +endif() + +set(ENV_GTG_DIR "$ENV{GTG_DIR}") +set(ENV_GTG_INCDIR "$ENV{GTG_INCDIR}") +set(ENV_GTG_LIBDIR "$ENV{GTG_LIBDIR}") +set(GTG_GIVEN_BY_USER "FALSE") +if ( GTG_DIR OR ( GTG_INCDIR AND GTG_LIBDIR) OR ENV_GTG_DIR OR (ENV_GTG_INCDIR AND ENV_GTG_LIBDIR) ) + set(GTG_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 GTG_GIVEN_BY_USER) + + pkg_search_module(GTG gtg) + if (NOT GTG_FIND_QUIETLY) + if (GTG_FOUND AND GTG_LIBRARIES) + message(STATUS "Looking for GTG - found using PkgConfig") + #if(NOT GTG_INCLUDE_DIRS) + # message("${Magenta}GTG_INCLUDE_DIRS is empty using PkgConfig." + # "Perhaps the path to gtg headers is already present in your" + # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") + #endif() + else() + message(STATUS "${Magenta}Looking for GTG - not found using PkgConfig." + "\n Perhaps you should add the directory containing gtg.pc to the" + "\n PKG_CONFIG_PATH environment variable.${ColourReset}") + endif() + endif() + + set(GTG_C_FLAGS "${GTG_CFLAGS_OTHER}") + +endif(PKG_CONFIG_EXECUTABLE AND NOT GTG_GIVEN_BY_USER) + +if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT GTG_FOUND) OR (GTG_GIVEN_BY_USER) ) + + if (NOT GTG_FIND_QUIETLY) + message(STATUS "Looking for GTG - PkgConfig not used") + endif() + + # Looking for include + # ------------------- + + # Add system include paths to search include + # ------------------------------------------ + unset(_inc_env) + set(ENV_GTG_DIR "$ENV{GTG_DIR}") + set(ENV_GTG_INCDIR "$ENV{GTG_INCDIR}") + if(ENV_GTG_INCDIR) + list(APPEND _inc_env "${ENV_GTG_INCDIR}") + elseif(ENV_GTG_DIR) + list(APPEND _inc_env "${ENV_GTG_DIR}") + list(APPEND _inc_env "${ENV_GTG_DIR}/include") + list(APPEND _inc_env "${ENV_GTG_DIR}/include/gtg") + 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 gtg header in the given paths + # ------------------------------------------------- + # call cmake macro to find the header path + if(GTG_INCDIR) + set(GTG_GTG.h_DIRS "GTG_GTG.h_DIRS-NOTFOUND") + find_path(GTG_GTG.h_DIRS + NAMES GTG.h + HINTS ${GTG_INCDIR}) + else() + if(GTG_DIR) + set(GTG_GTG.h_DIRS "GTG_GTG.h_DIRS-NOTFOUND") + find_path(GTG_GTG.h_DIRS + NAMES GTG.h + HINTS ${GTG_DIR} + PATH_SUFFIXES "include" "include/gtg") + else() + set(GTG_GTG.h_DIRS "GTG_GTG.h_DIRS-NOTFOUND") + find_path(GTG_GTG.h_DIRS + NAMES GTG.h + HINTS ${_inc_env} + PATH_SUFFIXES "gtg") + endif() + endif() + mark_as_advanced(GTG_GTG.h_DIRS) + + # Add path to cmake variable + # ------------------------------------ + if (GTG_GTG.h_DIRS) + set(GTG_INCLUDE_DIRS "${GTG_GTG.h_DIRS}") + else () + set(GTG_INCLUDE_DIRS "GTG_INCLUDE_DIRS-NOTFOUND") + if(NOT GTG_FIND_QUIETLY) + message(STATUS "Looking for gtg -- GTG.h not found") + endif() + endif () + + if (GTG_INCLUDE_DIRS) + list(REMOVE_DUPLICATES GTG_INCLUDE_DIRS) + endif () + + + # Looking for lib + # --------------- + + # Add system library paths to search lib + # -------------------------------------- + unset(_lib_env) + set(ENV_GTG_LIBDIR "$ENV{GTG_LIBDIR}") + if(ENV_GTG_LIBDIR) + list(APPEND _lib_env "${ENV_GTG_LIBDIR}") + elseif(ENV_GTG_DIR) + list(APPEND _lib_env "${ENV_GTG_DIR}") + list(APPEND _lib_env "${ENV_GTG_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 gtg lib in the given paths + # ---------------------------------------------- + + # call cmake macro to find the lib path + if(GTG_LIBDIR) + set(GTG_gtg_LIBRARY "GTG_gtg_LIBRARY-NOTFOUND") + find_library(GTG_gtg_LIBRARY + NAMES gtg + HINTS ${GTG_LIBDIR}) + else() + if(GTG_DIR) + set(GTG_gtg_LIBRARY "GTG_gtg_LIBRARY-NOTFOUND") + find_library(GTG_gtg_LIBRARY + NAMES gtg + HINTS ${GTG_DIR} + PATH_SUFFIXES lib lib32 lib64) + else() + set(GTG_gtg_LIBRARY "GTG_gtg_LIBRARY-NOTFOUND") + find_library(GTG_gtg_LIBRARY + NAMES gtg + HINTS ${_lib_env}) + endif() + endif() + mark_as_advanced(GTG_gtg_LIBRARY) + + # If found, add path to cmake variable + # ------------------------------------ + if (GTG_gtg_LIBRARY) + get_filename_component(gtg_lib_path ${GTG_gtg_LIBRARY} PATH) + # set cmake variables (respects naming convention) + set(GTG_LIBRARIES "${GTG_gtg_LIBRARY}") + set(GTG_LIBRARY_DIRS "${gtg_lib_path}") + else () + set(GTG_LIBRARIES "GTG_LIBRARIES-NOTFOUND") + set(GTG_LIBRARY_DIRS "GTG_LIBRARY_DIRS-NOTFOUND") + if(NOT GTG_FIND_QUIETLY) + message(STATUS "Looking for gtg -- lib gtg not found") + endif() + endif () + + if (GTG_LIBRARY_DIRS) + list(REMOVE_DUPLICATES GTG_LIBRARY_DIRS) + endif () + + # check a function to validate the find + if(GTG_LIBRARIES) + + set(REQUIRED_INCDIRS) + set(REQUIRED_LIBDIRS) + set(REQUIRED_LIBS) + + # GTG + if (GTG_INCLUDE_DIRS) + set(REQUIRED_INCDIRS "${GTG_INCLUDE_DIRS}") + endif() + if (GTG_LIBRARY_DIRS) + set(REQUIRED_LIBDIRS "${GTG_LIBRARY_DIRS}") + endif() + set(REQUIRED_LIBS "${GTG_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(GTG_WORKS CACHE) + include(CheckFunctionExists) + check_function_exists(initTrace GTG_WORKS) + mark_as_advanced(GTG_WORKS) + + if(NOT GTG_WORKS) + if(NOT GTG_FIND_QUIETLY) + message(STATUS "Looking for gtg : test of GTG_start with gtg 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(GTG_LIBRARIES) + +endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT GTG_FOUND) OR (GTG_GIVEN_BY_USER) ) + +if (GTG_LIBRARIES) + if (GTG_LIBRARY_DIRS) + list(GET GTG_LIBRARY_DIRS 0 first_lib_path) + else() + list(GET GTG_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(GTG_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of GTG library" FORCE) + else() + set(GTG_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of GTG library" FORCE) + endif() +endif() +mark_as_advanced(GTG_DIR) +mark_as_advanced(GTG_DIR_FOUND) + +# check that GTG has been found +# ------------------------------- +include(FindPackageHandleStandardArgs) +if (PKG_CONFIG_EXECUTABLE AND GTG_FOUND) + find_package_handle_standard_args(GTG DEFAULT_MSG + GTG_LIBRARIES) +else() + find_package_handle_standard_args(GTG DEFAULT_MSG + GTG_LIBRARIES + GTG_WORKS) +endif() diff --git a/CMakeModules/morse/find/FindHQR.cmake b/CMakeModules/morse/find/FindHQR.cmake new file mode 100644 index 0000000000000000000000000000000000000000..14863c2b8e5e6e31499cf968d3903598475a07bc --- /dev/null +++ b/CMakeModules/morse/find/FindHQR.cmake @@ -0,0 +1,307 @@ +### +# +# @copyright (c) 2009-2014 The University of Tennessee and The University +# of Tennessee Research Foundation. +# All rights reserved. +# @copyright (c) 2012-2017 Inria. All rights reserved. +# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. +# +### +# +# - Find HQR include dirs and libraries +# Use this module by invoking find_package with the form: +# find_package(HQR +# [REQUIRED]) # Fail with error if hqr is not found +# +# This module finds headers and hqr library. +# Results are reported in variables: +# HQR_FOUND - True if headers and requested libraries were found +# HQR_INCLUDE_DIRS - hqr include directories +# HQR_LIBRARY_DIRS - Link directories for hqr libraries +# HQR_LIBRARIES - hqr 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 -DHQR_DIR=path/to/hqr): +# HQR_DIR - Where to find the base directory of hqr +# HQR_INCDIR - Where to find the header files +# HQR_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: HQR_DIR, HQR_INCDIR, HQR_LIBDIR + +#============================================================================= +# Copyright 2012-2017 Inria +# Copyright 2012-2013 Emmanuel Agullo +# Copyright 2012-2013 Mathieu Faverge +# Copyright 2012 Cedric Castagnede +# Copyright 2013-2017 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 HQR_FOUND) + set(HQR_DIR "" CACHE PATH "Installation directory of HQR library") + if (NOT HQR_FIND_QUIETLY) + message(STATUS "A cache variable, namely HQR_DIR, has been set to specify the install directory of HQR") + endif() +endif() + +set(ENV_HQR_DIR "$ENV{HQR_DIR}") +set(ENV_HQR_INCDIR "$ENV{HQR_INCDIR}") +set(ENV_HQR_LIBDIR "$ENV{HQR_LIBDIR}") +set(HQR_GIVEN_BY_USER "FALSE") +if ( HQR_DIR OR ( HQR_INCDIR AND HQR_LIBDIR) OR ENV_HQR_DIR OR (ENV_HQR_INCDIR AND ENV_HQR_LIBDIR) ) + set(HQR_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 HQR_GIVEN_BY_USER) + + pkg_search_module(HQR hqr) + if (NOT HQR_FIND_QUIETLY) + if (HQR_FOUND AND HQR_LIBRARIES) + message(STATUS "Looking for HQR - found using PkgConfig") + #if(NOT HQR_INCLUDE_DIRS) + # message("${Magenta}HQR_INCLUDE_DIRS is empty using PkgConfig." + # "Perhaps the path to hqr headers is already present in your" + # "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}") + #endif() + else() + message(STATUS "${Magenta}Looking for HQR - not found using PkgConfig." + "\n Perhaps you should add the directory containing hqr.pc to the" + "\n PKG_CONFIG_PATH environment variable.${ColourReset}") + endif() + endif() + +endif(PKG_CONFIG_EXECUTABLE AND NOT HQR_GIVEN_BY_USER) + +if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR (HQR_GIVEN_BY_USER) ) + + if (NOT HQR_FIND_QUIETLY) + message(STATUS "Looking for HQR - PkgConfig not used") + endif() + + # Looking for include + # ------------------- + + # Add system include paths to search include + # ------------------------------------------ + unset(_inc_env) + set(ENV_HQR_DIR "$ENV{HQR_DIR}") + set(ENV_HQR_INCDIR "$ENV{HQR_INCDIR}") + if(ENV_HQR_INCDIR) + list(APPEND _inc_env "${ENV_HQR_INCDIR}") + elseif(ENV_HQR_DIR) + list(APPEND _inc_env "${ENV_HQR_DIR}") + list(APPEND _inc_env "${ENV_HQR_DIR}/include") + 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 hqr header in the given paths + # ------------------------------------------------- + # call cmake macro to find the header path + if(HQR_INCDIR) + set(HQR_HQR.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND") + find_path(HQR_libhqr.h_DIRS + NAMES libhqr.h + HINTS ${HQR_INCDIR}) + else() + if(HQR_DIR) + set(HQR_libhqr.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND") + find_path(HQR_libhqr.h_DIRS + NAMES libhqr.h + HINTS ${HQR_DIR} + else() + set(HQR_libhqr.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND") + find_path(HQR_libhqr.h_DIRS + NAMES libhqr.h + HINTS ${_inc_env} + PATH_SUFFIXES "hqr") + endif() + endif() + mark_as_advanced(HQR_libhqr.h_DIRS) + + # Add path to cmake variable + # ------------------------------------ + if (HQR_libhqr.h_DIRS) + set(HQR_INCLUDE_DIRS "${HQR_libhqr.h_DIRS}") + else () + set(HQR_INCLUDE_DIRS "HQR_INCLUDE_DIRS-NOTFOUND") + if(NOT HQR_FIND_QUIETLY) + message(STATUS "Looking for hqr -- libhqr.h not found") + endif() + endif () + + if (HQR_INCLUDE_DIRS) + list(REMOVE_DUPLICATES HQR_INCLUDE_DIRS) + endif () + + # Looking for lib + # --------------- + + # Add system library paths to search lib + # -------------------------------------- + unset(_lib_env) + set(ENV_HQR_LIBDIR "$ENV{HQR_LIBDIR}") + if(ENV_HQR_LIBDIR) + list(APPEND _lib_env "${ENV_HQR_LIBDIR}") + elseif(ENV_HQR_DIR) + list(APPEND _lib_env "${ENV_HQR_DIR}") + list(APPEND _lib_env "${ENV_HQR_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 hqr lib in the given paths + # ---------------------------------------------- + + # call cmake macro to find the lib path + if(HQR_LIBDIR) + set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND") + find_library(HQR_hqr_LIBRARY + NAMES hqr + HINTS ${HQR_LIBDIR}) + else() + if(HQR_DIR) + set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND") + find_library(HQR_hqr_LIBRARY + NAMES hqr + HINTS ${HQR_DIR} + PATH_SUFFIXES lib lib32 lib64) + else() + set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND") + find_library(HQR_hqr_LIBRARY + NAMES hqr + HINTS ${_lib_env}) + endif() + endif() + mark_as_advanced(HQR_hqr_LIBRARY) + + # If found, add path to cmake variable + # ------------------------------------ + if (HQR_hqr_LIBRARY) + get_filename_component(hqr_lib_path ${HQR_hqr_LIBRARY} PATH) + # set cmake variables (respects naming convention) + set(HQR_LIBRARIES "${HQR_hqr_LIBRARY}") + set(HQR_LIBRARY_DIRS "${hqr_lib_path}") + else () + set(HQR_LIBRARIES "HQR_LIBRARIES-NOTFOUND") + set(HQR_LIBRARY_DIRS "HQR_LIBRARY_DIRS-NOTFOUND") + if(NOT HQR_FIND_QUIETLY) + message(STATUS "Looking for hqr -- lib hqr not found") + endif() + endif () + + if (HQR_LIBRARY_DIRS) + list(REMOVE_DUPLICATES HQR_LIBRARY_DIRS) + endif () + + # check a function to validate the find + if(HQR_LIBRARIES) + + set(REQUIRED_INCDIRS) + set(REQUIRED_LIBDIRS) + set(REQUIRED_LIBS) + + # HQR + if (HQR_INCLUDE_DIRS) + set(REQUIRED_INCDIRS "${HQR_INCLUDE_DIRS}") + endif() + if (HQR_LIBRARY_DIRS) + set(REQUIRED_LIBDIRS "${HQR_LIBRARY_DIRS}") + endif() + set(REQUIRED_LIBS "${HQR_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(HQR_WORKS CACHE) + include(CheckFunctionExists) + check_function_exists(libhqr_hqr_init HQR_WORKS) + mark_as_advanced(HQR_WORKS) + + if(NOT HQR_WORKS) + if(NOT HQR_FIND_QUIETLY) + message(STATUS "Looking for hqr : test of libhqr_hqr_init with hqr library fails") + message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}") + message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") + message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") + endif() + endif() + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_LIBRARIES) + endif(HQR_LIBRARIES) + +endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR (HQR_GIVEN_BY_USER) ) + +if (HQR_LIBRARIES) + if (HQR_LIBRARY_DIRS) + list(GET HQR_LIBRARY_DIRS 0 first_lib_path) + else() + list(GET HQR_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(HQR_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of HQR library" FORCE) + else() + set(HQR_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of HQR library" FORCE) + endif() +endif() +mark_as_advanced(HQR_DIR) +mark_as_advanced(HQR_DIR_FOUND) + +# check that HQR has been found +# ------------------------------- +include(FindPackageHandleStandardArgs) +if (PKG_CONFIG_EXECUTABLE AND HQR_FOUND) + find_package_handle_standard_args(HQR DEFAULT_MSG + HQR_LIBRARIES) +else() + find_package_handle_standard_args(HQR DEFAULT_MSG + HQR_LIBRARIES + HQR_WORKS) +endif() diff --git a/CMakeModules/morse/find/FindHWLOC.cmake b/CMakeModules/morse/find/FindHWLOC.cmake index a831b5c725acc0b88dfba169e3ed477dd5bf2910..4d7c47f7ba6d4ff7507894c5c25c234a8ffbea95 100644 --- a/CMakeModules/morse/find/FindHWLOC.cmake +++ b/CMakeModules/morse/find/FindHWLOC.cmake @@ -16,6 +16,7 @@ # This module finds headers and hwloc library. # Results are reported in variables: # HWLOC_FOUND - True if headers and requested libraries were found +# HWLOC_C_FLAGS - list of required compilation flags (excluding -I) # HWLOC_INCLUDE_DIRS - hwloc include directories # HWLOC_LIBRARY_DIRS - Link directories for hwloc libraries # HWLOC_LIBRARIES - hwloc component libraries to be linked @@ -85,6 +86,8 @@ if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER ) endif() endif() + set(HWLOC_C_FLAGS "${HWLOC_CFLAGS_OTHER}") + 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) ) @@ -318,6 +321,18 @@ endif() if (HWLOC_FOUND) set(HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) list(APPEND CMAKE_REQUIRED_INCLUDES ${HWLOC_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES) + if (HWLOC_LIBRARY_DIRS) + set (LIBDIR ${HWLOC_LIBRARY_DIRS}) + elseif(HWLOC_LIBDIR) + set (LIBDIR ${HWLOC_LIBDIR}) + endif() + if (LIBDIR) + foreach(lib_dir ${LIBDIR}) + list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") + endforeach() + endif() + string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") # test headers to guess the version check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER ) diff --git a/CMakeModules/morse/find/FindLAPACK.cmake b/CMakeModules/morse/find/FindLAPACK.cmake index 378a8fdb81c63b518bb11a7c29832b201a116fb8..0a517819e60c9d81e1147f9bcf8e2a1a327547b8 100644 --- a/CMakeModules/morse/find/FindLAPACK.cmake +++ b/CMakeModules/morse/find/FindLAPACK.cmake @@ -29,6 +29,7 @@ # 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 +# LAPACK_VENDOR_FOUND stores the LAPACK vendor found # 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): @@ -73,18 +74,18 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find) else() if(${LIBNAME}_DIR) message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}" - "has not been found in ${ARGN}${ColourReset}") + "has not been found in ${ARGN}${ColourReset}") else() message("${Yellow}${_lib_to_find} not found." - "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" - "are defined so that we look for ${_lib_to_find} in" - "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," - "Mac: DYLD_LIBRARY_PATH," - "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," - "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") + "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR" + "are defined so that we look for ${_lib_to_find} in" + "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB," + "Mac: DYLD_LIBRARY_PATH," + "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES," + "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}") if(_lib_env) - message("${Yellow}${_lib_to_find} has not been found in" - "${_lib_env}${ColourReset}") + message("${Yellow}${_lib_to_find} has not been found in" + "${_lib_env}${ColourReset}") endif() endif() endif() @@ -150,11 +151,11 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads list(APPEND _libdir "${BLAS_DIR}") list(APPEND _libdir "${BLAS_DIR}/lib") if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${BLAS_DIR}/lib64") - list(APPEND _libdir "${BLAS_DIR}/lib/intel64") + list(APPEND _libdir "${BLAS_DIR}/lib64") + list(APPEND _libdir "${BLAS_DIR}/lib/intel64") else() - list(APPEND _libdir "${BLAS_DIR}/lib32") - list(APPEND _libdir "${BLAS_DIR}/lib/ia32") + list(APPEND _libdir "${BLAS_DIR}/lib32") + list(APPEND _libdir "${BLAS_DIR}/lib/ia32") endif() elseif(ENV_BLAS_LIBDIR) list(APPEND _libdir "${ENV_BLAS_LIBDIR}") @@ -162,11 +163,11 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads list(APPEND _libdir "${ENV_BLAS_DIR}") list(APPEND _libdir "${ENV_BLAS_DIR}/lib") if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - list(APPEND _libdir "${ENV_BLAS_DIR}/lib64") - list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64") + list(APPEND _libdir "${ENV_BLAS_DIR}/lib64") + list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64") else() - list(APPEND _libdir "${ENV_BLAS_DIR}/lib32") - list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32") + list(APPEND _libdir "${ENV_BLAS_DIR}/lib32") + list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32") endif() endif() if (LAPACK_LIBDIR) @@ -175,11 +176,11 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads 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") + 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") + list(APPEND _libdir "${LAPACK_DIR}/lib32") + list(APPEND _libdir "${LAPACK_DIR}/lib/ia32") endif() elseif(ENV_LAPACK_LIBDIR) list(APPEND _libdir "${ENV_LAPACK_LIBDIR}") @@ -187,29 +188,29 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads 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") + 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") + 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() + list(APPEND _libdir "${ENV_MKLROOT}/lib") + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + list(APPEND _libdir "${ENV_MKLROOT}/lib64") + list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64") + else() + list(APPEND _libdir "${ENV_MKLROOT}/lib32") + list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32") + endif() endif() if (WIN32) - string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") + string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") elseif (APPLE) - string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") + string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") else () - string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") + string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") endif () list(APPEND _libdir "${_libdir2}") list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") @@ -226,30 +227,30 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads if(_libraries_work) if (BLA_STATIC) - if (WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif ( WIN32 ) - if (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else (APPLE) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif (APPLE) + if (WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif ( WIN32 ) + if (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else (APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif (APPLE) else (BLA_STATIC) - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif () + 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} - NO_DEFAULT_PATH - ) + NAMES ${_library} + HINTS ${_libdir} + NO_DEFAULT_PATH + ) 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}) + Print_Find_Library_Blas_Status(lapack ${_library} ${_libdir}) endif () set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) @@ -269,7 +270,7 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _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}") + "following libraries: ${CMAKE_REQUIRED_LIBRARIES}") endif () if(NOT LAPACK_FOUND) unset(${_prefix}${_combined_name}_WORKS CACHE) @@ -326,109 +327,149 @@ if(BLAS_FOUND) endif() endif() - #intel lapack - if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - - 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") + # check if blas lib contains lapack symbols + if (BLAS_LIBRARIES) + if (BLAS_LIBRARIES_DEP) + set(LIBRARIES ${BLAS_LIBRARIES_DEP}) + else() + set(LIBRARIES ${BLAS_LIBRARIES}) + endif() + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + "CHEEV" + "" + "" + "${LIBRARIES}" + "" + ) + if (LAPACK_LIBRARIES) + if(NOT LAPACK_FIND_QUIETLY) + if(LAPACK_LIBRARIES) + message(STATUS "Looking for LAPACK in BLAS: found") + else() + message(STATUS "Looking for LAPACK in BLAS: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "${BLAS_VENDOR_FOUND}") endif() + endif() + endif(BLAS_LIBRARIES) - 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() + #intel lapack + if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - # First try empty lapack libs - if (NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - LAPACK - ${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} - LAPACK - ${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 () - if(NOT LAPACK_FIND_QUIETLY) - if(${_LIBRARIES}) - message(STATUS "Looking for MKL LAPACK: found") - else() - message(STATUS "Looking for MKL LAPACK: not found") - endif() - endif() - endif () - endif() + if(NOT LAPACK_LIBRARIES) + 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(BLA_F95) + 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(BLA_F95) + + # First try empty lapack libs + if (NOT ${_LIBRARIES}) + check_lapack_libraries( + ${_LIBRARIES} + LAPACK + ${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} + LAPACK + ${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 () + if(NOT LAPACK_FIND_QUIETLY) + if(${_LIBRARIES}) + message(STATUS "Looking for MKL LAPACK: found") + else() + message(STATUS "Looking for MKL LAPACK: not found") + endif() + endif(NOT LAPACK_FIND_QUIETLY) + if (${_LIBRARIES} AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "Intel MKL") + endif() + + endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) + endif(NOT LAPACK_LIBRARIES) + endif(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") #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}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheev + "" + "goto2" + "${BLAS_LIBRARIES}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for Goto LAPACK: found") - else() - message(STATUS "Looking for Goto LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for Goto LAPACK: found") + else() + message(STATUS "Looking for Goto LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "Goto") endif() endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") @@ -437,20 +478,23 @@ if(BLAS_FOUND) if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "openblas" - "${BLAS_LIBRARIES}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheev + "" + "openblas" + "${BLAS_LIBRARIES}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for Open LAPACK: found") - else() - message(STATUS "Looking for Open LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for Open LAPACK: found") + else() + message(STATUS "Looking for Open LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "Openblas") endif() endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All") @@ -459,20 +503,23 @@ if(BLAS_FOUND) if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheevd - "" - "essl;lapack" - "${BLAS_LIBRARIES}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheevd + "" + "essl;lapack" + "${BLAS_LIBRARIES}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for IBM ESSL LAPACK: found") - else() - message(STATUS "Looking for IBM ESSL LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for IBM ESSL LAPACK: found") + else() + message(STATUS "Looking for IBM ESSL LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "IBM ESSL") endif() endif() endif () @@ -481,20 +528,23 @@ if(BLAS_FOUND) if (BLA_VENDOR STREQUAL "IBMESSLMT" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheevd - "" - "esslsmp;lapack" - "${BLAS_PAR_LIBRARIES}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheevd + "" + "esslsmp;lapack" + "${BLAS_PAR_LIBRARIES}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for IBM ESSL MT LAPACK: found") - else() - message(STATUS "Looking for IBM ESSL MT LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for IBM ESSL MT LAPACK: found") + else() + message(STATUS "Looking for IBM ESSL MT LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "IBM ESSL MT") endif() endif() endif () @@ -504,11 +554,14 @@ if(BLAS_FOUND) if (BLAS_LIBRARIES MATCHES ".+acml.+") set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for ACML LAPACK: found") - else() - message(STATUS "Looking for ACML LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for ACML LAPACK: found") + else() + message(STATUS "Looking for ACML LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "ACML") endif() endif () endif () @@ -517,20 +570,23 @@ if(BLAS_FOUND) if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") if(NOT LAPACK_LIBRARIES) check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "${BLAS_LIBRARIES}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheev + "" + "Accelerate" + "${BLAS_LIBRARIES}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for Apple Accelerate LAPACK: found") - else() - message(STATUS "Looking for Apple Accelerate LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for Apple Accelerate LAPACK: found") + else() + message(STATUS "Looking for Apple Accelerate LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "Apple Accelerate") endif() endif(NOT LAPACK_LIBRARIES) endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") @@ -538,20 +594,23 @@ if(BLAS_FOUND) if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") if ( NOT LAPACK_LIBRARIES ) check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "${BLAS_LIBRARIES}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheev + "" + "vecLib" + "${BLAS_LIBRARIES}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for NAS LAPACK: found") - else() - message(STATUS "Looking for NAS LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for NAS LAPACK: found") + else() + message(STATUS "Looking for NAS LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "NAS") endif() endif ( NOT LAPACK_LIBRARIES ) endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") @@ -562,20 +621,23 @@ if(BLAS_FOUND) BLA_VENDOR STREQUAL "All") if ( NOT LAPACK_LIBRARIES ) check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack" - "${BLAS_LIBRARIES};${LM}" - "" - ) + LAPACK_LIBRARIES + LAPACK + cheev + "" + "lapack" + "${BLAS_LIBRARIES};${LM}" + "" + ) if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_LIBRARIES) - message(STATUS "Looking for Generic LAPACK: found") - else() - message(STATUS "Looking for Generic LAPACK: not found") - endif() + if(LAPACK_LIBRARIES) + message(STATUS "Looking for Generic LAPACK: found") + else() + message(STATUS "Looking for Generic LAPACK: not found") + endif() + endif() + if (LAPACK_LIBRARIES AND NOT LAPACK_VENDOR_FOUND) + set (LAPACK_VENDOR_FOUND "Netlib or other Generic liblapack") endif() endif ( NOT LAPACK_LIBRARIES ) endif () @@ -595,23 +657,23 @@ if(BLA_F95) 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") + "\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." - ) + 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." - ) + 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) @@ -630,23 +692,23 @@ else(BLA_F95) 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") + "\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." - ) + 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." - ) + 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) diff --git a/CMakeModules/morse/find/FindLAPACKE.cmake b/CMakeModules/morse/find/FindLAPACKE.cmake index 145f85e18c06d258be8797ddc6f6b40379223c35..55fc87e6960acd11223a2ea65cea10f36ec1de94 100644 --- a/CMakeModules/morse/find/FindLAPACKE.cmake +++ b/CMakeModules/morse/find/FindLAPACKE.cmake @@ -91,18 +91,20 @@ if (LAPACK_FOUND) if(LAPACKE_WORKS) if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke: test with lapack succeeds") + message(STATUS "Looking for lapacke: test with lapack succeeds") endif() # test succeeds: LAPACKE is in LAPACK set(LAPACKE_LIBRARIES "${LAPACK_LIBRARIES}") + set(LAPACKE_LIBRARIES_DEP "${LAPACK_LIBRARIES}") if (LAPACK_LIBRARY_DIRS) - set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}") + set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}") endif() if(LAPACK_INCLUDE_DIRS) - set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}") + set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}") + set(LAPACKE_INCLUDE_DIRS_DEP "${LAPACK_INCLUDE_DIRS}") endif() if (LAPACK_LINKER_FLAGS) - set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") + set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") endif() endif() endif (NOT LAPACKE_STANDALONE) @@ -133,16 +135,16 @@ if (LAPACK_FOUND) list(APPEND _inc_env "${ENV_LAPACKE_DIR}/include/lapacke") else() if(WIN32) - string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") + 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}") + 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}") @@ -156,20 +158,20 @@ if (LAPACK_FOUND) 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}) + 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") + 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}) + 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) @@ -181,7 +183,7 @@ if (LAPACK_FOUND) else () set(LAPACKE_INCLUDE_DIRS "LAPACKE_INCLUDE_DIRS-NOTFOUND") if(NOT LAPACKE_FIND_QUIETLY) - message(STATUS "Looking for lapacke -- lapacke.h not found") + message(STATUS "Looking for lapacke -- lapacke.h not found") endif() endif() @@ -200,15 +202,15 @@ if (LAPACK_FOUND) list(APPEND _lib_env "${ENV_LAPACKE_DIR}/lib") else() if(WIN32) - string(REPLACE ":" ";" _lib_env "$ENV{LIB}") + 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}") + 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) @@ -220,20 +222,20 @@ if (LAPACK_FOUND) if(LAPACKE_LIBDIR) set(LAPACKE_lapacke_LIBRARY "LAPACKE_lapacke_LIBRARY-NOTFOUND") find_library(LAPACKE_lapacke_LIBRARY - NAMES lapacke - HINTS ${LAPACKE_LIBDIR}) + 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) + 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}) + 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) @@ -249,7 +251,7 @@ if (LAPACK_FOUND) 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") + message(STATUS "Looking for lapacke -- lib lapacke not found") endif() endif () @@ -263,57 +265,57 @@ if (LAPACK_FOUND) # LAPACKE if (LAPACKE_INCLUDE_DIRS) - set(REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}") + set(REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}") endif() if (LAPACKE_LIBRARY_DIRS) - set(REQUIRED_LIBDIRS "${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}") + list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}") endif() if (LAPACK_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${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}") + list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}") endif() # Fortran if (CMAKE_C_COMPILER_ID MATCHES "GNU") - find_library( - FORTRAN_gfortran_LIBRARY - NAMES gfortran - HINTS ${_lib_env} - ) - mark_as_advanced(FORTRAN_gfortran_LIBRARY) - if (FORTRAN_gfortran_LIBRARY) - list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}") - endif() + find_library( + FORTRAN_gfortran_LIBRARY + NAMES gfortran + HINTS ${_lib_env} + ) + mark_as_advanced(FORTRAN_gfortran_LIBRARY) + if (FORTRAN_gfortran_LIBRARY) + list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}") + endif() elseif (CMAKE_C_COMPILER_ID MATCHES "Intel") - find_library( - FORTRAN_ifcore_LIBRARY - NAMES ifcore - HINTS ${_lib_env} - ) - mark_as_advanced(FORTRAN_ifcore_LIBRARY) - if (FORTRAN_ifcore_LIBRARY) - list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}") - endif() + find_library( + FORTRAN_ifcore_LIBRARY + NAMES ifcore + HINTS ${_lib_env} + ) + mark_as_advanced(FORTRAN_ifcore_LIBRARY) + if (FORTRAN_ifcore_LIBRARY) + list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}") + endif() endif() # m find_library(M_LIBRARY NAMES m HINTS ${_lib_env}) mark_as_advanced(M_LIBRARY) if(M_LIBRARY) - list(APPEND REQUIRED_LIBS "-lm") + 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}") + 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}") @@ -325,21 +327,21 @@ if (LAPACK_FOUND) 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) + # 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() + 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) diff --git a/CMakeModules/morse/find/FindMAGMA.cmake b/CMakeModules/morse/find/FindMAGMA.cmake index d3eda98d3ccd8036d2fcc5f42e9052ce03b573e6..c4f740ae45770c404eba6d429ba79377266154a1 100644 --- a/CMakeModules/morse/find/FindMAGMA.cmake +++ b/CMakeModules/morse/find/FindMAGMA.cmake @@ -27,6 +27,7 @@ # # Results are reported in variables: # MAGMA_FOUND - True if headers and requested libraries were found +# MAGMA_C_FLAGS - list of required compilation flags (excluding -I) # 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 @@ -159,9 +160,10 @@ if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER) 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}") + set(MAGMA_INCLUDE_DIRS_DEP "${MAGMA_STATIC_INCLUDE_DIRS}") + set(MAGMA_LIBRARY_DIRS_DEP "${MAGMA_STATIC_LIBRARY_DIRS}") + set(MAGMA_LIBRARIES_DEP "${MAGMA_STATIC_LIBRARIES}") + set(MAGMA_C_FLAGS "${MAGMA_CFLAGS_OTHER}") endif(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER) diff --git a/CMakeModules/morse/find/FindMETIS.cmake b/CMakeModules/morse/find/FindMETIS.cmake index da2f1f1d7b056f97a185b9da672bfc2cd4cbb220..ea67563d7c7c7eabb4e71c7ee256d2b2e7808492 100644 --- a/CMakeModules/morse/find/FindMETIS.cmake +++ b/CMakeModules/morse/find/FindMETIS.cmake @@ -20,6 +20,7 @@ # METIS_INCLUDE_DIRS - metis include directories # METIS_LIBRARY_DIRS - Link directories for metis libraries # METIS_LIBRARIES - metis component libraries to be linked +# METIX_INTSIZE - Number of octets occupied by a idx_t (IDXTYPEWIDTH) # # 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): @@ -253,6 +254,50 @@ endif() mark_as_advanced(METIS_DIR) mark_as_advanced(METIS_DIR_FOUND) +# Check the size of METIS_Idx +# --------------------------------- +set(CMAKE_REQUIRED_INCLUDES ${METIS_INCLUDE_DIRS}) + +include(CheckCSourceRuns) +#stdio.h and stdint.h should be included by metis.h directly +set(METIS_C_TEST_METIS_Idx_4 " +#include <stdio.h> +#include <stdint.h> +#include <metis.h> +int main(int argc, char **argv) { + if (sizeof(idx_t) == 4) + return 0; + else + return 1; +} +") + +set(METIS_C_TEST_METIS_Idx_8 " +#include <stdio.h> +#include <stdint.h> +#include <metis.h> +int main(int argc, char **argv) { + if (sizeof(idx_t) == 8) + return 0; + else + return 1; +} +") +unset(METIS_Idx_4 CACHE) +unset(METIS_Idx_8 CACHE) +check_c_source_runs("${METIS_C_TEST_METIS_Idx_4}" METIS_Idx_4) +check_c_source_runs("${METIS_C_TEST_METIS_Idx_8}" METIS_Idx_8) +if(NOT METIS_Idx_4) + if(NOT METIS_Idx_8) + set(METIS_INTSIZE -1) + else() + set(METIS_INTSIZE 8) + endif() +else() + set(METIS_INTSIZE 4) +endif() +set(CMAKE_REQUIRED_INCLUDES "") + # check that METIS has been found # --------------------------------- include(FindPackageHandleStandardArgs) diff --git a/CMakeModules/morse/find/FindMUMPS.cmake b/CMakeModules/morse/find/FindMUMPS.cmake index 4c956e85acee833a17a88045c8689d6cc9a533be..f901df48e104f3b7c309c06b5f2686990ed69efd 100644 --- a/CMakeModules/morse/find/FindMUMPS.cmake +++ b/CMakeModules/morse/find/FindMUMPS.cmake @@ -30,6 +30,7 @@ # - PTSCOTCH: to activate detection of MUMPS linked with PTSCOTCH # - METIS: to activate detection of MUMPS linked with METIS # - PARMETIS: to activate detection of MUMPS linked with PARMETIS +# - OPENMP: to activate detection of MUMPS linked with OPENMP # # This module finds headers and mumps library. # Results are reported in variables: @@ -80,6 +81,7 @@ set(MUMPS_LOOK_FOR_SCOTCH OFF) set(MUMPS_LOOK_FOR_PTSCOTCH OFF) set(MUMPS_LOOK_FOR_METIS OFF) set(MUMPS_LOOK_FOR_PARMETIS OFF) +set(MUMPS_LOOK_FOR_OPENMP OFF) if( MUMPS_FIND_COMPONENTS ) foreach( component ${MUMPS_FIND_COMPONENTS} ) @@ -105,6 +107,9 @@ if( MUMPS_FIND_COMPONENTS ) if (${component} STREQUAL "PARMETIS") set(MUMPS_LOOK_FOR_PARMETIS ON) endif() + if (${component} STREQUAL "OPENMP") + set(MUMPS_LOOK_FOR_OPENMP ON) + endif() endforeach() endif() @@ -245,6 +250,19 @@ if (NOT PARMETIS_FOUND AND MUMPS_LOOK_FOR_PARMETIS) endif() endif() +# MUMPS may depends on OPENMP +#------------------------------ +if (NOT OPENMP_FOUND AND MUMPS_LOOK_FOR_OPENMP) + if (NOT MUMPS_FIND_QUIETLY) + message(STATUS "Looking for MUMPS - Try to detect OPENMP") + endif() + if (MUMPS_FIND_REQUIRED) + find_package(OpenMP REQUIRED) + else() + find_package(OpenMP) + endif() +endif() + # Looking for MUMPS # ----------------- @@ -561,6 +579,7 @@ if(MUMPS_LIBRARIES) endif() endforeach() set(REQUIRED_LIBS "${MUMPS_LIBRARIES}") + # SCALAPACK if (MUMPS_LOOK_FOR_MPI AND SCALAPACK_FOUND) if (SCALAPACK_INCLUDE_DIRS) @@ -652,6 +671,10 @@ if(MUMPS_LIBRARIES) endforeach() list(APPEND REQUIRED_LIBS "${PARMETIS_LIBRARIES}") endif() + # OpenMP + if(MUMPS_LOOK_FOR_OPENMP AND OPENMP_FOUND) + list(APPEND REQUIRED_LDFLAGS "${OpenMP_C_FLAGS}") + endif() # Fortran if (CMAKE_C_COMPILER_ID MATCHES "GNU") find_library( @@ -727,9 +750,11 @@ if(MUMPS_LIBRARIES) "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) diff --git a/CMakeModules/morse/find/FindPAPI.cmake b/CMakeModules/morse/find/FindPAPI.cmake index 918edb43af6b4e4f259392196af4a579bfb80d11..c8395aec200cd97500ecb3364e3d621c1fa3ec16 100644 --- a/CMakeModules/morse/find/FindPAPI.cmake +++ b/CMakeModules/morse/find/FindPAPI.cmake @@ -16,6 +16,7 @@ # This module finds headers and papi library. # Results are reported in variables: # PAPI_FOUND - True if headers and requested libraries were found +# PAPI_C_FLAGS - list of required compilation flags (excluding -I) # PAPI_INCLUDE_DIRS - papi include directories # PAPI_LIBRARY_DIRS - Link directories for papi libraries # PAPI_LIBRARIES - papi component libraries to be linked @@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT PAPI_GIVEN_BY_USER) endif() endif() + set(PAPI_C_FLAGS "${PAPI_CFLAGS_OTHER}") + endif(PKG_CONFIG_EXECUTABLE AND NOT PAPI_GIVEN_BY_USER) if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PAPI_FOUND) OR (PAPI_GIVEN_BY_USER) ) diff --git a/CMakeModules/morse/find/FindPARSEC.cmake b/CMakeModules/morse/find/FindPARSEC.cmake index d1daf48d3cb46c0e4a96e45c22f2192c933d10ee..dd79f3e81d37615b6f0074c2beb6e97c09c83ea5 100644 --- a/CMakeModules/morse/find/FindPARSEC.cmake +++ b/CMakeModules/morse/find/FindPARSEC.cmake @@ -37,8 +37,8 @@ # PARSEC_INCLUDE_DIRS_DEP - parsec + dependencies include directories # PARSEC_LIBRARY_DIRS_DEP - parsec + dependencies link directories # PARSEC_LIBRARIES_DEP - parsec libraries + dependencies -# PARSEC_daguepp_BIN_DIR - path to parsec driver daguepp -# PARSEC_DAGUEPP - parsec jdf compiler +# PARSEC_parsec_ptgpp_BIN_DIR - path to parsec driver parsec_ptgpp +# PARSEC_PARSEC_PTGPP - parsec jdf compiler # The user can give specific paths where to find the libraries adding cmake # options at configure (ex: cmake path/to/project -DPARSEC=path/to/parsec): # PARSEC_DIR - Where to find the base directory of parsec @@ -125,7 +125,7 @@ if(UNIX OR WIN32) else() if (PARSEC_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find libm on your system." - "Are you sure to a have a C compiler installed?") + "Are you sure to a have a C compiler installed?") endif() endif() endif() @@ -231,26 +231,27 @@ if(PKG_CONFIG_EXECUTABLE AND NOT PARSEC_GIVEN_BY_USER) #endif() else() message(STATUS "${Magenta}Looking for PARSEC - not found using PkgConfig." - "\n Perhaps you should add the directory containing libparsec.pc" - "\n to the PKG_CONFIG_PATH environment variable.${ColourReset}") + "\n Perhaps you should add the directory containing libparsec.pc" + "\n to the PKG_CONFIG_PATH environment variable.${ColourReset}") endif() endif() set(PARSEC_INCLUDE_DIRS_DEP "${PARSEC_INCLUDE_DIRS}") set(PARSEC_LIBRARY_DIRS_DEP "${PARSEC_LIBRARY_DIRS}") set(PARSEC_LIBRARIES_DEP "${PARSEC_LIBRARIES}") + set(PARSEC_C_FLAGS "${PARSEC_CFLAGS_OTHER}") # create list of binaries to find - set(PARSEC_bins_to_find "daguepp") + set(PARSEC_bins_to_find "parsec_ptgpp") # call cmake macro to find the bin path if(PARSEC_PREFIX) foreach(parsec_bin ${PARSEC_bins_to_find}) set(PARSEC_${parsec_bin}_BIN_DIR "PARSEC_${parsec_bin}_BIN_DIR-NOTFOUND") find_path(PARSEC_${parsec_bin}_BIN_DIR - NAMES ${parsec_bin} - HINTS ${PARSEC_PREFIX} - PATH_SUFFIXES "bin") + NAMES ${parsec_bin} + HINTS ${PARSEC_PREFIX} + PATH_SUFFIXES "bin") endforeach() else() if (PARSEC_FIND_REQUIRED) @@ -275,7 +276,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) elseif(ENV_PARSEC_DIR) list(APPEND _inc_env "${ENV_PARSEC_DIR}") list(APPEND _inc_env "${ENV_PARSEC_DIR}/include") - list(APPEND _inc_env "${ENV_PARSEC_DIR}/include/dague") + list(APPEND _inc_env "${ENV_PARSEC_DIR}/include/parsec") else() if(WIN32) string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}") @@ -294,36 +295,35 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}") list(REMOVE_DUPLICATES _inc_env) - # Try to find the parsec headers in the given paths # ------------------------------------------------- # create list of headers to find - set(PARSEC_hdrs_to_find "dague_config.h" "dague.h") + set(PARSEC_hdrs_to_find "parsec_config.h" "parsec.h") # call cmake macro to find the header path if(PARSEC_INCDIR) foreach(parsec_hdr ${PARSEC_hdrs_to_find}) set(PARSEC_${parsec_hdr}_INCLUDE_DIRS "PARSEC_${parsec_hdr}_INCLUDE_DIRS-NOTFOUND") find_path(PARSEC_${parsec_hdr}_INCLUDE_DIRS - NAMES ${parsec_hdr} - HINTS ${PARSEC_INCDIR}) + NAMES ${parsec_hdr} + HINTS ${PARSEC_INCDIR}) endforeach() else() if(PARSEC_DIR) set(PARSEC_${parsec_hdr}_INCLUDE_DIRS "PARSEC_${parsec_hdr}_INCLUDE_DIRS-NOTFOUND") foreach(parsec_hdr ${PARSEC_hdrs_to_find}) - find_path(PARSEC_${parsec_hdr}_INCLUDE_DIRS - NAMES ${parsec_hdr} - HINTS ${PARSEC_DIR} - PATH_SUFFIXES "include") + find_path(PARSEC_${parsec_hdr}_INCLUDE_DIRS + NAMES ${parsec_hdr} + HINTS ${PARSEC_DIR} + PATH_SUFFIXES "include") endforeach() else() foreach(parsec_hdr ${PARSEC_hdrs_to_find}) - set(PARSEC_${parsec_hdr}_INCLUDE_DIRS "PARSEC_${parsec_hdr}_INCLUDE_DIRS-NOTFOUND") - find_path(PARSEC_${parsec_hdr}_INCLUDE_DIRS - NAMES ${parsec_hdr} - HINTS ${_inc_env}) + set(PARSEC_${parsec_hdr}_INCLUDE_DIRS "PARSEC_${parsec_hdr}_INCLUDE_DIRS-NOTFOUND") + find_path(PARSEC_${parsec_hdr}_INCLUDE_DIRS + NAMES ${parsec_hdr} + HINTS ${_inc_env}) endforeach() endif() endif() @@ -338,7 +338,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) list(APPEND PARSEC_INCLUDE_DIRS "${PARSEC_${parsec_hdr}_INCLUDE_DIRS}" ) else () if(NOT PARSEC_FIND_QUIETLY) - message(STATUS "Looking for parsec -- ${parsec_hdr} not found") + message(STATUS "Looking for parsec -- ${parsec_hdr} not found") endif() endif () mark_as_advanced(PARSEC_${parsec_hdr}_INCLUDE_DIRS) @@ -369,9 +369,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) string(REPLACE ":" ";" _lib_env "$ENV{LIB}") else() if(APPLE) - string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") + string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") else() - string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") + string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") endif() list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") @@ -383,31 +383,31 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) # ---------------------------------------------- # create list of libs to find - set(PARSEC_libs_to_find "dague" "dague-base" "dague_distribution" "dague_distribution_matrix") + set(PARSEC_libs_to_find "parsec" "parsec-base" "parsec_distribution" "parsec_distribution_matrix") # call cmake macro to find the lib path if(PARSEC_LIBDIR) foreach(parsec_lib ${PARSEC_libs_to_find}) set(PARSEC_${parsec_lib}_LIBRARY "PARSEC_${parsec_lib}_LIBRARY-NOTFOUND") find_library(PARSEC_${parsec_lib}_LIBRARY - NAMES ${parsec_lib} - HINTS ${PARSEC_LIBDIR}) + NAMES ${parsec_lib} + HINTS ${PARSEC_LIBDIR}) endforeach() else() if(PARSEC_DIR) foreach(parsec_lib ${PARSEC_libs_to_find}) - set(PARSEC_${parsec_lib}_LIBRARY "PARSEC_${parsec_lib}_LIBRARY-NOTFOUND") - find_library(PARSEC_${parsec_lib}_LIBRARY - NAMES ${parsec_lib} - HINTS ${PARSEC_DIR} - PATH_SUFFIXES lib lib32 lib64) + set(PARSEC_${parsec_lib}_LIBRARY "PARSEC_${parsec_lib}_LIBRARY-NOTFOUND") + find_library(PARSEC_${parsec_lib}_LIBRARY + NAMES ${parsec_lib} + HINTS ${PARSEC_DIR} + PATH_SUFFIXES lib lib32 lib64) endforeach() else() foreach(parsec_lib ${PARSEC_libs_to_find}) - set(PARSEC_${parsec_lib}_LIBRARY "PARSEC_${parsec_lib}_LIBRARY-NOTFOUND") - find_library(PARSEC_${parsec_lib}_LIBRARY - NAMES ${parsec_lib} - HINTS ${_lib_env}) + set(PARSEC_${parsec_lib}_LIBRARY "PARSEC_${parsec_lib}_LIBRARY-NOTFOUND") + find_library(PARSEC_${parsec_lib}_LIBRARY + NAMES ${parsec_lib} + HINTS ${_lib_env}) endforeach() endif() endif() @@ -426,7 +426,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) else (PARSEC_${parsec_lib}_LIBRARY) if(NOT PARSEC_FIND_QUIETLY) - message(STATUS "Looking for parsec -- lib ${parsec_lib} not found") + message(STATUS "Looking for parsec -- lib ${parsec_lib} not found") endif() endif (PARSEC_${parsec_lib}_LIBRARY) @@ -455,32 +455,32 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) list(REMOVE_DUPLICATES _bin_env) # create list of binaries to find - set(PARSEC_bins_to_find "daguepp") + set(PARSEC_bins_to_find "parsec_ptgpp") # call cmake macro to find the bin path if(PARSEC_DIR) foreach(parsec_bin ${PARSEC_bins_to_find}) set(PARSEC_${parsec_bin}_BIN_DIR "PARSEC_${parsec_bin}_BIN_DIR-NOTFOUND") find_path(PARSEC_${parsec_bin}_BIN_DIR - NAMES ${parsec_bin} - HINTS ${PARSEC_DIR} - PATH_SUFFIXES "bin") + NAMES ${parsec_bin} + HINTS ${PARSEC_DIR} + PATH_SUFFIXES "bin") endforeach() else() foreach(parsec_bin ${PARSEC_bins_to_find}) set(PARSEC_${parsec_bin}_BIN_DIR "PARSEC_${parsec_bin}_BIN_DIR-NOTFOUND") find_path(PARSEC_${parsec_bin}_BIN_DIR - NAMES ${parsec_bin} - HINTS ${_bin_env}) + NAMES ${parsec_bin} + HINTS ${_bin_env}) endforeach() endif() - if (PARSEC_daguepp_BIN_DIR) + if (PARSEC_parsec_ptgpp_BIN_DIR) if (NOT PARSEC_FIND_QUIETLY) - message(STATUS "Look for PARSEC - compiler daguepp found in ${PARSEC_daguepp_BIN_DIR}") + message(STATUS "Look for PARSEC - compiler parsec_ptgpp found in ${PARSEC_parsec_ptgpp_BIN_DIR}") endif() else() if (PARSEC_FIND_REQUIRED) - message(FATAL_ERROR "Look for PARSEC - compiler daguepp not found while required") + message(FATAL_ERROR "Look for PARSEC - compiler parsec_ptgpp not found while required") endif() endif() @@ -500,69 +500,69 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) set(CMAKE_REQUIRED_FLAGS) foreach(libdir ${PARSEC_LIBRARY_DIRS}) if (libdir) - list(APPEND REQUIRED_LIBDIRS "${libdir}") + list(APPEND REQUIRED_LIBDIRS "${libdir}") endif() endforeach() set(REQUIRED_LIBS "${PARSEC_LIBRARIES}") # HWLOC if (HWLOC_FOUND AND PARSEC_LOOK_FOR_HWLOC) if (HWLOC_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") + list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}") endif() if (HWLOC_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${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() + 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 PARSEC_LOOK_FOR_MPI) if (MPI_C_INCLUDE_PATH) - list(APPEND REQUIRED_INCDIRS "${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}") + 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() # CUDA if (CUDA_FOUND AND PARSEC_LOOK_FOR_CUDA) if (CUDA_INCLUDE_DIRS) - list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}") + list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}") endif() if (CUDA_LIBRARY_DIRS) - list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}") + list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}") endif() list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_CUDART_LIBRARY};${CUDA_CUDA_LIBRARY}") endif() # Fortran if (CMAKE_C_COMPILER_ID MATCHES "GNU") find_library( - FORTRAN_gfortran_LIBRARY - NAMES gfortran - HINTS ${_lib_env} - ) + FORTRAN_gfortran_LIBRARY + NAMES gfortran + HINTS ${_lib_env} + ) mark_as_advanced(FORTRAN_gfortran_LIBRARY) if (FORTRAN_gfortran_LIBRARY) - list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}") + list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}") endif() elseif (CMAKE_C_COMPILER_ID MATCHES "Intel") find_library( - FORTRAN_ifcore_LIBRARY - NAMES ifcore - HINTS ${_lib_env} - ) + FORTRAN_ifcore_LIBRARY + NAMES ifcore + HINTS ${_lib_env} + ) mark_as_advanced(FORTRAN_ifcore_LIBRARY) if (FORTRAN_ifcore_LIBRARY) - list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}") + list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}") endif() endif() # EXTRA LIBS such that pthread, m, rt, dl @@ -582,15 +582,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) # test link unset(PARSEC_WORKS CACHE) include(CheckFunctionExists) - check_function_exists(dague_init PARSEC_WORKS) + check_function_exists(parsec_init PARSEC_WORKS) mark_as_advanced(PARSEC_WORKS) if(PARSEC_WORKS) # save link with dependencies if (REQUIRED_FLAGS) - set(PARSEC_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}") + set(PARSEC_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}") else() - set(PARSEC_LIBRARIES_DEP "${REQUIRED_LIBS}") + set(PARSEC_LIBRARIES_DEP "${REQUIRED_LIBS}") endif() set(PARSEC_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") set(PARSEC_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") @@ -600,13 +600,13 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND) list(REMOVE_DUPLICATES PARSEC_LINKER_FLAGS) else() if(NOT PARSEC_FIND_QUIETLY) - message(STATUS "Looking for parsec : test of dague_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 PARSEC is linked with specific libraries. " - "Have you tried with COMPONENTS (HWLOC, CUDA, MPI)? " - "See the explanation in FindPARSEC.cmake.") + message(STATUS "Looking for parsec : test of parsec_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 PARSEC is linked with specific libraries. " + "Have you tried with COMPONENTS (HWLOC, CUDA, MPI)? " + "See the explanation in FindPARSEC.cmake.") endif() endif() set(CMAKE_REQUIRED_INCLUDES) @@ -620,7 +620,7 @@ if (PARSEC_LIBRARIES) if (PARSEC_LIBRARY_DIRS) foreach(dir ${PARSEC_LIBRARY_DIRS}) if ("${dir}" MATCHES "parsec") - set(first_lib_path "${dir}") + set(first_lib_path "${dir}") endif() endforeach() else() @@ -643,18 +643,18 @@ include(FindPackageHandleStandardArgs) if (PKG_CONFIG_EXECUTABLE AND PARSEC_FOUND) find_package_handle_standard_args(PARSEC DEFAULT_MSG PARSEC_LIBRARIES - PARSEC_daguepp_BIN_DIR) + PARSEC_parsec_ptgpp_BIN_DIR) else() find_package_handle_standard_args(PARSEC DEFAULT_MSG PARSEC_LIBRARIES - PARSEC_daguepp_BIN_DIR + PARSEC_parsec_ptgpp_BIN_DIR PARSEC_WORKS) endif() -if ( PARSEC_daguepp_BIN_DIR ) - find_program(PARSEC_DAGUEPP - NAMES daguepp - HINTS ${PARSEC_daguepp_BIN_DIR}) +if ( PARSEC_parsec_ptgpp_BIN_DIR ) + find_program(PARSEC_PARSEC_PTGPP + NAMES parsec_ptgpp + HINTS ${PARSEC_parsec_ptgpp_BIN_DIR}) else() - set(PARSEC_DAGUEPP "PARSEC_DAGUEPP-NOTFOUND") + set(PARSEC_PARSEC_PTGPP "PARSEC_PARSEC_PTGPP-NOTFOUND") endif() diff --git a/CMakeModules/morse/find/FindPTSCOTCH.cmake b/CMakeModules/morse/find/FindPTSCOTCH.cmake index 2873325830b0ecdd35f61f714a13ef89390ac471..341358ca1dfe351c08f8bb42f7cc087d4eeb3e8e 100644 --- a/CMakeModules/morse/find/FindPTSCOTCH.cmake +++ b/CMakeModules/morse/find/FindPTSCOTCH.cmake @@ -177,7 +177,7 @@ foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find}) endif() endif() endforeach() - +list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS) # Looking for lib # --------------- @@ -285,7 +285,7 @@ if(PTSCOTCH_LIBRARIES) # MPI if (MPI_FOUND) if (MPI_C_INCLUDE_PATH) - list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}") + list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}") endif() if (MPI_C_LINK_FLAGS) if (${MPI_C_LINK_FLAGS} MATCHES " -") @@ -372,13 +372,14 @@ mark_as_advanced(PTSCOTCH_DIR_FOUND) # Check the size of SCOTCH_Num # --------------------------------- -set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS}) - +set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS_DEP}) include(CheckCSourceRuns) #stdio.h and stdint.h should be included by scotch.h directly +#mpi.h not included into ptscotch.h => MPI_comm undefined set(PTSCOTCH_C_TEST_SCOTCH_Num_4 " #include <stdio.h> #include <stdint.h> +#include <mpi.h> #include <ptscotch.h> int main(int argc, char **argv) { if (sizeof(SCOTCH_Num) == 4) @@ -391,6 +392,7 @@ int main(int argc, char **argv) { set(PTSCOTCH_C_TEST_SCOTCH_Num_8 " #include <stdio.h> #include <stdint.h> +#include <mpi.h> #include <ptscotch.h> int main(int argc, char **argv) { if (sizeof(SCOTCH_Num) == 8) @@ -399,9 +401,12 @@ int main(int argc, char **argv) { return 1; } ") + +unset(PTSCOTCH_Num_4 CACHE) +unset(PTSCOTCH_Num_8 CACHE) check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_4}" PTSCOTCH_Num_4) +check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8) 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() diff --git a/CMakeModules/morse/find/FindSCALAPACK.cmake b/CMakeModules/morse/find/FindSCALAPACK.cmake index 4f19b1e4048a88fafa2c5bfa51728e35759b5319..5a96239b5a903d84b4964eb56aa21f1967d11d0c 100644 --- a/CMakeModules/morse/find/FindSCALAPACK.cmake +++ b/CMakeModules/morse/find/FindSCALAPACK.cmake @@ -378,7 +378,7 @@ if(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND) ${SCALAPACK_mkl_SEARCH_SYMBOL} "" "" - "${_BLAS_LIBRARIES};mkl_blacs_intelmpi_lp64" + "${_BLAS_LIBRARIES}" "" "${MPI_Fortran_LIBRARIES}" ) @@ -391,8 +391,8 @@ if(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND) BLAS ${SCALAPACK_mkl_SEARCH_SYMBOL} "" - "${IT}" - "${_BLAS_LIBRARIES};mkl_blacs_intelmpi_lp64" + "${IT};mkl_blacs_intelmpi_lp64" + "${_BLAS_LIBRARIES}" "" "${MPI_Fortran_LIBRARIES}" ) diff --git a/CMakeModules/morse/find/FindSCOTCH.cmake b/CMakeModules/morse/find/FindSCOTCH.cmake index fd3d1722324503022f1a9d1030b8f1419fc02e16..48f6542b0c9d26602b16f239eafcbea7e722328b 100644 --- a/CMakeModules/morse/find/FindSCOTCH.cmake +++ b/CMakeModules/morse/find/FindSCOTCH.cmake @@ -147,7 +147,7 @@ else () message(STATUS "Looking for scotch -- scotch.h not found") endif() endif() - +list(REMOVE_DUPLICATES SCOTCH_INCLUDE_DIRS) # Looking for lib # --------------- @@ -309,7 +309,7 @@ if (SCOTCH_LIBRARIES) 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() + else() set(SCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of SCOTCH library" FORCE) endif() endif() @@ -345,9 +345,12 @@ int main(int argc, char **argv) { return 1; } ") + +unset(SCOTCH_Num_4 CACHE) +unset(SCOTCH_Num_8 CACHE) check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_4}" SCOTCH_Num_4) +check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8) 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() diff --git a/CMakeModules/morse/find/FindSIMGRID.cmake b/CMakeModules/morse/find/FindSIMGRID.cmake index 89e29823b154a1eabb4accce715a823f217c45bc..db03529999cddfa678cc3f65b78325b87b4ddd79 100644 --- a/CMakeModules/morse/find/FindSIMGRID.cmake +++ b/CMakeModules/morse/find/FindSIMGRID.cmake @@ -16,6 +16,7 @@ # This module finds headers and simgrid library. # Results are reported in variables: # SIMGRID_FOUND - True if headers and requested libraries were found +# SIMGRID_C_FLAGS - list of required compilation flags (excluding -I) # SIMGRID_INCLUDE_DIRS - simgrid include directories # SIMGRID_LIBRARY_DIRS - Link directories for simgrid libraries # SIMGRID_LIBRARIES - simgrid component libraries to be linked @@ -82,6 +83,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_GIVEN_BY_USER) endif() endif() + set(SIMGRID_C_FLAGS "${SIMGRID_CFLAGS_OTHER}") + endif(PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_GIVEN_BY_USER) if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_FOUND) OR (SIMGRID_GIVEN_BY_USER) ) @@ -124,37 +127,47 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_FOUND) # Try to find the simgrid header in the given paths # ------------------------------------------------- + set(SIMGRID_hdrs_to_find "simgrid.h;simgrid_config.h") + # call cmake macro to find the header path if(SIMGRID_INCDIR) - set(SIMGRID_simgrid.h_DIRS "SIMGRID_simgrid.h_DIRS-NOTFOUND") - find_path(SIMGRID_simgrid.h_DIRS - NAMES simgrid.h - HINTS ${SIMGRID_INCDIR}) + foreach(simgrid_hdr ${SIMGRID_hdrs_to_find}) + set(SIMGRID_${simgrid_hdr}_DIRS "SIMGRID_${simgrid_hdr}_DIRS-NOTFOUND") + find_path(SIMGRID_${simgrid_hdr}_DIRS + NAMES ${simgrid_hdr} + HINTS ${SIMGRID_INCDIR}) + mark_as_advanced(SIMGRID_${simgrid_hdr}_DIRS) + endforeach() else() if(SIMGRID_DIR) - set(SIMGRID_simgrid.h_DIRS "SIMGRID_simgrid.h_DIRS-NOTFOUND") - find_path(SIMGRID_simgrid.h_DIRS - NAMES simgrid.h - HINTS ${SIMGRID_DIR} - PATH_SUFFIXES "include" "include/simgrid") + foreach(simgrid_hdr ${SIMGRID_hdrs_to_find}) + set(SIMGRID_${simgrid_hdr}_DIRS "SIMGRID_${simgrid_hdr}_DIRS-NOTFOUND") + find_path(SIMGRID_${simgrid_hdr}_DIRS + NAMES ${simgrid_hdr} + HINTS ${SIMGRID_DIR} + PATH_SUFFIXES "include" "include/simgrid") + mark_as_advanced(SIMGRID_${simgrid_hdr}_DIRS) + endforeach() else() - set(SIMGRID_simgrid.h_DIRS "SIMGRID_simgrid.h_DIRS-NOTFOUND") - find_path(SIMGRID_simgrid.h_DIRS - NAMES simgrid.h - HINTS ${_inc_env} - PATH_SUFFIXES "simgrid") + foreach(simgrid_hdr ${SIMGRID_hdrs_to_find}) + set(SIMGRID_${simgrid_hdr}_DIRS "SIMGRID_${simgrid_hdr}_DIRS-NOTFOUND") + find_path(SIMGRID_${simgrid_hdr}_DIRS + NAMES ${simgrid_hdr} + HINTS ${_inc_env} + PATH_SUFFIXES "simgrid") + mark_as_advanced(SIMGRID_${simgrid_hdr}_DIRS) + endforeach() endif() endif() - mark_as_advanced(SIMGRID_simgrid.h_DIRS) # Add path to cmake variable # ------------------------------------ - if (SIMGRID_simgrid.h_DIRS) - set(SIMGRID_INCLUDE_DIRS "${SIMGRID_simgrid.h_DIRS}") + if (SIMGRID_simgrid_config.h_DIRS) + set(SIMGRID_INCLUDE_DIRS "${SIMGRID_simgrid_config.h_DIRS}") else () set(SIMGRID_INCLUDE_DIRS "SIMGRID_INCLUDE_DIRS-NOTFOUND") if(NOT SIMGRID_FIND_QUIETLY) - message(STATUS "Looking for simgrid -- simgrid.h not found") + message(STATUS "Looking for simgrid -- simgrid_config.h not found") endif() endif () diff --git a/CMakeModules/morse/find/FindSTARPU.cmake b/CMakeModules/morse/find/FindSTARPU.cmake index 15973c71aeb4fa2159a2013032af01928823264f..adf884a3823286148c4dd76a46e85619a03bbb3d 100644 --- a/CMakeModules/morse/find/FindSTARPU.cmake +++ b/CMakeModules/morse/find/FindSTARPU.cmake @@ -212,8 +212,8 @@ 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}") + set(STARPU_INCLUDE_DIRS "${STARPU_SHM_STATIC_INCLUDE_DIRS}") + set(STARPU_LIBRARY_DIRS "${STARPU_SHM_STATIC_LIBRARY_DIRS}") if(STARPU_LOOK_FOR_MPI AND MPI_FOUND) pkg_search_module(STARPU_MPI libstarpumpi) endif() @@ -239,8 +239,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) message(STATUS "Looking for STARPU MPI - found using PkgConfig") else() message(STATUS "${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}") + " Perhaps you should add the directory containing libstarpumpi.pc to" + " the PKG_CONFIG_PATH environment variable.${ColourReset}") endif() endif() endif() @@ -251,7 +251,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) 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}") + " when required is ${STARPU_FIND_VERSION}") endif() endif() else() @@ -261,7 +261,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) 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") + " when required is ${STARPU_FIND_VERSION} or newer") endif() endif() endif() @@ -273,11 +273,13 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) string(REGEX MATCH "[^;]*/libfxt.a" FXT_STATIC_LIB "${STARPU_MPI_LDFLAGS_OTHER}") list(APPEND STARPU_MPI_LIBRARIES "${FXT_STATIC_LIB}") endif() - set(STARPU_LIBRARIES "${STARPU_MPI_LIBRARIES}") - set(STARPU_LINKER_FLAGS "${STARPU_MPI_LDFLAGS_OTHER}") + set(STARPU_LIBRARIES "${STARPU_MPI_STATIC_LIBRARIES}") + set(STARPU_LINKER_FLAGS "${STARPU_MPI_STATIC_LDFLAGS_OTHER}") + set(STARPU_C_FLAGS "${STARPU_MPI_CFLAGS_OTHER}") elseif(STARPU_SHM_LIBRARIES) - set(STARPU_LIBRARIES "${STARPU_SHM_LIBRARIES}") - set(STARPU_LINKER_FLAGS "${STARPU_SHM_LDFLAGS_OTHER}") + set(STARPU_LIBRARIES "${STARPU_SHM_STATIC_LIBRARIES}") + set(STARPU_LINKER_FLAGS "${STARPU_SHM_STATIC_LDFLAGS_OTHER}") + set(STARPU_C_FLAGS "${STARPU_CFLAGS_OTHER}") else() set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND") endif() @@ -292,6 +294,7 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER) 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) @@ -427,7 +430,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) 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}") + " located in ${STARPU_starpu_config.h_INCLUDE_DIRS}") endif() endif() else() @@ -919,8 +922,8 @@ if(NOT STARPU_FIND_QUIETLY) message(STATUS "StarPU library 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).") + " 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() diff --git a/CMakeModules/morse/find/FindSUITESPARSE.cmake b/CMakeModules/morse/find/FindSUITESPARSE.cmake index 6a017bfab7553a22a291c17ada62c34df9381a63..8aeb52d3bf6480d3e6556e6baf86e3563be46cb7 100644 --- a/CMakeModules/morse/find/FindSUITESPARSE.cmake +++ b/CMakeModules/morse/find/FindSUITESPARSE.cmake @@ -180,7 +180,7 @@ list(APPEND SUITESPARSE_hdrs_to_find "cs.h" "klu.h" "ldl.h" - "RBio.h" + #"RBio.h" "spqr.hpp" "SuiteSparse_config.h" "umfpack.h") @@ -209,7 +209,7 @@ else() set(SUITESPARSE_${suitesparse_hdr}_DIRS "SUITESPARSE_${suitesparse_hdr}_INCLUDE_DIRS-NOTFOUND") find_path(SUITESPARSE_${suitesparse_hdr}_DIRS NAMES ${suitesparse_hdr} - HINTS ${_inc_env}) + HINTS ${_inc_env} ${_inc_env}/suitesparse) mark_as_advanced(SUITESPARSE_${suitesparse_hdr}_DIRS) endforeach() endif() @@ -249,7 +249,7 @@ set(SUITESPARSE_libs_to_find "camd" "ccolamd" "colamd" - "rbio" + #"rbio" "suitesparseconfig" ) diff --git a/CMakeModules/morse/find/RulesJDF.cmake b/CMakeModules/morse/find/RulesJDF.cmake index 2251edd5dd4c9c49be7af08a84a551c41f5896dd..d3a7e5314041116159a196bad5f166fa9ec6e3c3 100644 --- a/CMakeModules/morse/find/RulesJDF.cmake +++ b/CMakeModules/morse/find/RulesJDF.cmake @@ -1,5 +1,5 @@ # -# Internal module for DAGuE. +# Internal module for PaRSEC. # Setup the minimal environment to compile and generate .JDF files. # @@ -14,7 +14,7 @@ macro(jdf_rules jdf_rules_OUTPUTLIST jdf_rules_SOURCES) string(REGEX REPLACE ".jdf" "" jdf_rules_SRC ${jdf_rules_SOURCE}) string(REGEX REPLACE "^(.*/)*(.+)\\.*.*" "\\2" jdf_rules_BSRC ${jdf_rules_SRC}) set(jdf_rules_OSRC "${jdf_rules_BSRC}") - GET_PROPERTY(ADDITIONAL_DAGUEPP_CFLAGS SOURCE ${jdf_rules_SOURCE} PROPERTY ADDITIONAL_DAGUEPP_CFLAGS) + GET_PROPERTY(ADDITIONAL_PARSEC_PTGPP_CFLAGS SOURCE ${jdf_rules_SOURCE} PROPERTY ADDITIONAL_PARSEC_PTGPP_CFLAGS) get_source_file_property(jdf_rules_IsInBinaryDir ${jdf_rules_SOURCE} IS_IN_BINARY_DIR ) @@ -24,31 +24,33 @@ macro(jdf_rules jdf_rules_OUTPUTLIST jdf_rules_SOURCES) if( jdf_rules_IsInBinaryDir ) add_custom_command( - OUTPUT ${jdf_rules_OSRC}.h ${jdf_rules_OSRC}.c - COMMAND ${PARSEC_DAGUEPP} ${DAGUEPP_CFLAGS} ${ADDITIONAL_DAGUEPP_CFLAGS} -E -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC} - MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf ${PARSEC_DAGUEPP}) + OUTPUT ${jdf_rules_OSRC}.h ${jdf_rules_OSRC}.c + COMMAND ${PARSEC_PARSEC_PTGPP} ${PARSEC_PTGPP_CFLAGS} ${ADDITIONAL_PARSEC_PTGPP_CFLAGS} -E -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC} + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf ${PARSEC_PARSEC_PTGPP}) else( jdf_rules_IsInBinaryDir ) add_custom_command( - OUTPUT ${jdf_rules_OSRC}.h ${jdf_rules_OSRC}.c - COMMAND ${PARSEC_DAGUEPP} ${DAGUEPP_CFLAGS} ${ADDITIONAL_DAGUEPP_CFLAGS} -E -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC} - MAIN_DEPENDENCY ${jdf_rules_SRC}.jdf - DEPENDS ${jdf_rules_SRC}.jdf ${PARSEC_DAGUEPP}) + OUTPUT ${jdf_rules_OSRC}.h ${jdf_rules_OSRC}.c + COMMAND ${PARSEC_PARSEC_PTGPP} ${PARSEC_PTGPP_CFLAGS} ${ADDITIONAL_PARSEC_PTGPP_CFLAGS} -E -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC} + MAIN_DEPENDENCY ${jdf_rules_SRC}.jdf + DEPENDS ${jdf_rules_SRC}.jdf ${PARSEC_PARSEC_PTGPP}) endif( jdf_rules_IsInBinaryDir ) - set_source_files_properties(${jdf_rules_OSRC}.c PROPERTIES COMPILE_FLAGS "-I${PARSEC_DIR_FOUND}/include/daguepp") + set_source_files_properties(${jdf_rules_OSRC}.c PROPERTIES COMPILE_FLAGS "-I${PARSEC_DIR_FOUND}/include/parsec") list(APPEND ${jdf_rules_OUTPUTLIST} "${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.h;${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.c") + + # Mark generated files as such. + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.h ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.c + PROPERTIES GENERATED 1) + get_source_file_property(jdf_rules_CompileFlags ${jdf_rules_SOURCE} COMPILE_FLAGS ) if( jdf_rules_CompileFlags ) - set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.c PROPERTIES COMPILE_FLAGS ${jdf_rules_CompileFlags} ) + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.c PROPERTIES COMPILE_FLAGS ${jdf_rules_CompileFlags} ) endif() endforeach() # - # Mark all generated files as such. - # - set_source_files_properties(${jdf_rules_OUTPUTLIST} PROPERTIES GENERATED 1) endmacro(jdf_rules) diff --git a/CMakeModules/morse/find/morse_cmakefind_doc.org b/CMakeModules/morse/find/morse_cmakefind_doc.org new file mode 100644 index 0000000000000000000000000000000000000000..75fb9e0c2f84228e5b296bae195c8a4adfb97d6e --- /dev/null +++ b/CMakeModules/morse/find/morse_cmakefind_doc.org @@ -0,0 +1,135 @@ +#+TITLE: MORSE CMake "Find modules" documentation +#+AUTHOR: HiePACS +#+LANGUAGE: en +#+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t _:nil ^:nil -:t f:t *:t <:t +#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil pri:nil tags:not-in-toc html-style:nil +#+EXPORT_SELECT_TAGS: export +#+EXPORT_EXCLUDE_TAGS: noexport +#+TAGS: noexport(n) +#+STARTUP: nolatexpreview + +#+BEAMER_THEME: Rochester + +#+HTML_HEAD: <link rel="stylesheet" title="Standard" href="css/worg.css" type="text/css" /> +#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/VisuGen.css" /> +#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/VisuRubriqueEncadre.css" /> + +This document aims at documenting MORSE find_package CMake modules +which allow to detect library dependencies on UNIX systems (mainly +Linux and MAC OS X). These additional modules have been written +because either, they are not distributed by the CMake community, or, +they already exist but some are outdated or miss the requirements we +need. + +* CMake find modules: what is it, why is it useful? +The CMake modules being here can be used to "find" some installed +libraries on the system through the invocation of the ~find_package~ +CMake command ("MODULE" mode signature, cf. CMake documentation of +~find_package~ command) +#+BEGIN_EXAMPLE +find_package(BLAS) # look for BLAS libraries and compiler/linker flags +add_executable(foo ${FOO_SOURCES}) # define an executable from sources +target_link_libraries(foo ${BLAS_LIBRARIES}) # add BLAS libraries for the link +#+END_EXAMPLE + +It allows to find efficiently the libraries we depend on. +The modules are generally written by the library developers or very +active users so that they know very well how the library is built how +it is installed, etc. + +* How CMake is aware of these specific modules? +~find_package(LIBNAME)~ rely on a CMake module file called +/FindLIBNAME.cmake/ which should lies in a directory set in the CMake +variable ~CMAKE_MODULE_PATH~. For example, ~FindLIBNAME.cmake~ is in the +relative path ~./cmake_modules/FindLIBNAME.cmake~ +#+BEGIN_EXAMPLE +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules") +find_package(LIBNAME) +#+END_EXAMPLE + +To use MORSE modules you can add the path to the modules in your CMake +project like this +#+BEGIN_EXAMPLE +list(APPEND CMAKE_MODULE_PATH "${MORSE_DISTRIB_DIR}/cmake_modules/morse/find" ) +#+END_EXAMPLE + +* Internal mechanism: what a "find" mainly do, what are the paths scanned? +The general process consists in looking into some system paths known +from CMake to find headers and libraries and define in output some +CMake variables the user need to link with his dependency. Additionaly +to the system paths, some environment variable can also be scanned +like ~LD_LIBRARY_PATH~ and ~CPATH~. A custom CMake cache variable +~LIBNAME_DIR~ is also introduced in our modules in order to let users +indicate directly during the "configure" step a specific installation +directory for the library (e.g. where are located the include/, lib/, +etc, sub-directories). The priority order is the following: +1) The CMake variable ~LIBNAME_DIR~ is set or both ~LIBNAME_INCDIR~ and + ~LIBNAME_LIBDIR~ are set +2) The environment variable ~LIBNAME_DIR~ is set or both ~LIBNAME_INCDIR~ and + ~LIBNAME_LIBDIR~ +3) A pkg-config .pc file (hwloc.pc) of the library is available in the + environment (cf. PKG_CONFIG_PATH environment variable) and is used +4) Look into the following paths + a) for headers: + - scan the paths present in the following environment variables + ~INCLUDE~, ~C_INCLUDE_PATH~, ~CPATH~, ~INCLUDE_PATH~ + - scan the system paths for headers: look into path present in + the CMake variables + ~CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES~ and + ~CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES~ + b) for libraries: + - scan the paths present in the following environment variables + ~LIB~ (Windows), ~DYLD_LIBRARY_PATH~ (Mac OS X), ~LD_LIBRARY_PATH~ (Linux) + - scan the system paths for headers: look into path present in + the CMake variables + ~CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES~, + ~CMAKE_C_IMPLICIT_LINK_DIRECTORIES~ + +When it is possible, compiler flags are also given to users. This last +point suggest that the information can be found in the library +installation, e.g. through a pkg-config file. + +In some cases, the library can be searched for a specific +configuration, e.g "I want to find an installation of this library +coming with all these components enabled" such as: MUMPS linear solver +must be able to use SCOTCH graph partitioner. See the "COMPONENTS" +option of the ~find_package~ command and look for the header of the +module file to get more information about possible components. + +Once some header files and libraries have been found the module tries +to call a basic function of the library to test the link step. During +this process, the CMake ~check_function_exists~ is used. If the test +fails a message is given with the compiler and linker flags used +during the test. The precise error can also be found in the +~CMakeFiles/CMakeError.log~ file of the build directory. + +** How to act on the searching process? +If the user does not change the environment (do not modify environment +variables like ~LD_LIBRARY_PATH~), and gives no hint at all about the +location of the libraries, the module will match the situation 4.2 and +will look into system paths. + +To give an "exotic" locations, i.e. not in system paths, the user can +use scripts or a ~module~ like system to set the paths in environment +variables (~LD_LIBRARY_PATH~, ~INCLUDE~, ...), cf. situation 4.1 and 2. + +For some libraries it is possible to rely on ~pkg-config~ if the .pc +file path is in the ~PKG_CONFIG_PATH~ environment variable, +cf. situation 3. + +Finally, to directly give "by hand" the path, the user can set a CMake +variable ~LIBNAME_DIR~, or the pair ~LIBNAME_INCDIR~ and ~LIBNAME_LIBDIR~, +cf. situation 1. + +** A version of the library is found but I want another one, how to change? +If a first configuration has found a library somewhere but you are not +satisfied with this one and want to give some hints to look for it: +- update your environment or give the location "by hand" (~LIBNAME_DIR~) +- delete the CMake cache file to make it "forget" the libraries + already found: ~rm CMakeCache.txt~ +- configure again: ~cmake path/to/your/CMakeLists.txt ...~ + +* How to get more information about a specific module usage? +Specific information about a precise Find module are given directly at +the head of the module file. The usage, the optional parameters that +can be used and the output variables are explained here. diff --git a/Contribs/inria/algorithm/distributed/distribute.hpp b/Contribs/inria/algorithm/distributed/distribute.hpp index 8dda439411aba529db83b01149618893c88ea4f8..ed9958f8c57a814e1664aa54c11dca03eaa31f99 100644 --- a/Contribs/inria/algorithm/distributed/distribute.hpp +++ b/Contribs/inria/algorithm/distributed/distribute.hpp @@ -240,7 +240,7 @@ struct distribution_state { ++first; } // Setup span views - for(uint i = 0; i < this->send_buffers.size(); ++i) { + for(std::size_t i = 0; i < this->send_buffers.size(); ++i) { send_chunks[i].resize(this->send_buffers[i].size()); send_chunks[i].reset(this->send_buffers[i].data()); } diff --git a/Data/UTest/SphericalPrevious.data.double b/Data/UTest/SphericalPrevious.data.double index 3be9a5bb56d5a603927a4e504ffa7135c85d5aaf..5a94708ae98ac956f0994a93873d65dbb5a01b83 100644 Binary files a/Data/UTest/SphericalPrevious.data.double and b/Data/UTest/SphericalPrevious.data.double differ diff --git a/Src/Adaptive/FVariadicParticleContainer.hpp b/Src/Adaptive/FVariadicParticleContainer.hpp index 72750fe227ce6e71ddb09ef480f4a895cf7dc796..85cfd214b9010c074866d130044493ca3e894a82 100644 --- a/Src/Adaptive/FVariadicParticleContainer.hpp +++ b/Src/Adaptive/FVariadicParticleContainer.hpp @@ -165,7 +165,7 @@ private: */ template<class... Types> FSize getSavedSize_impl(std::tuple<Types*...>) const { - FSize tmp = sizeof(this->size()); + FSize tmp = sizeof(FSize); // Sum, for T in Types, of (sizeof(T) * this->size()) auto l = {(tmp += sizeof(Types) * this->size(), 0)..., 0}; (void)l; @@ -198,7 +198,7 @@ private: */ template<class BufferWriter, std::size_t ... Is> void save_impl(BufferWriter& buffer, inria::index_sequence<Is...>) const { - buffer << this->size(); + buffer << FSize(this->size()); // For each sub-array `s`, write `s` to the buffer auto l = { (buffer.write(std::get<Is>(this->data()), this->size()),0)..., diff --git a/Src/Components/FAbstractSerializable.hpp b/Src/Components/FAbstractSerializable.hpp index 1e6fd9b4996ced5768ec23c5f3fb5fd194260167..f28aba798a97c2713234b79f723f0e5bba60f6e3 100644 --- a/Src/Components/FAbstractSerializable.hpp +++ b/Src/Components/FAbstractSerializable.hpp @@ -12,6 +12,7 @@ * To make your container are usable in the mpi fmm, they must provide this interface. * This class is mainly called by the Sendable classes in order to store the attributes. */ +#include "Utils/FGlobal.hpp" class FAbstractSerializable { protected: /** diff --git a/Src/Components/FBasicCell.hpp b/Src/Components/FBasicCell.hpp index ad86e7f5b2797ada15befd6f61b83dfce2072f81..f45365599ec008c988c27d0932ed15d123016089 100644 --- a/Src/Components/FBasicCell.hpp +++ b/Src/Components/FBasicCell.hpp @@ -27,7 +27,7 @@ class FBasicCell : public FAbstractSerializable { public: /** Default constructor */ - FBasicCell() : mortonIndex(0) { + FBasicCell() : mortonIndex(0), level(0){ } /** Default destructor */ diff --git a/Src/Core/FFmmAlgorithm.hpp b/Src/Core/FFmmAlgorithm.hpp index 71c07faf0972425615aeafa15e8c9e8858bb700e..2d8f1fb02ae4d5805a19f27a7eab167712a21500 100644 --- a/Src/Core/FFmmAlgorithm.hpp +++ b/Src/Core/FFmmAlgorithm.hpp @@ -129,7 +129,7 @@ protected: FLOG(computationCounter.tac()); } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -188,11 +188,11 @@ protected: avoidGotoLeftIterator.moveUp(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -265,9 +265,9 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -323,10 +323,10 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); diff --git a/Src/Core/FFmmAlgorithmOmp4.hpp b/Src/Core/FFmmAlgorithmOmp4.hpp index c614a561f40d1421f14cbefdc5a7b1c2e3ee205e..ea14f572f9732e1b3066a44465af5eed7cf45053 100644 --- a/Src/Core/FFmmAlgorithmOmp4.hpp +++ b/Src/Core/FFmmAlgorithmOmp4.hpp @@ -271,7 +271,7 @@ protected: } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -399,11 +399,11 @@ protected: avoidGotoLeftIterator.moveUp(); octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft(); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -490,10 +490,10 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); } @@ -618,10 +618,10 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); } @@ -1087,7 +1087,7 @@ protected: } } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\tFinished (@Direct Pass (P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); } /** L2P */ @@ -1113,7 +1113,7 @@ protected: } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\tFinished (@Merge Pass (L2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Merge Pass (L2P) = " << counterTime.tacAndElapsed() << " s)\n" ); } }; diff --git a/Src/Core/FFmmAlgorithmPeriodic.hpp b/Src/Core/FFmmAlgorithmPeriodic.hpp index 2df81100285f88e1a3cfd4551f33da7ac61e777c..2d40071b445f0766e21498a6ffad4531d23bea31 100644 --- a/Src/Core/FFmmAlgorithmPeriodic.hpp +++ b/Src/Core/FFmmAlgorithmPeriodic.hpp @@ -245,7 +245,7 @@ protected: FLOG(computationCounter.tac()); } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -296,13 +296,13 @@ protected: FLOG(computationCounter.tac()); } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << "(" << (idxLevel + offsetRealTree) << ", " << octreeIterator.getCurrentCell()->getLevel() << ") = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << "(" << (idxLevel + offsetRealTree) << ", " << octreeIterator.getCurrentCell()->getLevel() << ") = " << counterTimeLevel.tacAndElapsed() << " s\n" ); avoidGotoLeftIterator.moveUp(); octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft(); } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -360,7 +360,7 @@ protected: counter); FLOG(computationCounter.tac()); } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << "(" << fakeLevel << ", " << octreeIterator.getCurrentCell()->getLevel() << ") = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << "(" << fakeLevel << ", " << octreeIterator.getCurrentCell()->getLevel() << ") = " << counterTimeLevel.tacAndElapsed() << " s\n" ); avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; @@ -368,7 +368,7 @@ protected: kernels->finishedLevelM2L(fakeLevel); FLOG(computationCounter.tac()); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -415,12 +415,12 @@ protected: FLOG(computationCounter.tac()); } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << "(" << (idxLevel + offsetRealTree) << ", " << octreeIterator.getCurrentCell()->getLevel() << ") = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << "(" << (idxLevel + offsetRealTree) << ", " << octreeIterator.getCurrentCell()->getLevel() << ") = " << counterTimeLevel.tacAndElapsed() << " s\n" ); avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); @@ -519,7 +519,7 @@ protected: } while(octreeIterator.moveRight()); - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation L2P : " << computationCounterL2P.cumulated() << " s\n" ); FLOG( FLog::Controller << "\t\t Computation P2P : " << computationCounterP2P.cumulated() << " s\n" ); @@ -780,7 +780,7 @@ protected: delete[] downerCells; } - FLOG( FLog::Controller << "\tFinished (@Periodic = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Periodic = " << counterTime.tacAndElapsed() << " s)\n" ); } diff --git a/Src/Core/FFmmAlgorithmSectionTask.hpp b/Src/Core/FFmmAlgorithmSectionTask.hpp index cff24bcc2c2871d9ae67feea7579880a34a352b1..88b6ed4e232540048c5a8db064fe8e6a5ba470d1 100644 --- a/Src/Core/FFmmAlgorithmSectionTask.hpp +++ b/Src/Core/FFmmAlgorithmSectionTask.hpp @@ -177,7 +177,7 @@ protected: #pragma omp taskwait - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -235,11 +235,11 @@ protected: octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft(); #pragma omp taskwait - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -447,10 +447,10 @@ protected: octreeIterator = avoidGotoLeftIterator; #pragma omp taskwait - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); } @@ -507,7 +507,7 @@ protected: FLOG( computationCounter.tac() ); - FLOG( FLog::Controller << "\tFinished (@Direct Pass (P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation P2P : " << computationCounter.cumulated() << " s\n" ); } @@ -531,7 +531,7 @@ protected: #pragma omp taskwait - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P) = " << counterTime.tacAndElapsed() << " s)\n" ); } }; diff --git a/Src/Core/FFmmAlgorithmTask.hpp b/Src/Core/FFmmAlgorithmTask.hpp index 524068511675178bf613bc2ced346b132e21f28e..d5f6d4102853cea66135f8cb3a62a6300a5806f3 100644 --- a/Src/Core/FFmmAlgorithmTask.hpp +++ b/Src/Core/FFmmAlgorithmTask.hpp @@ -169,7 +169,7 @@ protected: } } - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -231,12 +231,12 @@ protected: octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft(); #pragma omp taskwait - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } } } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -323,12 +323,12 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } } } // end parallel region // - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); } void transferPassWithFinalize(){ @@ -405,11 +405,11 @@ protected: } } #pragma omp taskwait - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } } // end single region } // end // region - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); } ///////////////////////////////////////////////////////////////////////////// @@ -468,12 +468,12 @@ protected: octreeIterator = avoidGotoLeftIterator; #pragma omp taskwait - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } } } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); } @@ -543,7 +543,7 @@ protected: } - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation L2P + P2P : " << computationCounter.cumulated() << " s\n" ); } diff --git a/Src/Core/FFmmAlgorithmThread.hpp b/Src/Core/FFmmAlgorithmThread.hpp index 49c6688fe0b48a287b9ee77b5e78d6aaca28b981..3d2b0e0c7fe15822a55bf8aba00fd2ed7868f1f1 100644 --- a/Src/Core/FFmmAlgorithmThread.hpp +++ b/Src/Core/FFmmAlgorithmThread.hpp @@ -90,6 +90,9 @@ public: FAbstractAlgorithm::setNbLevelsInTree(tree->getHeight()); + for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){ + this->shapeLeaf[idxShape] = 0; + } FLOG(FLog::Controller << "FFmmAlgorithmThread (Max Thread " << omp_get_max_threads() << ")\n"); FLOG(FLog::Controller << "\t static schedule " << (userChunkSize == -1 ? "static" : (userChunkSize == 0 ? "N/p^2" : std::to_string(userChunkSize))) << ")\n"); } @@ -217,7 +220,7 @@ protected: } FLOG(computationCounter.tac() ); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.elapsed() << " s\n" ); } @@ -294,11 +297,11 @@ protected: } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -391,10 +394,10 @@ protected: myThreadkernels->finishedLevelM2L(idxLevel); } //Synchro end of parallel section FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -465,10 +468,10 @@ protected: } } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -586,7 +589,7 @@ protected: } - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation L2P + P2P : " << computationCounter.cumulated() << " s\n" ); FLOG( FLog::Controller << "\t\t Computation P2P : " << computationCounterP2P.cumulated() << " s\n" ); diff --git a/Src/Core/FFmmAlgorithmThreadBalance.hpp b/Src/Core/FFmmAlgorithmThreadBalance.hpp index 3efbafbef6aa1a4b8b73ccf3ab7560cc8282cf66..a92ac28f05cc19009d334ebae9e714b0e3ab980f 100644 --- a/Src/Core/FFmmAlgorithmThreadBalance.hpp +++ b/Src/Core/FFmmAlgorithmThreadBalance.hpp @@ -484,7 +484,7 @@ protected: } FLOG(computationCounter.tac() ); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.elapsed() << " s\n" ); } @@ -541,11 +541,11 @@ protected: } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -628,10 +628,10 @@ protected: || octreeIterator.getCurrentGlobalIndex() == workloadM2L[idxLevel][omp_get_thread_num()+1].iterator.getCurrentGlobalIndex()); } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -688,10 +688,10 @@ protected: || octreeIterator.getCurrentGlobalIndex() == workloadL2L[idxLevel][omp_get_thread_num()+1].iterator.getCurrentGlobalIndex()); } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -768,7 +768,7 @@ protected: FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation L2P + P2P : " << computationCounter.cumulated() << " s\n" ); FLOG( FLog::Controller << "\t\t Computation P2P : " << computationCounterP2P.cumulated() << " s\n" ); diff --git a/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp b/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp index 383673bd54187a92c160ac874929b412ed854bf9..c397c60f4469a3064d367fa45de5f0a0f355bb7b 100644 --- a/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp +++ b/Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp @@ -2429,7 +2429,7 @@ protected: } - FLOG( FLog::Controller << "\tFinished (@Periodic = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Periodic = " << counterTime.tacAndElapsed() << " s)\n" ); } diff --git a/Src/Core/FFmmAlgorithmThreadTsm.hpp b/Src/Core/FFmmAlgorithmThreadTsm.hpp index 1e6318eabfaf6735546a79167bf698a11eb84700..149eaa2d820b9ffdb6421c224122c410f5eff8be 100644 --- a/Src/Core/FFmmAlgorithmThreadTsm.hpp +++ b/Src/Core/FFmmAlgorithmThreadTsm.hpp @@ -158,7 +158,7 @@ protected: FLOG(computationCounter.tac()); FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.elapsed() << " s\n" ); } @@ -243,11 +243,11 @@ protected: } } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -344,9 +344,9 @@ protected: FLOG(computationCounter.tac()); } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -421,9 +421,9 @@ protected: } } FLOG(computationCounter.tac()); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" ); } @@ -480,7 +480,7 @@ protected: FLOG(computationCounter.tac()); FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation L2P + P2P : " << computationCounter.elapsed() << " s\n" ); } diff --git a/Src/Core/FFmmAlgorithmTsm.hpp b/Src/Core/FFmmAlgorithmTsm.hpp index 45a1f4d9d4a7534ec3b29efaf425e6b19c17094d..11fb8a56fb312a44d9aaf46d754286a9c1684119 100644 --- a/Src/Core/FFmmAlgorithmTsm.hpp +++ b/Src/Core/FFmmAlgorithmTsm.hpp @@ -113,7 +113,7 @@ protected: } while(octreeIterator.moveRight()); FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << totalComputation << " s\n" ); } @@ -184,11 +184,11 @@ protected: avoidGotoLeftIterator.moveUp(); octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft(); - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << totalComputation << " s\n" ); } @@ -268,11 +268,11 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << totalComputation << " s\n" ); } @@ -334,11 +334,11 @@ protected: avoidGotoLeftIterator.moveDown(); octreeIterator = avoidGotoLeftIterator; - FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << "s\n" ); + FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = " << counterTimeLevel.tacAndElapsed() << " s\n" ); } FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation : " << totalComputation << " s\n" ); } @@ -383,7 +383,7 @@ protected: } while(octreeIterator.moveRight()); FLOG( counterTime.tac() ); - FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.elapsed() << "s)\n" ); + FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.elapsed() << " s)\n" ); FLOG( FLog::Controller << "\t\t Computation L2P + P2P : " << totalComputation << " s\n" ); } diff --git a/Src/Files/FMpiFmaGenericLoader.hpp b/Src/Files/FMpiFmaGenericLoader.hpp index 15ca448c733b82b169908316004f2d9d2ba89ddf..1a1053728ddb608cf1e4183ae83173ce7ffa7bbd 100644 --- a/Src/Files/FMpiFmaGenericLoader.hpp +++ b/Src/Files/FMpiFmaGenericLoader.hpp @@ -31,6 +31,7 @@ public: FSize endPart = comm.getRight(nbParticles); this->start = startPart; this->myNbOfParticles = endPart-startPart; + std::cout << " startPart "<< startPart << " endPart " << endPart<<std::endl; std::cout << "Proc " << comm.processId() << " will hold " << myNbOfParticles << std::endl; if(this->binaryFile) { @@ -40,6 +41,8 @@ public: //To this header size, we had the parts that belongs to proc on my left file->seekg(headerSize + startPart*typeData[1]*sizeof(FReal)); } else { + // First finish to read the current line + file->ignore(std::numeric_limits<std::streamsize>::max(), '\n'); for(int i = 0; i < startPart; ++i) { file->ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } diff --git a/Src/Files/FMpiStaticTreeBuilder.hpp b/Src/Files/FMpiStaticTreeBuilder.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10d85f9a52c8c98ba2ce6bc79df6e2db82ac0f87 --- /dev/null +++ b/Src/Files/FMpiStaticTreeBuilder.hpp @@ -0,0 +1,208 @@ +// See LICENCE file at project root +#ifndef FMPISTATICTREEBUILDER_H +#define FMPISTATICTREEBUILDER_H + +#include "../Utils/FMpi.hpp" +#include "../Utils/FQuickSortMpi.hpp" +#include "../Utils/FBitonicSort.hpp" +#include "../Utils/FTic.hpp" +#include "../Utils/FEnv.hpp" + +#include "../Utils/FMemUtils.hpp" + +#include "../Containers/FVector.hpp" + +#include "../Utils/FLeafBalance.hpp" +#include "../Utils/FEqualize.hpp" + +#include "../Containers/FCoordinateComputer.hpp" + +/** + * This class manage the loading of particles for the mpi version. + * It work in several steps. + * First it load the data from a file or an array and sort them amon the MPI processes. + * Then, it carrefully manage if a leaf is shared by multiple processes. + * Finally it balances the data using an external interval builder. + * + */ +template<class FReal, class ParticleClass> +class FMpiStaticTreeBuilder{ +public: + /** + * A particle may not have a MortonIndex Method (set/get morton index) + * But in this algorithm they are sorted based on their morton indexes. + * So an IndexedParticle is storing a real particle + its index. + */ + struct IndexedParticle{ + public: + MortonIndex index; + ParticleClass particle; + + operator MortonIndex() const { + return this->index; + } + }; + + ////////////////////////////////////////////////////////////////////////// + // The builder function + ////////////////////////////////////////////////////////////////////////// + + template <class ContainerClass> + static void DistributeArrayToContainer(const FMpi::FComm& communicator, const ParticleClass originalParticlesArray[], const FSize originalNbParticles, + const FPoint<FReal>& boxCenter, const FReal boxWidth, const int treeHeight, + ContainerClass* particleSaver){ + // Allocate the particles array + std::unique_ptr<IndexedParticle[]> originalParticlesCore(new IndexedParticle[originalNbParticles]); + FMemUtils::memset(originalParticlesCore.get(), 0, sizeof(IndexedParticle) * originalNbParticles); + + FPoint<FReal> boxCorner(boxCenter - (boxWidth/2)); + FTreeCoordinate host; + const FReal boxWidthAtLeafLevel = boxWidth / FReal(1 << (treeHeight - 1) ); + + FLOG(FTic counterTime); + + MortonIndex minMaxIndexes[2]; + minMaxIndexes[0] = std::numeric_limits<decltype(MortonIndex())>::max(); + minMaxIndexes[1] = std::numeric_limits<decltype(MortonIndex())>::min(); + + // Fill the array and compute the morton index + for(FSize idxPart = 0 ; idxPart < originalNbParticles ; ++idxPart){ + originalParticlesCore[idxPart].particle = originalParticlesArray[idxPart]; + host.setX( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesCore[idxPart].particle.getPosition().getX() - boxCorner.getX(), boxWidth, boxWidthAtLeafLevel, + treeHeight )); + host.setY( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesCore[idxPart].particle.getPosition().getY() - boxCorner.getY(), boxWidth, boxWidthAtLeafLevel, + treeHeight )); + host.setZ( FCoordinateComputer::GetTreeCoordinate<FReal>( originalParticlesCore[idxPart].particle.getPosition().getZ() - boxCorner.getZ(), boxWidth, boxWidthAtLeafLevel, + treeHeight )); + + originalParticlesCore[idxPart].index = host.getMortonIndex(); + + minMaxIndexes[0] = std::min(host.getMortonIndex(),minMaxIndexes[0]); + minMaxIndexes[1] = std::max(host.getMortonIndex(),minMaxIndexes[1]); + } + + FQuickSort<IndexedParticle>::QsOmp(originalParticlesCore.get(), originalNbParticles); + + MortonIndex globalMinMaxIndexes[2]; + FMpi::MpiAssert(MPI_Allreduce(&minMaxIndexes[0], + &globalMinMaxIndexes[0], + 1, + MPI_LONG_LONG, + MPI_MIN, + communicator.getComm()), __LINE__); + + FMpi::MpiAssert(MPI_Allreduce(&minMaxIndexes[1], + &globalMinMaxIndexes[1], + 1, + MPI_LONG_LONG, + MPI_MAX, + communicator.getComm()), __LINE__); + + + const int nb_processes = communicator.processCount(); + const int my_rank = communicator.processId(); + + const MortonIndex intervalSize = 1 + globalMinMaxIndexes[1] - globalMinMaxIndexes[0]; + const MortonIndex stepNbCells = (intervalSize+nb_processes-1)/nb_processes; + + std::vector<int> nb_items_to_send(nb_processes, 0); + for(FSize idxPart = 0 ; idxPart < originalNbParticles ; ++idxPart){ + nb_items_to_send[(originalParticlesCore[idxPart].index - globalMinMaxIndexes[0])/stepNbCells] += 1; + } + + std::vector<int> offset_items_to_send(nb_processes+1, 0); + for(int idxProc = 0; idxProc < nb_processes ; ++idxProc){ + assert(std::numeric_limits<int>::max()-offset_items_to_send[idxProc] >= nb_items_to_send[idxProc]); + offset_items_to_send[idxProc+1] = offset_items_to_send[idxProc] + nb_items_to_send[idxProc]; + } + + std::vector<int> nb_items_to_sendrecv_all(nb_processes*nb_processes); + FMpi::MpiAssert(MPI_Allgather(const_cast<int*>(nb_items_to_send.data()), nb_processes, MPI_INT, + nb_items_to_sendrecv_all.data(), nb_processes, MPI_INT, + communicator.getComm()), __LINE__); + + int total_to_recv = 0; + std::vector<int> nb_items_to_recv(nb_processes, 0); + std::vector<int> offset_items_to_recv(nb_processes+1, 0); + for(int idx_proc = 0 ; idx_proc < nb_processes ; ++idx_proc){ + const int nbrecv = nb_items_to_sendrecv_all[idx_proc*nb_processes + my_rank]; + assert(static_cast<long long int>(total_to_recv) + static_cast<long long int>(nbrecv) <= std::numeric_limits<int>::max()); + total_to_recv += nbrecv; + nb_items_to_recv[idx_proc] = nbrecv; + assert(static_cast<long long int>(nb_items_to_recv[idx_proc]) + static_cast<long long int>(offset_items_to_recv[idx_proc]) <= std::numeric_limits<int>::max()); + offset_items_to_recv[idx_proc+1] = nb_items_to_recv[idx_proc] + + offset_items_to_recv[idx_proc]; + } + + + std::unique_ptr<IndexedParticle[]> out_to_recv(new IndexedParticle[total_to_recv]); + + { + // Convert to byte! + const int sizeOfParticle = sizeof(IndexedParticle); + + for(int& val : nb_items_to_send){ + assert(std::numeric_limits<int>::max()-sizeOfParticle >= val); + val *= sizeOfParticle; + } + for(int& val : offset_items_to_send){ + assert(std::numeric_limits<int>::max()-sizeOfParticle >= val); + val *= sizeOfParticle; + } + for(int& val : nb_items_to_recv){ + assert(std::numeric_limits<int>::max()-sizeOfParticle >= val); + val *= sizeOfParticle; + } + for(int& val : offset_items_to_recv){ + assert(std::numeric_limits<int>::max()-sizeOfParticle >= val); + val *= sizeOfParticle; + } + + FMpi::MpiAssert(MPI_Alltoallv(originalParticlesCore.get(), const_cast<int*>(nb_items_to_send.data()), + const_cast<int*>(offset_items_to_send.data()), MPI_BYTE, out_to_recv.get(), + const_cast<int*>(nb_items_to_recv.data()), const_cast<int*>(offset_items_to_recv.data()), MPI_BYTE, + communicator.getComm()), __LINE__); + } + + for(FSize idxPart = 0 ; idxPart < total_to_recv ; ++idxPart){ + particleSaver->push(out_to_recv[idxPart].particle); + } + +#ifdef SCALFMM_USE_LOG + /** To produce stats after the Equalize phase */ + { + const FSize finalNbParticles = particleSaver->getSize(); + + if(communicator.processId() != 0){ + FMpi::MpiAssert(MPI_Gather(const_cast<FSize*>(&finalNbParticles),1,FMpi::GetType(finalNbParticles),nullptr, + 1,FMpi::GetType(finalNbParticles),0,communicator.getComm()), __LINE__); + } + else{ + const int nbProcs = communicator.processCount(); + std::unique_ptr<FSize[]> nbPartsPerProc(new FSize[nbProcs]); + + FMpi::MpiAssert(MPI_Gather(const_cast<FSize*>(&finalNbParticles),1,FMpi::GetType(finalNbParticles),nbPartsPerProc.get(), + 1,FMpi::GetType(finalNbParticles),0,communicator.getComm()), __LINE__); + + FReal averageNbParticles = 0; + FSize minNbParticles = finalNbParticles; + FSize maxNbParticles = finalNbParticles; + + for(int idxProc = 0 ; idxProc < nbProcs ; ++idxProc){ + maxNbParticles = FMath::Max(maxNbParticles, nbPartsPerProc[idxProc]); + minNbParticles = FMath::Min(minNbParticles, nbPartsPerProc[idxProc]); + averageNbParticles += FReal(nbPartsPerProc[idxProc]); + } + averageNbParticles /= float(nbProcs); + + printf("Particles Distribution: End of Equalize Phase : \n \t Min number of parts : %lld \n \t Max number of parts : %lld \n \t Average number of parts : %e \n", + minNbParticles,maxNbParticles,averageNbParticles); + } + } +#endif + } + + +}; + +#endif // FMPITREEBUILDER_H diff --git a/Src/Files/FMpiTreeBuilder.hpp b/Src/Files/FMpiTreeBuilder.hpp index 7978981c519f7932cdba1b6339af602ceda70aaf..f80c5bbd6b022378edefa7287434a62ccbfa19e1 100644 --- a/Src/Files/FMpiTreeBuilder.hpp +++ b/Src/Files/FMpiTreeBuilder.hpp @@ -381,7 +381,7 @@ public: if(idxPack != 0) FAssertLF(packsToSend[idxPack].elementFrom == packsToSend[idxPack-1].elementTo); FAssertLF(FSize(pack.elementTo) <= FSize(currentNbParts)); FAssertLF(pack.elementFrom <= pack.elementTo); - const long long int nbPartsPerPackToSend = leavesOffsetInParticles[pack.elementTo]-leavesOffsetInParticles[pack.elementFrom]; + long long int nbPartsPerPackToSend = leavesOffsetInParticles[pack.elementTo]-leavesOffsetInParticles[pack.elementFrom]; totalSend += nbPartsPerPackToSend; if(pack.idProc != myRank && 0 < (pack.elementTo-pack.elementFrom)){ @@ -390,7 +390,7 @@ public: << " from " << pack.elementFrom << " to " << pack.elementTo << " \n"; FLog::Controller.flush(); ); // Send the size of the data requestsNbParts.emplace_back(); - FMpi::MpiAssert(MPI_Isend((void*)&nbPartsPerPackToSend,1,MPI_LONG_LONG_INT,pack.idProc, + FMpi::MpiAssert(MPI_Isend(static_cast<void*>(&nbPartsPerPackToSend),1,MPI_LONG_LONG_INT,pack.idProc, FMpi::TagExchangeIndexs, communicator.getComm(), &requestsNbParts.back()),__LINE__); } diff --git a/Src/Files/FTreeIO.hpp b/Src/Files/FTreeIO.hpp index 9e86fa0439acc8c81c6cc00b48c4b255aec14bc3..5cc7d682097fa90537d610b9c16b771b0feb79d0 100644 --- a/Src/Files/FTreeIO.hpp +++ b/Src/Files/FTreeIO.hpp @@ -192,6 +192,7 @@ public: FSize sizeOfLeaf = 0; file.read((char*)&sizeOfLeaf, sizeof(FSize)); + buffer.seek(0); buffer.reserve(sizeOfLeaf); file.read((char*)buffer.data(), sizeOfLeaf); @@ -226,6 +227,7 @@ public: FSize sizeOfCell = 0; file.read((char*)&sizeOfCell, sizeof(FSize)); + buffer.seek(0); buffer.reserve(sizeOfCell); file.read((char*)buffer.data(), sizeOfCell); diff --git a/Src/GroupTree/Core/FGroupTree.hpp b/Src/GroupTree/Core/FGroupTree.hpp index 8a0a15e6a717f6e14236754c604b7351be5a1100..14240fcf6e64dee0716fe4898570ac7967ed0c29 100644 --- a/Src/GroupTree/Core/FGroupTree.hpp +++ b/Src/GroupTree/Core/FGroupTree.hpp @@ -13,7 +13,7 @@ #include "FGroupOfCells.hpp" #include "FGroupOfParticles.hpp" #include "FGroupAttachedLeaf.hpp" -#include "../../Src/Kernels/P2P/FP2PParticleContainer.hpp" +#include "../../Kernels/P2P/FP2PParticleContainer.hpp" diff --git a/Src/Kernels/Interpolation/FInterpSymmetries.hpp b/Src/Kernels/Interpolation/FInterpSymmetries.hpp index f1d76b100455d465f53def93cff6afc0bd750859..3138664e28c531b0d9488ca3f79f9b01156dcb11 100644 --- a/Src/Kernels/Interpolation/FInterpSymmetries.hpp +++ b/Src/Kernels/Interpolation/FInterpSymmetries.hpp @@ -47,8 +47,9 @@ class FInterpSymmetries unsigned int cones[8][nnodes]; // set quads and cones permutations - unsigned int evn[ORDER]; unsigned int odd[ORDER]; - for (unsigned int o=0; o<ORDER; ++o) {evn[o] = o; odd[o] = ORDER-1 - o;} + unsigned int evn[ORDER], odd[ORDER]; + for (unsigned int o=0; o<ORDER; ++o) + {evn[o] = o; odd[o] = ORDER-1 - o;} for (unsigned int i=0; i<ORDER; ++i) { for (unsigned int j=0; j<ORDER; ++j) { diff --git a/Src/Kernels/Uniform/FUnifM2LHandler.hpp b/Src/Kernels/Uniform/FUnifM2LHandler.hpp index 0b81ab5d6637f4647c8d3cff64aa1b3f3cf54fd2..23a8956cb160c1124517c68c3e2a1f11b2e62a70 100644 --- a/Src/Kernels/Uniform/FUnifM2LHandler.hpp +++ b/Src/Kernels/Uniform/FUnifM2LHandler.hpp @@ -40,7 +40,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel TensorType::setRoots(FPoint<FReal>(0.,0.,0.), CellWidth, X); // allocate memory and compute 316 m2l operators (342 if separation equals 0, 343 if separation equals -1) - FReal *_C; + FReal *_C; FComplex<FReal> *_FC; // reduce storage from nnodes^2=order^6 to (2order-1)^3 diff --git a/UTests/CMakeLists.txt b/UTests/CMakeLists.txt index 0c1676258908110916276519c549ac32b52605e8..1cd7f71c0754a88e3d82e4d383f8c7af80be0556 100644 --- a/UTests/CMakeLists.txt +++ b/UTests/CMakeLists.txt @@ -97,7 +97,7 @@ foreach(exec ${source_tests_files}) if(lines_mpi) add_test(${execname} mpirun -np 4 ${EXECUTABLE_OUTPUT_PATH}/${execname}) else() - add_test(${execname} ${CMAKE_CURRENT_BINARY_DIR}/${execname}) + add_test(${execname} ${CMAKE_CURRENT_BINARY_DIR}/${execname}) endif() - endif() + endif() endforeach(exec) diff --git a/UTests/utestLagrangeMpi.cpp b/UTests/utestLagrangeMpi.cpp index 274fd4d60e358e70f1ef28e582b0d171434254bf..da94dbb7852a540526dc5a7b52d6b3b4e850e098 100644 --- a/UTests/utestLagrangeMpi.cpp +++ b/UTests/utestLagrangeMpi.cpp @@ -265,7 +265,7 @@ class TestLagrangeMpiDirect : public FUTesterMpi<TestLagrangeMpiDirect>{ /** TestChebSymKernel */ - void TestChebSymKernel(){ + void TestUnifKernel(){ typedef double FReal; const unsigned int ORDER = 6; typedef FP2PParticleContainerIndexed<FReal> ContainerClass; @@ -285,7 +285,7 @@ class TestLagrangeMpiDirect : public FUTesterMpi<TestLagrangeMpiDirect>{ /** set test */ void SetTests(){ - AddTest(&TestLagrangeMpiDirect::TestChebSymKernel,"Test Chebyshev Kernel with 16 small SVDs and symmetries"); + AddTest(&TestLagrangeMpiDirect::TestUnifKernel,"Test Uniform Kernel with order 6"); } public: diff --git a/UTests/utestMPILoader.cpp b/UTests/utestMPILoader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0012d85940c603187025ce758c05131f30097473 --- /dev/null +++ b/UTests/utestMPILoader.cpp @@ -0,0 +1,158 @@ +// See LICENCE file at project root + +// ==== CMAKE ===== +// @FUSE_MPI +// ================ + +#include <iostream> +#include <stdexcept> +#include <cstdio> +#include <cstdlib> + + +#include "ScalFmmConfig.h" +#include "Utils/FMpi.hpp" + +#include "Files/FFmaGenericLoader.hpp" +#include "Files/FMpiFmaGenericLoader.hpp" +#include "FUTester.hpp" + + +#include "Utils/FParameters.hpp" + +#include "Utils/FParameterNames.hpp" + +/// \file utestMPILoader.cpp +//! +//! \brief This program check the MPI Loader +//! \authors B. Bramas, O. Coulaud +//! +//! +// +/** the test class + * + */ +class TestMpiLoader : public FUTesterMpi<TestMpiLoader> { + + /////////////////////////////////////////////////////////// + // The tests! + /////////////////////////////////////////////////////////// + + template <class FReal> + void RunTest() { + FReal eps = 1.0e-10; + // + if(sizeof(FReal) == sizeof(float) ) { + std::cerr << "No input data available for Float "<< std::endl; + std::exit(EXIT_FAILURE); + } + const std::string parFile("test20k.fma"); + // + std::string filename(SCALFMMDataPath+parFile); + // + FMpiFmaGenericLoader<FReal> mpiLoader(filename,app.global()); + FFmaGenericLoader<FReal> loader(filename); // sequential loader + + if(!mpiLoader.isOpen()) throw std::runtime_error("Particle file couldn't be opened!") ; + //////////////////////////////////////////////////////////////////// + + { // ----------------------------------------------------- + if(app.global().processId() == 0){ + std::cout << "Creating & Inserting " << mpiLoader.getNumberOfParticles() + << " particles ..." << std::endl; + } + // + + struct TestParticle{ + FSize indexInFile; + FPoint<FReal> position; + FReal physicalValue; + const FPoint<FReal>& getPosition(){ + return position; + } + const FReal diffPosition(TestParticle& otherParticles){ + return (position - otherParticles.getPosition()).norm(); + } + }; + FSize localNumberOfParticles = mpiLoader.getMyNumberOfParticles() ; + FSize globalNumberOfParticles = loader.getNumberOfParticles() ; + TestParticle* particles = new TestParticle[localNumberOfParticles]; + memset(particles, 0, (sizeof(TestParticle) * localNumberOfParticles)); + TestParticle* allParticles = new TestParticle[globalNumberOfParticles]; + memset(allParticles, 0, (sizeof(TestParticle) * globalNumberOfParticles)); + // READ IN PARALLEL the particles + //idx (in file) of the first part that will be used by this proc. + std::cout << "Load particles in parallel" <<std::endl; + FSize idxStart = mpiLoader.getStart(); + for(FSize idxPart = 0 ; idxPart < localNumberOfParticles ; ++idxPart){ + //Storage of the index (in the original file) of each part. + particles[idxPart].indexInFile = idxPart + idxStart; + // Read particles from file + mpiLoader.fillParticle(&particles[idxPart].position,&particles[idxPart].physicalValue); + } + // + // Read All Particles + std::cout << "Load all particles in sequential" <<std::endl; + + for(FSize idxPart = 0 ; idxPart < globalNumberOfParticles ; ++idxPart){ + //Storage of the index (in the original file) of each part. + allParticles[idxPart].indexInFile = idxStart; + // Read particles from file + loader.fillParticle(&allParticles[idxPart].position,&allParticles[idxPart].physicalValue); + } + // + // Check if the parallel read is OK + // + std::cout << " Compare the txo set of particles" <<std::endl; + + bool check ; + for(FSize idxPart = 0 ; idxPart < localNumberOfParticles ; ++idxPart){ + //Storage of the index (in the original file) of each part. + check = (particles[idxPart].diffPosition( allParticles[idxStart+idxPart])) < eps ; + if(!check) { + std::cout << "Proc "<< app.global().processId() + << " seqPos [ "<<allParticles[idxStart+idxPart].getPosition()<<" ] " + << " parPos: "<<particles[idxPart].getPosition()<<" ] " <<std::endl; + break ; + } + // Read particles from file + } + MPI_Reduce(MPI_IN_PLACE,&check,1,MPI_LOGICAL,MPI_LAND,0,app.global().getComm()); +// + Print("Test1 - Read in parallel "); + uassert(check); + // + } // ----------------------------------------------------- + } + /** If memstas is running print the memory used */ + void PostTest() { + if( FMemStats::controler.isUsed() ){ + std::cout << app.global().processId() << "-> Memory used at the end " << FMemStats::controler.getCurrentAllocated() + << " Bytes (" << FMemStats::controler.getCurrentAllocatedMB() << "MB)\n"; + std::cout << app.global().processId() << "-> Max memory used " << FMemStats::controler.getMaxAllocated() + << " Bytes (" << FMemStats::controler.getMaxAllocatedMB() << "MB)\n"; + std::cout << app.global().processId() << "-> Total memory used " << FMemStats::controler.getTotalAllocated() + << " Bytes (" << FMemStats::controler.getTotalAllocatedMB() << "MB)\n"; + } + } + /////////////////////////////////////////////////////////// + // Set the tests! + /////////////////////////////////////////////////////////// + /** TestUnifKernel */ + void TestLoader(){ + typedef double FReal; + // run test + RunTest<FReal>(); + } + + /** set test */ + void SetTests(){ + AddTest(&TestMpiLoader::TestLoader,"Compare MpiLoader with sequential Loader"); + } +public: + TestMpiLoader(int argc,char ** argv) : FUTesterMpi(argc,argv){ + } + +}; + +TestClassMpi(TestMpiLoader); diff --git a/UTests/utestSphericalWithPrevious.cpp b/UTests/utestSphericalWithPrevious.cpp index 718bdaf3c0b910840c29b7ab02d2b0336f7f3653..54c00723403401bcfe2e3b2c81e68cf69017dce9 100644 --- a/UTests/utestSphericalWithPrevious.cpp +++ b/UTests/utestSphericalWithPrevious.cpp @@ -97,7 +97,7 @@ class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> { algo.execute(); // If needed save the result - //FTreeIO<FReal>::Save<OctreeClass, CellClass, LeafClass, ContainerClass >(DataFile.c_str(), testTree); + // FTreeIO<FReal>::Save<OctreeClass, CellClass, LeafClass, ContainerClass >(DataFile.c_str(), testTree); // Load previous result OctreeClass goodTree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox()); @@ -127,10 +127,10 @@ class TestSphericalWithPrevious : public FUTester<TestSphericalWithPrevious> { const ContainerClass* goodLeaf = goodOctreeIterator.getCurrentListSrc(); for(FSize idxPart = 0 ; idxPart < testLeaf->getNbParticles() ; ++idxPart ){ - uassert( IsSimilar(goodLeaf->getPotentials()[idxPart], testLeaf->getPotentials()[idxPart]) ); - uassert( IsSimilar(goodLeaf->getForcesX()[idxPart], testLeaf->getForcesX()[idxPart]) ); - uassert( IsSimilar(goodLeaf->getForcesY()[idxPart], testLeaf->getForcesY()[idxPart]) ); - uassert( IsSimilar(goodLeaf->getForcesZ()[idxPart], testLeaf->getForcesZ()[idxPart]) ); + uassert( IsSimilar(goodLeaf->getPotentials()[idxPart], testLeaf->getPotentials()[idxPart]) ); + uassert( IsSimilar(goodLeaf->getForcesX()[idxPart], testLeaf->getForcesX()[idxPart]) ); + uassert( IsSimilar(goodLeaf->getForcesY()[idxPart], testLeaf->getForcesY()[idxPart]) ); + uassert( IsSimilar(goodLeaf->getForcesZ()[idxPart], testLeaf->getForcesZ()[idxPart]) ); } if(!testOctreeIterator.moveRight()){ diff --git a/UTests/utestStaticMpiTreeBuilder.cpp b/UTests/utestStaticMpiTreeBuilder.cpp new file mode 100644 index 0000000000000000000000000000000000000000..71e93200477016ad86a70ed4bbf503977268be4d --- /dev/null +++ b/UTests/utestStaticMpiTreeBuilder.cpp @@ -0,0 +1,140 @@ +// See LICENCE file at project root + +// ==== CMAKE ===== +// @FUSE_MPI +// ================ + +#include "ScalFmmConfig.h" +#include <cstdlib> +#include <string.h> +#include <stdexcept> +#include <algorithm> +#include <vector> + +#include "FUTester.hpp" + +#include "Utils/FMpi.hpp" +#include "Containers/FVector.hpp" + +#include "Files/FRandomLoader.hpp" +#include "Utils/FLeafBalance.hpp" +#include "Containers/FTreeCoordinate.hpp" +#include "Containers/FCoordinateComputer.hpp" + +#include "Utils/FQuickSortMpi.hpp" +#include "Utils/FBitonicSort.hpp" +#include "Files/FMpiStaticTreeBuilder.hpp" +#include "Core/FCoreCommon.hpp" + +#include "Utils/FPoint.hpp" +#include "Utils/FMath.hpp" + + +class TestMpiTreeBuilder : public FUTesterMpi< class TestMpiTreeBuilder> { + + template <class FReal> + struct TestParticle{ + FSize indexInFile; + FPoint<FReal> position; + FReal physicalValue; + + const FPoint<FReal>& getPosition()const{ + return position; + } + + bool operator==(const TestParticle& other){ + return indexInFile == other.indexInFile + && position.getX() == other.position.getX() + && position.getY() == other.position.getY() + && position.getZ() == other.position.getZ() + && physicalValue == other.physicalValue; + } + }; + + template <class FReal, int localNbParticlesLocal> + void RunTest(){ + const int totalNbParticles = localNbParticlesLocal*app.global().processCount(); + std::unique_ptr<TestParticle<FReal>[]> globalParticles(new TestParticle<FReal>[totalNbParticles]); + + FRandomLoader<FReal> loader(totalNbParticles, 1., FPoint<FReal>(0,0,0), 0); + + for(int idxPart = 0 ; idxPart < totalNbParticles ; ++idxPart){ + loader.fillParticle(&globalParticles[idxPart].position); + globalParticles[idxPart].physicalValue = FReal(idxPart); + globalParticles[idxPart].indexInFile = idxPart; + } + + for(int treeHeigt = 3 ; treeHeigt < 8 ; ++treeHeigt){ + FVector<TestParticle<FReal>> finalParticles; + FMpiStaticTreeBuilder< FReal,TestParticle<FReal> >::DistributeArrayToContainer(app.global(), + &globalParticles[localNbParticlesLocal*app.global().processId()], + localNbParticlesLocal, + loader.getCenterOfBox(), + loader.getBoxWidth(),treeHeigt, + &finalParticles); + + { + assert(finalParticles.getSize() <= std::numeric_limits<int>::max()); + int myNbParticles = int(finalParticles.getSize()); + int nbParticlesAfter = 0; + FMpi::MpiAssert(MPI_Allreduce(&myNbParticles, + &nbParticlesAfter, + 1, + MPI_INT, + MPI_SUM, + app.global().getComm()), __LINE__); + uassert(nbParticlesAfter == totalNbParticles); + } + + std::unique_ptr<int[]> exists(new int[totalNbParticles]()); + + for(int idxPart = 0 ;idxPart < finalParticles.getSize() ; ++idxPart){ + uassert(finalParticles[idxPart] == globalParticles[finalParticles[idxPart].indexInFile]); + uassert(exists[finalParticles[idxPart].indexInFile] == 0); + exists[finalParticles[idxPart].indexInFile] += 1; + } + + std::unique_ptr<int[]> existsAll(new int[totalNbParticles]()); + + FMpi::MpiAssert(MPI_Allreduce(exists.get(), + existsAll.get(), + totalNbParticles, + MPI_INT, + MPI_SUM, + app.global().getComm()), __LINE__); + + + for(int idxPart = 0 ; idxPart < totalNbParticles ; ++idxPart){ + uassert(existsAll[idxPart] == 1); + } + } + } + + /** If memstas is running print the memory used */ + void PostTest() { + if( FMemStats::controler.isUsed() ){ + std::cout << app.global().processId() << "-> Memory used at the end " << FMemStats::controler.getCurrentAllocated() + << " Bytes (" << FMemStats::controler.getCurrentAllocatedMB() << "MB)\n"; + std::cout << app.global().processId() << "-> Max memory used " << FMemStats::controler.getMaxAllocated() + << " Bytes (" << FMemStats::controler.getMaxAllocatedMB() << "MB)\n"; + std::cout << app.global().processId() << "-> Total memory used " << FMemStats::controler.getTotalAllocated() + << " Bytes (" << FMemStats::controler.getTotalAllocatedMB() << "MB)\n"; + } + } + + void SetTests(){ + AddTest(&TestMpiTreeBuilder::RunTest<double, 1000>,"Generate particles and distribute them"); + AddTest(&TestMpiTreeBuilder::RunTest<float, 1000>,"Generate particles and distribute them"); + + AddTest(&TestMpiTreeBuilder::RunTest<double, 1200>,"Generate particles and distribute them"); + AddTest(&TestMpiTreeBuilder::RunTest<float, 1200>,"Generate particles and distribute them"); + } + +public: + TestMpiTreeBuilder(int argc,char ** argv) : FUTesterMpi(argc,argv){ + } + + +}; + +TestClassMpi(TestMpiTreeBuilder); diff --git a/Utils/scripts/analysis.sh b/Utils/scripts/analysis.sh new file mode 100644 index 0000000000000000000000000000000000000000..68a13ce6cf976ab514e10161e30cc676c4d7677d --- /dev/null +++ b/Utils/scripts/analysis.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Performs an analysis of ScalFMM source code +# We consider to be in ScalFMM's source code root + +# build with proper options +cd Build && cmake .. -DSCALFMM_USE_LOG=ON -DSCALFMM_USE_ASSERT=ON -DSCALFMM_USE_SSE=OFF -DSCALFMM_USE_BLAS=ON -DSCALFMM_USE_FFT=ON -DSCALFMM_USE_MPI=ON -DSCALFMM_BUILD_EXAMPLES=ON -DSCALFMM_BUILD_TESTS=ON -DSCALFMM_BUILD_UTESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="-O0 -g -fPIC --coverage -Wall -fdiagnostics-show-option -fno-inline" -DCMAKE_EXE_LINKER_FLAGS="--coverage" -DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6 +make -j8 | tee ../scalfmm-build.log + +# run tests +OMP_NUM_THREADS=8 ctest -V +cd .. + +# capture coverage +lcov --directory . --capture --output-file scalfmm.lcov +lcov_cobertura.py scalfmm.lcov --output scalfmm-coverage.xml + +# filter sources: +export SOURCES_TO_ANALYZE="Build/Src/ScalFmmConfig.h Examples Src Tests UTests" + +# run cppcheck analysis +# commented for now because too long +# cppcheck -v -f --language=c++ --platform=unix64 --enable=all --xml --xml-version=2 --suppress=missingIncludeSystem -IBuild/Src ${SOURCES_TO_ANALYZE} 2> scalfmm-cppcheck.xml + +# run rats analysis +rats -w 3 --xml ${SOURCES_TO_ANALYZE} > scalfmm-rats.xml + +# create the sonarqube config file +cat > sonar-project.properties << EOF +sonar.host.url=https://hpclib-sed.bordeaux.inria.fr/sonarqube-dev +sonar.links.homepage=https://gitlab.inria.fr/solverstack/ScalFMM +sonar.links.scm=https://fpruvost@gitlab.inria.fr/solverstack/ScalFMM.git +sonar.links.issue=https://gitlab.inria.fr/solverstack/ScalFMM/issues +sonar.projectKey=scalfmm +sonar.projectName=Scalfmm +sonar.projectDescription=C++ library that implements a kernel independent Fast Multipole Method (LGPL+CeCILL-C) +sonar.projectVersion=devel +sonar.language=c++ +sonar.sources=Build/Src/ScalFmmConfig.h, Examples, Src, Tests, UTests +sonar.exclusions=Src/Kernels/FKernelConcepts.hpp, Tests/noDist/PerfTest/TestDriver.hpp +sonar.sourceEncoding=UTF-8 +sonar.cxx.compiler.charset=UTF-8 +sonar.cxx.compiler.regex=^(.*):(\\d+):\\d+: warning: (.*)\\[(.*)\\]$ +sonar.cxx.compiler.reportPath=scalfmm-build.log +sonar.cxx.coverage.reportPath=scalfmm-coverage.xml +#sonar.cxx.cppcheck.reportPath=scalfmm-cppcheck.xml +sonar.cxx.rats.reportPath=scalfmm-rats.xml +EOF diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000000000000000000000000000000000..d47d8b29f314b1ffed2beb8791507b61ddacbd60 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,18 @@ +sonar.host.url=https://hpclib-sed.bordeaux.inria.fr/sonarqube-dev +sonar.links.homepage=https://gitlab.inria.fr/solverstack/ScalFMM +sonar.links.scm=https://fpruvost@gitlab.inria.fr/solverstack/ScalFMM.git +sonar.links.issue=https://gitlab.inria.fr/solverstack/ScalFMM/issues +sonar.projectKey=scalfmm +sonar.projectName=Scalfmm +sonar.projectDescription=C++ library that implements a kernel independent Fast Multipole Method (LGPL+CeCILL-C) +sonar.projectVersion=devel +sonar.language=c++ +sonar.sources=Examples, Src, Tests, UTests +sonar.exclusions=Src/Kernels/FKernelConcepts.hpp, Tests/noDist/PerfTest/TestDriver.hpp +sonar.sourceEncoding=UTF-8 +sonar.cxx.compiler.charset=UTF-8 +sonar.cxx.compiler.regex=^(.*):(\\d+):\\d+: warning: (.*)\\[(.*)\\]$ +sonar.cxx.compiler.reportPath=scalfmm-build.log +sonar.cxx.coverage.reportPath=scalfmm-coverage.xml +#sonar.cxx.cppcheck.reportPath=scalfmm-cppcheck.xml +sonar.cxx.rats.reportPath=scalfmm-rats.xml