Installing PyTorch with CUDA support on NVidia Jetson TK1

username: nrsyed
cooked: <p>Based on what I’ve tried (discussed in <a href="https://devtalk.nvidia.com/default/topic/1020228/jetson-tk1/install-pytorch-on-jetson-tk1/post/5369887/#5369887" rel="noopener nofollow ugc">this post</a> and <a href="https://devtalk.nvidia.com/default/topic/1020228/jetson-tk1/install-pytorch-on-jetson-tk1/post/5369932/#5369932" rel="noopener nofollow ugc">this post</a> over on the NVidia devtalk forums), I’m pretty sure it’s not possible, and I’ve successfully managed to build PyTorch v0.3.1 <em>without</em> CUDA support, but was wondering if anyone here could offer insight on whether PyTorch <em>with</em> CUDA support can be built on the NVidia Jetson TK1.</p>
<p>Jetson TK1 environment:</p>
<ul>
<li>Ubuntu 14.04</li>
<li>armv7l architecture (32-bit ARM)</li>
<li>CUDA 6.5 (this is the maximum CUDA version supported on the TK1)</li>
</ul>
<p>Here’s what I’ve tried. First, I set the following environment variables:</p>
<ul>
<li><code>PATH=/usr/local/cuda/bin:$PATH</code></li>
<li><code>NO_MKLDNN=1</code> (since MKL-DNN is incompatible with 32-bit)</li>
<li><code>USE_NCCL=0</code></li>
<li><code>NO_DISTRIBUTED=1</code></li>
<li><code>TORCH_CUDA_ARCH_LIST=3.5</code></li>
</ul>
<p>I found that PyTorch &gt; 0.3.1 requires libnvrtc which is only part of CUDA &gt;= 7.0, so attempted to build PyTorch 0.3.1, but encountered the following error:</p>
<blockquote>
<p>/tmp/tmp.i6b4rGpeXt/pytorch/torch/lib/THC/THCBlas.cu(495):<br>
error: identifier “cublasSgetrsBatched” is undefined</p>
<p>/tmp/tmp.i6b4rGpeXt/pytorch/torch/lib/THC/THCBlas.cu(512):<br>
error: identifier “cublasDgetrsBatched” is undefined</p>
</blockquote>
<p>Turns out that the cuBLAS functions <code>cublas&lt;T&gt;getrsBatched</code> were introduced in CUDA 7.0 based on the CUDA 7.0 release notes. Did some digging and found that the earliest version of PyTorch that didn’t reference these functions was v0.1.10. However, attempting to build PyTorch v0.1.10 resulted in the following CMake error stating that CUDA &gt;= 7.0 is required:</p>
<blockquote>
<p>[100%] Built target THCUNN<br>
Install the project…<br>
– Install configuration: “Release”<br>
– Installing: /tmp/tmp.CmqAOpt6SC/pytorch/torch/lib/tmp_install/lib/libTHCUNN.so.1<br>
– Installing: /tmp/tmp.CmqAOpt6SC/pytorch/torch/lib/tmp_install/lib/libTHCUNN.so<br>
– Set runtime path of “/tmp/tmp.CmqAOpt6SC/pytorch/torch/lib/tmp_install/lib/libTHCUNN.so.1” to “”<br>
– Installing: /tmp/tmp.CmqAOpt6SC/pytorch/torch/lib/tmp_install/include/THCUNN/THCUNN.h<br>
– Installing: /tmp/tmp.CmqAOpt6SC/pytorch/torch/lib/tmp_install/include/THCUNN/generic/THCUNN.h<br>
– The C compiler identification is GNU 4.8.4<br>
– The CXX compiler identification is GNU 4.8.4<br>
– Check for working C compiler: /usr/bin/cc<br>
– Check for working C compiler: /usr/bin/cc – works<br>
– Detecting C compiler ABI info<br>
– Detecting C compiler ABI info - done<br>
– Detecting C compile features<br>
– Detecting C compile features - done<br>
– Check for working CXX compiler: /usr/bin/c++<br>
– Check for working CXX compiler: /usr/bin/c++ – works<br>
– Detecting CXX compiler ABI info<br>
– Detecting CXX compiler ABI info - done<br>
– Detecting CXX compile features<br>
– Detecting CXX compile features - done<br>
CMake Error at /usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):<br>
Could NOT find CUDA: Found unsuitable version “6.5”, but required is at<br>
least “7.0” (found /usr/local/cuda)<br>
Call Stack (most recent call first):<br>
/usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)<br>
/tmp/tmp.CmqAOpt6SC/pytorch/cmake/FindCUDA/FindCUDA.cmake:1013 (find_package_handle_standard_args)<br>
CMakeLists.txt:5 (FIND_PACKAGE)</p>
</blockquote>
<p>Even the first tagged release of PyTorch (v0.1.1) seems to mention CUDA 7.0 in the CMake file <code>pytorch/cmake/FindCUDA/FindCUDA.cmake</code>, which leads me to think it’s impossible to build PyTorch with CUDA 6.5 support on the Jetson TK1.</p>
<p>Am I correct or have I missed something?</p>