-
Notifications
You must be signed in to change notification settings - Fork 104
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
Reshape method #1760
base: develop
Are you sure you want to change the base?
Reshape method #1760
Conversation
examples/reshape.cpp
Outdated
// RAJA::Layout objects may be templated on dimension, argument type, and | ||
// index with unit stride. Here, the column index has unit stride (argument 2). |
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.
Can you supply the permutation at compile time, via camp::list or std::index_sequence, and have it produce a view with the right unit stride index?
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.
yes, I pushed a version for that just now. Let me know what you think.
struct layout_left{}; | ||
struct layout_right{}; | ||
|
||
template<typename LAYOUT> |
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.
Can we add a specialization for a generic index sequence like std::index_sequence?
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.
Sure, I'll take a pass at this and then I'll remove the "Draft" marking from this PR.
@MrBurmark , @rhornung67 I think the example for the reshape method can be simplified. I just pushed up a new version. I was a bit worried the previous version might have too much going on. |
} | ||
|
||
template<std::size_t...Is> | ||
struct Reshape<std::index_sequence<Is...>> |
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.
@MrBurmark , this is the specialization that takes an index_sequence and identifies the correct unit stride
// Initialize memory using right most unit stride | ||
// | ||
//----------------------------------------------------------------------------// | ||
std::cout << "\n\nInitialize array with right most indexing...\n"; |
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.
I think these implementations are much easier to understand if your intent is just to show the mechanics of View reshaping. 👍
I fixed a bug with the custom sequence, thanks @rhornung67 for point it out. This PR is now ready for review. |
Summary
This PR adds helper methods to views to create Reshape methods with compile time options C and Fortran style indexing