diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -8,7 +8,7 @@ #define CASE_ERR(ec) case ec: return #ec; -const char * cluErrorString(cl_int error) +const char * clTestErrorString(cl_int error) { switch(error) { @@ -50,7 +50,7 @@ const char * cluErrorString(cl_int error) } } -unsigned cluInitGpuDevice(cl_device_id * device_id) +unsigned clTestInitGpuDevice(cl_device_id * device_id) { cl_int error; @@ -66,7 +66,7 @@ unsigned cluInitGpuDevice(cl_device_id * device_id) * found on the system */ if (error != CL_SUCCESS) { - fprintf(stderr, "clGetPlatformIDs() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clGetPlatformIDs() failed: %s\n", clTestErrorString(error)); return 0; } @@ -79,7 +79,7 @@ unsigned cluInitGpuDevice(cl_device_id * device_id) &total_gpu_devices); if (error != CL_SUCCESS) { - fprintf(stderr, "clGetDeviceIDs() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clGetDeviceIDs() failed: %s\n", clTestErrorString(error)); return 0; } @@ -88,7 +88,7 @@ unsigned cluInitGpuDevice(cl_device_id * device_id) return 1; } -unsigned cluCreateContext(cl_context * context, cl_device_id device_id) +unsigned clTestCreateContext(cl_context * context, cl_device_id device_id) { cl_int error; *context = clCreateContext(NULL, /* Properties */ @@ -100,13 +100,13 @@ unsigned cluCreateContext(cl_context * context, cl_device_id device_id) if (error != CL_SUCCESS) { fprintf(stderr, "clCreateContext() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return 0; } return 1; } -unsigned cluCreateCommandQueue(cl_command_queue * command_queue, +unsigned clTestCreateCommandQueue(cl_command_queue * command_queue, cl_context context, cl_device_id device_id) { cl_int error; @@ -117,7 +117,7 @@ unsigned cluCreateCommandQueue(cl_command_queue * command_queue, if (error != CL_SUCCESS) { fprintf(stderr, "clCreateCommandQueue() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return 0; } return 1; @@ -125,7 +125,7 @@ unsigned cluCreateCommandQueue(cl_command_queue * command_queue, #define CODE_CHUNK 64 -unsigned cluCreateKernel(cl_context context, cl_device_id device_id, +unsigned clTestCreateKernel(cl_context context, cl_device_id device_id, cl_kernel * kernel, const char * kernel_name) { char * filename; @@ -186,7 +186,7 @@ unsigned cluCreateKernel(cl_context context, cl_device_id device_id, if (error != CL_SUCCESS) { fprintf(stderr, "clCreateProgramWithSource() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return 0; } @@ -211,7 +211,7 @@ unsigned cluCreateKernel(cl_context context, cl_device_id device_id, NULL); /* Number of bytes written to the log */ if (error != CL_SUCCESS) { fprintf(stderr, "clGetProgramBuildInfo() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); } else { fprintf(stderr, "Build Log: \n%s\n\n", build_str); } @@ -223,7 +223,7 @@ unsigned cluCreateKernel(cl_context context, cl_device_id device_id, *kernel = clCreateKernel(program, kernel_name, &error); if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateKernel() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateKernel() failed: %s\n", clTestErrorString(error)); return 0; } @@ -232,22 +232,22 @@ unsigned cluCreateKernel(cl_context context, cl_device_id device_id, return 1; } -unsigned cluSimpleInit(struct clu_context * context, const char * kernel_name) +unsigned clTestSimpleInit(struct cltest_context * context, const char * kernel_name) { - if (!cluInitGpuDevice(&context->device_id)) { + if (!clTestInitGpuDevice(&context->device_id)) { return 0; } - if (!cluCreateContext(&context->cl_ctx, context->device_id)) { + if (!clTestCreateContext(&context->cl_ctx, context->device_id)) { return 0; } - if (!cluCreateCommandQueue(&context->command_queue, context->cl_ctx, + if (!clTestCreateCommandQueue(&context->command_queue, context->cl_ctx, context->device_id)) { return 0; } - if (!cluCreateKernel(context->cl_ctx, context->device_id, &context->kernel, + if (!clTestCreateKernel(context->cl_ctx, context->device_id, &context->kernel, kernel_name)) { return 0; } @@ -255,7 +255,7 @@ unsigned cluSimpleInit(struct clu_context * context, const char * kernel_name) return 1; } -unsigned cluKernelSetArg(cl_kernel kernel, cl_uint index, size_t size, +unsigned clTestKernelSetArg(cl_kernel kernel, cl_uint index, size_t size, const void * value) { cl_int error; @@ -263,7 +263,7 @@ unsigned cluKernelSetArg(cl_kernel kernel, cl_uint index, size_t size, error = clSetKernelArg(kernel, index, size, value); if (error != CL_SUCCESS) { - fprintf(stderr, "clSetKernelArg failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clSetKernelArg failed: %s\n", clTestErrorString(error)); return 0; } |