[SOLVED] PyTorch no longer supports this GPU because it is too old

Derek: <p>Recently, I update the pytorch version to ‘0.3.1’.<br>
I have received the following warning message while running code:<br>
“PyTorch no longer supports this GPU because it is too old.”</p>
<p>What does this mean? The code can not be accelerated using the old GPU.<br>
From now on, all the codes are running only on CPU?</p>

ptrblck: <p>Which GPU do you use?<br>
You could compile from source to get GPU support. The binaries are built for cuda compute capability &gt;= 5 as far as I know.<br>
You can find the instructions <a href="https://github.com/pytorch/pytorch/blob/master/README.md#from-source">here</a>. Let me know if you encounter any problems.</p>

jpeg729: <p>That means that unless you compile pytorch from source all your models will run on the CPU.</p>
<p>See here for instructions on how to compile from source <a href="https://github.com/pytorch/pytorch/#from-source">https://github.com/pytorch/pytorch/#from-source</a></p>

Derek: <p>I develop mini model on my pc with Quadro K620 before using some powerful GPU.<br>
I will check the instructions.<br>
Thanks a lot.</p>

Derek: <p>I see.<br>
I will look into the instructions.<br>
Thanks a lot.</p>

apako: <p>In my case, even after compiling from the source I still get this error:</p>
<p>Found GPU0 GeForce GT 650M which is of cuda capability 3.0.<br>
PyTorch no longer supports this GPU because it is too old.</p>
<p>Any ideas?</p>

soerface: <p><a class="mention" href="/u/apako">@apako</a> Did you managed to get it running? I own a similar card, GeForce GTX 650, also tried to compile it myself (inside a Docker image with nvidia-docker, based on <code>nvidia/cuda:9.0-cudnn7-devel</code>)</p>

apako: <p>Yes, it runs well despite the warning message.</p>

redradist: <p>During the build form sources I still get the following error:</p>
<pre><code class="lang-auto">...
nvcc fatal   : Unsupported gpu architecture 'compute_30'
...
</code></pre>
<p>I thought that during build from sources PyTorch will detect GPU architecture and it builds for it package …</p>
<p>How to solve this issue ?</p>

ptrblck: <p>You can specify the compute capability via <code>TORCH_CUDA_ARCH_LIST=3.0</code> and try to rebuild it. However, based on the error message, I guess you might be using CUDA&gt;=11.0, which dropped the compute capability 3.0, so you might need to use an older CUDA toolkit.</p>

redradist: <aside class="quote no-group" data-username="ptrblck" data-post="10" data-topic="15444">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p>TORCH_CUDA_ARCH_LIST=3.0</p>
</blockquote>
</aside>
<p>Oh, thanks, I will try <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=12" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"><br>
Yes, I am using CUDA&gt;=11.0 … maybe this is the case …</p>

redradist: <p>Yeah, I downgrade the CUDA version to 10.2 and building starts but failed with strange error:</p>
<pre><code class="lang-auto">FAILED: confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o 
cd /home/{User}/Projects/AI/pytorch/build/confu-deps/NNPACK &amp;&amp; PYTHONPATH=/home/{User}/Projects/AI/pytorch/third_party/python-six:/home/{User}/Projects/AI/pytorch/third_party/python-peachpy /usr/local/bin/python3 -m peachpy.x86_64 -mabi=sysv -g4 -mimage-format=elf -I/home/{User}/Projects/AI/pytorch/third_party/NNPACK/src -I/home/{User}/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma -I/home/{User}/Projects/AI/pytorch/third_party/FP16/include -o /home/{User}/Projects/AI/pytorch/build/confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o /home/{User}/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/2d-fourier-8x8.py
/home/{User}/Projects/AI/pytorch/third_party/python-peachpy/peachpy/writer.py:114: ResourceWarning: unclosed file &lt;_io.FileIO name='/home/{User}/Projects/AI/pytorch/build/confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o' mode='wb' closefd=True&gt;
  self.output_file = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "/opt/python-3.8.2/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/python-3.8.2/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/{User}/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 280, in &lt;module&gt;
    main()
  File "/home/{User}/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 267, in main
    execute_script(writers, options.input[0])
  File "/home/{User}/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/{User}/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/{User}/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 202, in execute_script
    exec(code, globals())
  File "/home/{User}/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/2d-fourier-8x8.py", line 5, in &lt;module&gt;
    import fft.complex_soa
  File "/home/{User}/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/fft/complex_soa.py", line 7, in &lt;module&gt;
    from common import cos_npi_over_8, sin_npi_over_8, cos_npi_over_4, sin_npi_over_4
