[petsc-users] how to use petsc4py with mpi subcommunicators?

Lisandro Dalcin dalcinl at gmail.com
Thu Apr 13 02:16:22 CDT 2017


On 11 April 2017 at 17:31, Rodrigo Felicio <Rodrigo.Felicio at iongeo.com>
wrote:

> Thanks, Jed, but using color == 0 lead to the same error msg. Is there no
> way to set PETSc.COMM_WORLD to a subcomm instead of MPI.COMM_WORLD in
> python?
>
>

You can do it, but it is a bit tricky, and related to the fact that
PETSC_COMM_WORLD has to be set to subcomm before calling PetscInitialize(),
which happens automatically the first time Python executes "from petsc4py
import PETSc". The way to do it would be the following:

import sys, petsc4py
petsc4py.init(sys.argv, comm=subcomm)
from petsc4py import PETSc



-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 0109
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170413/9e323e5c/attachment-0001.html>


More information about the petsc-users mailing list