From f6971d234260ec1c78411990f8233242ca220962 Mon Sep 17 00:00:00 2001 From: acrovato <a.crovato@uliege.be> Date: Tue, 15 Mar 2022 12:48:07 +0100 Subject: [PATCH] Remove BLAS (not usefull with Eigen). Fix warnings on MSVC. --- tbox/src/CMakeLists.txt | 31 ++++--------------------------- tbox/src/wDss.cpp | 10 +++++----- tbox/src/wGmres.h | 2 +- tbox/src/wMshDeform.cpp | 1 + 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/tbox/src/CMakeLists.txt b/tbox/src/CMakeLists.txt index c2ccf55..9947874 100644 --- a/tbox/src/CMakeLists.txt +++ b/tbox/src/CMakeLists.txt @@ -30,7 +30,7 @@ IF(TBB_VERSION_INTERFACE LESS 11004) ENDIF() TARGET_LINK_LIBRARIES(tbox ${TBB_LIBRARIES}) -# -- MKL/BLAS/LAPACK -- +# -- MKL -- # Do not forget to set your environement variables using: (default path) # - "C:\Program Files (x86)\Intel\Composer XE\mkl\bin\intel64\mklvars_intel64.bat" (windows, check that VS is in x64 mode) # - source /opt/intel/mkl/bin/mklvars.sh intel64 (linux) @@ -45,40 +45,17 @@ IF(USE_MKL) MESSAGE(STATUS "MKL_LIBRARIES=${MKL_LIBRARIES}") IF(MKL_INCLUDE_DIRS AND MKL_LIBRARIES) MESSAGE(STATUS "Found Intel MKL") - SET(FOUND_MKL TRUE) - SET(LAPACK_INCLUDE_DIRS ${MKL_INCLUDE_DIRS}) - SET(LAPACK_LIBRARIES ${MKL_LIBRARIES}) + TARGET_INCLUDE_DIRECTORIES(tbox PUBLIC ${MKL_INCLUDE_DIRS}) + TARGET_LINK_LIBRARIES(tbox ${MKL_LIBRARIES}) ELSE() MESSAGE(FATAL_ERROR "Intel MKL not found!") ENDIF() -# Find BLAS -ELSE() - IF(${BLA_VENDOR} MATCHES "OpenBlas") - FIND_LIBRARY(LAPACK_LIBRARIES openblas) - ELSE() - FIND_PACKAGE(LAPACK REQUIRED) #FIND_LAPACK calls FIND_BLAS - ENDIF() - IF(NOT LAPACK_LIBRARIES) - MESSAGE(FATAL_ERROR "BLAS/LAPACK not found!") - ENDIF() - MESSAGE(STATUS "LAPACK_LIBRARIES=${LAPACK_LIBRARIES}") - MESSAGE(STATUS "LAPACK_LINKER_FLAGS=${LAPACK_LINKER_FLAGS}") - MESSAGE(STATUS "BLA_VENDOR=${BLA_VENDOR}") - MESSAGE(STATUS "BLA_STATIC=${BLA_STATIC}") ENDIF() # -- Eigen -- FIND_PACKAGE(EIGEN 3.3.4 REQUIRED) -TARGET_INCLUDE_DIRECTORIES(tbox PUBLIC ${EIGEN_INCLUDE_DIRS} ${LAPACK_INCLUDE_DIRS}) +TARGET_INCLUDE_DIRECTORIES(tbox PUBLIC ${EIGEN_INCLUDE_DIRS}) TARGET_COMPILE_DEFINITIONS(tbox PUBLIC EIGEN_DONT_PARALLELIZE) -IF(FOUND_MKL) - MESSAGE(STATUS "Linking Eigen with MKL") - TARGET_COMPILE_DEFINITIONS(tbox PUBLIC EIGEN_USE_MKL_ALL) -ELSE() - MESSAGE(STATUS "Linking Eigen with BLAS ${BLA_VENDOR}") - TARGET_COMPILE_DEFINITIONS(tbox PUBLIC EIGEN_USE_BLAS) -ENDIF() -TARGET_LINK_LIBRARIES(tbox ${LAPACK_LIBRARIES}) # -- MUMPS -- IF (USE_MUMPS) diff --git a/tbox/src/wDss.cpp b/tbox/src/wDss.cpp index c412f3c..d29dceb 100644 --- a/tbox/src/wDss.cpp +++ b/tbox/src/wDss.cpp @@ -46,11 +46,11 @@ void Dss::analyze(Eigen::SparseMatrix<double> const &A) AA.makeCompressed(); // Build data structure - MKL_INT opt = MKL_DSS_NON_SYMMETRIC; // consider MKL_DSS_SYMMETRIC and MKL_DSS_SYMMETRIC_STRUCTURE - MKL_INT n = AA.rows(); // matrix size (number of rows and columns) - MKL_INT nz = AA.nonZeros(); // number of non-zero entries - const MKL_INT *rStart = AA.outerIndexPtr(); // starting index of non-zero entry for a row - const MKL_INT *cIndex = AA.innerIndexPtr(); // index of column of non-zero entry + MKL_INT opt = MKL_DSS_NON_SYMMETRIC; // consider MKL_DSS_SYMMETRIC and MKL_DSS_SYMMETRIC_STRUCTURE + MKL_INT n = static_cast<int>(AA.rows()); // matrix size (number of rows and columns) + MKL_INT nz = static_cast<int>(AA.nonZeros()); // number of non-zero entries + const MKL_INT *rStart = AA.outerIndexPtr(); // starting index of non-zero entry for a row + const MKL_INT *cIndex = AA.innerIndexPtr(); // index of column of non-zero entry print(dss_define_structure(handle, opt, rStart, n, n, cIndex, nz)); // Define reordering diff --git a/tbox/src/wGmres.h b/tbox/src/wGmres.h index b0a4a44..1057069 100644 --- a/tbox/src/wGmres.h +++ b/tbox/src/wGmres.h @@ -43,7 +43,7 @@ public: virtual void compute(Eigen::SparseMatrix<double> const &A, Eigen::Map<Eigen::VectorXd> const &b, Eigen::Map<Eigen::VectorXd> &x) override; virtual double getError() override { return solver.error(); } - virtual int getIterations() override { return solver.iterations(); } + virtual int getIterations() override { return static_cast<int>(solver.iterations()); } virtual void write(std::ostream &out) const override; #endif diff --git a/tbox/src/wMshDeform.cpp b/tbox/src/wMshDeform.cpp index e3f4e39..1c2009c 100644 --- a/tbox/src/wMshDeform.cpp +++ b/tbox/src/wMshDeform.cpp @@ -49,6 +49,7 @@ MshDeform::MshDeform(std::shared_ptr<MshData> _msh, // Display configuration std::cout << "--- Mesh morpher (linear elasticity) ---\n" + << "Inner solver: " << *linsol << "Number of threads: " << nthreads << "\n" << std::endl; } -- GitLab