From 6ee29b06afe45d05ae321791085b37d5693e05b2 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 14 Mar 2012 14:13:27 -0400 Subject: Change util prefix from clu to clTest --- get_global_id.c | 12 ++++++------ get_global_id_2d.c | 6 +++--- hello_world.c | 22 +++++++++++----------- loop.c | 6 +++--- math-int.c | 20 ++++++++++---------- util.c | 38 +++++++++++++++++++------------------- util.h | 16 ++++++++-------- 7 files changed, 60 insertions(+), 60 deletions(-) diff --git a/get_global_id.c b/get_global_id.c index 1b41809..9f347fc 100644 --- a/get_global_id.c +++ b/get_global_id.c @@ -9,7 +9,7 @@ int main(int argc, char ** argv) { cl_int error; - struct clu_context context; + struct cltest_context context; cl_mem out_buffer; @@ -17,7 +17,7 @@ int main(int argc, char ** argv) int out_data[10]; size_t global_work_size = 10; - cluSimpleInit(&context, "global_id"); + clTestSimpleInit(&context, "global_id"); out_buffer = clCreateBuffer(context.cl_ctx, CL_MEM_WRITE_ONLY, /* Flags */ @@ -26,13 +26,13 @@ int main(int argc, char ** argv) &error); /* error code */ if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateBuffer() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateBuffer() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } fprintf(stderr, "clCreateBuffer() succeeded.\n"); - if ( !cluKernelSetArg(context.kernel, 0, sizeof(cl_mem), &out_buffer)) { + if ( !clTestKernelSetArg(context.kernel, 0, sizeof(cl_mem), &out_buffer)) { return EXIT_FAILURE; } @@ -48,7 +48,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clEnqueueNDRangeKernel() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } @@ -67,7 +67,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clEnqueueReadBuffer() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } diff --git a/get_global_id_2d.c b/get_global_id_2d.c index be16038..f127d3a 100644 --- a/get_global_id_2d.c +++ b/get_global_id_2d.c @@ -18,9 +18,9 @@ int main (int argc, char ** argv) size_t global_work_size[2] = {GLOBAL_DIM_X, GLOBAL_DIM_Y}; size_t local_work_size[2] = {5, 5}; - struct clu_context context; + struct cltest_context context; - cluSimpleInit(&context, "global_id2d"); + clTestSimpleInit(&context, "global_id2d"); /* XXX: Delete this to see a missing error path */ out_buffer = clCreateBuffer(context.cl_ctx, @@ -30,7 +30,7 @@ int main (int argc, char ** argv) assert(error == CL_SUCCESS); - if (!cluKernelSetArg(context.kernel, 0, sizeof(cl_mem), &out_buffer)) { + if (!clTestKernelSetArg(context.kernel, 0, sizeof(cl_mem), &out_buffer)) { return EXIT_FAILURE; } diff --git a/hello_world.c b/hello_world.c index 7e42370..1daf653 100644 --- a/hello_world.c +++ b/hello_world.c @@ -42,7 +42,7 @@ int main(int argc, char ** argv) * 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 EXIT_FAILURE; } @@ -57,7 +57,7 @@ int main(int argc, char ** argv) &total_gpu_devices); if (error != CL_SUCCESS) { - fprintf(stderr, "clGetDeviceIDs() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clGetDeviceIDs() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } @@ -71,7 +71,7 @@ int main(int argc, char ** argv) &error); /* Error code */ if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateContext() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateContext() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } @@ -84,7 +84,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clCreateCommandQueue() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } @@ -99,7 +99,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clCreateProgramWithSource() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } @@ -123,7 +123,7 @@ int main(int argc, char ** argv) 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); } @@ -135,7 +135,7 @@ int main(int argc, char ** argv) kernel = clCreateKernel(program, "pi", &error); if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateKernel() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateKernel() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } @@ -148,7 +148,7 @@ int main(int argc, char ** argv) &error); /* error code */ if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateBuffer() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateBuffer() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } @@ -160,7 +160,7 @@ int main(int argc, char ** argv) &out_buffer); if (error != CL_SUCCESS) { - fprintf(stderr, "clSetKernelArg failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clSetKernelArg failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } @@ -179,7 +179,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clEnqueueNDRangeKernel() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } @@ -198,7 +198,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clEnqueueReadBuffer() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } diff --git a/loop.c b/loop.c index adac26d..b7e5fa7 100644 --- a/loop.c +++ b/loop.c @@ -9,7 +9,7 @@ int main (int argc, char ** argv) { int i,j; - struct clu_context context; + struct cltest_context context; cl_int error; @@ -17,7 +17,7 @@ int main (int argc, char ** argv) int out_data[100]; size_t global_work_size = 10; - if (!cluSimpleInit(&context, "loop")) { + if (!clTestSimpleInit(&context, "loop")) { return EXIT_FAILURE; } @@ -28,7 +28,7 @@ int main (int argc, char ** argv) assert(error == CL_SUCCESS); - if (!cluKernelSetArg(context.kernel, 0, sizeof(cl_mem), &out_buffer)) { + if (!clTestKernelSetArg(context.kernel, 0, sizeof(cl_mem), &out_buffer)) { return EXIT_FAILURE; } diff --git a/math-int.c b/math-int.c index e02439e..018e28f 100644 --- a/math-int.c +++ b/math-int.c @@ -26,7 +26,7 @@ int main(int argc, char ** argv) arg1 = atoi(argv[3]); expected = atoi(argv[4]); - if (!cluInitGpuDevice(&device_id)) { + if (!clTestInitGpuDevice(&device_id)) { return EXIT_FAILURE; } @@ -38,7 +38,7 @@ int main(int argc, char ** argv) &error); /* Error code */ if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateContext() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateContext() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } @@ -51,13 +51,13 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clCreateCommandQueue() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } fprintf(stderr, "clCreateCommandQueue() succeeded.\n"); - if (!cluCreateKernel(context, device_id, &kernel, kernel_name)) { + if (!clTestCreateKernel(context, device_id, &kernel, kernel_name)) { return EXIT_FAILURE; } @@ -68,15 +68,15 @@ int main(int argc, char ** argv) &error); /* error code */ if (error != CL_SUCCESS) { - fprintf(stderr, "clCreateBuffer() failed: %s\n", cluErrorString(error)); + fprintf(stderr, "clCreateBuffer() failed: %s\n", clTestErrorString(error)); return EXIT_FAILURE; } fprintf(stderr, "clCreateBuffer() succeeded.\n"); - if ( !cluKernelSetArg(kernel, 0, sizeof(cl_mem), &out_buffer) - || !cluKernelSetArg(kernel, 1, sizeof(int), &arg0) - || !cluKernelSetArg(kernel, 2, sizeof(int), &arg1)) { + if ( !clTestKernelSetArg(kernel, 0, sizeof(cl_mem), &out_buffer) + || !clTestKernelSetArg(kernel, 1, sizeof(int), &arg0) + || !clTestKernelSetArg(kernel, 2, sizeof(int), &arg1)) { return EXIT_FAILURE; } @@ -92,7 +92,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clEnqueueNDRangeKernel() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } @@ -111,7 +111,7 @@ int main(int argc, char ** argv) if (error != CL_SUCCESS) { fprintf(stderr, "clEnqueueReadBuffer() failed: %s\n", - cluErrorString(error)); + clTestErrorString(error)); return EXIT_FAILURE; } diff --git a/util.c b/util.c index 8989dce..c8e476b 100644 --- a/util.c +++ b/util.c @@ -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; } diff --git a/util.h b/util.h index 5a1d2f5..d2977bf 100644 --- a/util.h +++ b/util.h @@ -1,18 +1,18 @@ -struct clu_context { +struct cltest_context { cl_device_id device_id; cl_context cl_ctx; cl_command_queue command_queue; cl_kernel kernel; }; -const char * cluErrorString(cl_int error); -unsigned cluInitGpuDevice(cl_device_id * device_id); -unsigned cluCreateContext(cl_context * context, cl_device_id device_id); -unsigned cluCreateCommandQueue(cl_command_queue * command_queue, +const char * cltestErrorString(cl_int error); +unsigned cltestInitGpuDevice(cl_device_id * device_id); +unsigned cltestCreateContext(cl_context * context, cl_device_id device_id); +unsigned cltestCreateCommandQueue(cl_command_queue * command_queue, cl_context context, cl_device_id device_id); -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); -unsigned cluSimpleInit(struct clu_context * context, const char * kernel_name); -unsigned cluKernelSetArg(cl_kernel kernel, cl_uint index, size_t size, +unsigned cltestSimpleInit(struct cltest_context * context, const char * kernel_name); +unsigned cltestKernelSetArg(cl_kernel kernel, cl_uint index, size_t size, const void * value); -- cgit v1.2.3