title: Cuda Error (209): cudaLaunchKernel returned cudaErrorNoKernelImageForDevice
body: <p>Operating System: CentOS 7
  Cuda Toolkit Version: 11.0</p>
  <p>Nvidia Driver and GPU Info:</p>
  <p>NVIDIA-SMI 450.51.05<br />
  Driver Version: 450.51.05<br />
  CUDA Version: 11.0<br />
  GPU: Quadro M2000M</p>
  <p><a href="https://i.stack.imgur.com/93NgD.png" rel="nofollow noreferrer">screenshot of nvidia-smi details</a></p>
  <p>I'm very new to cuda programming so any guidance is extremely appreciated. I have a very simple cuda c++ program that computes the sum of two arrays in unified memory on the GPU. However, it appears that the kernel fails to launch due to a cudaErrorNoKernelImageForDevice error. The code is below:</p>
  <pre><code>using namespace std;
  #include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;cuda_runtime_api.h&gt;
  __global__
  void add(int n, float *x, float*y){
  for (int i = 0; i &lt; n; i++)
  y[i] = x[i] + y[i];
  }
  
  int main() {
  cout &lt;&lt; &quot;!!!Hello World!!!&quot; &lt;&lt; endl; // prints !!!Hello World!!!
  
  int N = 1&lt;&lt;20;
  float *x, *y;
  
  cudaMallocManaged((void**)&amp;x, N*sizeof(float));
  cudaMallocManaged((void**)&amp;y, N*sizeof(float));
  
  for(int i = 0; i &lt; N; i++){
  x[i] = 1.0f;
  y[i] = 2.0f;
  }
  
  add&lt;&lt;&lt;1, 1&gt;&gt;&gt;(N, x, y);
  cudaGetLastError();
      /**
       * This indicates that there is no kernel image available that is suitable
       * for the device. This can occur when a user specifies code generation
       * options for a particular CUDA source file that do not include the
       * corresponding device configuration.
       *
       *    cudaErrorNoKernelImageForDevice       =     209,
       */
  
  cudaDeviceSynchronize();
  
  float maxError = 0.0f;
  for (int i = 0; i &lt; N; i++){
  maxError = fmax(maxError, fabs(y[i]-3.0f));
  }
  
  cudaFree(x);
  cudaFree(y);
  
  return 0;
  
  
  }
  
  </code></pre>