<div dir="ltr"><div dir="ltr"><div><br></div><div>Added this w/o luck:</div><div><br></div><div>#if defined(PETSC_HAVE_CUDA)<br> ierr = PetscOptionsCheckCUDA(logView);CHKERRQ(ierr);<br>#if defined(PETSC_HAVE_THREADSAFETY)<br> ierr = PetscCUPMInitializeCheck();CHKERRQ(ierr);<br>#endif<br>#endif<br></div><div> </div><div>Do you think I should keep this in or take it out? Seems like a good idea and when it all works we can see if we can make it lazy.</div><div><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
1) Calling PetscOptions inside threads. I looked quickly at the code and it seems like it should be ok but perhaps not. This is one reason why having stuff like PetscOptionsBegin inside a low-level creation VecCreate_SeqCUDA_Private is normally not done in PETSc. Eventually this needs to be moved or reworked. <br>
<br></blockquote><div><br></div><div>I will try this next. It is hard to see the stack here. I think I will put it in ddt and put a breakpoint PetscOptionsEnd_Private. Other ideas welcome.</div><div><br></div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2) PetscCUDAInitializeCheck is not thread safe.If it is being call for the first timeby multiple threads there can be trouble. So edit init.c and under<br>
<br>
#if defined(PETSC_HAVE_CUDA)<br>
ierr = PetscOptionsCheckCUDA(logView);CHKERRQ(ierr);<br>
#endif<br>
<br>
#if defined(PETSC_HAVE_HIP)<br>
ierr = PetscOptionsCheckHIP(logView);CHKERRQ(ierr);<br>
#endif<br>
<br>
put in <br>
#if defined thread safety<br>
PetscCUPMInitializeCheck<br>
#endif<br>
<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
this will force the initialize to be done before any threads are used <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote></div></div>