1 #ifndef VIENNACL_OCL_UTILS_HPP_
2 #define VIENNACL_OCL_UTILS_HPP_
37 template <
typename ScalarType>
45 struct DOUBLE_PRECISION_CHECKER<double>
60 template <>
struct type_to_string<char> {
static std::string apply() {
return "char"; } };
61 template <>
struct type_to_string<short> {
static std::string apply() {
return "short"; } };
62 template <>
struct type_to_string<int> {
static std::string apply() {
return "int"; } };
63 template <>
struct type_to_string<long> {
static std::string apply() {
return "long"; } };
65 template <>
struct type_to_string<unsigned char> {
static std::string apply() {
return "uchar"; } };
66 template <>
struct type_to_string<unsigned short> {
static std::string apply() {
return "ushort"; } };
67 template <>
struct type_to_string<unsigned int> {
static std::string apply() {
return "uint"; } };
68 template <>
struct type_to_string<unsigned long> {
static std::string apply() {
return "ulong"; } };
70 template <>
struct type_to_string<float> {
static std::string apply() {
return "float"; } };
71 template <>
struct type_to_string<double> {
static std::string apply() {
return "double"; } };
80 source.append(
"#pragma OPENCL EXTENSION " + ctx.current_device().double_support_extension() +
" : enable\n\n");
Represents an OpenCL device within ViennaCL.
void append_double_precision_pragma< double >(viennacl::ocl::context const &ctx, std::string &source)
Definition: utils.hpp:78
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:51
void append_double_precision_pragma(viennacl::ocl::context const &, std::string &)
Definition: utils.hpp:75
bool double_support() const
ViennaCL convenience function: Returns true if the device supports double precision.
Definition: device.hpp:956
viennacl::ocl::device const & current_device() const
Returns the current device.
Definition: context.hpp:95
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
Ensures that double precision types are only allocated if it is supported by the device. If double precision is requested for a device not capable of providing that, a double_precision_not_provided_error is thrown.
Definition: utils.hpp:38
Exception thrown if the user wants to use double precision arithmetics, but the device does not suppo...
Definition: error.hpp:548
static void apply(viennacl::ocl::context const &)
Definition: utils.hpp:40
Implementations of the OpenCL backend, where all contexts are stored in.
std::string type_to_string(viennacl::row_major)
Definition: matrix.hpp:868
Helper class for converting a type to its string representation.
Definition: utils.hpp:57