Excessive allocations with VectorOfArray in broadcast
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- julia
- 領域
- performance
調査の方向性
まず、報告された VectorOfArray の再現コードを DifferentialEquations、ODEProblem、RK4、および rhs! ベンチマークで実行し、次に中点則と比較します。solve 中のアロケーションを追跡し、要素ごとのアロケーションの原因となっている操作を特定します。RK4 のケースで過剰なアロケーションが発生しなくなり、報告された solve の挙動が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am using a VectorOfArray as state vector in DifferentialEquations. This leads to too many allocations.
using DifferentialEquations
using RecursiveArrayTools
# Set up the state vector
U = VectorOfArray([zeros(100,100,100), zeros(100,100,100)]);
rhs!(U̇, U, p, t) = U̇ .= U
# Compile all code
prob = ODEProblem(rhs!, U, (0.0, 1.0));
sol = solve(prob, RK4(); adaptive=false, dt=1.0);
# Benchmark
prob = ODEProblem(rhs!, U, (0.0, 1.0));
@time sol = solve(prob, RK4(); adaptive=false, dt=1.0);
This outputs
1.639028 seconds (42.00 M allocations: 991.828 MiB, 18.67% gc time)
Note the very large number of allocations. It seems as if some operation was performing one small allocation per array element.
(I notice that this problem disappears if I switch to the midpoint rule.)
I tried with both Julia 1.7 and the current release branch of Julia 1.8.
- 主要言語
- Julia
- スター
- 233
- フォーク
- 76
- 平均マージ
- 5時間 33分
- マージ済み PR(30日)
- 11
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SciML/RecursiveArrayTools.jl のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
SciML/RecursiveArrayTools.jl#255 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
SciML/RecursiveArrayTools.jl#662 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
SciML/RecursiveArrayTools.jl#661 ·
-
JET: similar_type(::Any) no-matching-method in RecursiveArrayToolsRaggedArrays (pre-existing QA red) オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
SciML/RecursiveArrayTools.jl#620 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
SciML/RecursiveArrayTools.jl#619 ·
SciML/RecursiveArrayTools.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CliMA/Oceananigans.jl#6066 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JuliaLang/LinearAlgebra.jl#1707 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JuliaAstro/AstroImages.jl#140 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 90/100