Error when installing pytorch from source

username: iremonur
cooked: <p>Hi, I want to use Pytorch with Quadro K3100M which is of Cuda capability 3.0. But i get this error :<br>
"   Found GPU0 Quadro K3100M which is of Cuda capability 3.0.<br>
PyTorch no longer supports this GPU because it is too old.<br>
The minimum Cuda capability that we support is 3.5.  "</p>
<p>So, I did some research and found that i should have installed Pytorch from source, therefore i am trying to do it. But after i run “python setup.py install”, i get this error :</p>
<p>[3894/5004] Building NVCC (Device) obj…cuda_generated_THCTensorTopKShort.cu.o<br>
FAILED: caffe2/CMakeFiles/torch_cuda.dir/<strong>/aten/src/THC/generated/torch_cuda_generated_THCTensorTopKShort.cu.o<br>
cd /home/ionur1/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/</strong>/aten/src/THC/generated &amp;&amp; /home/ionur1/anaconda3/envs/conda_env/bin/cmake -E make_directory /home/ionur1/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/<strong>/aten/src/THC/generated/. &amp;&amp; /home/ionur1/anaconda3/envs/conda_env/bin/cmake -D verbose:BOOL=OFF -D build_configuration:STRING=Release -D generated_file:STRING=/home/ionur1/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/</strong>/aten/src/THC/generated/./torch_cuda_generated_THCTensorTopKShort.cu.o -D generated_cubin_file:STRING=/home/ionur1/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/<strong>/aten/src/THC/generated/./torch_cuda_generated_THCTensorTopKShort.cu.o.cubin.txt -P /home/ionur1/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/</strong>/aten/src/THC/generated/torch_cuda_generated_THCTensorTopKShort.cu.o.Release.cmake<br>
/home/ionur1/pytorch/aten/src/THC/THCDeviceUtils.cuh(38): error: identifier “__ldg” is undefined<br>
detected during:<br>
instantiation of “T doLdg(const T *) [with T=int16_t]”<br>
/home/ionur1/pytorch/aten/src/ATen/native/cuda/SortingRadixSelect.cuh(201): here<br>
instantiation of “void at::native::countRadixUsingMask&lt;scalar_t,bitwise_t,index_t,CountType,RadixSize,RadixBits&gt;(CountType *, CountType *, bitwise_t, bitwise_t, int, index_t, index_t, scalar_t *) [with scalar_t=int16_t, bitwise_t=uint32_t, index_t=uint32_t, CountType=int, RadixSize=4, RadixBits=2]”<br>
/home/ionur1/pytorch/aten/src/ATen/native/cuda/SortingRadixSelect.cuh(337): here<br>
instantiation of “void at::native::radixSelect&lt;scalar_t,bitwise_t,index_t,Order&gt;(scalar_t *, index_t, index_t, index_t, int *, scalar_t *) [with scalar_t=int16_t, bitwise_t=uint32_t, index_t=uint32_t, Order=true]”<br>
/home/ionur1/pytorch/aten/src/THC/THCTensorTopK.cuh(69): here<br>
instantiation of “void gatherTopK&lt;T,IndexType,Dim,Order&gt;(TensorInfo&lt;T, IndexType&gt;, IndexType, IndexType, IndexType, IndexType, TensorInfo&lt;T, IndexType&gt;, IndexType, IndexType, TensorInfo&lt;int64_t, IndexType&gt;, IndexType) [with T=int16_t, IndexType=uint32_t, Dim=1, Order=true]”<br>
/home/ionur1/pytorch/aten/src/THC/generic/THCTensorTopK.cu(127): here</p>
<p>1 error detected in the compilation of “/tmp/tmpxft_0000297e_00000000-6_THCTensorTopKShort.cpp1.ii”.<br>
CMake Error at torch_cuda_generated_THCTensorTopKShort.cu.o.Release.cmake:281 (message):<br>
Error generating file<br>
/home/ionur1/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/THC/generated/./torch_cuda_generated_THCTensorTopKShort.cu.o</p>
<p>[3901/5004] Building NVCC (Device) obj…rch_cuda_generated_THCTensorIndex.cu.o<br>
ninja: build stopped: subcommand failed.<br>
Traceback (most recent call last):<br>
File “setup.py”, line 724, in <br>
build_deps()<br>
File “setup.py”, line 312, in build_deps<br>
build_caffe2(version=version,<br>
File “/home/ionur1/pytorch/tools/build_pytorch_libs.py”, line 62, in build_caffe2<br>
cmake.build(my_env)<br>
File “/home/ionur1/pytorch/tools/setup_helpers/cmake.py”, line 346, in build<br>
self.run(build_args, my_env)<br>
File “/home/ionur1/pytorch/tools/setup_helpers/cmake.py”, line 141, in run<br>
check_call(command, cwd=self.build_dir, env=env)<br>
File “/home/ionur1/anaconda3/envs/conda_env/lib/python3.8/subprocess.py”, line 364, in check_call<br>
raise CalledProcessError(retcode, cmd)<br>
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘–build’, ‘.’, ‘–target’, ‘install’, ‘–config’, ‘Release’, ‘–’, ‘-j’, ‘8’]’ returned non-zero exit status 1.</p>
<p>Note: I tried to run with python and python3, nothing has changed. I activated conda environment before running the commands.</p>
<p>OS: Ubuntu 18.04.1 LTS<br>
CUDA Version 10.2.89<br>
cudNN Version 7603<br>
Python : 3.8.5<br>
GPU : GPU0 Quadro K3100M<br>
GCC version : 8.4.0</p>
<p>I would like to be very glad if you help me about this.</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="iremonur" data-post="1" data-topic="100105">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/i/f4b2a3/48.png" class="avatar"> iremonur:</div>
<blockquote>
<p>error: identifier “__ldg” is undefined</p>
</blockquote>
</aside>
<p>As stated in the error message, the minimal compute capability is 3.5, since e.g. <code>__ldg</code> is defined for &gt;=3.5 as seen <a href="https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#ldg-function">here</a>.</p>