关于为libtorch建造柯南包的问题

发布于 2025-01-28 09:45:54 字数 847 浏览 4 评论 0原文

我尝试在Ubuntu 18.04中为Libtorch构建一个Conan包,环境是: NVIDIA-SMI 460.32.03驱动程序版本:460.32.03 CUDA版本:11.2 GEFORCE RTX 2080

TEST_PACKAGE.CPP:

#include <torch/cuda.h>
#include <iostream>

int main(void) {
  std::cout << "CUDA DEVICE COUNT: " << torch::cuda::device_count() << std::endl;
  if (torch::cuda::is_available()) {
    std::cout << "CUDA is available! Training on GPU." << std::endl;
  }
  return 0;
}

当我测试Libtorch 1.10.2+Cu102时,它返回

libtorch/1.10.2+cu102 (test package): Running test()
CUDA DEVICE COUNT: 1
CUDA is available! Training on GPU.

,但是当我测试Libtorch 1.9.0+Cu102(或Libtorch)时(或Libtorch 1.9)。 1+Cu102),它返回:

libtorch/1.9.1+cu102 (test package): Running test()
CUDA DEVICE COUNT: 0

这是如何发生的?我不知道为什么。

I try to build a conan package for libtorch in ubuntu 18.04, Environment is:
NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 GeForce RTX 2080

test_package.cpp:

#include <torch/cuda.h>
#include <iostream>

int main(void) {
  std::cout << "CUDA DEVICE COUNT: " << torch::cuda::device_count() << std::endl;
  if (torch::cuda::is_available()) {
    std::cout << "CUDA is available! Training on GPU." << std::endl;
  }
  return 0;
}

When I test libtorch 1.10.2+cu102, it returns

libtorch/1.10.2+cu102 (test package): Running test()
CUDA DEVICE COUNT: 1
CUDA is available! Training on GPU.

But when I test libtorch 1.9.0+cu102(or libtorch 1.9.1+cu102), it returns:

libtorch/1.9.1+cu102 (test package): Running test()
CUDA DEVICE COUNT: 0

how does this happen? I can’t figure out why.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文