From f0238cfb6997c4acfc2bd200de7295f3fa36968f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Mar 2019 21:09:10 +0100 Subject: don't index Eigen --- eigen/bench/spbench/CMakeLists.txt | 85 ------ eigen/bench/spbench/sp_solver.cpp | 125 -------- eigen/bench/spbench/spbench.dtd | 31 -- eigen/bench/spbench/spbenchsolver.cpp | 87 ------ eigen/bench/spbench/spbenchsolver.h | 554 ---------------------------------- eigen/bench/spbench/spbenchstyle.h | 95 ------ eigen/bench/spbench/test_sparseLU.cpp | 93 ------ 7 files changed, 1070 deletions(-) delete mode 100644 eigen/bench/spbench/CMakeLists.txt delete mode 100644 eigen/bench/spbench/sp_solver.cpp delete mode 100644 eigen/bench/spbench/spbench.dtd delete mode 100644 eigen/bench/spbench/spbenchsolver.cpp delete mode 100644 eigen/bench/spbench/spbenchsolver.h delete mode 100644 eigen/bench/spbench/spbenchstyle.h delete mode 100644 eigen/bench/spbench/test_sparseLU.cpp (limited to 'eigen/bench/spbench') diff --git a/eigen/bench/spbench/CMakeLists.txt b/eigen/bench/spbench/CMakeLists.txt deleted file mode 100644 index 029ba6d..0000000 --- a/eigen/bench/spbench/CMakeLists.txt +++ /dev/null @@ -1,85 +0,0 @@ - - -set(BLAS_FOUND TRUE) -set(LAPACK_FOUND TRUE) -set(BLAS_LIBRARIES eigen_blas_static) -set(LAPACK_LIBRARIES eigen_lapack_static) - -set(SPARSE_LIBS "") - -# find_library(PARDISO_LIBRARIES pardiso412-GNU450-X86-64) -# if(PARDISO_LIBRARIES) -# add_definitions("-DEIGEN_PARDISO_SUPPORT") -# set(SPARSE_LIBS ${SPARSE_LIBS} ${PARDISO_LIBRARIES}) -# endif(PARDISO_LIBRARIES) - -find_package(Cholmod) -if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND) - add_definitions("-DEIGEN_CHOLMOD_SUPPORT") - include_directories(${CHOLMOD_INCLUDES}) - set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) - set(CHOLMOD_ALL_LIBS ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) -endif() - -find_package(Umfpack) -if(UMFPACK_FOUND AND BLAS_FOUND) - add_definitions("-DEIGEN_UMFPACK_SUPPORT") - include_directories(${UMFPACK_INCLUDES}) - set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES}) - set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES}) -endif() - -find_package(SuperLU 4.0) -if(SUPERLU_FOUND AND BLAS_FOUND) - add_definitions("-DEIGEN_SUPERLU_SUPPORT") - include_directories(${SUPERLU_INCLUDES}) - set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES}) - set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES}) -endif() - - -find_package(PASTIX QUIET COMPONENTS METIS SCOTCH) -# check that the PASTIX found is a version without MPI -find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS - NAMES pastix_nompi.h - HINTS ${PASTIX_INCLUDE_DIRS} -) -if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS) - message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory." - " Because Eigen tests require a version without MPI, we disable the Pastix backend.") -endif() -if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS AND BLAS_FOUND) - add_definitions("-DEIGEN_PASTIX_SUPPORT") - include_directories(${PASTIX_INCLUDE_DIRS_DEP}) - if(SCOTCH_FOUND) - include_directories(${SCOTCH_INCLUDE_DIRS}) - set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES}) - elseif(METIS_FOUND) - include_directories(${METIS_INCLUDE_DIRS}) - set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES}) - endif(SCOTCH_FOUND) - set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES}) - set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP}) -endif() - -if(METIS_FOUND) - include_directories(${METIS_INCLUDE_DIRS}) - set (SPARSE_LIBS ${SPARSE_LIBS} ${METIS_LIBRARIES}) - add_definitions("-DEIGEN_METIS_SUPPORT") -endif(METIS_FOUND) - -find_library(RT_LIBRARY rt) -if(RT_LIBRARY) - set(SPARSE_LIBS ${SPARSE_LIBS} ${RT_LIBRARY}) -endif(RT_LIBRARY) - -add_executable(spbenchsolver spbenchsolver.cpp) -target_link_libraries (spbenchsolver ${SPARSE_LIBS}) - -add_executable(spsolver sp_solver.cpp) -target_link_libraries (spsolver ${SPARSE_LIBS}) - - -add_executable(test_sparseLU test_sparseLU.cpp) -target_link_libraries (test_sparseLU ${SPARSE_LIBS}) - diff --git a/eigen/bench/spbench/sp_solver.cpp b/eigen/bench/spbench/sp_solver.cpp deleted file mode 100644 index a1f4bac..0000000 --- a/eigen/bench/spbench/sp_solver.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// Small bench routine for Eigen available in Eigen -// (C) Desire NUENTSA WAKAM, INRIA - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -// #include -#include -#include -using namespace std; -using namespace Eigen; - -int main(int argc, char **args) -{ - SparseMatrix A; - typedef SparseMatrix::Index Index; - typedef Matrix DenseMatrix; - typedef Matrix DenseRhs; - VectorXd b, x, tmp; - BenchTimer timer,totaltime; - //SparseLU > solver; -// SuperLU > solver; - ConjugateGradient, Lower,IncompleteCholesky > solver; - ifstream matrix_file; - string line; - int n; - // Set parameters -// solver.iparm(IPARM_THREAD_NBR) = 4; - /* Fill the matrix with sparse matrix stored in Matrix-Market coordinate column-oriented format */ - if (argc < 2) assert(false && "please, give the matrix market file "); - - timer.start(); - totaltime.start(); - loadMarket(A, args[1]); - cout << "End charging matrix " << endl; - bool iscomplex=false, isvector=false; - int sym; - getMarketHeader(args[1], sym, iscomplex, isvector); - if (iscomplex) { cout<< " Not for complex matrices \n"; return -1; } - if (isvector) { cout << "The provided file is not a matrix file\n"; return -1;} - if (sym != 0) { // symmetric matrices, only the lower part is stored - SparseMatrix temp; - temp = A; - A = temp.selfadjointView(); - } - timer.stop(); - - n = A.cols(); - // ====== TESTS FOR SPARSE TUTORIAL ====== -// cout<< "OuterSize " << A.outerSize() << " inner " << A.innerSize() << endl; -// SparseMatrix mat1(A); -// SparseMatrix mat2; -// cout << " norm of A " << mat1.norm() << endl; ; -// PermutationMatrix perm(n); -// perm.resize(n,1); -// perm.indices().setLinSpaced(n, 0, n-1); -// mat2 = perm * mat1; -// mat.subrows(); -// mat2.resize(n,n); -// mat2.reserve(10); -// mat2.setConstant(); -// std::cout<< "NORM " << mat1.squaredNorm()<< endl; - - cout<< "Time to load the matrix " << timer.value() < 2) - loadMarketVector(b, args[2]); - else - { - b.resize(n); - tmp.resize(n); -// tmp.setRandom(); - for (int i = 0; i < n; i++) tmp(i) = i; - b = A * tmp ; - } -// Scaling > scal; -// scal.computeRef(A); -// b = scal.LeftScaling().cwiseProduct(b); - - /* Compute the factorization */ - cout<< "Starting the factorization "<< endl; - timer.reset(); - timer.start(); - cout<< "Size of Input Matrix "<< b.size()<<"\n\n"; - cout<< "Rows and columns "<< A.rows() <<" " < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/eigen/bench/spbench/spbenchsolver.cpp b/eigen/bench/spbench/spbenchsolver.cpp deleted file mode 100644 index 4acd003..0000000 --- a/eigen/bench/spbench/spbenchsolver.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include - -void bench_printhelp() -{ - cout<< " \nbenchsolver : performs a benchmark of all the solvers available in Eigen \n\n"; - cout<< " MATRIX FOLDER : \n"; - cout<< " The matrices for the benchmark should be collected in a folder specified with an environment variable EIGEN_MATRIXDIR \n"; - cout<< " The matrices are stored using the matrix market coordinate format \n"; - cout<< " The matrix and associated right-hand side (rhs) files are named respectively \n"; - cout<< " as MatrixName.mtx and MatrixName_b.mtx. If the rhs does not exist, a random one is generated. \n"; - cout<< " If a matrix is SPD, the matrix should be named as MatrixName_SPD.mtx \n"; - cout<< " If a true solution exists, it should be named as MatrixName_x.mtx; \n" ; - cout<< " it will be used to compute the norm of the error relative to the computed solutions\n\n"; - cout<< " OPTIONS : \n"; - cout<< " -h or --help \n print this help and return\n\n"; - cout<< " -d matrixdir \n Use matrixdir as the matrix folder instead of the one specified in the environment variable EIGEN_MATRIXDIR\n\n"; - cout<< " -o outputfile.xml \n Output the statistics to a xml file \n\n"; - cout<< " --eps Sets the relative tolerance for iterative solvers (default 1e-08) \n\n"; - cout<< " --maxits Sets the maximum number of iterations (default 1000) \n\n"; - -} -int main(int argc, char ** args) -{ - - bool help = ( get_options(argc, args, "-h") || get_options(argc, args, "--help") ); - if(help) { - bench_printhelp(); - return 0; - } - - // Get the location of the test matrices - string matrix_dir; - if (!get_options(argc, args, "-d", &matrix_dir)) - { - if(getenv("EIGEN_MATRIXDIR") == NULL){ - std::cerr << "Please, specify the location of the matrices with -d mat_folder or the environment variable EIGEN_MATRIXDIR \n"; - std::cerr << " Run with --help to see the list of all the available options \n"; - return -1; - } - matrix_dir = getenv("EIGEN_MATRIXDIR"); - } - - std::ofstream statbuf; - string statFile ; - - // Get the file to write the statistics - bool statFileExists = get_options(argc, args, "-o", &statFile); - if(statFileExists) - { - statbuf.open(statFile.c_str(), std::ios::out); - if(statbuf.good()){ - statFileExists = true; - printStatheader(statbuf); - statbuf.close(); - } - else - std::cerr << "Unable to open the provided file for writting... \n"; - } - - // Get the maximum number of iterations and the tolerance - int maxiters = 1000; - double tol = 1e-08; - string inval; - if (get_options(argc, args, "--eps", &inval)) - tol = atof(inval.c_str()); - if(get_options(argc, args, "--maxits", &inval)) - maxiters = atoi(inval.c_str()); - - string current_dir; - // Test the real-arithmetics matrices - Browse_Matrices(matrix_dir, statFileExists, statFile,maxiters, tol); - - // Test the complex-arithmetics matrices - Browse_Matrices >(matrix_dir, statFileExists, statFile, maxiters, tol); - - if(statFileExists) - { - statbuf.open(statFile.c_str(), std::ios::app); - statbuf << " \n"; - cout << "\n Output written in " << statFile << " ...\n"; - statbuf.close(); - } - - return 0; -} - - diff --git a/eigen/bench/spbench/spbenchsolver.h b/eigen/bench/spbench/spbenchsolver.h deleted file mode 100644 index 19c719c..0000000 --- a/eigen/bench/spbench/spbenchsolver.h +++ /dev/null @@ -1,554 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2012 Désiré Nuentsa-Wakam -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "spbenchstyle.h" - -#ifdef EIGEN_METIS_SUPPORT -#include -#endif - -#ifdef EIGEN_CHOLMOD_SUPPORT -#include -#endif - -#ifdef EIGEN_UMFPACK_SUPPORT -#include -#endif - -#ifdef EIGEN_PARDISO_SUPPORT -#include -#endif - -#ifdef EIGEN_SUPERLU_SUPPORT -#include -#endif - -#ifdef EIGEN_PASTIX_SUPPORT -#include -#endif - -// CONSTANTS -#define EIGEN_UMFPACK 10 -#define EIGEN_SUPERLU 20 -#define EIGEN_PASTIX 30 -#define EIGEN_PARDISO 40 -#define EIGEN_SPARSELU_COLAMD 50 -#define EIGEN_SPARSELU_METIS 51 -#define EIGEN_BICGSTAB 60 -#define EIGEN_BICGSTAB_ILUT 61 -#define EIGEN_GMRES 70 -#define EIGEN_GMRES_ILUT 71 -#define EIGEN_SIMPLICIAL_LDLT 80 -#define EIGEN_CHOLMOD_LDLT 90 -#define EIGEN_PASTIX_LDLT 100 -#define EIGEN_PARDISO_LDLT 110 -#define EIGEN_SIMPLICIAL_LLT 120 -#define EIGEN_CHOLMOD_SUPERNODAL_LLT 130 -#define EIGEN_CHOLMOD_SIMPLICIAL_LLT 140 -#define EIGEN_PASTIX_LLT 150 -#define EIGEN_PARDISO_LLT 160 -#define EIGEN_CG 170 -#define EIGEN_CG_PRECOND 180 - -using namespace Eigen; -using namespace std; - - -// Global variables for input parameters -int MaximumIters; // Maximum number of iterations -double RelErr; // Relative error of the computed solution -double best_time_val; // Current best time overall solvers -int best_time_id; // id of the best solver for the current system - -template inline typename NumTraits::Real test_precision() { return NumTraits::dummy_precision(); } -template<> inline float test_precision() { return 1e-3f; } -template<> inline double test_precision() { return 1e-6; } -template<> inline float test_precision >() { return test_precision(); } -template<> inline double test_precision >() { return test_precision(); } - -void printStatheader(std::ofstream& out) -{ - // Print XML header - // NOTE It would have been much easier to write these XML documents using external libraries like tinyXML or Xerces-C++. - - out << " \n"; - out << " \n"; - out << "\n]>"; - out << "\n\n\n"; - - out << "\n \n" ; //root XML element - // Print the xsl style section - printBenchStyle(out); - // List all available solvers - out << " \n"; -#ifdef EIGEN_UMFPACK_SUPPORT - out <<" \n"; - out << " LU \n"; - out << " UMFPACK \n"; - out << " \n"; -#endif -#ifdef EIGEN_SUPERLU_SUPPORT - out <<" \n"; - out << " LU \n"; - out << " SUPERLU \n"; - out << " \n"; -#endif -#ifdef EIGEN_CHOLMOD_SUPPORT - out <<" \n"; - out << " LLT SP \n"; - out << " CHOLMOD \n"; - out << " \n"; - - out <<" \n"; - out << " LLT \n"; - out << " CHOLMOD \n"; - out << " \n"; - - out <<" \n"; - out << " LDLT \n"; - out << " CHOLMOD \n"; - out << " \n"; -#endif -#ifdef EIGEN_PARDISO_SUPPORT - out <<" \n"; - out << " LU \n"; - out << " PARDISO \n"; - out << " \n"; - - out <<" \n"; - out << " LLT \n"; - out << " PARDISO \n"; - out << " \n"; - - out <<" \n"; - out << " LDLT \n"; - out << " PARDISO \n"; - out << " \n"; -#endif -#ifdef EIGEN_PASTIX_SUPPORT - out <<" \n"; - out << " LU \n"; - out << " PASTIX \n"; - out << " \n"; - - out <<" \n"; - out << " LLT \n"; - out << " PASTIX \n"; - out << " \n"; - - out <<" \n"; - out << " LDLT \n"; - out << " PASTIX \n"; - out << " \n"; -#endif - - out <<" \n"; - out << " BICGSTAB \n"; - out << " EIGEN \n"; - out << " \n"; - - out <<" \n"; - out << " BICGSTAB_ILUT \n"; - out << " EIGEN \n"; - out << " \n"; - - out <<" \n"; - out << " GMRES_ILUT \n"; - out << " EIGEN \n"; - out << " \n"; - - out <<" \n"; - out << " LDLT \n"; - out << " EIGEN \n"; - out << " \n"; - - out <<" \n"; - out << " LLT \n"; - out << " EIGEN \n"; - out << " \n"; - - out <<" \n"; - out << " CG \n"; - out << " EIGEN \n"; - out << " \n"; - - out <<" \n"; - out << " LU_COLAMD \n"; - out << " EIGEN \n"; - out << " \n"; - -#ifdef EIGEN_METIS_SUPPORT - out <<" \n"; - out << " LU_METIS \n"; - out << " EIGEN \n"; - out << " \n"; -#endif - out << " \n"; - -} - - -template -void call_solver(Solver &solver, const int solver_id, const typename Solver::MatrixType& A, const Matrix& b, const Matrix& refX,std::ofstream& statbuf) -{ - - double total_time; - double compute_time; - double solve_time; - double rel_error; - Matrix x; - BenchTimer timer; - timer.reset(); - timer.start(); - solver.compute(A); - if (solver.info() != Success) - { - std::cerr << "Solver failed ... \n"; - return; - } - timer.stop(); - compute_time = timer.value(); - statbuf << "