Add KLU support to spbenchsolver

This commit is contained in:
Mark Eberlein 2020-01-24 16:28:09 -08:00 committed by Rasmus Munk Larsen
parent 5fdc179241
commit ba9d18b938
2 changed files with 26 additions and 0 deletions

View File

@ -29,6 +29,13 @@ if(UMFPACK_FOUND AND BLAS_FOUND)
set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
endif()
find_package(KLU)
if(KLU_FOUND)
add_definitions("-DEIGEN_KLU_SUPPORT")
include_directories(${KLU_INCLUDES})
set(SPARSE_LIBS ${SPARSE_LIBS} ${KLU_LIBRARIES})
endif()
find_package(SuperLU 4.0)
if(SUPERLU_FOUND AND BLAS_FOUND)
add_definitions("-DEIGEN_SUPERLU_SUPPORT")

View File

@ -37,6 +37,10 @@
#include <Eigen/UmfPackSupport>
#endif
#ifdef EIGEN_KLU_SUPPORT
#include <Eigen/KLUSupport>
#endif
#ifdef EIGEN_PARDISO_SUPPORT
#include <Eigen/PardisoSupport>
#endif
@ -51,6 +55,7 @@
// CONSTANTS
#define EIGEN_UMFPACK 10
#define EIGEN_KLU 11
#define EIGEN_SUPERLU 20
#define EIGEN_PASTIX 30
#define EIGEN_PARDISO 40
@ -109,6 +114,12 @@ void printStatheader(std::ofstream& out)
out << " <PACKAGE> UMFPACK </PACKAGE> \n";
out << " </SOLVER> \n";
#endif
#ifdef EIGEN_KLU_SUPPORT
out <<" <SOLVER ID='" << EIGEN_KLU << "'>\n";
out << " <TYPE> LU </TYPE> \n";
out << " <PACKAGE> KLU </PACKAGE> \n";
out << " </SOLVER> \n";
#endif
#ifdef EIGEN_SUPERLU_SUPPORT
out <<" <SOLVER ID='" << EIGEN_SUPERLU << "'>\n";
out << " <TYPE> LU </TYPE> \n";
@ -315,6 +326,14 @@ void SelectSolvers(const SparseMatrix<Scalar>&A, unsigned int sym, Matrix<Scalar
UmfPackLU<SpMat> solver;
call_directsolver(solver, EIGEN_UMFPACK, A, b, refX,statFile);
}
#endif
//KLU
#ifdef EIGEN_KLU_SUPPORT
{
cout << "Solving with KLU LU ... \n";
KLU<SpMat> solver;
call_directsolver(solver, EIGEN_KLU, A, b, refX,statFile);
}
#endif
//SuperLU
#ifdef EIGEN_SUPERLU_SUPPORT