Package com.aparapi

Annotation Type Kernel.PrivateMemorySpace


  • @Retention(RUNTIME)
    @Target(FIELD)
    public static @interface Kernel.PrivateMemorySpace
    We can use this Annotation to 'tag' __private (unshared) array fields. Data in the __private address space in OpenCL is accessible only from the current kernel instance. To so mark a field with a buffer size of 99, we can either annotate the buffer
    
      @PrivateMemorySpace(99) int[] buffer = new int[99];
      
    Or use a special suffix
    
      int[] buffer_$private$99 = new int[99];
      

    Note that any code which must be runnable in Kernel.EXECUTION_MODE.JTP will fail to work correctly if it uses such an array, as the array will be shared by all threads. The solution is to create a Kernel.NoCL method called at the start of Kernel.run() which sets the field to an array returned from a static ThreadLocal

    . Please see MedianKernel7x7 in the samples for an example.
    See Also:
    Kernel.PRIVATE_SUFFIX
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      int value
      Size of the array used as __private buffer.
    • Element Detail

      • value

        int value
        Size of the array used as __private buffer.