pytorch c++ gpu部署

本文详细列出了不同版本的Libtorch(包括CPU和cu100/CU101/CU102/CU113/CU116/CU117/CU118)及其对应CUDA版本的Windows下载链接。还介绍了如何测试环境是否兼容并提供必要的设置步骤。
摘要由CSDN通过智能技术生成

Libtorch 各历史版本的收集,方便直接下载


Windows下:
Libtorch 1.0.0
cpu-release: https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.0.0.zip
 
cu100-release: https://download.pytorch.org/libtorch/cu100/libtorch-win-shared-with-deps-1.0.0.zip
 
1.0没有debug的版本,从1.1开始有
 
Libtorch 1.1.0
cpu-debug: https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.1.0.zip
 
cpu-release: https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.1.0.zip
 
cu100-debug: https://download.pytorch.org/libtorch/cu100/libtorch-win-shared-with-deps-debug-1.1.0.zip
 
cu100-release: https://download.pytorch.org/libtorch/cu100/libtorch-win-shared-with-deps-1.1.0.zip
 
Libtorch 1.1.0 —— 1.5.0:  
按照1.1.0的格式来,只需要修改最后的几个数字或对应的CUDA的版本
 
Libtorch 1.6.0
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.6.0%2Bcpu.zip
 
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.6.0%2Bcpu.zip
 
cu101-debug: https://download.pytorch.org/libtorch/cu101/libtorch-win-shared-with-deps-debug-1.6.0%2Bcu101.zip
 
cu101-release: https://download.pytorch.org/libtorch/cu101/libtorch-win-shared-with-deps-1.6.0%2Bcu101.zip
 
cu102-debug: https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-debug-1.6.0.zip
 
cu102-release: https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-1.6.0.zip
 
Libtorch 1.7.0
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.7.0%2Bcpu.zip
 
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.7.0%2Bcpu.zip
 
cu101-debug: https://download.pytorch.org/libtorch/cu101/libtorch-win-shared-with-deps-debug-1.7.0%2Bcu101.zip
 
cu101-release: https://download.pytorch.org/libtorch/cu101/libtorch-win-shared-with-deps-1.7.0%2Bcu101.zip
 
cu102-debug:https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-debug-1.7.0.zip
 
cu102-debug:https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-1.7.0.zip
 
Libtorch 1.8.0
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.8.0%2Bcpu.zip
 
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.8.0%2Bcpu.zip
 
cu102-debug: https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-debug-1.8.0.zip
 
cu102-release: https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-1.8.0.zip
 
Libtorch 1.9.0
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.9.0%2Bcpu.zip
 
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.9.0%2Bcpu.zip
 
cu102-debug:https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-debug-1.9.0%2Bcu102.zip
 
cu102-release:https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-1.9.0%2Bcu102.zip
 
libtorch 1.10.0
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.10.0%2Bcpu.zip
 
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.10.0%2Bcpu.zip
 
cu102-debug: https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-debug-1.10.0%2Bcu102.zip
 
cu102-release: https://download.pytorch.org/libtorch/cu102/libtorch-win-shared-with-deps-1.10.0%2Bcu102.zip
 
libtorch 1.11.0
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.11.0%2Bcpu.zip
 
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.11.0%2Bcpu.zip
 
cu113-debug: https://download.pytorch.org/libtorch/cu113/libtorch-win-shared-with-deps-debug-1.11.0%2Bcu113.zip
 
cu113-release: https://download.pytorch.org/libtorch/cu113/libtorch-win-shared-with-deps-1.11.0%2Bcu113.zip
 
libtorch 1.12.0
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.12.0%2Bcpu.zip
 
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.12.0%2Bcpu.zip
 
cu113-debug: https://download.pytorch.org/libtorch/cu113/libtorch-win-shared-with-deps-debug-1.12.0%2Bcu113.zip
 
cu113-release: https://download.pytorch.org/libtorch/cu113/libtorch-win-shared-with-deps-1.12.0%2Bcu113.zip
 
cu116-debug: https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-debug-1.12.0%2Bcu116.zip
 
cu116-release: https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-1.12.0%2Bcu116.zip
 
libtorch 1.13.0
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.13.0%2Bcpu.zip
 
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.13.0%2Bcpu.zip
 
cu116-debug: https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-debug-1.13.0%2Bcu116.zip
 
cu116-release: https://download.pytorch.org/libtorch/cu116/libtorch-win-shared-with-deps-1.13.0%2Bcu116.zip
 
cu117-debug: https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-debug-1.13.0%2Bcu117.zip
 
cu117-release: https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-1.13.0%2Bcu117.zip
 
libtorch 2.0.0 与 2.0.1 与 cu117-118  [改对应版本号]
cpu-release:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.0.1%2Bcpu.zip
 
cpu-debug:https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-2.0.1%2Bcpu.zip
 
cu117-118-release: https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-2.0.1%2Bcu117.zip
 
cu117-118-debug: https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-debug-2.0.1%2Bcu117.zip

下载显卡驱动

CUDA Toolkit 10.2 Download

CUDA Toolkit 10.2 Download | NVIDIA Developer
 
 或者

CUDA Toolkit Archive | NVIDIA Developer
 cuDNN下载链接
 cuDNN Archive | NVIDIA Developer
 

测试

头文件包含问题
 #include <torch/script.h>

#include <torch/torch.h>
 

void test_libtorch_version() {
    std::cout << "cuDNN : " << torch::cuda::cudnn_is_available() << std::endl;
    std::cout << "CUDA : " << torch::cuda::is_available() << std::endl;
    std::cout << "Device count : " << torch::cuda::device_count() << std::endl;
}

如果程序返回结果都为非0,那证明CUDA以及CUDNN都是可用的,自此环境已经搭建完成,但是也有可能返回结果为0证明CUDA以及CUDNN都不可用。需要进行如下设置,找到Linker->Command Line选项,在其中填入如下命令

/INCLUDE:"?ignore_this_library_placeholder@@YAHXZ" 

 
 
 
 
 
 
 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值