← Back to team overview

dolfin team mailing list archive

[Bug 705401] Re: When PyTrilinos is imported after dolfin, bad things happen

 

To reiterate, the problem with MPI_Finalize is not the only one. There
are also failures before the program ends, including the inability to
create an ML preconditioner object.

I think it's quite ok to say to the user, "import PyTrilinos before
dolfin", even though there are real bugs that should eventually be
addressed. I understand my previous proposal (try: import PyTrilinos;
except: pass) is unacceptable. How do you feel about dolfin blocking
import of PyTrilinos through import hooks, something like the following?

def _block_import(name, reason):
    import sys
    prefix = name+'.'
    class Importer(object):
        def find_module(self, fullname, path=None):
            if fullname == name or fullname.startswith(prefix):
                if not name in sys.modules:
                    error('%s must be imported before dolfin (see %s)'%(name, reason))
                return None
    sys.meta_path.append(Importer())
_block_import('PyTrilinos', 'https://bugs.launchpad.net/dolfin/+bug/705401')

-- 
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/705401

Title:
  When PyTrilinos is imported after dolfin, bad things happen

Status in DOLFIN:
  New

Bug description:
  When using PyTrilinos (ML in particular), the order of imports is
  important. If dolfin is imported first, it crashes at exit, and there
  are problems also with constructing preconditioners etc.

  It looks like it has to do with MPI initialisation, but I haven't
  looked at it closely.

  A simple workaround may be to try an import ML in dolfin/__init__.py
  (just import, not expose) so that it gets initialised. I don't know if
  the performance hit is worth it. It would of course be better to find
  a proper fix.

  Otherwise, it's nice to have it documented here. For google::
  >>> import dolfin
  >>> from PyTrilinos import ML
  >>> exit()
  *** An error occurred in MPI_Finalize
  *** after MPI was finalized
  *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)
  [rodin:17864] Abort after MPI_FINALIZE completed successfully; not able to guarantee that all other processes were killed!





Follow ups

References