diff --git a/kernels/kernel.txt b/kernels/kernel.c similarity index 100% rename from kernels/kernel.txt rename to kernels/kernel.c diff --git a/src/CL_Wrapper.cpp b/src/CL_Wrapper.cpp index b96d3b1..9fb2346 100644 --- a/src/CL_Wrapper.cpp +++ b/src/CL_Wrapper.cpp @@ -232,14 +232,15 @@ int CL_Wrapper::store_buffer(cl_mem buffer, std::string buffer_name){ int CL_Wrapper::run_kernel(std::string kernel_name){ - const int WORKER_SIZE = 1; + const int WORKER_SIZE = 10; size_t global_work_size[1] = { WORKER_SIZE }; cl_kernel kernel = kernel_map.at(kernel_name); + //error = clEnqueueTask(command_queue, kernel, 0, NULL, NULL); error = clEnqueueNDRangeKernel( command_queue, kernel, - 1, NULL, global_work_size, + 1, NULL, global_work_size, NULL, 0, NULL, NULL); if (assert(error, "clEnqueueNDRangeKernel")) diff --git a/src/main.cpp b/src/main.cpp index 99b32d1..10f32ac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,18 +39,19 @@ int main(){ CL_Wrapper c; c.acquire_platform_and_device(); c.create_shared_context(); + c.create_command_queue(); - c.compile_kernel("../kernels/kernel.txt", true, "hello"); + c.compile_kernel("../kernels/kernel.c", true, "hello"); c.compile_kernel("../kernels/minimal_kernel.c", true, "min_kern"); std::string in = "hello!!!!!!!!!!!!!!!!!!!!!"; cl_mem buff = clCreateBuffer( c.getContext(), CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, - sizeof(char) * in.size(), &in, NULL); + sizeof(char) * 128, NULL, NULL); c.store_buffer(buff, "buffer_1"); - //c.set_kernel_arg("min_kern", 0, "buffer_1"); + c.set_kernel_arg("min_kern", 0, "buffer_1"); c.run_kernel("min_kern");