There is a branch in the petsc bitbucket repository http://www.mcs.anl.gov/petsc/developers/index.html called barry/make-petscoptionsobject-nonglobal where one can call the PETSc operations in threads without any conflicts. Otherwise it just won’t work.
Barry On Apr 5, 2014, at 12:25 PM, D H <[email protected]> wrote: > Hi, > > I have a C++ program where I would like to call some of PETSc's KSP methods > (KSPCreate, KSPSolve, etc.) from inside a for loop that has a "#pragma omp > parallel for" in front of it. Without this OpenMP pragma, my code runs fine. > But when I add in this parallelism, my program segfaults with PETSc > reporting some memory corruption errors. > > I've read online in a few places that PETSc is not thread-safe, but before I > give up hope, I thought I would ask to see if anyone has had success working > with KSP routines when they are being called simultaneously from multiple > threads (or whether such a feat is definitely not possible with PETSc). > Thanks very much for your advice! > > Best, > > David
