diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-03-13 11:03:34 -0400 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-03-13 11:03:34 -0400 |
commit | a493703303f953fa31703b36d112c7d595efa4c7 (patch) | |
tree | deab3e352d287be5dd2e513255ba9cb877a20ff5 | |
parent | 35162ce669bd02d07c7d1e708c2932dab7248690 (diff) |
Add cluCreateContext()
-rw-r--r-- | util.c | 18 | ||||
-rw-r--r-- | util.h | 1 |
2 files changed, 19 insertions, 0 deletions
@@ -88,6 +88,24 @@ unsigned cluInitGpuDevice(cl_device_id * device_id) return 1; } +unsigned cluCreateContext(cl_context * context, cl_device_id device_id) +{ + cl_int error; + *context = clCreateContext(NULL, /* Properties */ + 1, /* Number of devices */ + &device_id, /* Device pointer */ + NULL, /* Callback for reporting errors */ + NULL, /* User data to pass to error callback */ + &error); /* Error code */ + + if (error != CL_SUCCESS) { + fprintf(stderr, "clCreateContext() failed: %s\n", + cluErrorString(error)); + return 0; + } + return 1; +} + #define CODE_CHUNK 64 unsigned cluCreateKernel(cl_context context, cl_device_id device_id, @@ -1,6 +1,7 @@ const char * cluErrorString(cl_int error); unsigned cluInitGpuDevice(cl_device_id * device_id); +unsigned cluCreateContext(cl_context * context, cl_device_id device_id); unsigned cluCreateKernel(cl_context context, cl_device_id device_id, cl_kernel * kernel, const char * kernel_name); unsigned cluKernelSetArg(cl_kernel kernel, cl_uint index, size_t size, |