View Full Version : Dynamically allocated shared memory
11-27-2009, 03:45 AM
I just wondered if there is a possibility to allocate shared mem in opencl dynamically like in CUDA. Maybe someone can help me.
Thanks in advance.
11-27-2009, 11:13 AM
You set your local variable as a kernel argument:
__kernel void Something(..., __local float *var, ...)
And then from host allocate the local memory with clSetKernelArg that has last parameter NULL:
clSetKernelArg(kernel, arg, localMemorySize, NULL);
To know what is the allocated size inside kernel, remember also to pass the number of elements you allocated :) .
11-30-2009, 02:17 AM
Thanks very much!!!
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.