david_aiken

__local initialization

Discussion created by david_aiken on Jan 5, 2010
Latest reply on Jan 5, 2010 by MicahVillmow

hi all..

The following lines in a kernel:

 

    __local uint count[1] = {0}; // ASSUME no barrier is necessary
    if (localId == localSize - 1)
    {
        count[0] = retval;
    }
    barrier(CLK_LOCAL_MEM_FENCE);


give the following error using the 2.0 sdk:

error: variable "count" has already been initialized

      __local uint count[1] = {0}; // ASSUME no barrier is necessary

From the OpenCL spec i'm not sure what the variable is initialized to or how to override it without requiring a local memory barrier. Can i assume it is initialized to 0?

btw NVidia doesn't complain.. which doesn't necessarily mean it's correct..

 

thanks

Outcomes