Skip to content
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

Examples on GPU #167

Closed
navidcy opened this issue Dec 18, 2020 · 3 comments · Fixed by #207
Closed

Examples on GPU #167

navidcy opened this issue Dec 18, 2020 · 3 comments · Fixed by #207
Assignees
Labels

Comments

@navidcy
Copy link
Member

navidcy commented Dec 18, 2020

Some of the examples need slight modifications/generalizations to be able to run on GPU by simply setting dev=GPU().

@navidcy navidcy self-assigned this Dec 18, 2020
@navidcy
Copy link
Member Author

navidcy commented Mar 5, 2021

This issue was brought up by @ranocha in his review.

The main reason for examples failing is plotting: when plotting one needs to bring the arrays on CPU. E.g.,

heatmap(x, y, ζ')

won't work if ζ is a CuArray and instead we need to call

heatmap(x, y, collect(ζ)')

@glwagner any ideas what we can do here? Sprinkle collect() in all plotting commands in examples?

@navidcy
Copy link
Member Author

navidcy commented Mar 5, 2021

Or we can overload some plotting functions when we load GeophysicalFlows.jl, e.g.

import Plots.plot, Plots.heatmap, Plots.contourf

Plots.plot(x, y::CuArray, args...; kwargs...) = Plots.plot(x, collect(y), args...; kwargs...)
Plots.heatmap(x, y, z::CuArray, args...; kwargs...) = Plots.heatmap(x, y, collect(z), args...; kwargs...)
Plots.contourf(x, y, z::CuArray, args...; kwargs...) = Plots.contourf(x, y, collect(z), args...; kwargs...)

@navidcy
Copy link
Member Author

navidcy commented Mar 5, 2021

hm... no, we don't want to do that in GeophysicalFlows.jl
perhaps within the examples?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant