[petsc-users] Where to restrict MPI Communicator

Florian Lindner mailinglists at xgm.de
Tue Feb 7 08:06:54 CST 2017


Hello,

so far we have happily set PETSC_COMM_WORLD anywhere in our code and we were not having trouble with that.

However http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PETSC_COMM_WORLD.html states that:

"Notes: By default PETSC_COMM_WORLD and MPI_COMM_WORLD are identical unless you wish to run PETSc on ONLY a subset of
MPI_COMM_WORLD. In that case create your new (smaller) communicator, call it, say comm, and set PETSC_COMM_WORLD = comm
BEFORE calling PetscInitialize(), but after MPI_Init() has been called."

So, you should never modify PETSC_COMM_WORLD after PetscInitialize has been called. Is that warning still in effect?

What other ways are to set the MPI comm used by PETSc. There is an comm argument on most (all?) functions like
VecCreate, PetscViewer*Open, PetscRandomCreate, MatCreate). Is it sufficient to use that argument to supply an alternate
communicator?

Thanks,
Florian


More information about the petsc-users mailing list