-
Notifications
You must be signed in to change notification settings - Fork 32
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
GPUify the TwoDTurb module #25
Conversation
It'll be good if we can remove the boilerplate in GeophysicalFlows.jl/src/twodturb.jl Lines 99 to 127 in 733833b
I tried replacing it with const physicalvars = [:zeta, :u, :v]
const transformvars = [ Symbol(var, :h) for var in physicalvars ]
const forcedvars = [:Fh]
const stochforcedvars = [:prevsol]
varspecs = cat(
getfieldspecs(physicalvars, :(Aphys)),
getfieldspecs(transformvars, :(Atrans)),
dims=1)
forcedvarspecs = cat(varspecs, getfieldspecs(forcedvars, :(Atrans)), dims=1)
stochforcedvarspecs = cat(forcedvarspecs, getfieldspecs(stochforcedvars, :(Atrans)), dims=1)
struct Vars{Aphys, Atrans} <: TwoDTurbVars
[ :( $(spec[1])::$(spec[2]) ) for spec in varspecs]
end
struct ForcedVars{Aphys, Atrans} <: TwoDTurbVars
[ :( $(spec[1])::$(spec[2]) ) for spec in forcedvarspecs]
end
struct StochasticForcedVars{Aphys, Atrans} <: TwoDTurbVars
[ :( $(spec[1])::$(spec[2]) ) for spec in stochforcedvarspecs]
end but it didn't work... Did I do something wrong? |
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
==========================================
+ Coverage 98.63% 98.64% +0.01%
==========================================
Files 6 6
Lines 513 518 +5
==========================================
+ Hits 506 511 +5
Misses 7 7
Continue to review full report at Codecov.
|
Pull Request Test Coverage Report for Build 263
💛 - Coveralls |
Also, when a 2D grid is created on the GPU I get this message: ┌ Warning: Performing scalar operations on GPU arrays: This is very slow, consider disallowing these operations with `allowscalar(false)`
└ @ GPUArrays ~/.julia/packages/GPUArrays/J4c3Q/src/indexing.jl:16 and I couldn't figure out what causes it and how to make sure the code is efficient. |
@navidcy I think you want to use But there's another way --- we can define |
Ya that's annoying. I've been getting that too in different code using |
can you try do that? I've lost my patience with |
Btw, I tried running I removed step: 0200, t: 2, ΔE: 0.9909, ΔZ: 0.4213, τ: 0.04 min
step: 0400, t: 4, ΔE: 0.9884, ΔZ: 0.2665, τ: 0.06 min
step: 0600, t: 6, ΔE: 0.9873, ΔZ: 0.1979, τ: 0.07 min while on bruno using GPU: step: 0200, t: 2, ΔE: 0.9909, ΔZ: 0.4213, τ: 1.11 min
step: 0400, t: 4, ΔE: 0.9884, ΔZ: 0.2665, τ: 2.17 min
step: 0600, t: 6, ΔE: 0.9873, ΔZ: 0.1979, τ: 3.21 min When I run without computing diagnostics on bruno, i.e., step: 0200, t: 2, ΔE: 1.0000, ΔZ: 1.0000, τ: 0.01 min
step: 0400, t: 4, ΔE: 1.0000, ΔZ: 1.0000, τ: 0.03 min
step: 0600, t: 6, ΔE: 1.0000, ΔZ: 1.0000, τ: 0.04 min I think we should revisit the |
I don't think this by itself is a problem (you can have a CPU array of |
OK, so regarding this PR: should we merge? Anything else needed? |
This PR modifies the
TwoDTurb
module so that it can run smoothly on both CPU and GPU.