|Re: [eigen] assembling a sparse matrix from multiple threads|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] assembling a sparse matrix from multiple threads
- From: Dan Čermák <dan.cermak@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 05 Jul 2018 10:42:41 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=cgc-instruments.com; b=A1N/Nb/yxxYag0ji2o++qTrX/XBFbjV59KWoEP8p8IB3cf3naU1VWSaUzD2i0zQ+wdY+DXOpVdFcbG8IHZ1T585R5OAKNeK8EgoWjgs8vsGLomwOwIsiVoAeBE8t8jmwMok3n8htu2LkQR7J8aK/4PL5iBjtWXrEMowVQabPYrg=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type;
I haven't used Eigen in a while, but afaik it uses the compressed column
storage scheme which (at least I imagine it) makes it complicated to
insert new values efficiently in parallel.
Also the documentation of insert states that it is optimized for
which you probably aren't performing.
I guess you are probably better of assembling the matrix entries in the
vector of triplets and then creating the matrix afterwards. But someone
more familiar with Eigen should probably confirm that.
Lorenzo Botti <bottilorenzo@xxxxxxxxx> writes:
> Dear all,
> I'm having troubles assembling a sparse matrix in parallel, from multiple
> 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