Error: "PyTorch is not linked with support for cuda devices"

tgo: <p>Hey everyone,</p>
<p>I’ve recently updated from Libtorch 1.2 to Libtorch 1.7. However, when trying to load JIT traced models I get an error exactly at the <code>torch::jit::load</code> command.</p>
<p>The first error I get is the following one</p>
<pre><code class="lang-auto">Could not run 'aten::empty_strided' with arguments from the 'CUDA' backend. 'aten::empty_strided' is only available for these backends: [CPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].

CPU: registered at aten/src/ATen/CPUType.cpp:2127 [kernel]
BackendSelect: registered at aten/src/ATen/BackendSelectRegister.cpp:761 [kernel]
Named: registered at ../aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
AutogradOther: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
AutogradCPU: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
AutogradCUDA: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
AutogradXLA: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
AutogradPrivateUse1: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
AutogradPrivateUse2: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
AutogradPrivateUse3: registered at ../torch/csrc/autograd/generated/VariableType_0.cpp:7974 [autograd kernel]
Tracer: registered at ../torch/csrc/autograd/generated/TraceType_0.cpp:9341 [kernel]
Autocast: fallthrough registered at ../aten/src/ATen/autocast_mode.cpp:254 [backend fallback]
Batched: registered at ../aten/src/ATen/BatchingRegistrations.cpp:511 [backend fallback]
VmapMode: fallthrough registered at ../aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]

