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
 
   41 using namespace viennacl::ocl;
 
   43 template<
class ParamT>
 
   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));
 
  107 template<
typename StringT>
 
  113     if ((found = device_name.find(
"GeForce",0)) != std::string::npos)
 
  115       if ((found = device_name.find_first_of(
"123456789", found)) != std::string::npos)
 
  117         switch (device_name[found]) 
 
  119         case '4' : 
return "GeForce GTX 470";
 
  120         case '5' : 
return "GeForce GTX 570";
 
  125     else if ((found = device_name.find(
"Tesla",0)) != std::string::npos) 
 
  127       if (device_name.find(
"Tesla C10",0) != std::string::npos)
 
  128         return "Tesla C2050";
 
  129       else if (device_name.find(
"Tesla S10",0) != std::string::npos)
 
  130         return "Tesla C2050";
 
  131       else if (device_name.find(
"Tesla M20",0) != std::string::npos)
 
  132         return "Tesla C2050";
 
  133       else if (device_name.find(
"Tesla S20",0) != std::string::npos)
 
  134         return "Tesla C2050";
 
  135       else if (device_name.find(
"Tesla K",0) != std::string::npos) 
 
  147 template<
class NumericT, 
class ParamT>
 
  155   std::string 
const & device_name = device.
name();
 
  162   if (vendor_it==database.
map.d.end())
 
  169   if (device_type_it==vendor_it->second.d.end())
 
  176   if (architecture_it==device_type_it->second.d.end())
 
  179     architecture_it = current_it;
 
  180     int closest_arch = current_it->first - device_architecture;
 
  181     while (current_it!=device_type_it->second.d.end())
 
  183       int arch_diff = std::abs(static_cast<int>(current_it->first) - static_cast<int>(device_architecture));
 
  184       if (arch_diff < closest_arch)
 
  186         architecture_it = current_it;
 
  187         closest_arch = arch_diff;
 
  198   if (device_name_it==architecture_it->second.d.end())
 
  200     device_name_it = architecture_it->second.d.begin();
 
  207   if (expression_it==device_name_it->second.d.end())
 
  212   return expression_it->second;
 
std::string device_name_type
std::map< device_type, device_architecture_t > map_t
StringT get_mapped_device_name(StringT const &device_name, vendor_id_type vendor_id)
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
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)
device_architecture_family
ValueT const & at(std::map< KeyT, ValueT > const &map, KeyT const &key)
Emulation of C++11's .at() member for std::map<>, const-version. 
std::map< scheduler::statement_node_numeric_type, ParamT > map_t