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"