Exception raised from reportError at ../aten/src/ATen/core/dispatch/OperatorEntry.cpp:363 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;) + 0x69 (0x7f326e325b89 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libc10.so)
frame #1: c10::impl::OperatorEntry::reportError(c10::DispatchKey) const + 0x3ac (0x7f326f5d223c in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #2: &lt;unknown function&gt; + 0x1328706 (0x7f326fd21706 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #3: &lt;unknown function&gt; + 0x130196e (0x7f326fcfa96e in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #4: &lt;unknown function&gt; + 0x1307026 (0x7f326fd00026 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #5: &lt;unknown function&gt; + 0x1328650 (0x7f326fd21650 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #6: at::empty_strided(c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::TensorOptions const&amp;) + 0x295 (0x7f326fe00e35 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #7: &lt;unknown function&gt; + 0x2968546 (0x7f3271361546 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #8: &lt;unknown function&gt; + 0x1307026 (0x7f326fd00026 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #9: &lt;unknown function&gt; + 0x1328650 (0x7f326fd21650 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #10: &lt;unknown function&gt; + 0x130196e (0x7f326fcfa96e in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #11: &lt;unknown function&gt; + 0x1307026 (0x7f326fd00026 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #12: &lt;unknown function&gt; + 0x1328650 (0x7f326fd21650 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #13: at::empty_strided(c10::ArrayRef&lt;long&gt;, c10::ArrayRef&lt;long&gt;, c10::TensorOptions const&amp;) + 0x295 (0x7f326fe00e35 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #14: at::native::to(at::Tensor const&amp;, c10::Device, c10::ScalarType, bool, bool, c10::optional&lt;c10::MemoryFormat&gt;) + 0x49f (0x7f326f9e664f in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #15: &lt;unknown function&gt; + 0x158d1c1 (0x7f326ff861c1 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #16: &lt;unknown function&gt; + 0xaf1eaa (0x7f326f4eaeaa in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #17: &lt;unknown function&gt; + 0x1692131 (0x7f327008b131 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #18: at::Tensor::to(c10::Device, c10::ScalarType, bool, bool, c10::optional&lt;c10::MemoryFormat&gt;) const + 0x108 (0x7f32700686c8 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #19: torch::jit::Unpickler::readInstruction() + 0x2331 (0x7f3271b313a1 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #20: torch::jit::Unpickler::run() + 0xb0 (0x7f3271b32440 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #21: torch::jit::Unpickler::parse_ivalue() + 0x31 (0x7f3271b329f1 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #22: torch::jit::readArchiveAndTensors(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, c10::optional&lt;std::function&lt;c10::StrongTypePtr (c10::QualifiedName const&amp;)&gt; &gt;, c10::optional&lt;std::function&lt;c10::intrusive_ptr&lt;c10::ivalue::Object, c10::detail::intrusive_target_default_null_type&lt;c10::ivalue::Object&gt; &gt; (c10::StrongTypePtr, c10::IValue)&gt; &gt;, c10::optional&lt;c10::Device&gt;, caffe2::serialize::PyTorchStreamReader&amp;) + 0x6b2 (0x7f3271ad68c2 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #23: &lt;unknown function&gt; + 0x30ddbdd (0x7f3271ad6bdd in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #24: &lt;unknown function&gt; + 0x30e01b1 (0x7f3271ad91b1 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #25: torch::jit::load(std::unique_ptr&lt;caffe2::serialize::ReadAdapterInterface, std::default_delete&lt;caffe2::serialize::ReadAdapterInterface&gt; &gt;, c10::optional&lt;c10::Device&gt;, std::unordered_map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::hash&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::equal_to&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;&amp;) + 0x179 (0x7f3271ad9ad9 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #26: torch::jit::load(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, c10::optional&lt;c10::Device&gt;, std::unordered_map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::hash&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::equal_to&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;&amp;) + 0x75 (0x7f3271adc435 in /home/user/libtorch_1.7_gcc7_cuda_11.0_x86_64/libtorch_1.7_gcc7_cuda_11.0_x86_64/lib/libtorch_cpu.so)
frame #27: OpenPoseActionRecognition::setModel(QString) + 0x24e (0x7f327f7f0212 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_debug_gcc_x86_qt5.9.so)
frame #28: &lt;unknown function&gt; + 0x108f87 (0x7f327f837f87 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_debug_gcc_x86_qt5.9.so)
frame #29: QMetaObject::activate(QObject*, int, int, void**) + 0x659 (0x7f32ab5d33c9 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #30: OpenPoseActionRecognition::filenameSet(QString) + 0x56 (0x7f327f8381d0 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_debug_gcc_x86_qt5.9.so)
frame #31: OpenPoseActionRecognition::openFileDialog() + 0x178 (0x7f327f7efef0 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_debug_gcc_x86_qt5.9.so)
frame #32: &lt;unknown function&gt; + 0x108eb8 (0x7f327f837eb8 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_debug_gcc_x86_qt5.9.so)
frame #33: QMetaObject::activate(QObject*, int, int, void**) + 0x659 (0x7f32ab5d33c9 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #34: QAbstractButton::clicked(bool) + 0x32 (0x7f32aca2ea72 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #35: &lt;unknown function&gt; + 0x245c74 (0x7f32aca2ec74 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #36: &lt;unknown function&gt; + 0x24780e (0x7f32aca3080e in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #37: QAbstractButton::mouseReleaseEvent(QMouseEvent*) + 0xd5 (0x7f32aca30965 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #38: QWidget::event(QEvent*) + 0x1f8 (0x7f32ac978c38 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #39: QApplicationPrivate::notify_helper(QObject*, QEvent*) + 0x9c (0x7f32ac93c7ec in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #40: QApplication::notify(QObject*, QEvent*) + 0xc03 (0x7f32ac9445f3 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #41: QCoreApplication::notifyInternal2(QObject*, QEvent*) + 0x108 (0x7f32ab5a8de8 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #42: QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer&lt;QWidget&gt;&amp;, bool) + 0x1df (0x7f32ac94325f in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #43: &lt;unknown function&gt; + 0x1a9616 (0x7f32ac992616 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #44: &lt;unknown function&gt; + 0x1abf6b (0x7f32ac994f6b in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #45: QApplicationPrivate::notify_helper(QObject*, QEvent*) + 0x9c (0x7f32ac93c7ec in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #46: QApplication::notify(QObject*, QEvent*) + 0x227 (0x7f32ac943c17 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Widgets.so.5)
frame #47: QCoreApplication::notifyInternal2(QObject*, QEvent*) + 0x108 (0x7f32ab5a8de8 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #48: QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 0x370 (0x7f32ac166cf0 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Gui.so.5)
frame #49: QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) + 0x105 (0x7f32ac168ac5 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Gui.so.5)
frame #50: QWindowSystemInterface::sendWindowSystemEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) + 0xbb (0x7f32ac1435bb in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Gui.so.5)
frame #51: &lt;unknown function&gt; + 0xaef20 (0x7f32a56f7f20 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5XcbQpa.so.5)
frame #52: g_main_context_dispatch + 0x2e7 (0x7f32a71fb417 in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0)
frame #53: &lt;unknown function&gt; + 0x4c650 (0x7f32a71fb650 in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0)
frame #54: g_main_context_iteration + 0x2c (0x7f32a71fb6dc in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0)
frame #55: QEventDispatcherGlib::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) + 0x5f (0x7f32ab5fb6af in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #56: QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) + 0xea (0x7f32ab5a73da in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #57: QCoreApplication::exec() + 0x84 (0x7f32ab5afcb4 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #58: &lt;unknown function&gt; + 0x33e58 (0x556627cb8e58 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer_debug)
frame #59: __libc_start_main + 0xe7 (0x7f32aa3f1bf7 in /lib/x86_64-linux-gnu/libc.so.6)
frame #60: &lt;unknown function&gt; + 0x2e51a (0x556627cb351a in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer_debug)
</code></pre>
<p>I then checked my artifact using <code>ldd</code> and as I saw only <code>torch_cpu.so</code> is linked. As far as I could find out during my research, this is expected behavior. However, I do want to run my model using the GPU.</p>
<p>Next I found the following command <code>-INCLUDE:?warp_size@cuda@at@@YAHXZ</code> in order to force the linker to link my file against <code>torch_cuda.so</code>. The log shows, that this command is added, however ldd still doesn’t show <code>torch_cuda.so</code>. And when I try to add a gpu device to my loaded model, I get the following error:</p>
<pre><code class="lang-auto">PyTorch is not linked with support for cuda devices
Exception raised from getDeviceGuardImpl at ../c10/core/impl/DeviceGuardImplInterface.h:216 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;) + 0x69 (0x7f162f5c9b89 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libc10.so)
frame #1: at::native::to(at::Tensor const&amp;, c10::Device, c10::ScalarType, bool, bool, c10::optional&lt;c10::MemoryFormat&gt;) + 0xd54 (0x7f161f830f04 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #2: &lt;unknown function&gt; + 0x158d1c1 (0x7f161fdd01c1 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #3: &lt;unknown function&gt; + 0xaf1eaa (0x7f161f334eaa in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #4: &lt;unknown function&gt; + 0x1692131 (0x7f161fed5131 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #5: at::Tensor::to(c10::Device, c10::ScalarType, bool, bool, c10::optional&lt;c10::MemoryFormat&gt;) const + 0x108 (0x7f161feb26c8 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #6: &lt;unknown function&gt; + 0x32f5c32 (0x7f1621b38c32 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #7: &lt;unknown function&gt; + 0x32f78f4 (0x7f1621b3a8f4 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #8: &lt;unknown function&gt; + 0x30e0131 (0x7f1621923131 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #9: torch::jit::load(std::unique_ptr&lt;caffe2::serialize::ReadAdapterInterface, std::default_delete&lt;caffe2::serialize::ReadAdapterInterface&gt; &gt;, c10::optional&lt;c10::Device&gt;, std::unordered_map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::hash&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::equal_to&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;&amp;) + 0x179 (0x7f1621923ad9 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #10: torch::jit::load(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, c10::optional&lt;c10::Device&gt;, std::unordered_map&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::hash&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::equal_to&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt; &gt;&amp;) + 0x75 (0x7f1621926435 in /home/user/libtorch_1.7_gcc7_cuda_10.2_x86_64/libtorch_1.7_gcc7_cuda_10.2_x86_64/lib/libtorch_cpu.so)
frame #11: OpenPoseActionRecognition::setModel(QString) + 0x1d8 (0x7f162f839898 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_gcc_x86_qt5.9.so)
frame #12: OpenPoseActionRecognition::work(paco::Container&amp;) + 0x13b (0x7f162f839f2b in /home/user/DevEnviro-3.2.0/DevEnviroViewer/plugins/libOpenPoseActionRecognition_gcc_x86_qt5.9.so)
frame #13: &lt;unknown function&gt; + 0xb4d86 (0x55ab18809d86 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #14: &lt;unknown function&gt; + 0xa386e (0x55ab187f886e in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #15: &lt;unknown function&gt; + 0x7fee5 (0x55ab187d4ee5 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #16: &lt;unknown function&gt; + 0x8054f (0x55ab187d554f in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #17: &lt;unknown function&gt; + 0x83a48 (0x55ab187d8a48 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #18: &lt;unknown function&gt; + 0xf8756 (0x55ab1884d756 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #19: QMetaObject::activate(QObject*, int, int, void**) + 0x659 (0x7f165b5923c9 in /home/user/Qt5.9.5/5.9.5/gcc_64/lib/libQt5Core.so.5)
frame #20: &lt;unknown function&gt; + 0xf20b5 (0x55ab188470b5 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #21: &lt;unknown function&gt; + 0x35389 (0x55ab1878a389 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #22: &lt;unknown function&gt; + 0x776e6 (0x55ab187cc6e6 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #23: &lt;unknown function&gt; + 0x899e4 (0x55ab187de9e4 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #24: &lt;unknown function&gt; + 0x8b11f (0x55ab187e011f in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #25: &lt;unknown function&gt; + 0x8caf5 (0x55ab187e1af5 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #26: &lt;unknown function&gt; + 0x8cc5a (0x55ab187e1c5a in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #27: &lt;unknown function&gt; + 0x2e1e6 (0x55ab187831e6 in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
frame #28: __libc_start_main + 0xe7 (0x7f165a3b0bf7 in /lib/x86_64-linux-gnu/libc.so.6)
frame #29: &lt;unknown function&gt; + 0x3000a (0x55ab1878500a in /home/user/DevEnviro-3.2.0/DevEnviroViewer/DevEnviroViewer)
</code></pre>
<p>Here are some information:<br>
Ubuntu 18.04<br>
Nvidia 1080 Ti<br>
Libtorch 1.7 with CUDA 11.0 (same behavior with CUDA 10.2)<br>
Nvidia driver version: 450.80.02<br>
CUDA version: 11.0</p>
<p>I’m struggeling with this over 2-3 weeks and googled a lot and tried out many “solutions” without any success.</p>
<p>I would be very glad if somebody could help me. Maybe it’s super easy and I’m just “blind”.</p>

tgo: <p>I’ve found an alternative solution by forcing the linker to link libtorch_cuda.so to my artifact. However, this is more of a hack and I would still appreciate if someone knows a more elegant way to fix this.</p>
<p>My solution was to add <code>-Wl,--no-as-needed ltorch_cuda -Wl, --as-needed</code> to the linker.</p>