[petsc-users] KSP in OpenMP Parallel For Loop

D H mrhyde at stanford.edu
Sat Apr 5 12:25:37 CDT 2014


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!



More information about the petsc-users mailing list