I am trying to use CPU and GPU simultaneously in a computing task. I want to do slightly better than launching two tasks based on a predicted work-load and wish they both finish at roughtly the same time. I am wondering if there is a mechanism to trigger a kernel to stop and return results when it is running on CPU backend.
The attached is a little pseudo-code to illustrate the scheme. I am curious
1. is this currently possible?
2. what call I should be using to replace "??? signal_CPU_kernel_to_stop ???"
any commons are welcome. thanks in advance.
lauch_gpu_kernel(gpu_queue,"mykernel", gpu_work_load); lauch_cpu_kernel(cpu_queue,"mykernel", enough_work_load); clEnqueueReadBuffer(gpu_queue, ..., CL_TRUE, ...); // read from GPU, blocking ??? signal_CPU_kernel_to_stop ??? clEnqueueReadBuffer(cpu_queue, ..., CL_TRUE, ...); // read from CPU, blocking