How peterlee0127/tensorflow-nvjetson works
Project type and purpose
• This is an open-source build-and-packaging tool for producing TensorFlow wheel files optimized for Nvidia Jetson TX1/TX2.
• It automates fetching TensorFlow sources, applying Jetson-specific patches, compiling with Bazel against CUDA/CuDNN/TensorRT, and bundling the resulting binary into pip-installable wheels.
File structure
• Top‐level scripts:
• installBazel.sh, installTF.sh, buildTensorflow.sh – orchestration of dependencies and build steps
• patch/ – a catalog of .patch files for various TensorFlow versions
• tf-test/ – test harnesses split by TensorFlow major version (1.0, 2.0), with GPU validation and TensorRT conversion tests
• Configuration:
• .github/ – CI/deployment boilerplate (e.g., FUNDING.yml)
• .gitignore, .gitattributes, README.md, _config.yml – repository metadata and site build settings
• Version artifacts: wheel file parts and merge instructions are generated during the build.
README for additional insights
• Describes hardware prerequisites (JetPack, CUDA, cuDNN, TensorRT), environment setup, and Python dependencies (numpy, keras, hdf5).
• Outlines usage: download prebuilt wheel or run installTF.sh to fetch & install latest build.
• Demonstrates test outputs for GPU availability and TensorRT integration.
a. Source Repository
• Hosts scripts, patches, tests on GitHub
• CI/CD triggers (e.g., GitHub Actions) can invoke build scripts
b. Builder Environment
• Linux host emulating Jetson or actual Jetson TX1/TX2 hardware
• Dependencies: Bazel, CUDA toolkit, CuDNN, CUPTI libraries, Python3 & dev headers, hdf5 libraries
• Build Orchestrator (buildTensorflow.sh) applies patches from patch/ then invokes Bazel to compile TensorFlow core with GPU and TensorRT support
c. Artifact Packaging
• The Bazel output is staged into a Python wheel (.whl) file
• Scripts split/merge large wheels for distribution
• installTF.sh downloads/releases the wheel and runs pip3 install
d. Runtime Environment & Tests
• Python environment on Jetson with installed wheel
• tf-test modules (gpu.py, mnist.py, test_tftrt.py) validate functionality: GPU detection, inference accuracy, TensorRT optimization
e. External Services
• GitHub Releases or custom CDN for wheel hosting
• NVIDIA package repos for CUDA/CuDNN/TensorRT
• PyPI (pip index) for fallback installs
Architectural patterns and design principles
• Modular build pipeline: clearly separated fetch-patch-build-package steps
• Layered dependencies: system libs (CUDA/CuDNN/CUPTI) → build tool (Bazel) → TensorFlow source → Python environment
• Test harness decoupled by TensorFlow major version for clarity and maintenance
Detail
• Script and directory as a distinct node or subcomponent, especially patch/ and tf-test/
• Version branching (TensorFlow 1.x vs. 2.x) in the test harness