-
Notifications
You must be signed in to change notification settings - Fork 31
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
Optimize calcF! in examples with stochastic forcing #225
Conversation
If that works, that's awesome! |
|
||
Fh .= ArrayType(dev)(ξ) .* sqrt.(forcing_spectrum) | ||
|
||
Fh .= sqrt.(forcing_spectrum) .* exp(2π * im * random_uniform(eltype(grid))) ./ sqrt(clock.dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :-D
Unfortunately you may need different functions for Fh::Array
and Fh::CuArray
, because you may need to use CUDA.sqrt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, there are some still some issues which I will fix.
But on the other hand, CUDA.sqrt()
wasn't required previously... why it should be now? Even before forcing_spectrum
could be a CuArray...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I guess you're right:
julia> using CUDA
julia> a = CuArray(rand(3))
3-element CuArray{Float64,1}:
0.3974296213138291
0.46740283369767677
0.5039702920081996
julia> b = sqrt.(a)
3-element CuArray{Float64,1}:
0.6304201942465272
0.6836686578289785
0.7099086504672272
Closes #223.