title: Simple CUDA Kernel Optimization
body: <p>In the process of speeding up an application, I have a very simple kernel which does the type casting as shown below:</p>
  
  <pre><code>__global__ void UChar2FloatKernel(float *out, unsigned char *in, int nElem){
      unsigned int i = (blockIdx.x * blockDim.x) + threadIdx.x;
      if(i&lt;nElem)
          out[i] = (float) in[i];
  }
  </code></pre>
  
  <p>The global memory access is coalesced and in my understanding using shared memory will also not be beneficial as there are not multiple reads of the same memory. Does any one have any idea if there is any optimization which can be performed to speed up this kernel. The input and output data is already on the device, so no host to device memory copy will be required.</p>