cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

cgorac
Journeyman III

OpenCL equivalent for CUDA stream 0

Am porting some CUDA code to OpenCL, with implicit dependencies of CUDA special stream 0 (basically, any command put in stream 0, except for kernel launch, is executed synchronously w.r.t. host code execution); so I'm wondering: is there a "default" command queue in OpenCL with same characteristics?  Or I should create another command queue for this purpose, and then just call clFinish() after each command put into this queue?

Thanks.

0 Likes
2 Replies
himanshu_gautam
Grandmaster

Hi, There is no defualt command queue in OpenCL. You have to create command queue at the host side with the options in-order or out of order exeuction. by default all the commands will exeute in -order. But they execute asynchronously between host and the device.

Please check OpenCL spec for more information.

himanshu_gautam
Grandmaster

btw... What do you mean  by "will execute synchronously" with the code.

CUDA Streams will keep executing on device... And when you say "cudaThreadSynchronize()" - you synch with the device. I dont think Stream0 is any special...

May be, for other non-zero streams you require cudaStreamSychronize()? and for 0 you can use "cudaThreadSynchronize"... Is that what you mean?

You can use "clFinish(comm_Q)" which will tbe effect of calling "cudaStreamSynchronize(stream#)"

Thats straightforward enough..

Please explain your problem in detaill.. .We will give you the solution..

Best REgards,

Bruhaspati

0 Likes