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 35a4a17
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 38 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
26 changes: 10 additions & 16 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 \
libnvonnxparsers7_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvonnxparsers7_${PV}+cuda10.2_arm64.deb;name=onnx;subdir=tensorrt \
libnvonnxparsers-dev_${PV}+cuda10.2_arm64.deb;downloadfilename=${PREFIX}libnvonnxparsers-dev_${PV}+cuda10.2_arm64.deb;name=onnxdev;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 @@ -42,12 +38,11 @@ SRC_URI[bin.sha256sum] = "${BINSHA256SUM}"

COMPATIBLE_MACHINE = "(tegra)"

LIC_FILES_CHKSUM = "file://usr/include/aarch64-linux-gnu/NvInfer.h;endline=48;md5=59218f2f10ab9e4132dda76c59e80fa1"
LIC_FILES_CHKSUM = "file://usr/include/aarch64-linux-gnu/NvInferPlugin.h;endline=48;md5=59218f2f10ab9e4132dda76c59e80fa1"

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 libcublas cuda-nvrtc"
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,100 @@
From 2fb0ba399055414cf23c32e5e38abaf064dbdc19 Mon Sep 17 00:00:00 2001
From: Bryan Cisneros <bcisneros@sighthound.com>
Date: Sat, 25 Sep 2021 21:26:28 -0600
Subject: [PATCH] Makefile: fix cross compilation issues

Signed-off-by: Bryan Cisneros <bcisneros@sighthound.com>
---
Makefile.config | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/Makefile.config b/Makefile.config
index a2a5ca8..19fe755 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -4,6 +4,7 @@ CUBLAS_TRIPLE ?= x86_64-linux-gnu
DLSW_TRIPLE ?= x86_64-linux-gnu
SAFE_PDK ?= 0
TARGET ?= $(shell uname -m)
+BUILD_TYPE ?= release

ifeq ($(CUDA_INSTALL_DIR),)
CUDA_INSTALL_DIR ?= /usr/local/cuda
@@ -33,11 +34,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++
@@ -90,7 +91,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
@@ -265,7 +266,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)

@@ -292,13 +301,13 @@ $(OUTDIR)/$(OUTNAME_DEBUG) : $(DOBJS) $(CUDOBJS)
else
$(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
# Copy every EXTRA_FILE of this sample to bin dir
$(foreach EXTRA_FILE,$(EXTRA_FILES), cp -f $(EXTRA_FILE) $(OUTDIR)/$(EXTRA_FILE); )

$(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
endif

$(OBJDIR)/%.o: %.cpp
@@ -306,14 +315,14 @@ $(OBJDIR)/%.o: %.cpp
$(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.33.0


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=ea60fab79a29c78a6958fc75552ffdc0"

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 35a4a17

Please sign in to comment.