Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about libflattenconcat.so #5

Open
dcmrlee opened this issue Aug 15, 2019 · 10 comments
Open

Question about libflattenconcat.so #5

dcmrlee opened this issue Aug 15, 2019 · 10 comments

Comments

@dcmrlee
Copy link

dcmrlee commented Aug 15, 2019

Can I ask how did you get/generate your "libflattenconcat.so" ?

@dcmrlee
Copy link
Author

dcmrlee commented Aug 27, 2019

@kongkongthu
Copy link

Thank you both, I want to ask the question like demrlee. One of you has asked it, one has answered it. ^_^

@cosama
Copy link

cosama commented Nov 8, 2019

@philnguyenresson
Copy link

@cosama , it looks like https://devtalk.nvidia.com/default/topic/1051455/jetson-nano/problems-with-ssd-mobilenet-v2-uff/2 does not work anymore since the current version of TensorRT does not include CMakeLists.txt in the samples/python/uff_ssd folder.

I was able to build TensorRT manually with https://github.com/NVIDIA/TensorRT, but I cant seem to find the libflattenconcat.so file, is there something specific that I need to do?

@cosama
Copy link

cosama commented Feb 22, 2021

@philnguyenresson I don't know about the current state of this, but the link above still works. Just get the 4 files from this folder: https://github.com/NVIDIA/TensorRT/tree/master/plugin/flattenConcat and build it on your Jetson system. It will generate the libflattenconcat.so.

@philnguyenresson
Copy link

@cosama maybe I'm missing some part of the build procedure. From within the flattenConcat folder, I do:

mkdir build && cd build
cmake ../
make

The cmake command runs fine, but the make line does not create the libflattenconcat.so file ( I don't think it creates any file, no message is generated)

@cosama
Copy link

cosama commented Feb 22, 2021

It looks like you need to run the CMakeLists.txt in the plugin folder instead: https://github.com/NVIDIA/TensorRT/tree/master/plugin.

If that doesn't work this is the CMakeLists.txt file I have been using, it only requires the FlattenConcat.cpp file in the same folder. I have to admit I haven't tested this in TRT7 though:

cmake_minimum_required(VERSION 3.2 FATAL_ERROR)

project(FlattenConcat LANGUAGES CXX)

# Enable all compile warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -Werror")
# Use C++11
set (CMAKE_CXX_STANDARD 11)

# Sets variable to a value if variable is unset.
macro(set_ifndef var val)
    if (NOT ${var})
        set(${var} ${val})
    endif()
    message(STATUS "Configurable variable ${var} set to ${${var}}")
endmacro()

# -------- CONFIGURATION --------
find_package(CUDA REQUIRED)

set_ifndef(TRT_LIB /usr/lib/x86_64-linux-gnu)
set_ifndef(TRT_INCLUDE /usr/include/x86_64-linux-gnu)
set_ifndef(CUDA_ROOT /usr/local/cuda)

# Find dependencies:
message("\nThe following variables are derived from the values of the previous variables unless provided explicitly:\n")

# TensorRT's nvinfer lib
find_library(_NVINFER_LIB nvinfer HINTS ${TRT_LIB} PATH_SUFFIXES lib lib64)
set_ifndef(NVINFER_LIB ${_NVINFER_LIB})

# cuBLAS
find_library(_CUBLAS_LIB cublas HINTS ${CUDA_ROOT} PATH_SUFFIXES lib lib64)
set_ifndef(CUBLAS_LIB ${_CUBLAS_LIB})

# CUDA include dir
find_path(_CUDA_INC_DIR cuda_runtime_api.h HINTS ${CUDA_ROOT} PATH_SUFFIXES include)
set_ifndef(CUDA_INC_DIR ${_CUDA_INC_DIR})

# -------- BUILDING --------
include_directories(${TRT_INCLUDE} ${CUDA_INC_DIR})
add_library(flattenconcat MODULE
    ${CMAKE_SOURCE_DIR}/FlattenConcat.cpp
)

# Link TensorRT's nvinfer lib
target_link_libraries(flattenconcat PRIVATE ${NVINFER_LIB} ${CUBLAS_LIB})

@philnguyenresson
Copy link

Thanks!
I missed your reply, but in the meantime I was able to generate libflattenconcat.so by using an old Nvidia tensorRT image (nvcr.io/nvidia/tensorrt:19.12-py3) which had an older version of tensorrt/samples/python/uff_ssd. So I was able to follow the instructions from

See https://devtalk.nvidia.com/default/topic/1051455/jetson-nano/problems-with-ssd-mobilenet-v2-uff/2

@Emmanuel-Messulam
Copy link

It looks like you need to run the CMakeLists.txt in the plugin folder instead: https://github.com/NVIDIA/TensorRT/tree/master/plugin.

If that doesn't work this is the CMakeLists.txt file I have been using, it only requires the FlattenConcat.cpp file in the same folder. I have to admit I haven't tested this in TRT7 though:

cmake_minimum_required(VERSION 3.2 FATAL_ERROR)

project(FlattenConcat LANGUAGES CXX)

# Enable all compile warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -Werror")
# Use C++11
set (CMAKE_CXX_STANDARD 11)

# Sets variable to a value if variable is unset.
macro(set_ifndef var val)
    if (NOT ${var})
        set(${var} ${val})
    endif()
    message(STATUS "Configurable variable ${var} set to ${${var}}")
endmacro()

# -------- CONFIGURATION --------
find_package(CUDA REQUIRED)

set_ifndef(TRT_LIB /usr/lib/x86_64-linux-gnu)
set_ifndef(TRT_INCLUDE /usr/include/x86_64-linux-gnu)
set_ifndef(CUDA_ROOT /usr/local/cuda)

# Find dependencies:
message("\nThe following variables are derived from the values of the previous variables unless provided explicitly:\n")

# TensorRT's nvinfer lib
find_library(_NVINFER_LIB nvinfer HINTS ${TRT_LIB} PATH_SUFFIXES lib lib64)
set_ifndef(NVINFER_LIB ${_NVINFER_LIB})

# cuBLAS
find_library(_CUBLAS_LIB cublas HINTS ${CUDA_ROOT} PATH_SUFFIXES lib lib64)
set_ifndef(CUBLAS_LIB ${_CUBLAS_LIB})

# CUDA include dir
find_path(_CUDA_INC_DIR cuda_runtime_api.h HINTS ${CUDA_ROOT} PATH_SUFFIXES include)
set_ifndef(CUDA_INC_DIR ${_CUDA_INC_DIR})

# -------- BUILDING --------
include_directories(${TRT_INCLUDE} ${CUDA_INC_DIR})
add_library(flattenconcat MODULE
    ${CMAKE_SOURCE_DIR}/FlattenConcat.cpp
)

# Link TensorRT's nvinfer lib
target_link_libraries(flattenconcat PRIVATE ${NVINFER_LIB} ${CUBLAS_LIB})

this is missing the plugin.h file available at plugins/common.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants