Skip to content
Snippets Groups Projects
Commit f6971d23 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Remove BLAS (not usefull with Eigen). Fix warnings on MSVC.

parent 600f04a6
No related branches found
No related tags found
1 merge request!6amfe v1.0.5
Pipeline #5508 passed
...@@ -30,7 +30,7 @@ IF(TBB_VERSION_INTERFACE LESS 11004) ...@@ -30,7 +30,7 @@ IF(TBB_VERSION_INTERFACE LESS 11004)
ENDIF() ENDIF()
TARGET_LINK_LIBRARIES(tbox ${TBB_LIBRARIES}) TARGET_LINK_LIBRARIES(tbox ${TBB_LIBRARIES})
# -- MKL/BLAS/LAPACK -- # -- MKL --
# Do not forget to set your environement variables using: (default path) # 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) # - "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) # - source /opt/intel/mkl/bin/mklvars.sh intel64 (linux)
...@@ -45,40 +45,17 @@ IF(USE_MKL) ...@@ -45,40 +45,17 @@ IF(USE_MKL)
MESSAGE(STATUS "MKL_LIBRARIES=${MKL_LIBRARIES}") MESSAGE(STATUS "MKL_LIBRARIES=${MKL_LIBRARIES}")
IF(MKL_INCLUDE_DIRS AND MKL_LIBRARIES) IF(MKL_INCLUDE_DIRS AND MKL_LIBRARIES)
MESSAGE(STATUS "Found Intel MKL") MESSAGE(STATUS "Found Intel MKL")
SET(FOUND_MKL TRUE) TARGET_INCLUDE_DIRECTORIES(tbox PUBLIC ${MKL_INCLUDE_DIRS})
SET(LAPACK_INCLUDE_DIRS ${MKL_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(tbox ${MKL_LIBRARIES})
SET(LAPACK_LIBRARIES ${MKL_LIBRARIES})
ELSE() ELSE()
MESSAGE(FATAL_ERROR "Intel MKL not found!") MESSAGE(FATAL_ERROR "Intel MKL not found!")
ENDIF() 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() ENDIF()
# -- Eigen -- # -- Eigen --
FIND_PACKAGE(EIGEN 3.3.4 REQUIRED) 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) 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 -- # -- MUMPS --
IF (USE_MUMPS) IF (USE_MUMPS)
......
...@@ -46,11 +46,11 @@ void Dss::analyze(Eigen::SparseMatrix<double> const &A) ...@@ -46,11 +46,11 @@ void Dss::analyze(Eigen::SparseMatrix<double> const &A)
AA.makeCompressed(); AA.makeCompressed();
// Build data structure // Build data structure
MKL_INT opt = MKL_DSS_NON_SYMMETRIC; // consider MKL_DSS_SYMMETRIC and MKL_DSS_SYMMETRIC_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 n = static_cast<int>(AA.rows()); // matrix size (number of rows and columns)
MKL_INT nz = AA.nonZeros(); // number of non-zero entries 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 *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 const MKL_INT *cIndex = AA.innerIndexPtr(); // index of column of non-zero entry
print(dss_define_structure(handle, opt, rStart, n, n, cIndex, nz)); print(dss_define_structure(handle, opt, rStart, n, n, cIndex, nz));
// Define reordering // Define reordering
......
...@@ -43,7 +43,7 @@ public: ...@@ -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 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 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; virtual void write(std::ostream &out) const override;
#endif #endif
......
...@@ -49,6 +49,7 @@ MshDeform::MshDeform(std::shared_ptr<MshData> _msh, ...@@ -49,6 +49,7 @@ MshDeform::MshDeform(std::shared_ptr<MshData> _msh,
// Display configuration // Display configuration
std::cout << "--- Mesh morpher (linear elasticity) ---\n" std::cout << "--- Mesh morpher (linear elasticity) ---\n"
<< "Inner solver: " << *linsol
<< "Number of threads: " << nthreads << "\n" << "Number of threads: " << nthreads << "\n"
<< std::endl; << std::endl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment