Repository navigation
Remove various Core.Boxes being captured by closures in tests - #5965
Conversation
The stratified Couette flow validation script sets initial conditions
via closures that reached into `model.grid` for the domain extents, and
a nested `print_progress` function reassigned `model`, which turned the
captured variable into a `Core.Box`. On KernelAbstractions 0.10 the CPU
backend compiles kernels like GPU backends do, so these closures were
rejected as non-bitstype kernel arguments:
KernelError: passing non-bitstype argument
.ε is of type var"#ε#20" which is not isbits.
.model is of type Core.Box which is not isbits.
Capture `Lx` and `Lz` as plain numbers instead, and stop reassigning
`model` inside `print_progress`, so the closures only hold numbers and
compile on every backend.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHciC8x39gm97sABrSvBkt
|
I think all the validation scripts need to be refreshed, most of them are outdated |
|
This is sufficient to make the |
`z_immersed_boundary` had two methods, the second calling the first by
name. A local function that refers to its own name captures itself
through a `Core.Box`, so the closure is not isbits and cannot be a
kernel argument. `set!(field, func)` evaluates the function on the CPU,
which with KernelAbstractions 0.10 is a compiled backend with the same
isbits requirement as GPUs:
KernelError: passing non-bitstype argument
.func is of type var"#z_immersed_boundary#..." which is not isbits.
.z_immersed_boundary is of type Core.Box which is not isbits.
Only the 3-argument method is called, so define that one alone.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHciC8x39gm97sABrSvBkt
`bᵢ` captured the whole `grid` to read `grid.Lx`. On the GPU the grid
holds `CuArray`s, so the closure is not isbits and cannot be a kernel
argument. `set!(field, func)` evaluates the function on the CPU, which
with KernelAbstractions 0.10 is a compiled backend with the same isbits
requirement as GPUs:
KernelError: passing non-bitstype argument
.func is of type var"#bᵢ#bᵢ##0"{ImmersedBoundaryGrid{...}} which is not isbits.
.grid is of type ImmersedBoundaryGrid{...} which is not isbits.
Capture the domain length as a number instead.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHciC8x39gm97sABrSvBkt
Core.Boxes being captured by closures in tests
|
I cherry picked a few other changes from #5799 getting rid of |
…ction
The immersed boundary function is called with `(x, z)` on grids with a
`Flat` y direction and with `(x, y, z)` otherwise:
MethodError: no method matching (::var"#z_immersed_boundary#...")(::Float64, ::Float64)
Define both methods with independent bodies; unlike a method calling the
other by name, this keeps the closure isbits.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHciC8x39gm97sABrSvBkt
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5965 +/- ##
==========================================
+ Coverage 67.90% 74.11% +6.20%
==========================================
Files 428 428
Lines 25517 26573 +1056
==========================================
+ Hits 17327 19694 +2367
+ Misses 8190 6879 -1311
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
I mentioned multiple times that reusing same label is problematic, now it's biting us 🙂
Taken out of #5799.