| 15 | namespace compute = boost::compute; |
| 16 | |
| 17 | int 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 | } |