ksp parallel excecution, question on ex5 ksp tutorials

Hong Zhang hzhang at mcs.anl.gov
Thu Apr 2 09:27:00 CDT 2009


> i had a few questions on the ex5 tutorial of ksp. It is described as a
> parallel execution of two ksp. Does it mean that each ksp solve is running
> on a single processor or the both are running in parallel on both processors
> (on the cas mpirun -np 2) ? Because i don't really see the distinction with
> ex2 of the same tutorial.
> If it's not running  two ksp in parallel, each on a single processor (in
> ex5), is it possible to do that anyway ? Would i need to directly use MPI or
> is there is any Petsc way to do that ?

KSP is an abstract PETSc object that manages all linear methods.
It requires a small overhead to create.
In ex5, we solve two linear systems with same number
of processors:
   C_1 x = b and
   C_2 x = b 
Thus, we only create the object ksp once and use it for both systems.

You can run ex2 with any number of processors, e.g.
mpiexec -n <np> ./ex2

You do not need call MPI message passing routines
when using petsc. PETSc wrapps the MPI communication
and enable users focus on the high level math modeling
and computation. See


More information about the petsc-users mailing list