TI Deep Learning Library User Guide
Build Instruction

What can be built with TIDL release

By default, TIDL release includes all required pre-built libraries & executables. If there is no code change, you don't need to rebuild it. If code is changed or you want to debug step by step, you can rebuild it by following instructions given in this user guide

  • PC (Windows/Linux, x86_64)
    • TIDL Importer
      • Users can follow the TIDL Importer Guide to know more about import tool and debug it.
      • C++ code is located in ti_dl/utils/tidlModelImport)
    • TIDL Host Emulation - Sample application
      • C code for testbench is present in ti_dl/test/src/. TIDL host emulation library is present in ti_dl/lib/PC/
      • This tool should produce the same result as TIDL inference on target side.
      • Please refer the TIDL Sample Application doc
  • TI_DEVICE (J7)
    • TIDL Inference - Sample application (test bench)
      • This application can be loaded using CCS on J7 SoC. This is mainly used for TIDL standalone testing without SDK.
      • C code for testbench is present in ti_dl/test/src/. TIDL target library is present in ti_dl/lib/dsp/
      • This application should produce the same result as TIDL integrated in SDK.
      • Please refer the TIDL Sample Application doc

Validation Information

This release was built and validated using the following tools:

  • Dependencies (included in Processor SDK RTOS Automotive):
    • ivision - 01_00
    • MMALIB - 01_03_00
    • PDK - 07_01_00
    • C7x CGT - ti-cgt-c7000_1.4.0.LTS
  • Dependencies (NOT included in Processor SDK RTOS Automotive, Refer Here for more inforamtion on setting up these):
    • Microsoft Visual Studio Version 14.2 (MSVC 2015) Notes
    • GCC version 5.4.0 (In Ubuntu 18.04)
    • OpenCV: 3.1.0 (for Host emulation mode Test bench Only)
    • Protobuf: 3.5.1 (for Import tool only)
    • flatbuffers: 1.12.0 (for Import tool only)

Environment Variables

Build system of TIDL software assumes below environment variables being available in the system. Set below environment variables or modify “makerules/config.mk”

Environment Variable Description
IVISION_PATH Directory pointing to ivision package in SDK
DSP_TOOLS Directory pointing to C7x CG tool
MMALIB_PATH Directory pointing to MMA LIB Package (Only needed for TI_DEVICE Build)
PDK_INSTALL_PATH Directory pointing to PDK Package (Only needed for TI_DEVICE Build)
TIDL_PROTOBUF_PATH Directory pointing to Protobuf package (for Import tool only)
TIDL_FLATBUF_PATH Directory pointing to Flatbuffers package (for Import tool only)
TIDL_OPENCV_PATH Directory pointing to openCV package (for Test bench Only)
UTILS_PATH Directory pointing to utils command like mkdir, rm (can be found inside CCS installation CCS_INSTALLATION_DIR/ccs/utils/cygwin. Required only for Windows builds

Build Commands

Please note that use should use "make" utility for building on Linux whereas "gmake" should be used for Windows. Also executable for Linux have type .out whereas the one for Windows have added .exe in executable name. For simplicity make and .out is used in below section.

Run “make TARGET_PLATFORM=PC” from ${TIDL_INSTALL_PATH} folder to build PC tools

$ cd ${TIDL_INSTALL_PATH}
$ make TARGET_PLATFORM=PC
  • This step will generate all the binaries for PC
    • tidl_model_import.out in "ti_dl/utils/tidlModelImport/out"
    • PC_dsp_test_dl_algo.out in "ti_dl/test"
    • ti_cnnperfsim.out in "ti_dl/utils/perfsim"
  • If you are using a Linux PC, you can run "make" as make gv all TARGET_PLATFORM=PC. This will also generate the graph visulization tool
    • tidl_graphVisualiser.out in "ti_dl/utils/tidlModelGraphviz/out/"

Run “make” from ${TIDL_INSTALL_PATH} folder to build the test bench for target

$ cd ${TIDL_INSTALL_PATH}
$ make
  • This Step will generate binary (./TI_DEVICE_dsp_test_dl_algo.out) in "ti_dl/test"

Use "TARGET_BUILD=debug" to build debug binaries

Build Dependencies

Building PDK

Please note that PDK is a dependency for TIDL. It is expected that user has already built PDK before building PDK or using pre-built libraries. User should refer to SDK documentation for any issues with PDK build.

Build OpenCV from source

Download open CV Source from : https://github.com/opencv/opencv/archive/3.1.0.zip run "unzip opencv-3.1.0.zip" Install cmake if it not available in the system"sudo apt install cmake"

Use below CMake options to in "opencv-3.1.0/cmake" folder. And run "make" from same folder

cmake -DBUILD_opencv_highgui:BOOL="1" -DBUILD_opencv_videoio:BOOL="0" -DWITH_IPP:BOOL="0" -DWITH_WEBP:BOOL="1" -DWITH_OPENEXR:BOOL="1" -DWITH_IPP_A:BOOL="0" -DBUILD_WITH_DYNAMIC_IPP:BOOL="0" -DBUILD_opencv_cudacodec:BOOL="0" -DBUILD_PNG:BOOL="1" -DBUILD_opencv_cudaobjdetect:BOOL="0" -DBUILD_ZLIB:BOOL="1" -DBUILD_TESTS:BOOL="0" -DWITH_CUDA:BOOL="0" -DBUILD_opencv_cudafeatures2d:BOOL="0" -DBUILD_opencv_cudaoptflow:BOOL="0" -DBUILD_opencv_cudawarping:BOOL="0" -DINSTALL_TESTS:BOOL="0" -DBUILD_TIFF:BOOL="1" -DBUILD_JPEG:BOOL="1" -DBUILD_opencv_cudaarithm:BOOL="0" -DBUILD_PERF_TESTS:BOOL="0" -DBUILD_opencv_cudalegacy:BOOL="0" -DBUILD_opencv_cudaimgproc:BOOL="0" -DBUILD_opencv_cudastereo:BOOL="0" -DBUILD_opencv_cudafilters:BOOL="0" -DBUILD_opencv_cudabgsegm:BOOL="0" -DBUILD_SHARED_LIBS:BOOL="0" ../

Build ProtoBuf from source

Download ProtoBuf source: https://github.com/protocolbuffers/protobuf/releases/download/v3.5.1/protobuf-cpp-3.5.1.tar.gz

Extract the source "tar -xzvf protobuf-3.5.1.tar.gz"

Run below Configure command in "protobuf-3.5.1" folder and rum "make" from the same folder

./configure CXXFLAGS=-fPIC --enable-shared=no LDFLAGS="-static"

FlatBuffer

Flatbuffer is header only package, need not be built. Can be downloaded from Here : https://github.com/google/flatbuffers/archive/v1.11.0.zip

Note
Note : If you are building the OpenCV and ProtoBuf in Windows machine. Enable the corresponding flag from CMake wizard..
gmake can be used from CCS for windows building

Windows Build

  • Download and install build tools from : https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
  • Run below command from to set MSVC build environment
    "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 -vcvars_ver=14.2
  • gmake available in "ccs9xx\ccs\utils\bin" can be used for build. Add this path to PATH%
  • The PDK Host emulation libraries for windows build are not available in the PSDKRA package. Run the below command from "pdk\packages\ti\build" to build PDK Host emulation libraries
    gmake csl osal_nonos sciclient udma dmautils SOC=j721e BOARD=j721e_hostemu CORE=c7x-hostemu -s -j BUILD_PROFILE=debug
    gmake csl osal_nonos sciclient udma dmautils SOC=j721e BOARD=j721e_hostemu CORE=c7x-hostemu -s -j