[Dev] Precompile the problems so that users and tests do not recompile them every time
メンテナーはふだん 1 日以内に返信
@ocots がすでに取り組んでいます。
2026年11月5日 から。
評価
この issue はまだ評価されていません。
説明
Part of #310. Not for now: to do before the collection grows (the roadmap aims at many more problems, #179, #287, #308).
Context
Solving a problem of the OptimalControl modelings costs mostly compilation, and it is specific to each problem: each @def creates its own functions, and the modeler (ADNLP, Exa) and the solver specialize on them. Measured in #360 (phase A, macOS, Julia 1.12): the first pass over the 85 problem × modeling × configuration combinations took 211 s; the eight next passes took 0.1 to 0.2 s each. About 2.5 s per combination, almost all compilation. JuMP models are interpreted and do not pay it (whole JuMP suite: 24 s). This is also why the smoke tests of #363 did not save CPU time: 3 iterations or convergence cost about the same.
At 200 problems × 3 configurations this would be about 25 min of compilation per run (extrapolated, not measured), for the tests and for a user who solves many problems (benchmarks).
Options
- Precompilation in the package (PrecompileTools), recommended: a
@compile_workloadin the extensionsOptimalControlModelsandOptimalControlScalarizedModelsbuilds each problem and runs a few iterations of the usual configurations. Since Julia 1.9 the native code is stored in the package images in the depot, including the specializations of ADNLP, Exa and the solvers on our functions. A user pays once per install or update; the CI keeps the images in its cache (julia-actions/cache, made reliable by #336 and #340).- Drawback: a long install for everyone. A switch is needed, e.g. a preference (
Preferences.jl) to precompile all problems (on in the CI and for benchmarks), off or limited to a list by default. - Limit: an extension precompiles only for the packages loaded together; the solvers and modelers must be triggers or loaded in the workload.
- Drawback: a long install for everyone. A switch is needed, e.g. a preference (
- A system image (PackageCompiler) as a CI artifact: the largest gain at startup, but one image per Manifest, OS and Julia version, rebuilt at every dependency change; CI only.
- Less specialization: not realistic, automatic differentiation relies on it.
- GPU: CUDA kernels are compiled at run time and are not cached the same way; option 1 does not help much there.
Scope
- Measure the compilation per problem and configuration, and what a warm cache saves (locally and in the CI).
- Prototype
@compile_workloadon a few problems; check the images are reused by a second session and by the next CI run. - Decide the default for a user (switch, list, or nothing) and document it.
Done when
- Measurements: compilation per problem and configuration, cold and warm.
- A prototype on a few problems, reused across sessions and CI runs, with its install-time cost.
- A decision on the default for users, documented.
🤖 Generated with Claude Code
- 主要言語
- Julia
- スター
- 13
- フォーク
- 1
- 平均マージ
- 3時間 20分
- マージ済み PR(30日)
- 27
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
control-toolbox/OptimalControlProblems.jl のほかの issue
-
[Metadata] Declared fields: tags, references, Corleone, reference solution対応中かも @ocots が今日担当しました。 オープン
control-toolbox/OptimalControlProblems.jl#379 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Cron] Robustness of the initial guess and known local objectives対応中かも @ocots が今日担当しました。 オープン
control-toolbox/OptimalControlProblems.jl#378 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Metadata] Shared initial guess in the metadata, read by every modeling対応中かも @ocots が今日担当しました。 オープン
control-toolbox/OptimalControlProblems.jl#377 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Metadata] Compute the features of a problem from its model対応中かも @ocots が今日担当しました。 オープン
control-toolbox/OptimalControlProblems.jl#376 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Metadata] Reference objectives per scheme, computed by a script対応中かも @ocots が今日担当しました。 オープン
control-toolbox/OptimalControlProblems.jl#375 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
control-toolbox/OptimalControlProblems.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
backport 1.14 GC
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
`binary_focal_loss` throws a `DomainError` when a negative sample has `ŷ = 1`対応中かも @parth-patel010 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FluxML/Flux.jl#2818 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
JuliaDiff/TaylorSeries.jl#445 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
control-toolbox/CTActions#139 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信