pyop3: every assembled matrix keeps a second matrix of the same size alive
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #5614 di @sghelichkhani — chiusa senza merge
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend, performance
Direzione di ricerca
Start by tracing PetscMatBuffer.materialize() and how _lazy_template is retained by the sparsity buffer and cached loop executor in _compile. Check the related discussion in issue #5538 for context on the other reported memory leak. The issue is resolved when assembled matrices no longer leave an unnecessary same-sized PETSc matrix alive through cached sparsity buffers, with the example reporting only the matrix still in use.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
While looking at the peak memory of G-ADOPT with pyop3 I found that every assembled matrix keeps a second matrix of the same size alive.
PetscMatBuffer.materialize() builds a fully assembled matrix from the preallocator of the sparsity, stores it in _lazy_template and returns a duplicate of it. The sparsity buffer is then held by the executor of the loop that filled the sparsity, which stays in the heavy _compile cache, so the template is never freed. PyOP2 kept only the row counts of the sparsity. In G-ADOPT cases with many cells per rank this and the leak that #5538 fixes are the two largest parts of the extra PETSc memory of pyop3 against PyOP2.
A small example in serial:
import gc
from firedrake import *
mesh = UnitSquareMesh(20, 20)
V = VectorFunctionSpace(mesh, "CG", 2)
u, v = TrialFunction(V), TestFunction(V)
A = assemble(inner(grad(u), grad(v)) * dx)
gc.collect()
mats = [m for m in gc.get_objects()
if isinstance(m, PETSc.Mat) and m.handle and m.type == "seqaij"]
print(len(mats)) # 2, although only A is in use
Is it intended that the template stays alive for as long as the sparsity buffer is in the cache? And is it intended that the cached executors hold on to the buffers of their first call?
- Lingua principale
- Python
- Stelle
- 684
- Fork
- 204
- Merge medio
- 4g 14h
- PR unite (30g)
- 46
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di firedrakeproject/firedrake
-
BUG: NonlinearVariationalSolver errors with adj_kwargsForse già presa @dham l’ha presa 151 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
firedrakeproject/firedrake#5186 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
firedrakeproject/firedrake#5091 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
firedrakeproject/firedrake#3556 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
firedrakeproject/firedrake#5644 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Function.assign on a subset fails with a Constant, a Real Function or abs in the expressionForse già presa @connorjward l’ha presa 2 giorni fa. Aperta
firedrakeproject/firedrake#5643 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di firedrakeproject/firedrake
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Sienna-Platform/SiennaSchemas#130 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
firedrakeproject/Irksome#293 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ida-arbeitszeit/workers-control#1578 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws-samples/sample-per-model-bedrock#898 ·
I maintainer di solito rispondono entro 1 giorno