Skip to content

Commit

Permalink
Prints acc tags at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetyusufoglu committed Oct 7, 2024
1 parent f778f87 commit c279ff6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example/heatEquation2D/src/heatEquation2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,7 @@ auto main() -> int
// TagCpuSerial, TagGpuHipRt, TagGpuCudaRt, TagCpuOmp2Blocks, TagCpuTbbBlocks,
// TagCpuOmp2Threads, TagCpuSycl, TagCpuTbbBlocks, TagCpuThreads,
// TagFpgaSyclIntel, TagGenericSycl, TagGpuSyclIntel
alpaka::printAccTags<alpaka::EnabledAccTags>();

return alpaka::executeForEachAccTag([=](auto const& tag) { return example(tag); });
}
17 changes: 17 additions & 0 deletions include/alpaka/acc/Tag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,21 @@ namespace alpaka
alpaka::TagFpgaSyclIntel,
alpaka::TagGpuSyclIntel>;

//! \brief Function to print the names of each tag in the given tuple of acc tags
//! \tparam TTuple is the type of the tuple of tags
template<typename TTuple>
void printAccTags()
{
// Check if the tuple is empty using std::tuple_size
if(std::tuple_size<TTuple>::value == 0)
{
std::cout << "No Acc Tags!";
}
else
{
std::cout << "Acc Tags: ";
std::apply([](auto... args) { ((std::cout << args.get_name() << " "), ...); }, TTuple{});
}
std::cout << std::endl;
}
} // namespace alpaka

0 comments on commit c279ff6

Please sign in to comment.