-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically disable CuArray scalar operations #851
Conversation
Ah so the dispatch on @hascuda @inline cpudata(f::Field{X, Y, Z, <:CuArray}) where {X, Y, Z} =
OffsetArray(Array(parent(f)), f.grid, location(f)) is wrong so it falls back on Field{X, Y, Z, <:OffsetArray{T, D, <:CuArray} where {T, D}} where {X, Y, Z} but still trying to get it to work. Will add |
Codecov Report
@@ Coverage Diff @@
## master #851 +/- ##
==========================================
- Coverage 72.62% 72.52% -0.10%
==========================================
Files 188 187 -1
Lines 5337 5322 -15
==========================================
- Hits 3876 3860 -16
- Misses 1461 1462 +1
Continue to review full report at Codecov.
|
Got bitten by CuArray scalar operations while debugging some Europa runs so this PR adds an
__init__()
function to the Oceananigans module that disables CuArray scalar operations once the module has been loaded and only allows scalar ops via theCUDA.@allowscalar
macro.Now when we accidentally perform scalar ops on CuArrays we should get an error, which is much better than having silent performance regressions which has happened multiple times in the past.
Two remaining problems:
set!(u::Field, v::Number) = @. u.data = v
actually incurs scalar ops becausea::CuArray .= 1.5
does not buta::OffsetArray{CuArray .= 1.5
does, so it's probably something we have to fix by adapting broadcasting over offsetarrays?Resolves #276