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

ardata and ardata_view #313

Closed
glwagner opened this issue Jul 24, 2019 · 2 comments · Fixed by #399
Closed

ardata and ardata_view #313

glwagner opened this issue Jul 24, 2019 · 2 comments · Fixed by #399
Labels
cleanup 🧹 Paying off technical debt

Comments

@glwagner
Copy link
Member

What does ardata mean here:

https://github.com/climate-machine/Oceananigans.jl/blob/c961d3904700e73b1a4aebb71ebcc3f518693014/src/fields.jl#L114

? I can't decipher the meaning of the ar prefix.

Also, why is it necessary to have a separate function that returns a view? It might be better to return a view by default, and allow the user to create a copy by explicitly using copy or deepcopy, e.g. copy(ardata(u)), if that is needed.

@ali-ramadhan ali-ramadhan added the cleanup 🧹 Paying off technical debt label Jul 25, 2019
@ali-ramadhan
Copy link
Member

This is what happens when I don't write comments :(

The ar prefix I think was because the function indexes into the underlying array f.data.parent instead of the offset array.

At this point I think I've forgotten why they're all defined this way, I'd have to check to see where they're used. I suspect I used ardata somewhere where a view doesn't work. I think iterating over a non-contiguous view into an OffsetArray{CuArray} devolves into slow scalar operations.

Just highlights the need to prioritize cleaning up the field abstraction (#298).

@glwagner
Copy link
Member Author

Ok. Perhaps something like parentdata would be more meaningful here.

Whichever is better to be default for this class of functions --- a view, or a copy --- we should use consistent naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 Paying off technical debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants