Unable to run Pytorch with Cuda 11.1

mgoliyad: <p>Collecting environment information…<br>
PyTorch version: 1.8.1+cu111<br>
Is debug build: False<br>
CUDA used to build PyTorch: 11.1<br>
ROCM used to build PyTorch: N/A</p>
<p>OS: Microsoft Windows Server 2019 Standard<br>
GCC version: Could not collect<br>
Clang version: Could not collect<br>
CMake version: version 3.20.1</p>
<p>Python version: 3.7 (64-bit runtime)<br>
Is CUDA available: True<br>
CUDA runtime version: 11.1.105<br>
GPU models and configuration: Could not collect<br>
Nvidia driver version: Could not collect<br>
cuDNN version: Could not collect<br>
HIP runtime version: N/A<br>
MIOpen runtime version: N/A</p>
<p>Versions of relevant libraries:<br>
[pip3] numpy==1.20.2<br>
[pip3] numpydoc==1.1.0<br>
[pip3] torch==1.8.1+cu111<br>
[pip3] torchaudio==0.8.1<br>
[pip3] torchvision==0.9.1+cu111<br>
[conda] blas                      1.0                         mkl<br>
[conda] mkl                       2021.2.0           haa95532_296<br>
[conda] mkl-include               2021.2.0           haa95532_296<br>
[conda] mkl-service               2.3.0            py37h2bbff1b_1<br>
[conda] mkl_fft                   1.3.0            py37h277e83a_2<br>
[conda] mkl_random                1.2.1            py37hf11a4ad_2<br>
[conda] numpy                     1.20.2                   pypi_0    pypi<br>
[conda] numpy-base                1.20.1           py37haf7ebc8_0<br>
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1<br>
[conda] torch                     1.8.1+cu111              pypi_0    pypi<br>
[conda] torchaudio                0.8.1                    pypi_0    pypi<br>
[conda] torchvision               0.9.1+cu111              pypi_0    pypi</p>
<p>Fri Apr 23 20:12:41 2021<br>
±----------------------------------------------------------------------------+<br>
| NVIDIA-SMI 456.81       Driver Version: 456.81       CUDA Version: 11.1     |<br>
|-------------------------------±---------------------±---------------------+<br>
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |<br>
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |<br>
|                               |                      |               MIG M. |<br>
|===============================+======================+======================|<br>
|   0  Tesla K20c          TCC  | 00000000:82:00.0 Off |                    0 |<br>
| 30%   27C    P8    16W / 225W |      9MiB /  4737MiB |      0%      Default |<br>
|                               |                      |                  N/A |<br>
±------------------------------±---------------------±---------------------+</p>
<p>±----------------------------------------------------------------------------+<br>
| Processes:                                                                  |<br>
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |<br>
|        ID   ID                                                   Usage      |<br>
|=============================================================================|<br>
|  No running processes found                                                 |<br>
±----------------------------------------------------------------------------+</p>
<p>Simple code:</p>
<p>import torch<br>
print(‘F’, torch.tensor([1.0, 2.0]).cuda())</p>
<p>Error:</p>
<p>F Traceback (most recent call last):<br>
File “G:\Python_projects\OCR_new\1.py”, line 12, in <br>
print(‘F’, torch.tensor([1.0, 2.0]).cuda())<br>
File “C:\Users\mgoliyad_admin\AppData\Local\Continuum\anaconda3\envs\cuda_11\lib\site-packages\torch\tensor.py”, line 193, in <strong>repr</strong><br>
return torch._tensor_str._str(self)<br>
File “C:\Users\mgoliyad_admin\AppData\Local\Continuum\anaconda3\envs\cuda_11\lib\site-packages\torch_tensor_str.py”, line 383, in _str<br>
return _str_intern(self)<br>
File “C:\Users\mgoliyad_admin\AppData\Local\Continuum\anaconda3\envs\cuda_11\lib\site-packages\torch_tensor_str.py”, line 358, in _str_intern<br>
tensor_str = _tensor_str(self, indent)<br>
File “C:\Users\mgoliyad_admin\AppData\Local\Continuum\anaconda3\envs\cuda_11\lib\site-packages\torch_tensor_str.py”, line 242, in _tensor_str<br>
formatter = _Formatter(get_summarized_data(self) if summarize else self)<br>
File “C:\Users\mgoliyad_admin\AppData\Local\Continuum\anaconda3\envs\cuda_11\lib\site-packages\torch_tensor_str.py”, line 90, in <strong>init</strong><br>
nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) &amp; tensor_view.ne(0))<br>
RuntimeError: CUDA error: no kernel image is available for execution on the device</p>
<p>(cuda_11) G:\Python_projects\OCR_new&gt;</p>

ptrblck: <p>The K20 uses a compute capability of 3.5, which is not shipped in the binaries (min. compute capability is 3.7), so you could build PyTorch from source as described <a href="https://github.com/pytorch/pytorch#from-source">here</a>.</p>

