[eigen] assembling a sparse matrix from multiple threads

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear all,
I'm having troubles assembling a sparse matrix in parallel, from multiple threads.
In particular if I use matrix.insert(i,j)  to set the nonzero entries in several concurrent threads the code fails randomly in optimized mode while, in debug mode, an Eigen's error message is triggered saying that one of the matrix entries already exists. The code behavior is pretty unpredictable when repeatedly assembling a sparse matrix in a loop. 

I'm confident that my code is thread safe and matrix entries are unique as confirmed by the following: if I collect matrix entries in vectors of triplets (one vector for each thread) and then I assemble the matrix serially (using matrix.insert(triplet.row(),triplet.col()) = triplet.value()) everything works fine. 

I guess that concurrent insertion is not allowed/supported. Am I right? 

Thanks for help
Lorenzo 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/