> I have the following problem with multi-threading. I've followed
> tutorial 9 and changed my program completely in the same way - I
> use multi-threading to speed up the assembly procedure. Everything
> compiles and runs well with 1 or 2 threads. But when I run this
> problem on our cluster node with 8 cores/threads solution is different!
If you assemble linear systems with threads, you can't control the order in
which contributions from individual cells are added to the global matrix,
i.e. matrix entry A_{ij} may be
A_{ij}^{K1} + A_{ij}^{K2} + A_{ij}^{K3}
(where the three parts are contributions from three different cells), or
A_{ij}^{K1} + A_{ij}^{K3} + A_{ij}^{K2}
for example. Mathematically speaking this shouldn't matter, but because
floating point arithmetic is not commutative, it does matter in practice.
One way around this is to cast to lower precision, i.e. when you copy to the
global matrix, you should do something like this:
system_matrix.add (local_dof_indices[i],
local_dof_indices[j],
(float)cell_matrix(i,j));
Note the cast in the last line. This is neither elegant nor guaranteed to
always work, but it seems to work most of the time.
That said, in the current development version of deal.II (post 6.2), we have a
much more elegant way to do all this. Take a look here:
http://dealii.org/developer/doxygen/deal.II/group__threads.html
That approach completely avoids this problem by making sure that everything
always happen in exactly the same order.
Best
W.
--
-------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.tamu.edu/~bangerth/
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii