On 13 Mar 2014, at 13:57, Jed Brown <[email protected]> wrote:

> "Garth N. Wells" <[email protected]> writes:
>> At the moment, DOLFIN finalises MPI when a singleton class goes out of
>> scope at the end of program *if* DOLFIN initialised MPI.
> 
> Who creates that singleton?  Why can't the constructor for that class be
> the one to initialize MPI _if_ it hasn't already been?

It gets created the first time one of its member functions is called. The name 
of the class is SubSystemsManager, and MPI is initialised by calling 
SubSystemsManager::init_mpi() (optionally with arguments to control the MPI 
thread level). PETSc is initialised using SubSystemsManager::init_petsc(). 
These init functions first check if the ‘subsystem’ has been initialised, and 
if necessary initialise the subsystem.

The user can explicitly call SubSystemsManager::init_mpi(), or rely on it to be 
called by some object (usually at construction). We’re not consistent in the 
implementation of the latter case.

Garth
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to