Skip to content

Commit

Permalink
Prints acc tags at runtime for all examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetyusufoglu committed Oct 8, 2024
1 parent f778f87 commit 511907b
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example/bufferCopy/src/bufferCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/complex/src/complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/conv2DWithMdspan/src/conv2DWithMdspan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/convolution1D/src/convolution1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/convolution2D/src/convolution2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/counterBasedRng/src/counterBasedRng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/heatEquation/src/heatEquation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/heatEquation2D/src/heatEquation2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/helloWorld/src/helloWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/helloWorldLambda/src/helloWorldLambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/kernelSpecialization/src/kernelSpecialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/matrixMulWithMdspan/src/matrixMulMdSpan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/monteCarloIntegration/src/monteCarloIntegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/parallelLoopPatterns/src/parallelLoopPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/randomCells2D/src/randomCells2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/randomStrategies/src/randomStrategies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/tagSpecialization/src/tagSpecialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
2 changes: 2 additions & 0 deletions example/vectorAdd/src/vectorAdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ auto example(TAccTag const&) -> int

auto main() -> int
{
std::cout << "Check enabled accelerator tags:" << std::endl;
alpaka::printTagNames<alpaka::EnabledAccTags>();
// Execute the example once for each enabled accelerator.
// If you would like to execute it for a single accelerator only you can use the following code.
// \code{.cpp}
Expand Down
25 changes: 25 additions & 0 deletions include/alpaka/acc/Tag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "alpaka/core/BoostPredef.hpp"

#include <iostream>
#include <tuple>
#include <type_traits>

#define CREATE_ACC_TAG(tag_name) \
Expand Down Expand Up @@ -69,4 +70,28 @@ namespace alpaka
alpaka::TagFpgaSyclIntel,
alpaka::TagGpuSyclIntel>;

//! \brief Function to print the names of each tag in the given tuple of tags
//! \tparam TTuple is the type of the tuple of tags
template<typename TTuple>
void printTagNames()
{
// Check if the tuple is empty using std::tuple_size_v
if(std::tuple_size_v<TTuple> == 0)
{
std::cout << "No Tags!";
}
else
{
std::cout << "Tags: ";
// Print tags with comma in between
std::apply(
[](auto... args)
{
auto index = std::tuple_size_v<TTuple>;
((std::cout << args.get_name() << (--index > 0u ? "," : "")), ...);
},
TTuple{});
}
std::cout << std::endl;
}
} // namespace alpaka

0 comments on commit 511907b

Please sign in to comment.