<div dir="ltr">There is no support for threaded matrix assembly in PETSc. Here is a recent email thread on the issue: <div><br></div><div><a href="https://mail.google.com/mail/u/0/#search/label%3Apetsc+thread+assembly/15f10d078e9ea8e7">https://mail.google.com/mail/u/0/#search/label%3Apetsc+thread+assembly/15f10d078e9ea8e7</a></div><div><br></div><div>So you pretty much have to deal with race conditions yourself. There are several failure modes with threads:</div><div><br></div><div>1) Off processor entries are stashed in a global data structure for a scatter/gather stage during matrix finalize. A simple fix for this is to have every processor compute all elements that touch its vertices (overlapping element decomposition) and then have PETSc ignore off processor entries. This is how I do it to simply avoid communication with redundant computation. It also avoid synchronization.</div><div><br></div><div>2) The 1D array data structure is reconstructed when the data spills the preallocated memory. Solution: allocate memory exactly.</div><div><br></div><div>3) Just normal race conditions. Coloring is the basic approach to this problem, although I think Jed thinks this is not sufficient in PETSc as is.</div><div><br></div><div>4) unknown unknowns.</div><div><br></div><div>Mark</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 17, 2017 at 3:24 PM, Yoon, Eisung <span dir="ltr"><<a href="mailto:yoone@rpi.edu" target="_blank">yoone@rpi.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="KO" link="#0563C1" vlink="#954F72">
<div class="m_-6870455339014136929WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi Mark,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Seegyoung here in SCOREC is looking for a way to assemble elements for a global matrix with PETSC using threads. I’m aware that you have installed thread-safe PETSC into NERSC system for XGC and you know details about
PETSC.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">So could you tell us if PETSC supports thread-safe global matrix assembly with thread-safe version of PETSC, and some details, please?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Seegyoung might describe more details about her problem later.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thank you.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Best,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">ES<u></u><u></u></span></p>
</div>
</div>
</blockquote></div><br></div>