title: cudaOccupancyMaxPotentialBlockSize API template usage
body: <p>I m trying to understand the CUDA occupancy API cudaOccupancyMaxPotentialBlockSize. </p>
  
  <p>The templated version is defined as below.</p>
  
  <pre><code>template&lt;class T&gt;
  __inline__ __host__ CUDART_DEVICE cudaError_t 
  cudaOccupancyMaxPotentialBlockSize(
  int    *minGridSize,
  int    *blockSize,
  T       func,
  size_t  dynamicSMemSize = 0,
  int     blockSizeLimit = 0)
  {
  return cudaOccupancyMaxPotentialBlockSizeVariableSMem(minGridSize, blockSize, func, __cudaOccupancyB2DHelper(dynamicSMemSize), blockSizeLimit);
  } 
  </code></pre>
  
  <p>I haven't found much examples on how to use the API if the kernel is a template.</p>
  
  <p>I have found one in our code as seen in below example.</p>
  
  <pre><code>template &lt;typename T&gt; __global__ void fn(T *a) { *a = 10;}
  
  cudaOccupancyMaxPotentialBlockSize&lt;void(*)(int *)&gt;(&amp;gridSize, &amp;blockSize, fn, 0, 0); 
  </code></pre>
  
  <p>In this case, this void* (int*) represents the function pointer (of the kernel) returning void and int as an argument.  Is my understanding correct.</p>
  
  <p>If so, since the return type of the kernel is always void, Is the first parameter in the template list &lt;(void*)(int*)> always void and then the others like int* follows according to the arguments list?</p>
  
  <p>Can anyone explain better(with examples) on how to use this API with kernel being template. </p>