Commit aaef682
committed
get_differential_vars: check Diagonal.diag, not the full matrix
all(!iszero, mm) visits every (i, j) pair of the mass matrix via
scalar getindex. For a GPU-backed diagonal mass matrix
(Diagonal{Float64, <:CuVector}) that indexing is disallowed by
default, so the check throws whenever it runs on a device array,
and it is O(n^2) for a structurally O(n) question. Diagonal
guarantees off-diagonal zeros, so check mm.diag directly; the
broadcast over the diagonal vector dispatches to a device kernel,
matching what find_algebraic_vars_eqs(::Diagonal) already does.
Adds a guard test: a Diagonal wrapping a vector that errors on
scalar getindex but supports whole-array broadcast, i.e. device
array semantics on the CPU, so a regression back to the
whole-matrix walk is caught without GPU hardware in CI.
The statically resolvable Diagonal branch also fixes inference of
solve for the two Rodas4 + ShampineCollocationInit cases in the
NonlinearSolve mass matrix tests. Their form
@test_broken sol = @inferred solve(...) errors with "expression
evaluated to non-Boolean" once @inferred succeeds, so those two
lines become @test (@inferred ...; true), still erroring if
inference regresses.
Also wires up show_errors(results) in the GPU DAE test entry
point, which was defined but never called, so a real failure
prints its actual exception instead of just a status glyph.1 parent 2111422 commit aaef682
4 files changed
Lines changed: 50 additions & 2 deletions
File tree
- lib
- OrdinaryDiffEqCore
- src
- test
- OrdinaryDiffEqNonlinearSolve/test
- test/gpu
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
386 | 389 | | |
387 | | - | |
| 390 | + | |
388 | 391 | | |
389 | 392 | | |
390 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
461 | 466 | | |
462 | 467 | | |
463 | 468 | | |
| |||
0 commit comments