Comments (7)
Try a petsc garbage cleanup after the gc.collect as well, I think.
from firedrake.
I tried adding all the petsc garbage cleanups
PETSc.garbage_cleanup(PETSc.COMM_SELF)
PETSc.garbage_cleanup(mesh._comm)
gc.collect()
PETSc.garbage_cleanup(PETSc.COMM_SELF)
PETSc.garbage_cleanup(mesh._comm)
if __name__ == "__main__":
run()
PETSc.garbage_cleanup(PETSc.COMM_SELF)
gc.collect()
PETSc.garbage_cleanup(PETSc.COMM_SELF)
and the result is the same
from firedrake.
I suspect the problem is still garbage collection. Python just doesn't provide any guarantees about when reference cycles will be cleared, and if that's only while the interpreter is getting pulled apart, then in Parallel you will still have leaked objects.
from firedrake.
PETSc.garbage_cleanup(PETSc.COMM_SELF)
will do nothing. I contributed some code upstream that means that we only defer the destruction of objects whose communicator has size greater than 1.
To me it seems feasible that we could be caching PETSc objects in some of our global caches that only get cleared up at interpreter shutdown.
from firedrake.
An extra cleanup is needed after the final garbage collection.
...
return mesh._comm
if __name__ == "__main__":
comm = run()
gc.collect()
PETSc.garbage_cleanup(comm)
from firedrake.
PETSc.garbage_cleanup(PETSc.COMM_SELF)
will do nothing. I contributed some code upstream that means that we only defer the destruction of objects whose communicator has size greater than 1.To me it seems feasible that we could be caching PETSc objects in some of our global caches that only get cleared up at interpreter shutdown.
PETSc.garbage_cleanup(PETSc.COMM_SELF)
will do nothing. I contributed some code upstream that means that we only defer the destruction of objects whose communicator has size greater than 1.To me it seems feasible that we could be caching PETSc objects in some of our global caches that only get cleared up at interpreter shutdown.
I think I did a round of pulling all of those out, so there are only "Object-cached" things that live for the lifetime of the process.
But, we absolutely have refcycles in the firedrake objects, so to clean things up one does need gc.collect()
followed by garbage_collect
on the relevant communicator.
As @jrmaddison notes, it is insufficient to call collect
at the end of the run
function, because the references to firedrake objects are still live. Without explicitly deleting (via del
) the names, they don't go out of scope until the function exits. So one must send the communicator out of the run
function, and then do as James suggests.
from firedrake.
Changing to
solve(a == L, w, solver_parameters=parameters)
return mesh._comm
if __name__ == "__main__":
comm = run()
gc.collect()
PETSc.garbage_cleanup(comm)
does indeed resolve the issue, thanks! I think it woud be nice to incorporate this into documentation examples. Not many users may run with -log_view
, but this also removes warnings like yaksa: X leaked handle pool objects
from firedrake.
Related Issues (20)
- BUG: Greater error than expected in quadrilateral GLL elements HOT 4
- Compute norm of assembled derivative HOT 5
- "Too many indices for sum factorisation!" for calculating radius on extruded CubedSphereMesh. HOT 1
- INSTALL: ImportError when running firedrake-update on Linux HOT 2
- INSTALL: Linux (Ubuntu 22.04.4 LTS) HOT 12
- Tests for `to_petsc_local_numbering`
- BUG: firedrake-install is now failing with --petsc-int-type=int64 HOT 3
- Buckling problem HOT 2
- Flake8 for demos HOT 2
- Zenodo release
- Labelling of Internal Facets in Mesh Generated with Netgen HOT 3
- Zenodo release request
- Error on interpolation using --petsc-int-type int64 HOT 1
- BUG: Adjoint inconsistency with self-assignment via projection HOT 1
- BUG: Many tests fail with 64-bit indices
- Zenodo release please. HOT 1
- BUG: mesh.locate_cell not returning what is expected for points outside the mesh (--petsc-int-type=int64) HOT 2
- Interpolation on two different meshes doesn't work on parallel
- BUG: restricted mode in Lineareigenproblem for mixed problems.
- BUG: Issue with wrapping Firedrake interpolation to vertex-only mesh in PyTorch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firedrake.