Skip to content

Commit

Permalink
Copying latest changes from PR OE4T#799
Browse files Browse the repository at this point in the history
  • Loading branch information
bcis93 committed Sep 26, 2021
1 parent e5189ef commit b35ae2a
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 35 deletions.
7 changes: 2 additions & 5 deletions recipes-devtools/gie/tensorrt-core_7.1.3-1.bb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DESCRIPTION = "NVIDIA TensorRT Core (GPU Inference Engine) for deep learning"
LICENSE = "Proprietary"

inherit l4t_deb_pkgfeed
inherit l4t_deb_pkgfeed container-runtime-csv

HOMEPAGE = "http://developer.nvidia.com/tensorrt"

Expand Down Expand Up @@ -38,10 +38,7 @@ LIC_FILES_CHKSUM = "file://usr/include/aarch64-linux-gnu/NvInfer.h;endline=48;md

S = "${WORKDIR}/tensorrt"

DEPENDS = "libcublas cudnn cuda-cudart cuda-nvrtc libglvnd"
DEPENDS_append_tegra194 = " tegra-libraries"

CONTAINER_CSV_FILES = "${libdir}/*.so* /usr/src/*"
CONTAINER_CSV_FILES = "${libdir}/*.so*"

do_configure() {
:
Expand Down
20 changes: 7 additions & 13 deletions recipes-devtools/gie/tensorrt-plugins-prebuilt_7.1.3-1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,25 @@ PREFIX_tegra194 = "DLA-"
L4T_DEB_GROUP = "tensorrt"

SRC_SOC_DEBS = "\
libnvinfer-samples_${PV}+cuda10.2_all.deb;downloadfilename=${PREFIX}libnvinfer-samples_${PV}+cuda10.2_all.deb;name=samples;subdir=tensorrt \
libnvparsers7_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvparsers7_${PV}+cuda10.2_arm64.deb;name=nvp;subdir=tensorrt \
libnvparsers-dev_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvparsers-dev_${PV}+cuda10.2_arm64.deb;name=nvpdev;subdir=tensorrt \
libnvinfer-plugin7_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvinfer-plugin7_${PV}+cuda10.2_arm64.deb;name=plugin;subdir=tensorrt \
libnvinfer-plugin-dev_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvinfer-plugin-dev_${PV}+cuda10.2_arm64.deb;name=plugindev;subdir=tensorrt \
libnvinfer-bin_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvinfer-bin_${PV}+cuda10.2_arm64.deb;name=bin;subdir=tensorrt \
"

SAMPSHA256SUM = "3a5162474cce7e191d78703b196bc8bdd5a6908d7537200194f1e80d72cf45a0"
ONNXSHA256SUM = "e00ed2bff48de16ca275ce322fbc881b5bbd4a1521fd7f685d56cfb30136039a"
ONNXDEVSHA256SUM = "8c18ffac6b9118491248e14000cb72638268ce4f3698522a478cac6dd4631c34"
PLUGINSHA256SUM = "a57ea8b4757fa4592c6ba1555bc07045909b553a493c0bde8c8b23c74cf082b4"
PLUGINDEVSHA256SUM = "94820301980118e34cc1ab99570d3a7a13b96f4811828908b63bf638b4252edd"
BINSHA256SUM = "94927076974c59ae45b0c56300387816b8fa03d397d1503d8633e7989b4a20f6"

SAMPSHA256SUM_tegra194 = "87d32bb231c19717c4690e05c770eb51d3d5ad4bea8fbd0ee46ba4d1a386ad9f"
ONNXSHA256SUM_tegra194 = "26109c58e8eab9dc746fb3fc39cc39bf5a8bf2d61a27b5d9e7aa035fc0b97b4c"
ONNXDEVSHA256SUM_tegra194 = "52783ca7245171eb83c623a08851c0cfdc659696272b2edf6dfe3503ae9bc49b"
PLUGINSHA256SUM_tegra194 = "680c7849542dca1cac68fc94f7474f31446cf093b6e6df1d7bab8c24a6122aa3"
PLUGINDEVSHA256SUM_tegra194 = "bac84671b2990b8110d4f2ac69b4a29cf230346db37a902d1f47cf7a9be4601e"
BINSHA256SUM_tegra194 = "56275d8cba17be877af063db49ecb7b6e02bed5f8d387b1182a6a7ec2cabee2a"

SRC_URI[samples.sha256sum] = "${SAMPSHA256SUM}"
SRC_URI[onnx.sha256sum] = "${ONNXSHA256SUM}"
SRC_URI[onnxdev.sha256sum] = "${ONNXDEVSHA256SUM}"
SRC_URI[plugin.sha256sum] = "${PLUGINSHA256SUM}"
Expand All @@ -46,8 +42,7 @@ LIC_FILES_CHKSUM = "file://usr/include/aarch64-linux-gnu/NvInfer.h;endline=48;md

S = "${WORKDIR}/tensorrt"

DEPENDS = "cuda-cudart cudnn libglvnd tensorrt-core"
DEPENDS_append_tegra194 = " tegra-libraries"
DEPENDS = "cuda-cudart cudnn tegra-libraries tensorrt-core"

CONTAINER_CSV_FILES = "${libdir}/*.so* /usr/src/*"

Expand All @@ -56,7 +51,7 @@ do_configure() {
}

do_compile() {
find ${S}/usr/src/tensorrt -name '*.py' | xargs sed -i -r -e 's,^(\s*)print "(.*)$,\1print("\2),'
:
}

do_install() {
Expand All @@ -67,18 +62,17 @@ do_install() {
install -d ${D}${prefix}/src
cp --preserve=mode,timestamps --recursive ${S}/usr/src/tensorrt ${D}${prefix}/src/
}
PACKAGES += "${PN}-samples"

FILES_${PN} += "${prefix}/src/tensorrt/bin"
FILES_${PN}-samples = "${prefix}/src"

RDEPENDS_${PN} += "tensorrt-core"
RDEPENDS_${PN}-samples += "tegra-libraries bash python3 libglvnd cuda-cudart tensorrt-core"
RPROVIDES_${PN}-samples = "${PN}-examples"
RDEPENDS_${PN} += "tegra-libraries"
PROVIDES = "tensorrt-plugins"
RPROVIDES_${PN} = "tensorrt-plugins"
RCONFLICTS_${PN} = "tensorrt-plugins"

INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_SYSROOT_STRIP = "1"
INSANE_SKIP_${PN}-samples = "ldflags"

PACKAGE_ARCH = "${TEGRA_PKGARCH}"
PACKAGE_ARCH_tegra194 = "${SOC_FAMILY_PKGARCH}"
24 changes: 7 additions & 17 deletions recipes-devtools/gie/tensorrt-plugins_7.1.3-1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = " \
file://parsers/onnx/LICENSE;md5=73b35773827cb985bfc6c085ed8d2394 \
"

inherit cuda cmake
inherit cuda cmake container-runtime-csv

SRC_REPO = "github.com/NVIDIA/TensorRT.git;protocol=https"
SRCBRANCH = "master"
Expand All @@ -24,38 +24,28 @@ DEPENDS += "zlib libcublas cudnn cuda-cudart cuda-nvrtc protobuf protobuf-native

COMPATIBLE_MACHINE = "(tegra)"

CONTAINER_CSV_FILES = "${libdir}/*.so*"

PACKAGECONFIG ??= " \
plugin \
parsers \
samples \
"
PACKAGECONFIG[plugin] = "-DBUILD_PLUGINS=ON,-DBUILD_PLUGINS=OFF,"
PACKAGECONFIG[parsers] = "-DBUILD_PARSERS=ON,-DBUILD_PARSERS=OFF,"
PACKAGECONFIG[samples] = "-DBUILD_SAMPLES=ON,-DBUILD_SAMPLES=OFF,"

EXTRA_OECMAKE = "-DTRT_PLATFORM_ID=aarch64 -DCUDA_VERSION="${CUDA_VERSION}" \
-DCUDA_NVCC_FLAGS="${CUDA_NVCC_FLAGS}" -DSKIP_GPU_ARCHS=ON \
-DCUDA_INCLUDE_DIRS=${STAGING_DIR_HOST}/usr/local/cuda-${CUDA_VERSION}/include \
EXTRA_OECMAKE = "-DBUILD_SAMPLES=OFF -DSKIP_GPU_ARCHS=ON -DTRT_PLATFORM_ID="${TARGET_ARCH}" \
-DCUDA_VERSION="${CUDA_VERSION}" -DCUDA_NVCC_FLAGS="${CUDA_NVCC_FLAGS}" \
-DCUDA_INCLUDE_DIRS="${STAGING_DIR_HOST}/usr/local/cuda-${CUDA_VERSION}/include" \
"

LDFLAGS += "-Wl,--no-undefined"

do_install_append() {
install -d ${D}${prefix}/src/tensorrt/bin
cp --preserve=mode,timestamps ${D}${bindir}/* ${D}${prefix}/src/tensorrt/bin
rm -rf ${D}${bindir}
install -d ${D}${includedir}
install -m 0644 ${S}/include/NvInferPlugin.h ${D}${includedir}
install -m 0644 ${S}/include/NvInferPluginUtils.h ${D}${includedir}
install -m 0644 ${S}/include/NvOnnxConfig.h ${D}${includedir}
install -m 0644 ${S}/parsers/onnx/NvOnnxParser.h ${D}${includedir}
}

PACKAGES += "${PN}-samples"
FILES_${PN}-samples = "${prefix}/src/tensorrt/bin"

RDEPENDS_${PN} += "tensorrt-core"
RDEPENDS_${PN}-samples += "tegra-libraries cudnn cuda-cudart libcublas tensorrt-core"
RPROVIDES_${PN}-samples = "${PN}-examples"

PACKAGE_ARCH = "${TEGRA_PKGARCH}"
RDEPENDS_${PN} += "tegra-libraries"
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
From f196aef19ab533c5aae1195698c1d27c3ffc43bc Mon Sep 17 00:00:00 2001
From: Ilies CHERGUI <ilies.chergui@gmail.com>
Date: Tue, 21 Sep 2021 23:12:52 +0100
Subject: [PATCH] Makefile: fix cross compilation issues

Signed-off-by: Ilies CHERGUI <ilies.chergui@gmail.com>
---
Makefile.config | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/Makefile.config b/Makefile.config
index 48c1a8d..70db6aa 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -5,6 +5,7 @@ DLSW_TRIPLE ?= x86_64-linux-gnu
SAFE_PDK ?= 0
CPP_STANDARD?=14
TARGET ?= $(shell uname -m)
+BUILD_TYPE ?= release

ifeq ($(CUDA_INSTALL_DIR),)
CUDA_INSTALL_DIR ?= /usr/local/cuda
@@ -34,11 +35,11 @@ CUDNN_LIBDIR = lib64
ifeq ($(TARGET), aarch64)
ifeq ($(shell uname -m), aarch64)
CUDA_LIBDIR = lib64
- CC = g++
+ CXX ?= g++
else
- CC = aarch64-linux-gnu-g++
+ CXX ?= aarch64-linux-gnu-g++
endif
- CUCC = $(CUDA_INSTALL_DIR)/bin/nvcc -m64 -ccbin $(CC)
+ CUCC = $(CUDA_INSTALL_DIR)/bin/nvcc -m64 -ccbin $(CXX)
else ifeq ($(TARGET), x86_64)
CUDA_LIBDIR = lib64
CC = g++
@@ -54,7 +55,7 @@ else ########
$(error Auto-detection of platform failed. Please specify one of the following arguments to make: TARGET=[aarch64|x86_64|qnx])
endif

-CC_MAJOR_VER = $(shell $(CC) -dumpversion | sed -e "s/\..*//")
+CC_MAJOR_VER = $(shell $(CXX) -dumpversion | sed -e "s/\..*//")
ifeq (${CC_MAJOR_VER}, 4)
CPP_STANDARD := 11
endif
@@ -111,7 +112,7 @@ endef
ifneq ($(USE_QCC),1)
# Usage: $(call make-depend,source-file,object-file,depend-file)
define make-depend
- $(AT)$(CC) -MM -MF $3 -MP -MT $2 $(COMMON_FLAGS) $1
+ $(AT)$(CXX) -MM -MF $3 -MP -MT $2 $(COMMON_FLAGS) $1
endef
# Usage: $(call make-cuda-depend,source-file,object-file,depend-file,flags)
define make-cuda-depend
@@ -305,7 +306,15 @@ CFLAGSD = $(COMMON_FLAGS) -g
LFLAGS = $(COMMON_LD_FLAGS)
LFLAGSD = $(COMMON_LD_FLAGS)

-all: debug release
+ifeq ($(BUILD_TYPE), release)
+ all: release
+else
+ifeq ($(BUILD_TYPE), debug)
+ all: debug
+else
+ all: debug release
+endif
+endif

release : $(OUTDIR)/$(OUTNAME_RELEASE)

@@ -321,25 +330,25 @@ test_release:

$(OUTDIR)/$(OUTNAME_RELEASE) : $(OBJS) $(CUOBJS)
$(ECHO) Linking: $@
- $(AT)$(CC) -o $@ $(LFLAGS) -Wl,--start-group $(LIBS) $^ -Wl,--end-group
+ $(AT)$(CXX) -o $@ $(LFLAGS) -Wl,--start-group $(LIBS) $^ -Wl,--end-group

$(OUTDIR)/$(OUTNAME_DEBUG) : $(DOBJS) $(CUDOBJS)
$(ECHO) Linking: $@
- $(AT)$(CC) -o $@ $(LFLAGSD) -Wl,--start-group $(DLIBS) $^ -Wl,--end-group
+ $(AT)$(CXX) -o $@ $(LFLAGSD) -Wl,--start-group $(DLIBS) $^ -Wl,--end-group

$(OBJDIR)/%.o: %.cpp
$(AT)if [ ! -d $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi
$(foreach XDIR,$(EXTRA_DIRECTORIES), if [ ! -d $(OBJDIR)/$(XDIR) ]; then mkdir -p $(OBJDIR)/$(XDIR); fi;) :
$(call make-depend,$<,$@,$(subst .o,.d,$@))
$(ECHO) Compiling: $<
- $(AT)$(CC) $(CFLAGS) -c -o $@ $<
+ $(AT)$(CXX) $(CFLAGS) -c -o $@ $<

$(DOBJDIR)/%.o: %.cpp
$(AT)if [ ! -d $(DOBJDIR) ]; then mkdir -p $(DOBJDIR); fi
$(foreach XDIR,$(EXTRA_DIRECTORIES), if [ ! -d $(OBJDIR)/$(XDIR) ]; then mkdir -p $(DOBJDIR)/$(XDIR); fi;) :
$(call make-depend,$<,$@,$(subst .o,.d,$@))
$(ECHO) Compiling: $<
- $(AT)$(CC) $(CFLAGSD) -c -o $@ $<
+ $(AT)$(CXX) $(CFLAGSD) -c -o $@ $<

######################################################################### CU
$(OBJDIR)/%.o: %.cu
--
2.17.1

72 changes: 72 additions & 0 deletions recipes-devtools/gie/tensorrt-samples_7.1.3-1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
DESCRIPTION = "NVIDIA TensorRT Samples for deep learning"
LICENSE = "Proprietary"

inherit l4t_deb_pkgfeed cuda

HOMEPAGE = "http://developer.nvidia.com/tensorrt"

PREFIX = "NoDLA-"
PREFIX_tegra194 = "DLA-"

L4T_DEB_GROUP = "tensorrt"

SRC_SOC_DEBS = "\
libnvinfer-samples_${PV}+cuda10.2_all.deb;downloadfilename=${PREFIX}libnvinfer-samples_${PV}+cuda10.2_all.deb;name=samples;subdir=tensorrt \
"

SRC_URI_append = " file://0001-Makefile-fix-cross-compilation-issues.patch"

SRC_URI[samples.sha256sum] = "3a5162474cce7e191d78703b196bc8bdd5a6908d7537200194f1e80d72cf45a0"

COMPATIBLE_MACHINE = "(tegra)"

LIC_FILES_CHKSUM = "file://../../../share/doc/libnvinfer-samples/copyright;md5=713c2de2adb0f371a903b9fe20431bab"

S = "${WORKDIR}/tensorrt/usr/src/tensorrt/samples"

DEPENDS = "cuda-cudart cudnn tegra-libraries tensorrt-core tensorrt-plugins libglvnd"

EXTRA_OEMAKE = ' \
CUDA_INSTALL_DIR="${STAGING_DIR_HOST}/usr/local/cuda-${CUDA_VERSION}" \
CUDNN_INSTALL_DIR="${STAGING_DIR_HOST}/usr/lib" \
TRT_LIB_DIR="${STAGING_DIR_HOST}/usr/lib" \
TARGET="${TARGET_ARCH}" BUILD_TYPE="release" \
'

TARGET_CC_ARCH += "${LDFLAGS}"

do_configure() {
:
}

do_install() {
install -d ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_algorithm_selector ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_char_rnn ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_dynamic_reshape ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_fasterRCNN ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_googlenet ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_int8 ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_int8_api ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_mlp ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_mnist ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_mnist_api ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_nmt ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_onnx_mnist ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_reformat_free_io ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_ssd ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_uff_faster_rcnn ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_uff_mask_rcnn ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_uff_mnist ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_uff_plugin_v2_ext ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/sample_uff_ssd ${D}${prefix}/src/tensorrt/bin
install -m 0755 ${S}/../bin/trtexec ${D}${prefix}/src/tensorrt/bin

install -d ${D}${prefix}/src/tensorrt/data
cp -R --preserve=mode,timestamps ${S}/../data/* ${D}${prefix}/src/tensorrt/data
}

PACKAGES =+ "${PN}-trtexec"

FILES_${PN} += "${prefix}/src/tensorrt/bin ${prefix}/src/tensorrt/data"
FILES_${PN}-trtexec += "${prefix}/src/tensorrt/bin/trtexec"

0 comments on commit b35ae2a

Please sign in to comment.