[petsc-users] MatSetValues with openMP and no data races

Jed Brown jed at jedbrown.org
Thu Oct 12 13:14:26 CDT 2017


Lawrence Mitchell <lawrence.mitchell at imperial.ac.uk> writes:

> On 12/10/17 14:40, Guillaume Emond wrote:
>> Goodmorning,
>> 
>> I would like to clarify a point about the insertion of values with  
>> MatSetValues in a openMP loop. I know these routines are not thread  
>> safe. But, in our situation, we used a graph coloring algorithm on our  
>> mesh to make sure no adjacent element is inserted at the same time so  
>> no data races occurs when inserting values. Could these routines be  
>> used with openmp then or is there some internal variables that would  
>> not be thread safe?
>
> The MatStash used for saving and then later communicating off process
> entries during AssemblyEnd is, I believe, not thread safe.

Yeah, we could make a thread-safe MatSetValues (I would suggest per-row
or block-row locking), but it is not now, even with coloring.


More information about the petsc-users mailing list