SeanWangJS / grid-sample3d-trt-plugin

TensorRT plugin for 3-dimension grid sample operator
Apache License 2.0
17 stars 3 forks source link

请问windows 下如何实现编译? #4

Open zhanghongyong123456 opened 1 month ago

zhanghongyong123456 commented 1 month ago

我使用cmake .. -DTensorRT_ROOT="I:\path to\TensorRT-8.6.1.6" -G "Visual Studio 17 2022" 得到:grid_sample_3d_plugin.sln 当在VS2022 编译时,出现这个错误: 请问该如何解决,谢谢 test.obj : error LNK2019: 无法解析的外部符号 "int cdecl grid_sample_3d_cuda(struct half const *,struct half const ,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int64,bool,enum GridSample3DInterpolationMode,enum GridSample3DPaddingMode,struct __half ,struct C Ustream_st *)" (??$grid_sample_3d_cuda@Uhalf@@@@YAHPEBUhalf@@0_K1111111_NW4GridSample3DInterpolationMode@@W4GridSam ple3DPaddingMode@@PEAU0@PEAUCUstream_st@@@Z),函数 "void cdecl testGridSample3dFloat16(void)" (?testGridSample3dFloat16@ @YAXXZ) 中引用了该符号 [D:\2023project\project\0win_os\06Generative\FasterLivePortrait\grid-sample3d-trt-plugin\build\test\tes t_grid_sample.vcxproj] test.obj : error LNK2019: 无法解析的外部符号 "int cdecl grid_sample_3d_cuda(float const ,float const ,unsigned int6 4,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int64,unsigned int6 4,bool,enum GridSample3DInterpolationMode,enum GridSample3DPaddingMode,float ,struct CUstream_st )" (??$grid_sample_3 d_cuda@M@@YAHPEBM0_K1111111_NW4GridSample3DInterpolationMode@@W4GridSample3DPaddingMode@@PEAMPEAUCUstream_st@@@Z),函数 "v oid cdecl testGridSample3dFloat32(void)" (?testGridSample3dFloat32@@YAXXZ) 中引用了该符号 [D:\2023project\project\0win_os\06 Generative\FasterLivePortrait\grid-sample3d-trt-plugin\build\test\test_grid_sample.vcxproj] D:\2023project\project\0win_os\06Generative\FasterLivePortrait\grid-sample3d-trt-plugin\build\test\Debug\test_grid_samp le.exe : fatal error LNK1120: 2 个无法解析的外部命令 [D:\2023project\project\0win_os\06Generative\FasterLivePortrait\grid-sample3 d-trt-plugin\build\test\test_grid_sample.vcxproj]

SeanWangJS commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

warmshao commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

可以生成dll,但是加载的时候报错:Could not find module 'grid_sample_3d_plugin.dll' (or one of its dependencies). Try using the full path with constructor syntax. e9aaaa35e2d1cb4bf5ec8b079dd1640

zhanghongyong123456 commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

可以生成dll,但是加载的时候报错:Could not find module 'grid_sample_3d_plugin.dll' (or one of its dependencies). Try using the full path with constructor syntax. e9aaaa35e2d1cb4bf5ec8b079dd1640

大佬,请问你能提供一下 编译环境工具,以及代码设置和 编译命令设置吗。谢谢

warmshao commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

可以生成dll,但是加载的时候报错:Could not find module 'grid_sample_3d_plugin.dll' (or one of its dependencies). Try using the full path with constructor syntax. e9aaaa35e2d1cb4bf5ec8b079dd1640

大佬,请问你能提供一下 编译环境工具,以及代码设置和 编译命令设置吗。谢谢

vs2022 cuda12.2 tensorrt10.0, 不编译test,其他没改

zhanghongyong123456 commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

可以生成dll,但是加载的时候报错:Could not find module 'grid_sample_3d_plugin.dll' (or one of its dependencies). Try using the full path with constructor syntax. e9aaaa35e2d1cb4bf5ec8b079dd1640

大佬,请问你能提供一下 编译环境工具,以及代码设置和 编译命令设置吗。谢谢

vs2022 cuda12.2 tensorrt10.0, 不编译test,其他没改

好的,我以为你解决了 test 编译问题,我觉得你这个错误 可能是 路径没有设置正确导致的,我第一次也这样,给了正确路径就OK了

warmshao commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

可以生成dll,但是加载的时候报错:Could not find module 'grid_sample_3d_plugin.dll' (or one of its dependencies). Try using the full path with constructor syntax. e9aaaa35e2d1cb4bf5ec8b079dd1640

大佬,请问你能提供一下 编译环境工具,以及代码设置和 编译命令设置吗。谢谢

vs2022 cuda12.2 tensorrt10.0, 不编译test,其他没改

好的,我以为你解决了 test 编译问题,我觉得你这个错误 可能是 路径没有设置正确导致的,我第一次也这样,给了正确路径就OK了

求教怎么设置正确路径呀?

zhanghongyong123456 commented 1 month ago

不好意思,我还没有解决windows平台的编译问题,看报错是test模块没有找到编译出来的lib,您可以先在CMakeLists.txt中把test编译关闭掉,然后检测其他编译错误。不过不建议在windows编译,tensorrt-8.6.1 不支持在 windows 平台的 python 程序:https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-861/install-guide/index.html#installing-pip

可以生成dll,但是加载的时候报错:Could not find module 'grid_sample_3d_plugin.dll' (or one of its dependencies). Try using the full path with constructor syntax. e9aaaa35e2d1cb4bf5ec8b079dd1640

大佬,请问你能提供一下 编译环境工具,以及代码设置和 编译命令设置吗。谢谢

vs2022 cuda12.2 tensorrt10.0, 不编译test,其他没改

好的,我以为你解决了 test 编译问题,我觉得你这个错误 可能是 路径没有设置正确导致的,我第一次也这样,给了正确路径就OK了

求教怎么设置正确路径呀?

我直接 将 grid_sample_3d_plugin.dll 文件复制到 checkpoints 内 修改两处 代码: scripts/onnx2trt.py src/models/predictor.py 替换:/opt/grid-sample3d-trt-plugin/build/libgrid_sample_3d_plugin.so 为 ./checkpoints/grid_sample_3d_plugin.dll ctypes.CDLL("/opt/grid-sample3d-trt-plugin/build/libgrid_sample_3d_plugin.so", mode=ctypes.RTLD_GLOBAL) 为: ctypes.CDLL("./checkpoints/grid_sample_3d_plugin.dll", mode=ctypes.RTLD_GLOBAL)