LIBTORCH 再配置总结
1: 下载对应的版本 ,目前版本已经到 2.9.0
2:编译时候需要 C++17 来支持
3: 选择配置对应的路径和设置 C++ langage confoemode NO
4: DEBUG 需要设置 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64
5: 增加一个文件在 F:\model_libtorch\lib_torch_debug\libtorch-win-shared-with-deps-debug-2.9.0+cpu\libtorch\include\c10\cuda\impl cuda_cmake_macros.h
代码为:
#pragma once
// Automatically generated header file for the C10 CUDA library. Do not
// include this file directly. Instead, include c10/cuda/CUDAMacros.h
#define C10_CUDA_BUILD_SHARED_LIBS;
6: 下载对应的 vcruntime140_1d.dll 到编译的EXE 文件夹啊就可以了 ;
7: 改写初始化代码为 ="";
8: 删除循环代码中的[debug] 不然编译会错误 ;
这样经过上面的步骤 就可以编译通,直接运行就可以了。
运行会提示找msvcp140d.amd64.pdb 错误,暂时无法解决;
9: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\include 路径加上;
1:用RELEASE库来配置debug ,MT MDT需要特殊配置下;
2: 降低libtorch的版本 ;低版本的不需要 C++17 ,只需要 C++14 就可以;用1.110版本编译通过
3:等微软官方解决此问题;