mgoliyad: <p>Thanks for the answer! No luck with building from source either:<br>
[4582/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorTopKLong.cu.obj<br>
THCTensorTopKLong.cu<br>
THCTensorTopKLong.cu<br>
[4583/5621] Building NVCC (Device) object caffe2/CMakeFile…ATen/native/cuda/torch_cuda_generated_Distributions.cu.obj<br>
Distributions.cu<br>
Distributions.cu<br>
ninja: build stopped: subcommand failed.<br>
(cuda_11) PS C:\Users\mgoliyad_admin\pytorch&gt;</p>

mgoliyad: <p>Can I try binaries for older version for K20?</p>

ptrblck: <p>Yes, you could try to use an older version, but I’m currently unsure when 3.5 was dropped.<br>
The error message from the source build isn’t shown, so you would have to check the messages printed a bit earlier in the log.</p>
<p>EDIT: you might also want to check <a href="https://github.com/pytorch/pytorch/issues/30532">this issue</a> where some users were building the binaries with <code>sm_35</code>.</p>

mgoliyad: <p>Thanks for your answer; here is more data from log:[4563/5621] Building NVCC (Device) object caffe2/CMakeFile…C/generated/torch_cuda_generated_THCTensorSortFloat.cu.obj<br>
THCTensorSortFloat.cu<br>
THCTensorSortFloat.cu<br>
[4564/5621] Building NVCC (Device) object caffe2/CMakeFile…/generated/torch_cuda_generated_THCTensorSortDouble.cu.obj<br>
THCTensorSortDouble.cu<br>
THCTensorSortDouble.cu<br>
[4565/5621] Building NVCC (Device) object caffe2/CMakeFile…THC/generated/torch_cuda_generated_THCTensorSortInt.cu.obj<br>
THCTensorSortInt.cu<br>
THCTensorSortInt.cu<br>
[4566/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorTopKChar.cu.obj<br>
THCTensorTopKChar.cu<br>
THCTensorTopKChar.cu<br>
[4567/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorSortHalf.cu.obj<br>
THCTensorSortHalf.cu<br>
THCTensorSortHalf.cu<br>
[4568/5621] Building NVCC (Device) object caffe2/CMakeFile…e/cuda/torch_cuda_generated_EmbeddingBackwardKernel.cu.obj<br>
EmbeddingBackwardKernel.cu<br>
EmbeddingBackwardKernel.cu<br>
[4569/5621] Building NVCC (Device) object caffe2/CMakeFile…n/src/ATen/native/cuda/torch_cuda_generated_Dropout.cu.obj<br>
Dropout.cu<br>
Dropout.cu<br>
[4570/5621] Building NVCC (Device) object caffe2/CMakeFile…enerated/torch_cuda_generated_THCTensorSortBFloat16.cu.obj<br>
THCTensorSortBFloat16.cu<br>
THCTensorSortBFloat16.cu<br>
[4571/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorTopKHalf.cu.obj<br>
THCTensorTopKHalf.cu<br>
THCTensorTopKHalf.cu<br>
[4572/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorSortByte.cu.obj<br>
THCTensorSortByte.cu<br>
THCTensorSortByte.cu<br>
[4573/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorSortChar.cu.obj<br>
THCTensorSortChar.cu<br>
THCTensorSortChar.cu<br>
[4574/5621] Building NVCC (Device) object caffe2/CMakeFile…C/generated/torch_cuda_generated_THCTensorSortShort.cu.obj<br>
THCTensorSortShort.cu<br>
THCTensorSortShort.cu<br>
[4575/5621] Building NVCC (Device) object caffe2/CMakeFile…THC/generated/torch_cuda_generated_THCTensorTopKInt.cu.obj<br>
THCTensorTopKInt.cu<br>
THCTensorTopKInt.cu<br>
[4576/5621] Building NVCC (Device) object caffe2/CMakeFile…C/generated/torch_cuda_generated_THCTensorTopKFloat.cu.obj<br>
THCTensorTopKFloat.cu<br>
THCTensorTopKFloat.cu<br>
[4577/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorSortLong.cu.obj<br>
THCTensorSortLong.cu<br>
THCTensorSortLong.cu<br>
[4578/5621] Building NVCC (Device) object caffe2/CMakeFile…/cuda/torch_cuda_generated_DistributionRandomKernel.cu.obj<br>
DistributionRandomKernel.cu<br>
DistributionRandomKernel.cu<br>
[4579/5621] Building NVCC (Device) object caffe2/CMakeFile…src/ATen/native/cuda/torch_cuda_generated_Embedding.cu.obj<br>
Embedding.cu<br>
Embedding.cu<br>
[4580/5621] Building NVCC (Device) object caffe2/CMakeFile…HC/generated/torch_cuda_generated_THCTensorTopKLong.cu.obj<br>
THCTensorTopKLong.cu<br>
THCTensorTopKLong.cu<br>
[4581/5621] Building NVCC (Device) object caffe2/CMakeFile…/generated/torch_cuda_generated_THCTensorTopKDouble.cu.obj<br>
THCTensorTopKDouble.cu<br>
THCTensorTopKDouble.cu<br>
[4582/5621] Building NVCC (Device) object caffe2/CMakeFile…ATen/native/cuda/torch_cuda_generated_Distributions.cu.obj<br>
Distributions.cu<br>
Distributions.cu<br>
ninja: build stopped: subcommand failed.<br>
(py_self) PS C:\Users\mgoliyad_admin\pytorch&gt;</p>

ptrblck: <p>Unfortunately, the error message is still not shown. The log should contain a line containing the <code>error</code> keyword with a description why the build is failing.</p>

mgoliyad: <p>After downgrading VS to 16.7 I was able to build from source. Thanks!</p>