Version 1.1.0 build from sources compilation errors on NVIDIA Jetson TX2

username: OronG13
cooked: <p>Hello,<br>
I wanted to work with version PyTorch v1.1.0 and Torchvision 0.3.0.<br>
I have a Jetson TX2 with an old JetPack which includes:</p>
<ul>
<li>CUDA 8.x</li>
<li>No CuDNN</li>
<li>OpenCV 3.4.1</li>
<li>Python 3.5.2</li>
<li>gcc\g++ 5.4</li>
<li>Cmake 3.5.1</li>
</ul>
<p><strong>And I have no ability to upgrade the JetPack or to use another PyTorch version.</strong></p>
<p><strong>These are the script lines which I’m using to build the version</strong>:<br>
PYTORCH_COMMIT_ID=“0b868b1”</p>
<p>git clone <a href="https://github.com/pytorch/pytorch.git" rel="nofollow noopener">https://github.com/pytorch/pytorch.git</a> &amp;&amp;<br>
cd pytorch &amp;&amp; git checkout ${PYTORCH_COMMIT_ID} &amp;&amp; <br>
git submodule update --init --recursive  &amp;&amp;<br>
pip3 install pyyaml==3.13 &amp;&amp;<br>
pip3 install -r requirements.txt &amp;&amp;<br>
USE_OPENCV=1 <br>
BUILD_TORCH=ON <br>
CMAKE_PREFIX_PATH="/usr/bin/" <br>
LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/lib:$LD_LIBRARY_PATH <br>
CUDA_BIN_PATH=/usr/local/cuda/bin <br>
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ <br>
CUDNN_LIB_DIR=/usr/local/cuda/lib64 <br>
CUDA_HOST_COMPILER=cc <br>
USE_CUDA=1 <br>
USE_NCCL=0 <br>
USE_NNPACK=1 <br>
CC=cc <br>
CXX=c++ <br>
TORCH_CUDA_ARCH_LIST=“3.5 5.2 6.0 6.1 6.2+PTX” <br>
TORCH_NVCC_FLAGS="-Xfatbin -compress-all" <br>
python3 setup.py install</p>
<p><strong>After ~70% of the build process is successfully done I’m getting a batch of errors, for example:</strong><br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h:9:8: error: decltype cannot resolve address of overloaded function<br>
struct function_traits : public function_traits&lt;decltype(&amp;T::operator())&gt; {<br>
^<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h: In instantiation of ‘struct binary_function_traits&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;’:<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh:176:70:   required from ‘void at::native::gpu_binary_kernel(at::TensorIterator&amp;, const func_t&amp;) [with func_t = __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;]’<br>
/tmp/tmpxft_00003152_00000000-4_BinaryOpsKernel.compute_62.cudafe1.stub.c:7:666:   required from here<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h:62:63: error: no type named ‘result_type’ in ‘struct function_traits&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h:63:70: error: no class template named ‘arg’ in ‘struct function_traits&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h:64:70: error: no class template named ‘arg’ in ‘struct function_traits&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh: In instantiation of ‘void at::native::gpu_binary_kernel(at::TensorIterator&amp;, const func_t&amp;) [with func_t = __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;]’:<br>
/tmp/tmpxft_00003152_00000000-4_BinaryOpsKernel.compute_62.cudafe1.stub.c:7:666:   required from here<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh:185:93: error: no matching function for call to ‘at::TensorIterator::scalar_value(int)’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/TensorIterator.h:203:1: note: candidate: template T at::TensorIterator::scalar_value(int)<br>
T scalar_value(int arg) {<br>
^<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/TensorIterator.h:203:1: note:   template argument deduction/substitution failed:<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh:187:284: error: could not convert ‘()’ from ‘’ to ‘const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh:191:93: error: no matching function for call to ‘at::TensorIterator::scalar_value(int)’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/TensorIterator.h:203:1: note: candidate: template T at::TensorIterator::scalar_value(int)<br>
T scalar_value(int arg) {<br>
^<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/TensorIterator.h:203:1: note:   template argument deduction/substitution failed:<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh:193:284: error: could not convert ‘()’ from ‘’ to ‘const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h: In instantiation of ‘struct function_traits&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;&amp;), at::native::gpu_binary_kernel&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;, 1u&gt;, unsigned char(unsigned char), const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;, unsigned char&gt; &gt;’:<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/detail/FunctionTraits.h:55:63:   required from ‘struct unary_function_traits&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;&amp;), at::native::gpu_binary_kernel&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;, 1u&gt;, unsigned char(unsigned char), const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;, unsigned char&gt; &gt;’<br>
/home/ubuntu/Oron/pytorch/aten/src/ATen/native/cuda/Loops.cuh:127:69:   required from ‘void at::native::gpu_unary_kernel(at::TensorIterator&amp;, const func_t&amp;) [with func_t = __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;&amp;), at::native::gpu_binary_kernel&lt;__nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (<em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt; &gt;, 1u&gt;, unsigned char(unsigned char), const __nv_hdl_wrapper_t&lt;__nv_dl_tag&lt;void (</em>)(at::TensorIterator&amp;, c10::Scalar), at::native::add_kernel_impl, 1u&gt;, unsigned char(unsigned char, unsigned char), unsigned char&gt;, unsigned char&gt;]’</p>
<p>Any help will be much appreciated.<br>
Thanks</p>

username: glaringlee
cooked: <p><a class="mention" href="/u/orong13">@OronG13</a><br>
Is that possible for you install a newer version CUDA.</p>
<p>Check here if you want to install old version without compile, for pytorch 1.1, we have support for cuda 9.0 and above, so I guess, your problem is caused by nvcc in cuda8 under gcc5.4.<br>
‘<a href="https://pytorch.org/get-started/previous-versions/" rel="nofollow noopener">https://pytorch.org/get-started/previous-versions/</a>’</p>

username: OronG13
cooked: <p>Hello,</p>
<p>I wanted to update that I successfully upgraded the CUDA version to 9.0.252 (JetPack 3.2.1) as your recommendation and now the PyTorch build from source process was successfully completed.</p>
<p>Thanks,</p>