Xiss,
I run your code with:

const int numNodes = 100000;
const int numTetrahedrons = numNodes*4;
.....
ublas::generalized_vector_of_vector<float, ublas::row_major, ublas::vector<ublas::mapped_vector<float> > > K(numNodes*3, numNodes*3);
.....
//assemble K a few times
const int N = 1;

Compiled it with:
g++ -o test main.cpp -DNDEBUG -O3

and it turned out that it assembles the matrix in 1.84secs on my core2 duo laptop. Do you feel this is slow for a 300,000 degrees of freedom sparse stiffness matrix?

Last but not least. Do you compile in "release" mode in MSVC?

Best
Nasos




Date: Sun, 25 Apr 2010 02:50:19 -0300
From: xissburg@gmail.com
To: ublas@lists.boost.org
Subject: Re: [ublas] Element-wise operations are really slow


Here goes a sample code which performs pretty much the same operations that are performed in the main code, also with the same kind of access patterns. It is much faster than my code (around x10+ faster), probably because everything is very well aligned in contiguous blocks of memory like the element stiffness matrices and indices, which again suggests I have cache issues. Then my only hope now is to try a new data structure design where all these data which is used in that section of the code is contained in contiguous blocks of memory, something more cache friendly.

Any help is welcome.

Thanks,


x


The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. Get busy.