On Wed, 2 Oct 2013, at 13:38, Jed Brown wrote: > Gryllida <[email protected]> writes: > > > I have a parallel program which reads data and makes a call to a > > subroutine that uses petsc. It only needs to read data once. Is it > > possible to implement that using MPI and then initialise petsc in the > > subroutine? Or do I need to initialise petsc first (and use MPI calls > > with PETSC_COMM_WORLD)? > > We recommend only calling PetscInitialize and PetscFinalize once, so you > may want to lift it to an initialization function. You can call them > inside the function, but if the function is called multiple times, the > profiling and debugging functionality in PETSc will have to run each > time, producing more output than you probably want when you turn those > features on. > > Regardless of where you initialize PETSc, you can use MPI_COMM_WORLD or > any other communicator.
Thank you for your nudge toward that using MPI first is possible; I had a system-wide MPI installation but did not specify it to ./configure. Doing so resolved my problems.
