编译某个模型的工程化代码,模型里有多个算子使用了tensorrt plugin方式实现的,编译时总是报插件相关的目标文件找不到:
CMake Error at /opt/conda/share/cmake-3.22/Modules/FindCUDA/make2cmake.cmake:48 (file):
file failed to open for reading (No such file or directory):
/workspace/FOCC/build/CMakeFiles/bevdem.dir/src/bevdem_generated_preprocess_plugin.cu.o.NVCC-depend
CMake Error at bevdem_generated_preprocess_plugin.cu.o.DEBUG.cmake:237 (message):
Error generating
/workspace/FOCC/build/CMakeFiles/bevdem.dir/src/./bevdem_generated_preprocess_plugin.cu.o
-- Removing /workspace/FOCC/build/CMakeFiles/bevdem.dir/src/bevdem_generated_bevpool_plugin.cu.o.depend.tmp and /workspace/FOCC/build/CMakeFiles/bevdem.dir/src/bevdem_generated_bevpool_plugin.cu.o.NVCC-depend
make[2]: *** [CMakeFiles/export.dir/build.make:77: CMakeFiles/bevdem.dir/src/bevdem_generated_preprocess_plugin.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMake Error at /opt/conda/share/cmake-3.22/Modules/FindCUDA/make2cmake.cmake:48 (file):
file failed to open for reading (No such file or directory):
/workspace/FOCC/build/CMakeFiles/bevdem.dir/src/bevdem_generated_gatherbev_plugin.cu.o.NVCC-depend
-- Generating /workspace/FOCC/build/CMakeFiles/bevdem.dir/src/./bevdem_generated_preprocess_plugin.cu.o
CMake Error at bevdem_generated_gatherbev_plugin.cu.o.DEBUG.cmake:237 (message):
Error generating
/workspace/FOCC/build/CMakeFiles/bevdem.dir/src/./bevdem_generated_gatherbev_plugin.cu.o
开始以为是支持环境有问题,换不同的cuda和tensorrt版本有不同的表现,但只是错误的多少,冷静下来想想file failed to open for reading这种错误按理不应该出现,因为相关plugin的源码都有,编译时也都应该执行了,没有其他编译错误怎么会找不到呢,可能是哪里有时序问题,看了一下编译脚本里的命令,果然是有, make -j使用多核多任务并行编译加快了速度但是可能会造成这种依赖上的问题,改成make后编译就顺利完成了,记录一下备忘免得下次又忘了想到这种原因去苦哈哈的排查其他错误浪费时间。