cudaCheckError() failed : no kernel image is available for execution on the device

Zeph: <p>Getting this error while running yolov2 <a href="https://github.com/longcw/yolo2-pytorch" rel="nofollow noopener">https://github.com/longcw/yolo2-pytorch</a><br>
Ubuntu 16.04<br>
cuda 8.0<br>
python 3.6<br>
pytorch 0.3.0.post4<br>
gcc 5.4.0<br>
gpu Quadro M1200</p>
<p>Installed PyTorch Linux binary compiled with cuda8 , using pip</p>
<p>Any ideas on what could be done to fix it?</p>

ptrblck: <p>It seems the error is thrown from the compiled kernels using <code>nvcc</code> in YOLO2 (<a href="https://github.com/longcw/yolo2-pytorch/blob/17056ca69f097a07884135d9031c53d4ef217a6a/make.sh#L11">line of code</a>), not PyTorch directly.<br>
Could you try so get <code>-arch</code> to <code>-arch=sm_61</code>, as it seems your M1200 is built using the Pascal architecture (<a href="https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list">doc</a>).</p>

caonv: <p>I 'm facing the same error here,<br>
I’m using Titan Xp GPUs to run <a href="https://github.com/rowanz/neural-motifs" rel="nofollow noopener">neural-motifs</a> .<br>
I have both cuda-10.0 and cuda-9.0 installed, but the driver is for cuda-10.0<br>
Any idea?</p>

Jinghua_Gao: <p>I have been facing this problem for two days since i am leaning pytorch by the Official Pytorch Tutorial. I am stopped at<br>
y = torch.ones_like(x, device=device)<br>
when python3.6 reported this cuda error.<br>
I searched the internet and got no anwser.<br>
That’s disappointing …</p>
<p>I am on CentOS 7 with a GT650M gpu and CUDA 10.1<br>
nvidia-smi information:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/5/54b20f4438847c9397b21e9586f721990a57f88e.png" data-download-href="https://discuss.pytorch.org/uploads/default/54b20f4438847c9397b21e9586f721990a57f88e" title="59%20PM"><img src="https://discuss.pytorch.org/uploads/default/optimized/2X/5/54b20f4438847c9397b21e9586f721990a57f88e_2_690x357.png" alt="59%20PM" data-base62-sha1="c5fB6JqACQkmVdB5rKYC6sQx6Gi" width="690" height="357" srcset="https://discuss.pytorch.org/uploads/default/optimized/2X/5/54b20f4438847c9397b21e9586f721990a57f88e_2_690x357.png, https://discuss.pytorch.org/uploads/default/optimized/2X/5/54b20f4438847c9397b21e9586f721990a57f88e_2_1035x535.png 1.5x, https://discuss.pytorch.org/uploads/default/original/2X/5/54b20f4438847c9397b21e9586f721990a57f88e.png 2x" data-dominant-color="000F03"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">59%20PM</span><span class="informations">1126×584 45.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>SO, H!E!L!P! M!E!</p>

ptrblck: <p>Your GT650M has compute capability 3.0 based on <a href="https://developer.nvidia.com/cuda-gpus#compute" rel="nofollow noopener">this table</a>, which isn’t supported anymore using the prebuilt binaries. You could build from source following <a href="https://github.com/pytorch/pytorch/blob/master/README.md#from-source" rel="nofollow noopener">this instruction</a>.</p>

Jinghua_Gao: <p>Thanks  a lot, however, the guide of “Install from source” said,<br>
“Once you have <a href="https://www.anaconda.com/distribution/#download-section" rel="nofollow noopener">Anaconda</a> installed, here are the instructions.”</p>
<p>I can’t find where are the instructions…<img src="https://discuss.pytorch.org/images/emoji/apple/pensive.png?v=9" title=":pensive:" class="emoji" alt=":pensive:"></p>
<p>Maybe from source means from rpm?</p>

ptrblck: <p>The instructions are in the following sentences:</p>
<pre><code class="lang-auto">If you want to compile with CUDA support, install
...
</code></pre>
<p>Just follow this passage and it should walk you through the install process. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>

Ankit_Samal: <p>Hi Cao. Were you able to fix this?</p>

caonv: <p>Actually, it was the problem when I compiled some file written in cuda.<br>
Please check the followings:</p>
<ol>
<li>Pytorch is compiled in the same version with system cuda version</li>
<li>Choose the true architecture code for your GPUs. For example, in this line <a href="https://github.com/rowanz/neural-motifs/blob/d05a251b705cedaa51599bf2906cfa4653b7a761/lib/fpn/nms/src/cuda/Makefile#L2" rel="nofollow noopener">https://github.com/rowanz/neural-motifs/blob/d05a251b705cedaa51599bf2906cfa4653b7a761/lib/fpn/nms/src/cuda/Makefile#L2</a>, the GPU architecture is 61 for Titan Xp. You must change it into 52 for Geforce GTX Titan, or 75 for Titan V.<br>
Hope this helps.</li>
</ol>