Results 1 to 3 of 3

Thread: Dynamically allocated shared memory

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    9

    Dynamically allocated shared memory

    Hi,

    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.
    Daniel

  2. #2
    Member
    Join Date
    Sep 2009
    Posts
    35

    Re: Dynamically allocated shared memory

    You set your local variable as a kernel argument:
    Code :
    __kernel void Something(..., __local float *var, ...)
    And then from host allocate the local memory with clSetKernelArg that has last parameter NULL:
    Code :
    clSetKernelArg(kernel, arg, localMemorySize, NULL);
    To know what is the allocated size inside kernel, remember also to pass the number of elements you allocated .

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    9

    Re: Dynamically allocated shared memory

    Thanks very much!!!

Similar Threads

  1. shared memory question
    By jai in forum OpenCL
    Replies: 1
    Last Post: 11-01-2012, 07:39 AM
  2. Replies: 4
    Last Post: 08-09-2011, 04:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •