32 #ifndef VSMC_OPENCL_CL_SETUP_HPP
33 #define VSMC_OPENCL_CL_SETUP_HPP
42 template <
typename ID = CLDefault>
66 if (name == std::string(
"CPU"))
68 else if (name == std::string(
"GPU"))
70 else if (name == std::string(
"Accelerator"))
81 void device (
const std::string &name) {device_ = name;}
83 void platform (
const std::string &name) {platform_ = name;}
86 const std::string &
device ()
const {
return device_;}
88 const std::string &
platform ()
const {
return platform_;}
91 {
return device_type_ == CL_DEVICE_TYPE_DEFAULT;}
98 {
return check_name(name, device_);}
101 {
return check_name(name, device_vendor_);}
104 {
return check_name(name, platform_);}
108 ::cl_device_type device_type_;
109 std::string default_;
111 std::string device_vendor_;
112 std::string platform_;
115 device_type_(CL_DEVICE_TYPE_DEFAULT), default_(
"vSMCOpenCLDefault"),
116 device_(default_), device_vendor_(default_), platform_(default_) {}
118 CLSetup (
const CLSetup<ID> &);
119 CLSetup<ID> &operator= (
const CLSetup<ID> &);
121 bool check_name (
const std::string &name,
const std::string &stored)
const
123 if (stored == default_)
125 return name.find(stored) != std::string::npos;
131 #endif // VSMC_OPENCL_CL_SETUP_HPP
const std::string & default_name() const
Default string value of the device, vendor, platform names.
bool check_platform(const std::string &name) const
::cl_device_type device_type() const
bool check_device(const std::string &name) const
void platform(const std::string &name)
void device_type(::cl_device_type type)
void device(const std::string &name)
const std::string & device_vendor() const
bool default_device_vendor() const
bool device_type(const std::string &name)
Set the device type using a string value.
bool default_device() const
const std::string & platform() const
static CLSetup< ID > & instance()
bool check_device_vendor(const std::string &name) const
const std::string & device() const
Configure the default behavior of CLManager.
bool default_device_type() const
bool default_platform() const
void device_vendor(const std::string &name)