forked from bd4/sycl-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
listdev.cxx
38 lines (31 loc) · 1.11 KB
/
listdev.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <CL/sycl.hpp>
using namespace cl::sycl;
int main() {
auto platformlist = platform::get_platforms();
std::string type;
for(auto p : platformlist) {
decltype(p.get_devices(info::device_type::all)) devicelist;
devicelist = p.get_devices(info::device_type::all);
std::cout << p.get_info<info::platform::name>()
<< " {" << p.get_info<info::platform::vendor>() << "}"
<< std::endl;
for(const auto& dev : devicelist) {
if (dev.is_cpu()) {
type = "CPU ";
} else if (dev.is_gpu()) {
type = "GPU ";
} else if (dev.is_host()) {
type = "HOST ";
} else {
type = "OTHER";
}
std::cout << " [" << type << "] "
<< dev.get_info<info::device::name>()
<< " {" << dev.get_info<info::device::vendor>() << "}"
<< " (" << dev.get_info<info::device::vendor_id>() << ")"
<< std::endl;
}
}
return 0;
}