[petsc-users] Threading in petsc

Barry Smith bsmith at mcs.anl.gov
Wed Dec 30 16:30:23 CST 2009

   Check out the manual pages for PetscOpenMPSpawn(),  
PetscOpenMPMerge(), PCOpenMPRun(), PetscOpenMPNew(), and their command  
line options. You can look at src/ksp/pc/impls/openmp/openmp.c to an  
example of how they are used. Note that it does NOT explicitly use  
OpenMP, it is a way for one to write OpenMP code that is used with  
There are non-trivial concepts in this code and it is not recommended  
for most PETSc users who just want to solve some PDE or do some  
similar computation; they have no reason to use this code. You are on  
your own to understand this code if you want to play with it.  
Suggestions on how to improve it are appreciated.


On Dec 28, 2009, at 9:08 PM, yangchao at iscas.ac.cn wrote:

> Hi Barry,
> Any example of the code you mentioned? Or any hint on how to do  
> threading withing
> MPI process?
> Thanks in advance!
> Chao Yang
> On Dec 12, 2009, at 2:12 PM, Eugen Wintersberger wrote:
>> Hi there
>> I am entirely new to petsc. I would like to know if communication
>> between Jobs on a single node is done via threads or mpi.
>    The standard model is to have 1 MPI process per core so there is
> no need for or use of threads.
>     There is some code in place that allows one to have one MPI
> process per node and use threads within the node to compute the users
> nonlinear function.
>     Barry
>> Thanks in advance
>>      Eugen wintersberger

More information about the petsc-users mailing list