Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework initialisation #459

Closed
wence- opened this issue Aug 7, 2015 · 4 comments
Closed

Rework initialisation #459

wence- opened this issue Aug 7, 2015 · 4 comments

Comments

@wence-
Copy link
Member

wence- commented Aug 7, 2015

Recent issues on HPC systems to do with forking show how fragile our "automatic" initialisation is. There's a subtle interplay between MPI init and enabling the fork server for compilation, along with when the forked child is allowed to "import" anything.

The issues are:

  1. After MPI_Init we should not fork (either for compilation, or getting a version or anything else)

To address this we use Andreas Kloeckner's prefork.py to fork (before MPI_Init) a "fork server".

  1. During python "import", a fork()ed child may not also call "import", Python complains about import locks.

Plausibly the "prefork-everywhere" branch of PyOP2 addresses these problems. However, it's pretty fragile.

Problems are:

from mpi4py import MPI
# or
from petsc4py import PETSc

initialize MPI automagically. Therefore, we need to make sure we've set up the fork server before either of these are imported.

Given that we don't have a top-level "init" method the user has to call after importing firedrake, we're in a bit of a bind. Suggestions?

@miklos1
Copy link
Contributor

miklos1 commented Aug 14, 2015

Can't we just force from firedrake import * to call the prefork? Or is it the problem that that line itself is an import, so if we fork there then the fork server cannot import any more?

@wence-
Copy link
Member Author

wence- commented Aug 14, 2015

Exactly. Until that line completes, you're "importing"

@wence-
Copy link
Member Author

wence- commented Aug 14, 2015

Note that one way out of this is to move all the MPI/petsc initialisation into op2.init, which is currently called automagically for the user when they create a firedrake object.

We should then expose it in the API and document when one needs to do things by hand.

@connorjward
Copy link
Collaborator

Closing as effectively a duplicate of firedrakeproject/firedrake#3820

@connorjward connorjward closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants