Boost logo

Ublas :

Subject: Re: [ublas] FE assembly : a huge time time difference
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2011-01-03 07:22:37


On 01/03/2011 11:37 AM, Riccardo Rossi wrote:
> Hi,
> i have no experience with Ansys, however ublas CSR is reasonably
> fast at FE assembly, provided that you preallocate the structure of the
> matrix
>
> if you like to see how we do it follow this link:
>
> http://kratos.cimne.upc.es/trac/browser/kratos/kratos/solving_strategies/builder_and_solvers/residualbased_elimination_builder_and_solver.h
>
> ConstructMatrixStructure fills in the zero structure of the matrix
> (ccNUMA aware approach)
>
Hi Ricardo,

Thanks for the quick reply, however, it is a difficult track down from
the code.

But I guess you mean allocating the zeros on each row, and assemble row
by row, by the way I found that generalized_vector_of_vector is faster
than the compressed_matrix following the wiki of Gunther Winkler.

For instance to assemble a model, with 10-node tetrahedrons each having
30 dofs, of size 300k takes only 4.98 seconds, if I am not doing
something wrong, tests with 3, or 4 matrices assembled onto the global
system shows it is right.

By the way, digging some more on the mailing lists, I saw some of your
posts, on the index1(2)_data() and value_data() functions. In of them,
you propose sth like value_data.data() to get the C-style arrays of the
values, however this approach does not work anymore I guess, could you
also comment on that. I found out from the documentation that the
index1_data() returns unbouded_array (which is typedef'ed as IA), so I
also tried to use the unbounded_array class for my operations. Like,

    unbounded_array<std::size_t> rowI(m.index1_data());
    unbounded_array<std::size_t> colI(m.index2_data());
    unbounded_array<double> vals(m.value_data());

which seems to work, not sure if there are better ways to get the
triplet information to interface the matrices in Matrix Market format.
However, still row_ptr information should be converted to sensible row
counts conforming with the column indices, that seems not too difficult
though.

I used that like that for the moment, that is too bad that one has to
look at the documentation in detail and dig down the mailing list to
find out important details.

Best regards,
Umut

-- 
  - Hope is a good thing, maybe the best of things
    and no good thing ever dies...
  The Shawshank Redemption, replique of Tim Robbins