MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / main

Function main

compute/example/list_devices.cpp:17–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace compute = boost::compute;
16
17int main()
18{
19 std::vector<compute::platform> platforms = compute::system::platforms();
20
21 for(size_t i = 0; i < platforms.size(); i++){
22 const compute::platform &platform = platforms[i];
23
24 std::cout << "Platform '" << platform.name() << "'" << std::endl;
25
26 std::vector<compute::device> devices = platform.devices();
27 for(size_t j = 0; j < devices.size(); j++){
28 const compute::device &device = devices[j];
29
30 std::string type;
31 if(device.type() & compute::device::gpu)
32 type = "GPU Device";
33 else if(device.type() & compute::device::cpu)
34 type = "CPU Device";
35 else if(device.type() & compute::device::accelerator)
36 type = "Accelerator Device";
37 else
38 type = "Unknown Device";
39
40 std::cout << " " << type << ": " << device.name() << std::endl;
41 }
42 }
43
44 return 0;
45}

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.45
nameMethod · 0.45
devicesMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected