On 14. nov. 2014 16:33, Bård Skaflestad wrote:
On 2014-11-14 15:33, Jørgen Kvalsvik wrote:
I have an update and a few questions regarding my project. For
introduction and details, please see
http://www.opm-project.org/pipermail/opm/2014-October/000664.html
Thanks a lot for the update. I haven't digested the message yet and I
don't feel qualified to answer just yet so I'll comment on just one point.
Using my SparseMatrixBuilder, now modified to rely on std::map instead
of std::vector
As a general rule I usually distrust std::map<> when it comes to
handling anything that has to do with computational performance and
inner loops. Std::map<> is to a very great extent a "pointer focused"
container (tree-like structure internally). What's more discouraging
still is that std::unordered_map<> isn't all that much better though
there is some improvement. You can look up
Chandler Carruth CppCon 2014
on YouTube for some stories. Mr. Carruth is a Clang and LLVM developer
at Google.
Also, the conversion from coordinate format to CSR (or CSC for that
matter) is a solved problem that is O(nnz) complexity--including
optionally generating sorted rows (columns) without repeated indices.
You don't actually need the std::map<> at all, just the triplets (in
whatever form). This just means that there is further potential for
performance improvements. That's good.
I changed it to std::map as a test, and with what I had it out-performed
the previous std::vector-of-triples solution. It is no problem
supporting both, though, the code is container agnostic. Any other
arbitrary backend can easily be supported too.
The choice of underlying structure will of course depend on the problem
at hand. The implementation is aware of this and only requires source
compability.
Still
Do keep in mind, however, that per-row construction leads to a data
structure in which the matrix values are stored in separate containers
per row whereas the original scheme uses a single contiguous array for
the values. That may or may not matter in any particular application.
Is Dune::BCRSMatrix internal storage dependant on construction type? what.
_______________________________________________
Opm mailing list
[email protected]
http://www.opm-project.org/mailman/listinfo/opm