code: def __init__(self, ctx):
      self.kernel = (
          cl.Program(
              ctx,
              """
          #define BLOCK_SIZE %(block_size)d
          #define A_BLOCK_STRIDE (BLOCK_SIZE * a_width)
          #define A_T_BLOCK_STRIDE (BLOCK_SIZE * a_height)
  
          __kernel __attribute__((reqd_work_group_size(BLOCK_SIZE, BLOCK_SIZE, 1)))
          void transpose(
            __global float *a_t, __global float *a,
            unsigned a_width, unsigned a_height,
            __local float *a_local)
          {
            int base_idx_a   =
              get_group_id(0) * BLOCK_SIZE +
              get_group_id(1) * A_BLOCK_STRIDE;
            int base_idx_a_t =
              get_group_id(1) * BLOCK_SIZE +
              get_group_id(0) * A_T_BLOCK_STRIDE;
  
            int glob_idx_a   =
              base_idx_a + get_local_id(0) + a_width * get_local_id(1);
            int glob_idx_a_t =
              base_idx_a_t + get_local_id(0) + a_height * get_local_id(1);
  
            a_local[get_local_id(1)*BLOCK_SIZE+get_local_id(0)] = a[glob_idx_a];
  
            barrier(CLK_LOCAL_MEM_FENCE);
  
            a_t[glob_idx_a_t] = a_local[get_local_id(0)*BLOCK_SIZE+get_local_id(1)];
          }
          """
              % {"block_size": block_size},
          )
          .build()
          .transpose
      )
  
file_path: pyopencl/examples/transpose.py
imports: import pyopencl
  import numpy
  import numpy.linalg
label_desc: Use image node_id 1 to create a new TransposeWithLocal object  with example: obj = TransposeWithLocal(ctx)