NVIDIA / trt-samples-for-hackathon-cn

Simple samples for TensorRT programming
Apache License 2.0
1.47k stars 337 forks source link

环境报错 #69

Open megleo opened 1 year ago

megleo commented 1 year ago

Hello, 当我编译01-SimpleDemo的时后, 出现这个问题: ../../include/cookbookHelper.hpp:18:10: fatal error: NvInfer.h: 没有那个文件或目录 然后我再makefile 文件里面加上了NvInfer.h 在我电脑里面的路径,-I/usr/local/TensorRT-8.0.1.6/include 之后便出现了一些报错 如下面:

(pytorch) ts@ts-System-Product-Name:~/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4$ make test make clean make[1]: 进入目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” rm -rf ./.d ./.o ./.so ./.exe ./*.plan make[1]: 离开目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” make make[1]: 进入目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” /usr/local/cuda/bin/nvcc -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/usr/include/x86_64-linux-gnu -I../../include -I../../../include -M -MT main.o -o main.d main.cpp In file included from main.cpp:18:0: ../../include/cookbookHelper.hpp:18:10: fatal error: NvInfer.h: 没有那个文件或目录

include

      ^~~~~~~~~~~

compilation terminated. Makefile:17: recipe for target 'main.o' failed make[1]: [main.o] Error 1 make[1]: 离开目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” Makefile:22: recipe for target 'test' failed make: [test] Error 2 (pytorch) ts@ts-System-Product-Name:~/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4$ make test make clean make[1]: 进入目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” rm -rf ./.d ./.o ./.so ./.exe ./.plan make[1]: 离开目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” make make[1]: 进入目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” /usr/local/cuda/bin/nvcc -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/usr/include/x86_64-linux-gnu -I../../include -I../../../include -I/usr/local/TensorRT-8.0.1.6/include -M -MT main.o -o main.d main.cpp /usr/local/cuda/bin/nvcc -std=c++14 -O3 -UDEBUG -Xcompiler -fPIC -use_fast_math -I. -I/usr/local/cuda/include -I/usr/include/x86_64-linux-gnu -I../../include -I../../../include -I/usr/local/TensorRT-8.0.1.6/include -Xcompiler -fPIC -o main.o -c main.cpp In file included from ../../include/cookbookHelper.hpp:18:0, from main.cpp:18: /usr/local/TensorRT-8.0.1.6/include/NvInfer.h:6066:101: warning: ‘IRNNv2Layer’ is deprecated [-Wdeprecated-declarations] ITensor& input, int32_t layerCount, int32_t hiddenSize, int32_t maxSeqLen, RNNOperation op) noexcept ^~~~ /usr/local/TensorRT-8.0.1.6/include/NvInfer.h:3086:22: note: declared here class TRT_DEPRECATED IRNNv2Layer : public ILayer ^~~ In file included from main.cpp:18:0: ../../include/cookbookHelper.hpp: In function ‘std::__cxx11::string layerTypeToString(nvinfer1::LayerType)’: ../../include/cookbookHelper.hpp:321:21: error: ‘kCONDITION’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kCONDITION: return std::string("CONDITION"); ^~~~~~ ../../include/cookbookHelper.hpp:322:21: error: ‘kCONDITIONAL_INPUT’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kCONDITIONAL_INPUT: return std::string("CONDITIONAL_INPUT"); ^~~~~~ ../../include/cookbookHelper.hpp:323:21: error: ‘kCONDITIONAL_OUTPUT’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kCONDITIONAL_OUTPUT: return std::string("CONDITIONAL_OUTPUT"); ^~~~~~~ ../../include/cookbookHelper.hpp:324:21: error: ‘kSCATTER’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kSCATTER: return std::string("SCATTER"); ^~~~ ../../include/cookbookHelper.hpp:325:21: error: ‘kEINSUM’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kEINSUM: return std::string("EINSUM"); ^~~ ../../include/cookbookHelper.hpp:326:21: error: ‘kASSERTION’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kASSERTION: return std::string("ASSERTION"); ^~~~~~ ../../include/cookbookHelper.hpp:327:21: error: ‘kONE_HOT’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kONE_HOT: return std::string("ONE_HOT"); // One hot and following layers appears since TensorRT8.5 ^~~~ ../../include/cookbookHelper.hpp:328:21: error: ‘kNON_ZERO’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kNON_ZERO: return std::string("NON_ZERO"); ^~~~~ ../../include/cookbookHelper.hpp:329:21: error: ‘kGRID_SAMPLE’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kGRID_SAMPLE: return std::string("GRID_SAMPLE"); ^~~~ ../../include/cookbookHelper.hpp:330:21: error: ‘kNMS’ is not a member of ‘nvinfer1::LayerType’ case LayerType::kNMS: return std::string("NMS"); ^~~~ main.cpp: In function ‘void run()’: main.cpp:61:17: error: ‘class nvinfer1::IBuilderConfig’ has no member named ‘setMemoryPoolLimit’ config->setMemoryPoolLimit(MemoryPoolType::kWORKSPACE, 1 << 30); ^~~~~~ main.cpp:61:36: error: ‘MemoryPoolType’ has not been declared config->setMemoryPoolLimit(MemoryPoolType::kWORKSPACE, 1 << 30); ^~~~~~ main.cpp:133:52: warning: narrowing conversion of ‘nBinding’ from ‘int’ to ‘std::vector<void>::size_type {aka long unsigned int}’ inside { } [-Wnarrowing] std::vector<void > vBufferH {nBinding, nullptr}; ^ main.cpp:134:52: warning: narrowing conversion of ‘nBinding’ from ‘int’ to ‘std::vector<void>::size_type {aka long unsigned int}’ inside { } [-Wnarrowing] std::vector<void > vBufferD {nBinding, nullptr}; ^ main.cpp:165:28: warning: deleting ‘__gnu_cxx::__alloc_traits<std::allocator<void> >::value_type {aka void*}’ is undefined [-Wdelete-incomplete] delete[] vBufferH[i]; ^ Makefile:17: recipe for target 'main.o' failed make[1]: [main.o] Error 1 make[1]: 离开目录“/home/ts/vscode/trt-samples-for-hackathon-cn/cookbook/01-SimpleDemo/TensorRT8.4” Makefile:22: recipe for target 'test' failed make: [test] Error 2

请问这是什么原因造成的? 怎么去解决这样的报错问题呢? (ps 尝试注释这些,仍旧报错)

wili-65535 commented 1 year ago

You use TensorRT 8.0 right? Several features in the code are supported since TensorRT 8.4, so errors like "error: ‘XXX’ is not a member of ‘nvinfer1::YYY’" or "error: ‘XXX’ has not been declared" raised.

We recommend to use NVIDIA-optimized Docker to run the examples, steps to stall are listed in README.md