[petsc-users] Call MatsetValues in a openMP loop

Barry Smith bsmith at mcs.anl.gov
Wed Oct 11 04:52:54 CDT 2017

> On Oct 11, 2017, at 7:17 AM, Luca Verzeroli <l.verzeroli at studenti.unibg.it> wrote:
> Goodmornig,
> Is it possible to put MatSetValues or VetSetValues in a openMP loop? Now I'm creating values in a loop and maybe it could be speed up with a multithreads implementation. Are these routines thread safe or not?

   Absolutely not, putting locks around each set values call would be grossly expensive.

   We don't recommend using OpenMP for HPC computing (that is mixed with MPI) we have yet to see any real evidence that MPI + OpenMP performs better than plan MPI.  We are aware that many people "say" you need to have MPI + OpenMP but when you look for real publications that demonstrate more than a trivial improvement of MPI + OpenMP over MPI you will find they are seriously lacking.


> Luca

More information about the petsc-users mailing list