1 #ifndef jb_opencl_device_selector_hpp 2 #define jb_opencl_device_selector_hpp 4 #include <boost/compute/device.hpp> 5 #include <boost/compute/system.hpp> 25 template <
typename Filter>
26 boost::compute::device
best_device(Filter filter,
char const* filter_name) {
27 boost::compute::device selection;
28 unsigned int count = 0;
29 for (
auto const& d : boost::compute::system::devices()) {
30 if (filter(d) and d.compute_units() > count) {
31 count = d.compute_units();
36 std::ostringstream os;
37 os <<
"Could not find a device using filter " << filter_name;
38 throw std::runtime_error(os.str());
48 #endif // jb_cl_device_selector_hpp boost::compute::device device_selector(config const &cfg)
Select an OpenCL device matching the current configuration.
boost::compute::device best_device(Filter filter, char const *filter_name)
Return the best available device of the given type.
The top-level namespace for the JayBeams library.