title: CUDA: How to check for the right compute capability?
body: <p>CUDA code compiled with a higher compute capability will execute perfectly for a long time on a device with lower compute capability, before silently failing one day in some kernel. I spent half a day chasing an elusive bug only to realize that the Build Rule had <code>sm_21</code> while the device (Tesla C2050) was a <code>2.0</code>.</p>
  
  <p>Is there any CUDA API code I can add which can self-check if it is running on a device with compatible compute capability? I need to compile and work with devices of many compute capabilities. Is there any other action I can take to ensure such errors do not occur?</p>