1 //---------------------------------------------------------------------------// 2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com> 3 // 4 // Distributed under the Boost Software License, Version 1.0 5 // See accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt 7 // 8 // See http://boostorg.github.com/compute for more information. 9 //---------------------------------------------------------------------------// 10 11 #include <iostream> 12 13 #include <boost/compute/core.hpp> 14 15 namespace compute = boost::compute; 16 main()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 } 46