ImportError: cannot import name 'cos_npi_over_8' from 'common' (/home/{User}/.local/lib/python3.8/site-packages/common/__init__.py)
[25/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vlrelu/gen/vlrelu-scalar-x4.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vunary.h:11,
                 from ../third_party/XNNPACK/src/f32-vlrelu/gen/vlrelu-scalar-x4.c:13:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[26/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vrnd/gen/vrndd-scalar-libm-x1.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vunary.h:11,
                 from ../third_party/XNNPACK/src/f32-vrnd/gen/vrndd-scalar-libm-x1.c:15:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[27/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-velu/gen/velu-scalar-rr2-p6-x6.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vunary.h:11,
                 from ../third_party/XNNPACK/src/f32-velu/gen/velu-scalar-rr2-p6-x6.c:14:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[28/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vmulcaddc/gen/c2-minmax-scalar-2x.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vmulcaddc.h:11,
                 from ../third_party/XNNPACK/src/f32-vmulcaddc/gen/c2-minmax-scalar-2x.c:13:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[29/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vrnd/gen/vrndd-scalar-libm-x2.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vunary.h:11,
                 from ../third_party/XNNPACK/src/f32-vrnd/gen/vrndd-scalar-libm-x2.c:15:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[30/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vmulcaddc/gen/c4-minmax-scalar-2x.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vmulcaddc.h:11,
                 from ../third_party/XNNPACK/src/f32-vmulcaddc/gen/c4-minmax-scalar-2x.c:13:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[31/5198] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vrnd/gen/vrndd-scalar-libm-x4.c.o
In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0,
                 from ../third_party/XNNPACK/src/xnnpack/params.h:15,
                 from ../third_party/XNNPACK/src/xnnpack/vunary.h:11,
                 from ../third_party/XNNPACK/src/f32-vrnd/gen/vrndd-scalar-libm-x4.c:15:
../third_party/pthreadpool/include/pthreadpool.h:997:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1003:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_1d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1010:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1017:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_2d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1026:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_3d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../third_party/pthreadpool/include/pthreadpool.h:1037:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations]
  pthreadpool_function_4d_tiled_t function,
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 773, in &lt;module&gt;
    build_deps()
  File "setup.py", line 315, in build_deps
    build_caffe2(version=version,
  File "/home/{User}/Projects/AI/pytorch/tools/build_pytorch_libs.py", line 58, in build_caffe2
    cmake.build(my_env)
  File "/home/{User}/Projects/AI/pytorch/tools/setup_helpers/cmake.py", line 346, in build
    self.run(build_args, my_env)
  File "/home/{User}/Projects/AI/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/opt/python-3.8.2/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 1.
</code></pre>
<p>Error is:</p>
<pre><code class="lang-auto">ImportError: cannot import name 'cos_npi_over_8' from 'common'
</code></pre>
<p>But how it’s possible, all submodules updated properly …</p>

ptrblck: <p>This error seems to be raised by <code>NNPACK</code> and while I’m not deeply familiar with it, I would recommend to uninstall all previously installed PyTorch versions, clear the build via <code>python setup.py clean</code>, checkout all sumbodules, and try to rebuild it.</p>

redradist: <p>Another strange issue:</p>
<pre><code class="lang-auto">-- Using third party subdirectory Eigen.
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.5", minimum required is "3.0") 
-- Found PythonLibs: /usr/lib/libpython3.8.so.1.0 (Required is at least version "3.0") 
CMake Error at cmake/Dependencies.cmake:959 (if):
  if given arguments:

    "VERSION_LESS" "3"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:549 (include)


-- Configuring incomplete, errors occurred!
</code></pre>

redradist: <p>I just hard-coded version of the Python that was detected wrong to 3.8</p>
<p>And then build starts but faced with another issue:</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 280, in &lt;module&gt;
    main()
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 267, in main
[ 57%] Built target XNNPACK
    execute_script(writers, options.input[0])
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 202, in execute_script
    exec(code, globals())
  File "/home/redra/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/2d-fourier-8x8.py", line 5, in &lt;module&gt;
    import fft.complex_soa
  File "/home/redra/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/fft/complex_soa.py", line 7, in &lt;module&gt;
    from common import cos_npi_over_8, sin_npi_over_8, cos_npi_over_4, sin_npi_over_4
ImportError: cannot import name 'cos_npi_over_8' from 'common' (/home/redra/.local/lib/python3.8/site-packages/common/__init__.py)
[ 57%] Building C object sleef/src/libm/CMakeFiles/sleefavx512fnofma.dir/sleefsimddp.c.o
[ 57%] Building CXX object caffe2/proto/CMakeFiles/Caffe2_PROTO.dir/caffe2.pb.cc.o
make[2]: *** [confu-deps/NNPACK/CMakeFiles/nnpack.dir/build.make:81: confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3282: confu-deps/NNPACK/CMakeFiles/nnpack.dir/all] Error 2
</code></pre>
<p>Seems like this is related to <a href="https://github.com/facebookarchive/caffe2/issues/2296" class="inline-onebox" rel="noopener nofollow ugc">sudo make install -- ImportError: cannot import name cos_npi_over_8 · Issue #2296 · facebookarchive/caffe2 · GitHub</a></p>

redradist: <p>Even build from docker failed:</p>
<pre><code class="lang-auto">#23 325.0 [  8%] Building CXX object third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/shuffle/jit_uni_shuffle.cpp.o
#23 337.2 [  8%] Built target dnnl_cpu_x64
#23 337.2 make: *** [all] Error 2
#23 337.2 Makefile:140: recipe for target 'all' failed
#23 337.2 Building wheel torch-1.8.0a0
#23 337.2 -- Building version 1.8.0a0
#23 337.2 cmake -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/pytorch/torch -DCMAKE_PREFIX_PATH=/opt/conda/bin/../ -DNUMPY_INCLUDE_DIR=/opt/conda/lib/python3.8/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/opt/conda/bin/python -DPYTHON_INCLUDE_DIR=/opt/conda/include/python3.8 -DPYTHON_LIBRARY=/opt/conda/lib/libpython3.8.so.1.0 -DTORCH_BUILD_VERSION=1.8.0a0 -DUSE_NUMPY=True /opt/pytorch
#23 337.2 cmake --build . --target install --config Release -- -j 8
#23 337.2 Traceback (most recent call last):
#23 337.2   File "setup.py", line 773, in &lt;module&gt;
#23 337.2     build_deps()
#23 337.2   File "setup.py", line 315, in build_deps
#23 337.2     build_caffe2(version=version,
#23 337.2   File "/opt/pytorch/tools/build_pytorch_libs.py", line 58, in build_caffe2
#23 337.2     cmake.build(my_env)
#23 337.2   File "/opt/pytorch/tools/setup_helpers/cmake.py", line 345, in build
#23 337.2     self.run(build_args, my_env)
#23 337.2   File "/opt/pytorch/tools/setup_helpers/cmake.py", line 140, in run
#23 337.2     check_call(command, cwd=self.build_dir, env=env)
#23 337.2   File "/opt/conda/lib/python3.8/subprocess.py", line 364, in check_call
#23 337.2     raise CalledProcessError(retcode, cmd)
#23 337.2 subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.
------
error committing ki40ko690hn6nxbbd83w6smqr: invalid mutable ref 0xc001c50fa0: invalid: executor failed running [/bin/sh -c TORCH_CUDA_ARCH_LIST="3.0 3.5 5.2 6.0 6.1 7.0+PTX 8.0" TORCH_NVCC_FLAGS="-Xfatbin -compress-all"     CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"     python setup.py install]: exit code: 1
make: *** [docker.Makefile:47: devel-image] Error 1
</code></pre>

ptrblck: <p>I would recommend to create a new conda or pip environment with the wanted Python version and try to reinstall it in this clean environment.</p>

redradist: <p>I also tried to build on WIndows:</p>
<pre><code class="lang-auto">  Stringify NVFUSER runtime source file
  Building Custom Rule C:/pytorch/caffe2/CMakeLists.txt
  Stringify NVFUSER runtime source file
  Building Custom Rule C:/pytorch/caffe2/CMakeLists.txt
  Building NVCC (Device) object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/THC/Release/torch_cuda_generated_THCReduce
  ApplyUtils.cu.obj
  nvcc fatal   : Unsupported gpu architecture 'compute_30'
  CMake Error at torch_cuda_generated_THCReduceApplyUtils.cu.obj.Release.cmake:221 (message):
    Error generating
    C:/pytorch/build/caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/THC/Release/torch_cuda_generated_THCReduceApplyUtils.
  cu.obj
</code></pre>
<p><code>compute_30</code>, but I have set <code>TORCH_CUDA_ARCH_LIST=3.0</code> … seems like another variable should be set for <code>caffe2</code></p>

ptrblck: <p>This error is raised, since the CUDA compiler <code>nvcc</code> doesn’t recognize the GPU architecture. As explained before, CUDA&gt;=11.0 dropped the compute capability 3.0, so you would have to use an older CUDA version.</p>

redradist: <aside class="quote no-group" data-username="redradist" data-post="15" data-topic="15444" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/redradist/48/26572_2.png" class="avatar"> redradist:</div>
<blockquote>
<p>I just hard-coded version of the Python that was detected wrong to 3.8</p>
<p>And then build starts but faced with another issue:</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 280, in &lt;module&gt;
    main()
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 267, in main
[ 57%] Built target XNNPACK
    execute_script(writers, options.input[0])
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 198, in execute_script
    execute_script(writers, source_filename)
  File "/home/redra/Projects/AI/pytorch/third_party/python-peachpy/peachpy/x86_64/__main__.py", line 202, in execute_script
    exec(code, globals())
  File "/home/redra/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/2d-fourier-8x8.py", line 5, in &lt;module&gt;
    import fft.complex_soa
  File "/home/redra/Projects/AI/pytorch/third_party/NNPACK/src/x86_64-fma/fft/complex_soa.py", line 7, in &lt;module&gt;
    from common import cos_npi_over_8, sin_npi_over_8, cos_npi_over_4, sin_npi_over_4
ImportError: cannot import name 'cos_npi_over_8' from 'common' (/home/redra/.local/lib/python3.8/site-packages/common/__init__.py)
[ 57%] Building C object sleef/src/libm/CMakeFiles/sleefavx512fnofma.dir/sleefsimddp.c.o
[ 57%] Building CXX object caffe2/proto/CMakeFiles/Caffe2_PROTO.dir/caffe2.pb.cc.o
make[2]: *** [confu-deps/NNPACK/CMakeFiles/nnpack.dir/build.make:81: confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3282: confu-deps/NNPACK/CMakeFiles/nnpack.dir/all] Error 2
</code></pre>
<p>Seems like this is related to <a href="https://github.com/facebookarchive/caffe2/issues/2296" class="inline-onebox" rel="noopener nofollow ugc">sudo make install -- ImportError: cannot import name cos_npi_over_8 · Issue #2296 · facebookarchive/caffe2 · GitHub</a></p>
</blockquote>
</aside>
<p>I’ve found the root cause for this issue:</p><aside class="onebox githubissue" data-onebox-src="https://github.com/Maratyszcza/NNPACK/issues/202">
  <header class="source">

      <a href="https://github.com/Maratyszcza/NNPACK/issues/202" target="_blank" rel="noopener nofollow ugc">github.com/Maratyszcza/NNPACK</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/Maratyszcza/NNPACK/issues/202" target="_blank" rel="noopener nofollow ugc">Build failed, cos_npi_over_8 is not available in common</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2021-05-03" data-time="10:06:01" data-timezone="UTC">10:06AM - 03 May 21 UTC</span>
      </div>


      <div class="user">
        <a href="https://github.com/redradist" target="_blank" rel="noopener nofollow ugc">
          <img alt="redradist" src="https://avatars.githubusercontent.com/u/6311799?v=4" class="onebox-avatar-inline" width="20" height="20">
          redradist
        </a>
      </div>
    </div>

    <div class="labels">
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">When I try to build PyTorch I got the following error:
```diff
ImportError: ca<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">nnot import name 'cos_npi_over_8' from 'common' (~/.local/lib/python3.8/site-packages/common/__init__.py)
make[2]: *** [confu-deps/NNPACK/CMakeFiles/nnpack.dir/build.make:81: confu-deps/NNPACK/src/x86_64-fma/2d-fourier-8x8.py.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2697: confu-deps/NNPACK/CMakeFiles/nnpack.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
```
I investigated this issue for some time and figured out that there was missed path in **PYTHONPATH** to _x86_64-fma_ where those module located with all child modules
To fix the issue I modified CMakeLists.txt:
```console
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ecd2df..6c6af68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,11 +169,12 @@ IF(NNPACK_BACKEND STREQUAL "x86-64")
     SET(PYTHON_PEACHPY_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/peachpy" CACHE STRING "PeachPy (Python package) source directory")
   ENDIF()
 
+  SET(PYTHON_NNPACK_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/x86_64-fma)
   IF(${PYTHON_VERSION_STRING} VERSION_LESS 3.4)
     # ---[ Python &lt; 3.4 does not natively support enums, and needs a polyfill
     SET(PEACHPY_PYTHONPATH "${PYTHON_SIX_SOURCE_DIR}:${PYTHON_ENUM_SOURCE_DIR}:${PYTHON_PEACHPY_SOURCE_DIR}")
   ELSE()
-    SET(PEACHPY_PYTHONPATH "${PYTHON_SIX_SOURCE_DIR}:${PYTHON_PEACHPY_SOURCE_DIR}")
+    SET(PEACHPY_PYTHONPATH "${PYTHON_NNPACK_MODULE_DIR}:${PYTHON_SIX_SOURCE_DIR}:${PYTHON_PEACHPY_SOURCE_DIR}")
   ENDIF()
 ENDIF()
```
After this PyTorch compiled successfully ...
Is it and issue of PyTorch ?
For me it seems like it is an issue in build file for NNPACK</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>