jkjung-avt / tensorrt_demos

TensorRT MODNet, YOLOv4, YOLOv3, SSD, MTCNN, and GoogLeNet
https://jkjung-avt.github.io/
MIT License
1.74k stars 545 forks source link

require virtual function override when make #515

Closed goeunsong closed 2 years ago

goeunsong commented 2 years ago

Hi, As I got an error message like below,

ERROR: failed to load ./plugins/libyolo_layer.so. Did you forget to do a "make" in the "./plugins/" subdirectory?

I tried make clean, then make again. but I encountered another message.

computes: 53 NVCCFLAGS: -gencode arch=compute_53,code=[sm_53,compute_53] nvcc -ccbin g++ -I"/usr/local/cuda/include" -I"/usr/local/TensorRT-7.1.3.4/include" -I"/usr/local/include" -I"plugin" -gencode arch=compute_53,code=[sm_53,compute_53] -Xcompiler -fPIC -c -o yolo_layer.o yolo_layer.cu yolo_layer.h(89): warning: function "nvinfer1::IPluginV2Ext::configurePlugin(const nvinfer1::Dims , int, const nvinfer1::Dims , int, const nvinfer1::DataType , const nvinfer1::DataType , const __nv_bool , const __nv_bool , nvinfer1::PluginFormat, int)" is hidden by "nvinfer1::YoloLayerPlugin::configurePlugin" -- virtual function override intended?

yolo_layer.h(89): warning: function "nvinfer1::IPluginV2Ext::configurePlugin(const nvinfer1::Dims , int, const nvinfer1::Dims , int, const nvinfer1::DataType , const nvinfer1::DataType , const bool , const bool , nvinfer1::PluginFormat, int)" is hidden by "nvinfer1::YoloLayerPlugin::configurePlugin" -- virtual function override intended?

g++ -shared -o libyolo_layer.so yolo_layer.o -L"/usr/local/cuda/lib64" -L"/usr/local/TensorRT-7.1.3.4/lib" -L"/usr/local/lib" -Wl,--start-group -lnvinfer -lnvparsers -lnvinfer_plugin -lcudnn -lcublas -lnvToolsExt -lcudart -lrt -ldl -lpthread -Wl,--end-group

I want to require virtual function override. How can I require it? thanks.

jkjung-avt commented 2 years ago

yolo_layer.h(89): warning: function "nvinfer1::IPluginV2Ext::configurePlugin(const nvinfer1::Dims , int, const nvinfer1::Dims , int, const nvinfer1::DataType , const nvinfer1::DataType , const __nv_bool , const __nv_bool , nvinfer1::PluginFormat, int)" is hidden by "nvinfer1::YoloLayerPlugin::configurePlugin" -- virtual function override intended?

yolo_layer.h(89): warning: function "nvinfer1::IPluginV2Ext::configurePlugin(const nvinfer1::Dims , int, const nvinfer1::Dims , int, const nvinfer1::DataType , const nvinfer1::DataType , const bool , const bool , nvinfer1::PluginFormat, int)" is hidden by "nvinfer1::YoloLayerPlugin::configurePlugin" -- virtual function override intended?

You could safely ignore these 2 warnings. I kept the code the way it is, because I want the code to compile across different versions of TensorRT (more exactly, TensorRT 6, 7, and 8).

If you really want to get rid of those warnings for TensorRT 7, you could refer to my old code here: https://github.com/jkjung-avt/tensorrt_demos/blob/9665269a013eb569992242dca8afa601c919d1be/plugins/yolo_layer.h#L107-L108

goeunsong commented 2 years ago

thanks. I tried change yolo_layer.h then make again and got no warnings. But when I run code , I got an error message

ERROR: failed to load ./plugins/libyolo_layer.so. Did you forget to do a "make" in the "./plugins/" subdirectory?

What can I try to successfully run code without errors?

jkjung-avt commented 2 years ago

What's the output of ldd ./plugins/libyolo_layer.so? (Could all dynamic library dependencies for "libyolo_layer.so" be resolved on your system?)

goeunsong commented 2 years ago
    linux-vdso.so.1 (0x0000007fa56c8000)
    libgtk3-nocsd.so.0 => /usr/lib/aarch64-linux-gnu/libgtk3-nocsd.so.0 (0x0000007fa5640000)
    libnvinfer.so.7 => /usr/lib/aarch64-linux-gnu/libnvinfer.so.7 (0x0000007f9822a000)
    libcudart.so.10.2 => /usr/local/cuda/lib64/libcudart.so.10.2 (0x0000007f981b6000)
    libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007f98022000)
    libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007f97ffe000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f97ea4000)
    /lib/ld-linux-aarch64.so.1 (0x0000007fa569d000)
    libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007f97e8f000)
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007f97e63000)
    libcublas.so.10 => /usr/lib/aarch64-linux-gnu/libcublas.so.10 (0x0000007f93185000)
    libcudnn.so.8 => /usr/lib/aarch64-linux-gnu/libcudnn.so.8 (0x0000007f93147000)
    libmyelin.so.1 => /usr/lib/aarch64-linux-gnu/libmyelin.so.1 (0x0000007f92cb9000)
    libnvrtc.so.10.2 => /usr/local/cuda/lib64/libnvrtc.so.10.2 (0x0000007f91888000)
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007f917cf000)
    librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000007f917b8000)
    libcublasLt.so.10 => /usr/lib/aarch64-linux-gnu/libcublasLt.so.10 (0x0000007f8f7f2000)

are output of ldd ./plugins/libyolo_layer.so

goeunsong commented 2 years ago

I also run and checked $ python3 -c "import ctypes; ctypes.cdll.LoadLibrary('./plugins/libyolo_layer.so') "

no error occurred and returned nothing.

goeunsong commented 2 years ago

Oh, there was a problem that paths were mixed. I solved it. Thank you.