3. • AI Server Performance in 30W, 15W, and 10W
• 512 Volta CUDA Cores and 2x NVDLA
• 8 core CPU
• 32 DL TOPS
향상된 점
보드 사양
| 3 |
[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
4. Model Number: Tegra194
Name: Xavier
• 8x Volta SM 1377MHz
• 512 CUDA cores, 64 Tensor Cores
• 22 TOPS INT8, 11 TFLOPS FP16
GPU
보드 사양
| 4 |[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
5. 케이블 설정
보드 사양
| 5 |[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
7. 버전: JetPack 4.1.1 Developer Preview (18.11.08)
구성
• OS Image
- L4T 31.1: 우분투 18.04 (Stability and Security fixes)
• Libraries
- TensorRT 5.0.3.2-1 (the latest version: 5.0.4)
- cuDNN 7.3.1
- CUDA 10
- OpenCV, Multimedia API, VisionWorks
• Developer Tools
- CUDA tools
- NVIDIA Nsight systems 2018.1
• Profiling on Jetson AGX Xavier
• Ability to trace cuDNN, cuBLAS, and OS runtime library API calls
- NVIDIA Nsight Graphics 2018.6
• Debugging and profiling
• Resource monitoring
Jetpack 설치
설정: Jetpack, TensorFlow
| 7 |
8. (1) Download JetPack installer to your Linux host computer.
(2) Connect your developer kit to the Linux host computer.
(3) Put your developer kit into Force Recovery Mode.
(4) Run JetPack installer to select and install desired components.
Jetpack 상세 설치법
설정: Jetpack, TensorFlow
| 8 |
9. Jetpack에 포함된 기본 Samples
설정: Jetpack, TensorFlow
| 9 |
[1] https://elinux.org/Jetson_AGX_Xavier
11. TensorFlow 설치 공식 가이드: Link, Blog
Jetpack 형태로 제공
• tf_gpu-1.12.1+nv19.1-py3
• tf_gpu-1.12.1+nv19.1-py2
• tf_gpu-1.12.1+nv18.12-py3
• tf_gpu-1.12.1+nv18.12-py2
• tf_gpu-1.12.0rc2+nv18.11-py3
• tf_gpu-1.12.0rc2+nv18.11-py2
사전 설치
• Install JetPack 4.1.1 Developer Preview
• Install HDF5
- apt-get install libhdf5-serial-dev hdf5-tools
• Install pip3 (python3.6)
• Install the following packages:
• pip3 install --upgrade pip sudo apt-get install zlib1g-dev zip libjpeg8-dev
libhdf5-dev sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil
portpicker grpcio six mock requests gast h5py astor termcolor
TensorFlow 설치 (1)
설정: Jetpack, TensorFlow
| 11 |
12. Tensorflow-gpu 설치 및 확인
• Installing TensorFlow
• pip3 install --extra-index-url
https://developer.download.nvidia.com/compute/redist/jp/v411
tensorflow-gpu
• 사전에 빌드된 바이너리를 다운 받는다.
- https://developer.download.nvidia.com/compute/redist/jp/v411/tensorflo
w-gpu/
- 현재 가장 최신 stable 버전을 지원: 1.12
TensorFlow 설치 (2)
설정: Jetpack, TensorFlow
| 12 |
13. NVPMODEL
• Default mode는 Mode ID=2로 15W로 동작
• 주요 명령어
- sudo nvpmodel -q (for current mode) 자세히 보고 싶으면 --verbose option
추가
- sudo nvpmodel -m 0 (for changing mode, persists after reboot)
- sudo ~/tegrastats (for monitoring clocks & core utilization)
보드 성능 변경
설정: Jetpack, TensorFlow
| 13 |
[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
14. 수정: /etc/nvpmodel.conf
개인 모드 생성
설정: Jetpack, TensorFlow
| 14 |
[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
18. Most accurate: Faster-R-CNN with inception ResNet with 300
proposals (1 frame)
• An ensemble model would be better
Fastest: SSD with MobileNet ,YOLOv3
• 주류는 Single shot multibox detection (SSD) 계열
Object detection: speed and accuracy comparison
YOLOv3 실행 및 최적화
| 18 |
19. 코드 및 웨이트 다운 (기존과 동일)
Makefile 수정
• OpenCV, GPU, cuDNN 모두 1로 설정
• -gencode arch=compute_72,code=[sm_72,compute_72]
컴파일
Yolov3 다운 및 컴파일
YOLOv3 실행 및 최적화
| 19 |
20. 사용된 이미지: dog.jpg
• Xavier: 0.164729 sec
• Geforce-1080: 0.051647 sec
성능 테스트
YOLOv3 실행 및 최적화
| 20 |
21. ./darknet detector demo cfg/coco.data cfg/yolov3.cfg
yolov3.weights traffic.mp4
Live demo
동영상 데모
YOLOv3 실행 및 최적화
| 21 |
22. Deep Learning Inference Engine (TensorRT)
• High-performance deep learning inference runtime for production
deployment
Deep Learning Primitives (cuDNN)
• High-performance building blocks for deep neural network
applications including convolutions, activation functions, and tensor
transformations
TensorRT를 이용한 최적화
YOLOv3 실행 및 최적화
| 22 |
23. Compile and optimize neural networks support for every
framework optimize for each target platform
• Fuse network layers
• Eliminate concatenation layers
• Kernel specialization
• Auto-tuning for target platform
• Select optimal tensor layout
• Batch size tuning
• Mixed-precision INT8/FP16 support
tensorRTv5
• Volta GPU INT8 Tensor Cores (HMMA/IMMA)
• Early-Access DLA FP 16 support
• Fine-grained control of DLA layers and GPU Fallback
TensorRT
YOLOv3 실행 및 최적화
| 23 |
[1] https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html
24. Using TensorRT in TensorFlow (TF-TRT)
• tensorflow/tensorflow/contrib/tensorrt/
• https://github.com/tensorflow/tensorflow/tree/master/tensorflow/co
ntrib/tensorrt
TensorRT의 공개 범위
YOLOv3 실행 및 최적화
| 24 |
31. NVIDIA에서 딥러닝 가속기의 표준 확립을 위해서 오픈 아키텍처를 공개하고 누구나 기여할 수 있도록 함.
하드웨어 구성요소
• Convolution Core: 서로 다른 크기로 지원
• Single Data Point Processor: activation function을 위한 방법, linear와 non-linear모두를 지원
• Planar Data Processor: pooling을 위한 것
• Cross-Channel Data Processor: local normalization을 위한 것
• Data Reshape Engines: 텐서 복사나 리쉐입을 위한 memory to memory transformation acceleration. 즉,
splitting, slicing, merging, contraction, reshape transpose.
• Bridge DMA: 시스템 DRAM사이에서의 데이터 전송을 관장함
FPGA는 Amazon EC2 F1 environment (verilog code 제공)
공개된 아키텍쳐
NVDLA
| 31 |
[1] http://nvdla.org/
32. Xavier에 실제적으로 open source NVDLA가 구현됨
2x DLA engines: 5 TOPS INT8, 2.5 TFLOPS FP16 per DLA
Optimized for energy efficiency (500-1500mW)
TensorRTv5 를 통해서만 Xavier NVDLA는 접근 가능
• DLA: supported layers
- Activiation, Concatenation, Convolution, Deconvolution, ElementWise,
FullyConnected, LRN, Poolling, and Scale
• 검증된 모델: Alexnet, GoogleNet, ResNet-50, LeNet for MNIST
NVIDIA Deep Learning Accelerator (DLA)
NVDLA
| 32 |
[1] http://nvdla.org/primer.html
33. 공통 제약
• Max batch size 32
• Input and output tensor data format FP16
레이어 제약
• Convolution and Deconvolution Layers
- Width and height of kernel size must be in the range [1, 32]
- Width and height of padding must be in the range [0, 31]
- Width and height of stride must be in the range [1,8] for Convolution Layer and [1,32] for Deconvolution layer
- Number of output maps must be in the range [1, 8192]
- Axis must be 1
- Grouped and dilated convolution supported. Dilation values must be in the range [1,32]
• Pooling Layer
- Operations supported: kMIN, kMAX, kAVERAGE
- Width and height of the window size must be in the range [1, 8]
- Width and height of padding must be in the range [0, 7]
- Width and height of stride must be in the range [1, 16]
• Activation Layer
- Functions supported: ReLU, Sigmoid, Hyperbolic Tangent
• Negative slope not supported for ReLU
• ElementWise Layer
- Operations supported: Sum, Product, Max, and Min
• Scale Layer
- Mode supported: Uniform, Per-Channel, and Elementwise
• LRN (Local Response Normalization) Layer
- Window size is configurable to 3, 5, 7, or 9
- Normalization region supported is: ACROSS_CHANNELS
• Concatenation Layer
- DLA supports concatenation only along the channel axis
DLA Supported Layers
NVDLA
| 33 |
[1] http://nvdla.org/primer.html
34. TensorRT를 이용해서 실행 가능
Trtexec tool: command line wrapper for TensorRT
랜덤 데이터에 대한 특정 네트웍을 벤치마킹하기 위한 도구로 해당 모델에
대한 serialized engine을 생성
계속해서 변경되므로 tensorRT release notes를 항상 확인
• useDLA -> useDLACore
• 1 to N이 아니라 0 to N-1
• trtexec는 아직 ONNX model을 DLA에서는 지원하지 않음
DLA 실행
NVDLA
| 34 |
[1] https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#dla_topic
35. AlexNet: ImageNet challenge 2012 winner
• GPU-INT8
- Average over 100 runs is 4.86918 ms (host walltime is 4.88175 ms, 99%
percentile time is 4.96976).
• GPU-FP16
- Average over 100 runs is 5.09872 ms (host walltime is 5.11733 ms, 99%
percentile time is 6.23514).
• GPU DLA=0, GPU fallback, FP16
- Average over 100 runs is 43.8821 ms (host walltime is 44.1185 ms, 99%
percentile time is 46.3073).
• GPU DLA=1, GPU fallback, FP16
- Average over 100 runs is 43.381 ms (host walltime is 43.5552 ms, 99%
percentile time is 43.9859).
AlexNet 실행
NVDLA
| 35 |
36. ResNet-50: https://github.com/KaimingHe/deep-residual-networks
• ImageNet challenge 2015 winner
• GPU-INT8
- Average over 100 runs is 7.36345 ms (host walltime is 7.38333 ms, 99%
percentile time is 8.55971).
• GPU-FP16
- Average over 100 runs is 12.3128 ms (host walltime is 12.3288 ms, 99%
percentile time is 14.1207).
• DLA0 and GPU fallback, FP16
- Average over 100 runs is 48.9775 ms (host walltime is 49.0705 ms, 99%
percentile time is 49.794).
• DLA1 and GPU fallback, FP16
- Average over 100 runs is 48.6207 ms (host walltime is 48.7205 ms, 99%
percentile time is 49.832).
ResNet
NVDLA
| 36 |
38. NVIDIA에서 제공하는 2일 수준의 데모 프로젝트
학습과 추론 과정 포함
$ git clone https://github.com/dusty-nv/jetson-inference
Two day a demo
유용한 튜토리얼 및 향후 연구
| 38 |
39. NeurIPS Expo 2018 - Session 3: Inference and Quantization[Link]
• Mixed Precision Networks
NVIDIA AT NeurIPS 2018, 2-8 Dec. 2018
유용한 튜토리얼 및 향후 연구
| 39 |
[1] https://www.nvidia.com/en-us/events/neurips/
[2] https://on-demand-gtc.gputechconf.com/gtcnew/on-demand-gtc.php
40. Auto-Tuner의 필요성
• 값의 범위와 빈도에 따라서 Quantization 맵핑을 최적화 [1]
• 레어이에 맞춰서 최적화 [TensorRTv5. NIPS2018 workshop]
• 모델에 따라서 precision 변환시 Calibration 과정에서 실패하는 경우가 있음
[TensorRT]
• Mixed Precision이 더 좋은 결과를 나타냄: NIPS 2018.12 workshop
기존 방법
• NVIDIA TensorRT
• Google Firebase의 Cloud AutoML의 내장 기능 (Alpha Test 진행 중)
- Custom On-Device ML Models with Learn2Compress
• 모두 비공개 기술
DLA (NPU) 문제
• 아직 까지는 많은 operation을 지원하지 않으므로 문제 발생
• Precision 처리 부분도 범용성이 낮아서 GPU 보다 문제 발생
• TensorRT가 버전이 올라가면서 점점 해결되는 중
- NPU 활용을 위해선 성숙된 SDK 필요
- GPU가 구조적으로는 불리할 수 있어도 소프트웨어 스택이 오랜 기간 동안 잘 구성되어
있으므로 다양한 모델을 최적으로 오류 없이 실행 가능함
단순히 NPU라고 하여 성능이 잘 나오진 않음
향후 연구
유용한 튜토리얼 및 향후 연구
| 40 |
[1] Value-aware Quantization for Training and Inference of Neural Networks, ECCV 2018