cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bardia
Journeyman III

Dynamic work-item and work-group size ?

Hi,

I am a beginner in OpenCL, and I have two questions: 

Suppose that we have two kernels k1 & k2. k1 works on 1D work space and k2 works on 2D work space. Size of dimensions varies with stream of processing data, but k2 sizes are always larger than k1's (ex. 16 to (256,256)), and k1 always calls k2 in its loops.

For optimum utilization of GPU resources, I need to dynamically change the work sizes for k2. Unfortunately, assigning work sizes from host using events and ques is very slow !

1- Is there any way to dynamically change work sizes for k2 during execution of k1 (from k1 source not from HOST) ?

2- Is it possible to dynamically put some commands for k2 in ques during execution of k1 (from k1 source not from HOST) ?

Thanks in advance

Bardia

0 Likes
6 Replies
himanshu_gautam
Grandmaster

When a kernel function K1 calls another Kernel function K2 -- it will be treated as just another "function" call - This is according to OpenCL Spec. Section 6.7.1 in OpenCL 1.2 spec.

So, if you have written K1 as a 1D kernel and K2 as a 2D kernel -- this is not going to work in OpenCL.

Please correct my understanding,

EDIT: Sharing your code will help others in helping you.

Message was edited by: Himanshu Gautam

0 Likes

Hi Himanshu,

Thanks for your reply.

I know, that is what I mean to change parameters for k2 during run time.

How about my second question ?

0 Likes

Hi bardia,

The answer to both of your questions is NO as of now. You cannot enqueue commands from kernel source.

IIRC dynamic kernel execution is a feature in CUDA 5 (not cuda 4)

nou
Exemplar

IIRC in CUDA 4 there is support for dynamic kernel launching within GPU without host. so maybe in future version of OpenCL we will see this functionality.

bardia
Journeyman III

Hi nou,

Thanks for your reply! It is interesting, so we are far from AMD implementation!

How about my second question ?

0 Likes

Hi Bardia,

I hope you have got all your answers. You can post your code here, for better suggestion.

0 Likes