This forum has been archived. All content is frozen. Please use KDE Discuss instead.

CG and BiCGStab with OpenMP - no speedup

Tags: None
(comma "," separated)
lzhang
Registered Member
Posts
5
Karma
0
Hi there,

I have downloaded Eigen 3.3-alpha1 and played with it to solve a sparse matrix (row major) on an 8 cores machine. The test code is quite simple. I compiled it using g++ version 4.7.2 with -fopenmp option. But I didn't see any speedup. The Eigen::nbThreads() did tell me that there were 8 threads. The followings are the test code.

Code: Select all
typedef Eigen::SparseMatrix<double, Eigen::RowMajor>  MatrixType;
typedef Eigen::VectorXd  VecType;

void run_CG(const MatrixType& mat, const VecType& rhs,
            int maxIters, double tolerance,
            VecType& rst, int& nIters, double& estimateErr) {

    std::cout << "---------- CG ----------" << std::endl;
    Eigen::ConjugateGradient<MatrixType,
                             Eigen::Lower | Eigen::Upper,
                             Eigen::IdentityPreconditioner> cg;
    cg.setMaxIterations(maxIters);
    cg.setTolerance(tolerance);
    cg.compute(mat);
    rst = cg.solve(rhs);
    nIters = cg.iterations();
    estimateErr = cg.error();
}

void run_BiCGSTAB(const MatrixType& mat, const VecType& rhs,
            int maxIters, double tolerance,
            VecType& rst, int& nIters, double& estimateErr) {

    std::cout << "---------- BiCGStab ----------" << std::endl;
    Eigen::BiCGSTAB<MatrixType, Eigen::IdentityPreconditioner> cg;
    cg.setMaxIterations(maxIters);
    cg.setTolerance(tolerance);
    cg.compute(mat);
    rst = cg.solve(rhs);
    nIters = cg.iterations();
    estimateErr = cg.error();
}


I also tried to
Code: Select all
 grep -R "pragma omp" ./*
in the source directory of Eigen. But I didn't see and OpenMP directives.
So I was wondering if i used the wrong version or it is not supported yet.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar