From c279ff67a0b0a959efcf5895e8bca1f15bc72bf3 Mon Sep 17 00:00:00 2001 From: mehmet yusufoglu Date: Mon, 7 Oct 2024 18:38:39 +0200 Subject: [PATCH] Prints acc tags at runtime --- example/heatEquation2D/src/heatEquation2D.cpp | 2 ++ include/alpaka/acc/Tag.hpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/example/heatEquation2D/src/heatEquation2D.cpp b/example/heatEquation2D/src/heatEquation2D.cpp index b186e9ec6dba..bba79631c690 100644 --- a/example/heatEquation2D/src/heatEquation2D.cpp +++ b/example/heatEquation2D/src/heatEquation2D.cpp @@ -215,5 +215,7 @@ auto main() -> int // TagCpuSerial, TagGpuHipRt, TagGpuCudaRt, TagCpuOmp2Blocks, TagCpuTbbBlocks, // TagCpuOmp2Threads, TagCpuSycl, TagCpuTbbBlocks, TagCpuThreads, // TagFpgaSyclIntel, TagGenericSycl, TagGpuSyclIntel + alpaka::printAccTags(); + return alpaka::executeForEachAccTag([=](auto const& tag) { return example(tag); }); } diff --git a/include/alpaka/acc/Tag.hpp b/include/alpaka/acc/Tag.hpp index f7880afd6f15..39dd06bdb63e 100644 --- a/include/alpaka/acc/Tag.hpp +++ b/include/alpaka/acc/Tag.hpp @@ -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 + void printAccTags() + { + // Check if the tuple is empty using std::tuple_size + if(std::tuple_size::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