forked from alpaka-group/alpaka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a small tool, checked in as example, to print all enabled accelerators with their devices. Co-authored-by: Simeon Ehrig <[email protected]>
- Loading branch information
1 parent
cce9b43
commit 7f316d9
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Bernhard Manfred Gruber | ||
# SPDX-License-Identifier: ISC | ||
|
||
cmake_minimum_required(VERSION 3.22) | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
|
||
project(alpaka-ls LANGUAGES CXX) | ||
if(NOT TARGET alpaka::alpaka) | ||
option(alpaka_USE_SOURCE_TREE "Use alpaka's source tree instead of an alpaka installation" OFF) | ||
if(alpaka_USE_SOURCE_TREE) | ||
set(alpaka_BUILD_EXAMPLES OFF) # Don't build the examples recursively | ||
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../.." "${CMAKE_BINARY_DIR}/alpaka") | ||
else() | ||
find_package(alpaka REQUIRED) | ||
endif() | ||
endif() | ||
|
||
alpaka_add_executable(${PROJECT_NAME} src/ls.cpp) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC alpaka::alpaka) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER example) | ||
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2023 Bernhard Manfred Gruber | ||
// SPDX-License-Identifier: ISC | ||
|
||
#include "alpaka/test/acc/TestAccs.hpp" | ||
|
||
#include <alpaka/alpaka.hpp> | ||
|
||
struct PerAcc | ||
{ | ||
template<typename TAcc> | ||
void operator()() const | ||
{ | ||
auto const platform = alpaka::Platform<TAcc>{}; | ||
std::cout << alpaka::getAccName<TAcc>() << '\n'; | ||
for(auto const& dev : alpaka::getDevs(platform)) | ||
std::cout << '\t' << alpaka::getName(dev) << '\n'; | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
using Idx = int; | ||
using Dim = alpaka::DimInt<1>; | ||
alpaka::meta::forEachType<alpaka::test::EnabledAccs<Dim, Idx>>(PerAcc{}); | ||
} |