<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<p dir="auto">The sample C++ program for libtorch results in an incorrect Makefile because the path to libculibos.a is hardcoded somewhere as <code class="notranslate">/usr/local/cuda/lib64/libculibos.a</code>.<br>
On Arch Linux, the default install directory for CUDA is <code class="notranslate">/opt/cuda</code>.<br>
<strong>This is handled correctly for other linked libraries.</strong></p>
<h2 dir="auto">Workaround</h2>
<p dir="auto">After running CMake, modify <code class="notranslate">CMakeFiles/(project).dir/build.make</code> and modify the line:<br>
(project): /usr/local/cuda/lib64/libculibos.a<br>
to:<br>
(project): /opt/cuda/lib64/libculibos.a</p>
<p dir="auto">This fixes the problem for me with CUDA 10.</p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<ol dir="auto">
<li>Be on Arch Linux with libtorch downloaded from the official download link.</li>
<li>Try to follow the [minimal C++ example]: <a href="https://pytorch.org/cppdocs/installing.html" rel="nofollow">https://pytorch.org/cppdocs/installing.html</a></li>
<li>You will get an error when running <code class="notranslate">make</code>, which can be fixed with the temporary workaround shown above.</li>
</ol>
<p dir="auto">hi all<br>
Follow the tutorial(Loading a PyTorch Model in C++)<br>
1.cmake<br>
-- Caffe2: CUDA detected: 10.0<br>
-- Caffe2: CUDA nvcc is: /usr/local/cuda-10.0/bin/nvcc<br>
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-10.0<br>
-- Caffe2: Header version is: 10.0<br>
-- Found cuDNN: v7.4.2  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)<br>
-- Automatic GPU detection failed. Building for common architectures.<br>
-- Autodetected CUDA architecture(s): 3.0;3.5;5.0;5.2;6.0;6.1;7.0;7.0+PTX<br>
-- Added CUDA NVCC flags for: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_70,code=compute_70<br>
-- Configuring done<br>
-- Generating done<br>
2. make<br>
make[2]: *** No rule to make target '/usr/local/cuda/lib64/libculibos.a', needed by 'example-app'.  Stop.<br>
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/example-app.dir/all' failed<br>
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2<br>
Makefile:83: recipe for target 'all' failed<br>
make: *** [all] Error 2</p>
<p dir="auto">please ....</p>