Direct use of Projector is never annotated on the pyadjoint tape

Abierto
#5,176 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python
Área
backend

Línea de trabajo

Empieza en adjoint_utils/blocks/solving.py leyendo ProjectorBase.project y ProjectBlock, junto con la refactorización de CachedSolverBlock en #4638. Rastrea cómo se anotan y reproducen la función libre project, Function.project y el uso directo de Projector. Se considera terminado cuando las tres rutas se registran en el tape de pyadjoint y la reproducción reutiliza el solver almacenado en caché de Projector, la inversa de slate y el comportamiento de constant_jacobian.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

While fixing #5172 (PR #5175) I noticed that using Projector directly records nothing on the pyadjoint tape. Only the free function project and Function.project are annotated; ProjectorBase.project is not, so the projector that the documentation recommends precisely when one wants to reuse the mass solver across repeated projections is invisible to the adjoint. A model that switches from project(f, V) to p = Projector(f, V) plus p.project() for performance silently loses those operations from the tape, with no warning.

The natural fix seems to be to move the annotation onto ProjectorBase.project itself, with the block holding the Projector so that replay reuses its cached solver, slate inverse and constant_jacobian behaviour. SupermeshProjectBlock already works this way. That would give a single annotation point for all three entry paths and would make the replay reproduce the forward computation exactly, rather than reconstructing it from recorded parameters as #5175 does. Since this means restructuring ProjectBlock, which lives in the same part of adjoint_utils/blocks/solving.py that the CachedSolverBlock work in #4638 is reshaping, it probably makes sense to do it on top of that refactor, where a cached projector block would be the natural analogue of the cached solver block.

Lenguaje dominante
Python
Estrellas
684
Forks
204
Merge medio
4 d 14 h
PR fusionados (30 d)
46

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firedrakeproject/firedrake

Todos los issues de firedrakeproject/firedrake

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.