Direct use of Projector is never annotated on the pyadjoint tape

オープン
#5,176 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
backend

調査の方向性

adjoint_utils/blocks/solving.py から始め、ProjectorBase.project と ProjectBlock を読み、#4638 の CachedSolverBlock のリファクタリングも確認します。自由関数 project、Function.project、Projector の直接使用がどのようにアノテーションされ、リプレイされるかを追跡します。完了条件は、3 つすべての経路が pyadjoint tape に記録され、リプレイ時に Projector のキャッシュ済み solver、slate inverse、constant_jacobian の挙動が再利用されることです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
684
フォーク
204
平均マージ
4日 14時間
マージ済み PR(30日)
46

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firedrakeproject/firedrake のほかの issue

firedrakeproject/firedrake の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。