On Mon, 9 Oct 2006, Patrick Lechner wrote:
> Dear all, > > I basically use PETSc inside an existing OpenMP application. All PETSc > solves are done in serial in this application. I therefore do not need MPI > (at the moment...). The code solves finite element problems, where the > OpenMP environment is used to use various parameters for these systems. All > private variables are allocated on the stack, the OpenMP parallel loop makes > calls to PETSc. This is a problem. If you have do i=1,100000 call SomeCodeThatCallsPETSc() enddo and the OpenMPI uses threads to parallelize the loop; you will have multiple calls to PETSc "at the same time". PETSc may not handle this, wierd stuff is likely to happen since several threads will access/change PETSc global variables at the "same time": at least profiling and logging information maybe other stuff. So you will need, at least to not do any PETSc profiling. Let us know how it goes, Barry > Thanks for your replies, > Patrick > > > > On 10/9/06, Barry Smith <bsmith at mcs.anl.gov> wrote: > > > > > > Patrick, > > > > Are you using "user level threads", that is your code stops > > and starts additional threads directly or are you using loop level > > threads, that is OpenMPI manages all the threads for you. If the > > later you are fine, if the former make sure only one thread > > makes PETSc calls. > > > > Barry > > > > > > On Mon, 9 Oct 2006, Patrick Lechner wrote: > > > > > Dear all, > > > I am currently writing a code and try to combine PETSc and OpenMP (where > > > PETSc will be used inside a parallel environment). > > > My questions now are: > > > 1. Is it safe to combine these libraries? > > > 2. What will I have to consider to make my code work reliably? > > > Thanks a lot for your help. > > > Best wishes, > > > Patrick > > > > > > > > > >
