Boost logo

Ublas :

Subject: Re: [ublas] prod(trans(M),M) performance?
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2009-11-17 08:56:41

In gcc with -DNDEBUG (and -O2), it runs on 5.7 secs on my laptop.

I would suggest putting

#define NDEBUGbefore including any ublas headers in your cpp files (just in case the compiler is not doing its job) and make sure that you are compiling in RELEASE mode.

my timings:
(qtcreator as ide under linux:)
5.7 secs with -DNDEBUG, RELEASE mode
65 secs with -DNDEBUG, DEBUG mode
30 secs without -DNDEBUG, RELEASE mode
76 without -DNDEBUG, DEBUG mode


Date: Mon, 26 Oct 2009 09:54:06 +0100
From: wewolski_at_[hidden]
To: ublas_at_[hidden]
Subject: [ublas] prod(trans(M),M) performance?

hope you can give me some advice.
I tried different types of matrices matrix, mapped_matrix etc.
The best performance for matrix matrix multiplication I am getting with ublas::matrix type. However, even with this type the computation time in release mode for a 1000x1000 band matrix, measured with boost::timer is tremendous: 111.4 s.

I am new to ublas so I am wondering how I can improve to code/compiler settings etc to speed up the computation.

Preporcessor settings: NDEBUG;_CONSOLE;BOOST_UBLAS_NDEBUG, VS2008, Boost 1.37
namespace bubla = boost::numeric::ublas;
typedef double value_type;
typedef bubla::matrix<value_type> SparseMatrix;

unsigned int m = 1000;
SparseMatrix D(m,m,3*m), X;

bubla::matrix_vector_range<SparseMatrix > mvr(
                    D, bubla::range (0, m ), bubla::range(0, m )

bubla::matrix_vector_range<SparseMatrix > mvr2
                    D, bubla::range (0, m-1 ), bubla::range(1, m )

bubla::matrix_vector_range<SparseMatrix > mvr3
                    D, bubla::range (1, m ), bubla::range(0, m )

boost::timer t1;
X = bubla::trans( D );
X = bubla::prod( X , D ) ;
std::cout << t1.elapsed() << std::endl;


Witold Eryk Wolski
Heidmark str 5
D-28329 Bremen
tel.: 04215261837
Windows 7: I wanted simpler, now it's simpler. I'm a rock star.