MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / OpenCL_V_Throw

Function OpenCL_V_Throw

src/client/clfunc_common.hpp:246–270  ·  view source on GitHub ↗

This is used to either wrap an OpenCL function call, or to explicitly check a variable for an OpenCL error condition. If an error occurs, we throw. Note: std::runtime_error does not take unicode strings as input, so only strings supported

Source from the content-addressed store, hash-verified

244// Note: std::runtime_error does not take unicode strings as input, so
245// only strings supported
246inline cl_int
247OpenCL_V_Throw( cl_int res, const std::string& msg, size_t lineno )
248{
249 switch( res )
250 {
251 case CL_SUCCESS: /**< No error */
252 break;
253 default:
254 {
255 std::stringstream tmp;
256
257 tmp << "OPENCL_V_THROWERROR< ";
258 tmp << prettyPrintClStatus(res) ;
259 tmp << " > (";
260 tmp << lineno;
261 tmp << "): ";
262 tmp << msg;
263 std::string errorm(tmp.str());
264 std::cout << errorm<< std::endl;
265 throw std::runtime_error( errorm );
266 }
267 }
268
269 return res;
270}
271
272#define OPENCL_V_THROW(_status,_message) OpenCL_V_Throw(_status, _message, \
273 __LINE__)

Callers

nothing calls this directly

Calls 1

prettyPrintClStatusFunction · 0.70

Tested by

no test coverage detected