mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Adding an interface to PaStiX, the multithreaded and distributed linear solver
This commit is contained in:
@@ -53,6 +53,29 @@ else()
|
||||
ei_add_property(EIGEN_MISSING_BACKENDS "SuperLU, ")
|
||||
endif()
|
||||
|
||||
|
||||
find_package(Pastix)
|
||||
find_package(Scotch)
|
||||
find_package(Metis)
|
||||
if(PASTIX_FOUND AND BLAS_FOUND)
|
||||
add_definitions("-DEIGEN_PASTIX_SUPPORT")
|
||||
include_directories(${PASTIX_INCLUDES})
|
||||
if(SCOTCH_FOUND)
|
||||
include_directories(${SCOTCH_INCLUDES})
|
||||
set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES})
|
||||
elseif(METIS_FOUND)
|
||||
include_directories(${METIS_INCLUDES})
|
||||
set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES})
|
||||
else(SCOTCH_FOUND)
|
||||
ei_add_property(EIGEN_MISSING_BACKENDS "PaStiX, ")
|
||||
endif(SCOTCH_FOUND)
|
||||
set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES} ${ORDERING_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
ei_add_property(EIGEN_TESTED_BACKENDS "PaStiX, ")
|
||||
else()
|
||||
ei_add_property(EIGEN_MISSING_BACKENDS "PaStiX, ")
|
||||
endif()
|
||||
|
||||
option(EIGEN_TEST_NOQT "Disable Qt support in unit tests" OFF)
|
||||
if(NOT EIGEN_TEST_NOQT)
|
||||
find_package(Qt4)
|
||||
@@ -170,6 +193,7 @@ ei_add_test(simplicial_cholesky)
|
||||
ei_add_test(conjugate_gradient)
|
||||
ei_add_test(bicgstab)
|
||||
|
||||
|
||||
if(UMFPACK_FOUND)
|
||||
ei_add_test(umfpack_support "" "${UMFPACK_ALL_LIBS}")
|
||||
endif()
|
||||
@@ -186,6 +210,10 @@ if(PARDISO_FOUND)
|
||||
ei_add_test(pardiso_support "" "${PARDISO_ALL_LIBS}")
|
||||
endif()
|
||||
|
||||
if(PASTIX_FOUND AND (SCOTCH_FOUND OR METIS_FOUND))
|
||||
ei_add_test(pastix_support "" "${PASTIX_ALL_LIBS}")
|
||||
endif()
|
||||
|
||||
string(TOLOWER "${CMAKE_CXX_COMPILER}" cmake_cxx_compiler_tolower)
|
||||
if(cmake_cxx_compiler_tolower MATCHES "qcc")
|
||||
set(CXX_IS_QCC "ON")
|
||||
|
||||
61
test/pastix_support.cpp
Normal file
61
test/pastix_support.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
// This file is part of Eigen, a lightweight C++ template library
|
||||
// for linear algebra.
|
||||
//
|
||||
// Copyright (C) 2008-2012 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
|
||||
//
|
||||
// Eigen is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Alternatively, you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License and a copy of the GNU General Public License along with
|
||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "sparse_solver.h"
|
||||
#include <Eigen/PaStiXSupport>
|
||||
#include <unsupported/Eigen/SparseExtra>
|
||||
|
||||
|
||||
template<typename T> void test_pastix_T()
|
||||
{
|
||||
PastixLLT< SparseMatrix<T, ColMajor>, Eigen::Lower > pastix_llt_lower;
|
||||
PastixLDLT< SparseMatrix<T, ColMajor>, Eigen::Lower > pastix_ldlt_lower;
|
||||
PastixLLT< SparseMatrix<T, ColMajor>, Eigen::Upper > pastix_llt_upper;
|
||||
PastixLDLT< SparseMatrix<T, ColMajor>, Eigen::Upper > pastix_ldlt_upper;
|
||||
PastixLU< SparseMatrix<T, ColMajor> > pastix_lu;
|
||||
|
||||
check_sparse_spd_solving(pastix_llt_lower);
|
||||
check_sparse_spd_solving(pastix_ldlt_lower);
|
||||
check_sparse_spd_solving(pastix_llt_upper);
|
||||
check_sparse_spd_solving(pastix_ldlt_upper);
|
||||
check_sparse_square_solving(pastix_lu);
|
||||
}
|
||||
|
||||
// There is no support for selfadjoint matrices with PaStiX.
|
||||
// Complex symmetric matrices should pass though
|
||||
template<typename T> void test_pastix_T_LU()
|
||||
{
|
||||
PastixLU< SparseMatrix<T, ColMajor> > pastix_lu;
|
||||
check_sparse_square_solving(pastix_lu);
|
||||
}
|
||||
|
||||
void test_pastix_support()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1(test_pastix_T<float>());
|
||||
CALL_SUBTEST_2(test_pastix_T<double>());
|
||||
CALL_SUBTEST_3( (test_pastix_T_LU<std::complex<float> >()) );
|
||||
CALL_SUBTEST_4(test_pastix_T_LU<std::complex<double> >());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user