-
Notifications
You must be signed in to change notification settings - Fork 75
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
Prints Acc tags of tags-tuple at runtime #2411
Prints Acc tags of tags-tuple at runtime #2411
Conversation
42b5e5a
to
6796c92
Compare
include/alpaka/acc/Tag.hpp
Outdated
void printAccTags() | ||
{ | ||
// Check if the tuple is empty using std::tuple_size | ||
if(std::tuple_size<TTuple>{} == 0) |
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.
std::size_size_v<TTuple>
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.
done using std::tuple_size_v
include/alpaka/acc/Tag.hpp
Outdated
else | ||
{ | ||
std::cout << "Acc Tags: "; | ||
std::apply([](auto... args) { ((std::cout << args.get_name() << " "), ...); }, TTuple{}); |
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 suggest something like this following code (Not tested) to have a comma seperated list.
std::apply(
[](auto... args) {
auto i = std::size_size_v<TTuple>;
((std::cout << args.get_name() << (--i > 0u ? "," : "")), ...);
},
TTuple{}
);
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, good idea
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.
alternatives exists using make_index_sequence
but i preferred this since it is still cleaner. thanks.
879ce62
to
5bf182f
Compare
5bf182f
to
511907b
Compare
I updated already which CI jobs are required. This PR was created before the last merge where clang10-12 got removed, therefore I merge it with my admin power. |
Examples was exiting silently if there are no enabled backends. This issue is reported by the assistants of the october2024 workshop.
This PR creates a function that prints the Acc-tags of the enabled backends at runtime. If there is no backends, the user is informed.