CalledProcessError when building from source on older GPU

username: Avisek
cooked: <p>I’m trying to build PyTorch from source on Manjaro Linux:</p>
<pre><code class="lang-auto">$ uname -a
Linux user-pc 5.4.14-2-MANJARO #1 SMP PREEMPT Fri Jan 24 09:34:16 UTC 2020 x86_64 GNU/Linux
</code></pre>
<p>I’m building on CUDA v10.1 on a Quadro K4200 with nvidia driver 418.113</p>
<pre><code class="lang-auto">$ nvidia-smi
Fri Jan 31 17:26:24 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.113      Driver Version: 418.113      CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro K4200        Off  | 00000000:03:00.0  On |                  N/A |
| 33%   55C    P5    29W / 110W |    182MiB /  4034MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0       774      G   /usr/lib/Xorg                                176MiB |
|    0      1336      G   xfwm4                                          2MiB |
+-----------------------------------------------------------------------------+

</code></pre>
<p>The tail end of the errors I get are below -</p>
<pre><code class="lang-auto">/home/user/Downloads/pytorch/c10/util/LeftRight.h:67:1: error: ‘typename std::result_of&lt;F(const T&amp;)&gt;::type c10::LeftRight&lt;T&gt;::read(F&amp;&amp;) const [with F = c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = std::tuple&lt;at::Tensor, at::Tensor&gt;; Args = {const at::Tensor&amp;, const at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, std::array&lt;bool, 2&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;; T = ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;; typename std::result_of&lt;F(const T&amp;)&gt;::type = std::tuple&lt;at::Tensor, at::Tensor&gt;]’, declared using local type ‘c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = std::tuple&lt;at::Tensor, at::Tensor&gt;; Args = {const at::Tensor&amp;, const at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, std::array&lt;bool, 2&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;’, is used but never defined [-fpermissive]
/home/user/Downloads/pytorch/c10/util/LeftRight.h:67:1: error: ‘typename std::result_of&lt;F(const T&amp;)&gt;::type c10::LeftRight&lt;T&gt;::read(F&amp;&amp;) const [with F = c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = std::tuple&lt;at::Tensor, at::Tensor, at::Tensor&gt;; Args = {const at::Tensor&amp;, const at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, std::array&lt;bool, 3&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;; T = ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;; typename std::result_of&lt;F(const T&amp;)&gt;::type = std::tuple&lt;at::Tensor, at::Tensor, at::Tensor&gt;]’, declared using local type ‘c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = std::tuple&lt;at::Tensor, at::Tensor, at::Tensor&gt;; Args = {const at::Tensor&amp;, const at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, std::array&lt;bool, 3&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;’, is used but never defined [-fpermissive]
/home/user/Downloads/pytorch/c10/util/LeftRight.h:67:1: error: ‘typename std::result_of&lt;F(const T&amp;)&gt;::type c10::LeftRight&lt;T&gt;::read(F&amp;&amp;) const [with F = c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor&amp;; Args = {at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;; T = ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;; typename std::result_of&lt;F(const T&amp;)&gt;::type = at::Tensor&amp;]’, declared using local type ‘c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor&amp;; Args = {at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;’, is used but never defined [-fpermissive]
/home/user/Downloads/pytorch/c10/util/LeftRight.h:67:1: error: ‘typename std::result_of&lt;F(const T&amp;)&gt;::type c10::LeftRight&lt;T&gt;::read(F&amp;&amp;) const [with F = c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor; Args = {const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;; T = ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;; typename std::result_of&lt;F(const T&amp;)&gt;::type = at::Tensor]’, declared using local type ‘c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor; Args = {const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;’, is used but never defined [-fpermissive]
/home/user/Downloads/pytorch/c10/util/LeftRight.h:67:1: error: ‘typename std::result_of&lt;F(const T&amp;)&gt;::type c10::LeftRight&lt;T&gt;::read(F&amp;&amp;) const [with F = c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor&amp;; Args = {at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;; T = ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;; typename std::result_of&lt;F(const T&amp;)&gt;::type = at::Tensor&amp;]’, declared using local type ‘c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor&amp;; Args = {at::Tensor&amp;, const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;’, is used but never defined [-fpermissive]
/home/user/Downloads/pytorch/c10/util/LeftRight.h:67:1: error: ‘typename std::result_of&lt;F(const T&amp;)&gt;::type c10::LeftRight&lt;T&gt;::read(F&amp;&amp;) const [with F = c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor; Args = {const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;; T = ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;; typename std::result_of&lt;F(const T&amp;)&gt;::type = at::Tensor]’, declared using local type ‘c10::Dispatcher::doCallUnboxedOnly(const c10::DispatchTable&amp;, const c10::LeftRight&lt;ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt; &gt;&amp;, Args ...) const [with Return = at::Tensor; Args = {const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;}]::&lt;lambda(const ska::flat_hash_map&lt;c10::TensorTypeId, c10::KernelFunction&gt;&amp;)&gt;’, is used but never defined [-fpermissive]
CMake Error at torch_generated_LogSigmoid.cu.o.Release.cmake:281 (message):
  Error generating file
  /home/user/Downloads/pytorch/build/caffe2/CMakeFiles/torch.dir/__/aten/src/THCUNN/./torch_generated_LogSigmoid.cu.o


ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 755, in &lt;module&gt;
    build_deps()
  File "setup.py", line 311, in build_deps
    build_caffe2(version=version,
  File "/home/user/Downloads/pytorch/tools/build_pytorch_libs.py", line 62, in build_caffe2
    cmake.build(my_env)
  File "/home/user/Downloads/pytorch/tools/setup_helpers/cmake.py", line 335, in build
    self.run(build_args, my_env)
  File "/home/user/Downloads/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '16']' returned non-zero exit status 1.
</code></pre>
<p>I get similar errors when I build PyTorch v1.3.0 or v1.2.0 (using git checkout)</p>
<p>I also tried building with</p>
<pre><code class="lang-auto">NO_DISTRIBUTED=1 python setup.py install
</code></pre>
<p>But that gives me the same errors.</p>
<p>If the error are arising from building Caffe2 (I’m assuming that is the issue), is it possible to build PyTorch without building Caffe2?</p>

username: ptrblck
cooked: <p>Could you try to uninstall all <code>torch</code> packages, clean the build (<code>python setup.py clean</code>) and retry the installation?<br>
Also, based on <a href="https://docs.nvidia.com/deploy/cuda-compatibility/index.html#binary-compatibility">this table</a>, you might need driver <code>&gt;= 418.39</code> for CUDA10.1.</p>

username: Avisek
cooked: <p>Yes between install attempts, I did check that all torch packages were uninstalled, as well as ran <code>python setup.py clean</code> between install attempts. I get this error nevertheless.</p>
<p>My driver version is <code>418.113</code>, so that should be good for the <code>&gt;= 418.39</code> requirement?</p>

username: ptrblck
cooked: <p>Yeah, you are right. The driver should be alright.<br>
Could you check <a href="https://github.com/pytorch/pytorch/issues/32277">this issue</a> as it seems to be related and has two commits, which should fix this issue?</p>

username: Avisek
cooked: <p>I think you’re right, it seems related to my issue.</p>
<p>Installing the Arch package (currently v1.4.0-4) works perfectly. It also runs fine on Cuda 10.2, but it runs on the processor, not on the GPU. So I’m trying to figure out how to build it on Cuda 10.1, which my GPU driver should support.</p>
<p>I’m also not sure why the Arch package installs fine, but building from the latest commit from source fails.</p>