1 #ifndef VIENNACL_DEVICE_SPECIFIC_BUILTIN_DATABASE_COMMON_HPP_
2 #define VIENNACL_DEVICE_SPECIFIC_BUILTIN_DATABASE_COMMON_HPP_
34 namespace device_specific
36 namespace builtin_database
43 template<
class ParamT>
50 struct expression_t{
typedef std::map<scheduler::statement_node_numeric_type, ParamT>
map_t; map_t d; };
54 struct type{
typedef std::map<vendor_id_type, device_type_t>
map_t; map_t d; };
59 map.
d[p0].d[p1].d[p2].d[p3].d.insert(std::make_pair(p4, p5));
92 return map.
d.at(p0).d.at(p1).d.at(p2).d.at(p3).d.at(p4);
103 template<
class NumericT,
class ParamT>
111 std::string
const & device_name = device.
name();
118 if (vendor_it==database.
map.d.end())
125 if (device_type_it==vendor_it->second.d.end())
132 if (architecture_it==device_type_it->second.d.end())
135 architecture_it = current_it;
136 int closest_arch = current_it->first - device_architecture;
137 while (current_it!=device_type_it->second.d.end())
139 int arch_diff = std::abs(static_cast<int>(current_it->first) - static_cast<int>(device_architecture));
140 if (arch_diff < closest_arch)
142 architecture_it = current_it;
143 closest_arch = arch_diff;
153 if (device_name_it==architecture_it->second.d.end())
155 device_name_it = architecture_it->second.d.begin();
162 if (expression_it==device_name_it->second.d.end())
167 return expression_it->second;
std::string device_name_type
std::map< device_type, device_architecture_t > map_t
A class representing a compute device (e.g. a GPU)
ParamT const & get_parameters(database_type< ParamT > const &database, viennacl::ocl::device const &device)
Get the profile for a device and a descriptor.
cl_device_type type() const
The OpenCL device type.
std::map< vendor_id_type, device_type_t > map_t
ParamT const & at(vendor_id_type p0, device_type p1, ocl::device_architecture_family p2, device_name_type p3, scheduler::statement_node_numeric_type p4) const
cl_uint vendor_id() const
A unique device vendor identifier. An example of a unique device identifier could be the PCIe ID...
statement_node_numeric_type
Encodes the type of a node in the statement tree.
std::map< ocl::device_architecture_family, device_name_t > map_t
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
database_type< ParamT > & add_8B(vendor_id_type p0, device_type p1, ocl::device_architecture_family p2, device_name_type p3, ParamT const &p5)
database_type< ParamT > & add_2B(vendor_id_type p0, device_type p1, ocl::device_architecture_family p2, device_name_type p3, ParamT const &p5)
database_type< ParamT > & add_4B(vendor_id_type p0, device_type p1, ocl::device_architecture_family p2, device_name_type p3, ParamT const &p5)
Various utility implementations for dispatching with respect to the different devices available on th...
std::map< device_name_type, expression_t > map_t
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
std::string name() const
Device name string.
device_architecture_family architecture_family() const
Device architecture family.
Helper metafunction for obtaining the runtime type ID for a numerical type.
database_type< ParamT > & add_1B(vendor_id_type p0, device_type p1, ocl::device_architecture_family p2, device_name_type p3, ParamT const &p5)
cl_device_type device_type
database_type< ParamT > & operator()(vendor_id_type p0, device_type p1, ocl::device_architecture_family p2, device_name_type p3, scheduler::statement_node_numeric_type p4, ParamT const &p5)
OpenCL backend. Manages platforms, contexts, buffers, kernels, etc.
device_architecture_family
std::map< scheduler::statement_node_numeric_type, ParamT > map_t