| 104 | size_t cb, void* userData); |
| 105 | |
| 106 | void create_context_and_queue(cl_device_id device, cl_context *out_context, cl_command_queue *out_queue) |
| 107 | { |
| 108 | assert( out_context && "out_context arg must be a valid pointer"); |
| 109 | assert( out_queue && "out_queue arg must be a valid pointer"); |
| 110 | |
| 111 | int error = CL_SUCCESS; |
| 112 | |
| 113 | *out_context = clCreateContext( NULL, 1, &device, notify_callback, NULL, &error ); |
| 114 | if( NULL == *out_context || error != CL_SUCCESS) |
| 115 | { |
| 116 | throw Exceptions::TestError("clCreateContext failed\n", error); |
| 117 | } |
| 118 | |
| 119 | *out_queue = clCreateCommandQueue( *out_context, device, 0, &error ); |
| 120 | if( NULL == *out_queue || error ) |
| 121 | { |
| 122 | throw Exceptions::TestError("clCreateCommandQueue failed\n", error); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | Loads the kernel text from the given text file |