...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::opencl_error — A run-time OpenCL error.
// In header: <boost/compute/exception/opencl_error.hpp> class opencl_error : public std::exception { public: // public member functions explicit opencl_error(cl_int); ~opencl_error(); cl_int error_code() const; std::string error_string() const; const char * what() const; // public static functions static std::string to_string(cl_int); };
The opencl_error class represents an error returned from an OpenCL function.
See Also: context_error
opencl_error
public member functionsexplicit opencl_error(cl_int error);Creates a new opencl_error exception object for
error
. ~opencl_error();Destroys the opencl_error object.
cl_int error_code() const;Returns the numeric error code.
std::string error_string() const;Returns a string description of the error.
const char * what() const;Returns a C-string description of the error.
opencl_error
public static functionsstatic std::string to_string(cl_int error);
Static function which converts the numeric OpenCL error code error
to a human-readable string.
For example:
std::cout << opencl_error::to_string(CL_INVALID_KERNEL_ARGS) << std::endl;
Will print "Invalid Kernel Arguments".
If the error code is unknown (e.g. not a valid OpenCL error), a string containing "Unknown OpenCL Error" along with the error number will be returned.