SlideShare a Scribd company logo
1 of 40
Download to read offline
Jetson AGX Xavier 소개 및 활용법
박사
이제민
https://leejaymin.github.io/index.html
목
차
보드 사양1
설정: Jetpack, TensorFlow2
YOLOv3 실행 및 최적화3
| 2 |
NVDLA4
유용한 튜토리얼 및 향후 연구5
• 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
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 |[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
목
차
보드 사양1
설정: Jetpack, TensorFlow2
YOLOv3 실행 및 최적화3
| 6 |
NVDLA4
유용한 튜토리얼 및 향후 연구5
버전: 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 |
(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 |
Jetpack에 포함된 기본 Samples
설정: Jetpack, TensorFlow
| 9 |
[1] https://elinux.org/Jetson_AGX_Xavier
VisionWorks: Feature Tracker Demo
설정: Jetpack, TensorFlow
| 10 |
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 |
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 |
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
수정: /etc/nvpmodel.conf
개인 모드 생성
설정: Jetpack, TensorFlow
| 14 |
[1] http://info.nvidia.com/rs/156-OFN-742/images/Jetson_AGX_Xavier_New_Era_Autonomous_Machines.pdf
jetson_clocks.sh
-- show
실행 모드
설정: Jetpack, TensorFlow
| 15 |
MNIST TF CNN 모델 학습 시간을 이용한 성능 확인
• https://github.com/leejaymin/TensorFlowLecture/tree/master/5.CNN
보드 성능 테스트
설정: Jetpack, TensorFlow
| 16 |
목
차
보드 사양1
설정: Jetpack, TensorFlow2
YOLOv3 실행 및 최적화3
| 17 |
NVDLA4
유용한 튜토리얼 및 향후 연구5
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 |
코드 및 웨이트 다운 (기존과 동일)
Makefile 수정
• OpenCV, GPU, cuDNN 모두 1로 설정
• -gencode arch=compute_72,code=[sm_72,compute_72]
컴파일
Yolov3 다운 및 컴파일
YOLOv3 실행 및 최적화
| 19 |
사용된 이미지: dog.jpg
• Xavier: 0.164729 sec
• Geforce-1080: 0.051647 sec
성능 테스트
YOLOv3 실행 및 최적화
| 20 |
./darknet detector demo cfg/coco.data cfg/yolov3.cfg
yolov3.weights traffic.mp4
Live demo
동영상 데모
YOLOv3 실행 및 최적화
| 21 |
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 |
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
Using TensorRT in TensorFlow (TF-TRT)
• tensorflow/tensorflow/contrib/tensorrt/
• https://github.com/tensorflow/tensorflow/tree/master/tensorflow/co
ntrib/tensorrt
TensorRT의 공개 범위
YOLOv3 실행 및 최적화
| 24 |
소스다운
• https://github.com/vat-nvidia/deepstream-plugins#note
• sources/apps/trt-yolo
설정
• yolo model weights를 다운 받음
data/yolo쪽으로 저장
Makefile.config
• CUDA_VER:=10.0
• PLATFORM:=Tegra
• cd source/apps/trt-yolo
make && sudo make install
• config/yolov3.txt
• trt-yolo-app --flagfile=./config/yolov3.txt
Trt-YOLOv3 실행
YOLOv3 실행 및 최적화
| 25 |
--network_type=yolov3
--config_file_path=data/yolo/yolov3.cfg
--wts_file_path=data/yolo/yolov3.weights
--labels_file_path=data/yolo/labels.txt
--precision= [kINT8, kHALF, kFLOAT]
--calibration_table_path=data/yolo/calibration/yolov3-calibration.table
--engine_file_path=
--print_prediction_info=true
--print_perf_info=true
--batch_size=4
--view_detections=true
--save_detections=true
--save_detections_path=data/yolo/detections/
--decode=false
--seed
./config/yolov3.txt 수정
YOLOv3 실행 및 최적화
| 26 |
FP32: full precision
YOLOv3 실행 및 최적화
| 27 |
FP16: half precision
YOLOv3 실행 및 최적화
| 28 |
목
차
보드 사양1
설정: Jetpack, TensorFlow2
YOLOv3 실행 및 최적화3
| 29 |
NVDLA4
유용한 튜토리얼 및 향후 연구5
엔비디아의 오픈소스 활동
NVDLA
| 30 |
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/
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
공통 제약
• 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
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
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 |
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 |
목
차
보드 사양1
설정: Jetpack, TensorFlow2
YOLOv3 실행 및 최적화3
| 37 |
NVDLA4
유용한 튜토리얼 및 향후 연구5
NVIDIA에서 제공하는 2일 수준의 데모 프로젝트
학습과 추론 과정 포함
$ git clone https://github.com/dusty-nv/jetson-inference
Two day a demo
유용한 튜토리얼 및 향후 연구
| 38 |
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
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

More Related Content

What's hot

Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
Rohit Joshi
 
TCAMのしくみ
TCAMのしくみTCAMのしくみ
TCAMのしくみ
ogatay
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
hugo lu
 

What's hot (20)

eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
 
Vivado hls勉強会1(基礎編)
Vivado hls勉強会1(基礎編)Vivado hls勉強会1(基礎編)
Vivado hls勉強会1(基礎編)
 
A Peek into TFRT
A Peek into TFRTA Peek into TFRT
A Peek into TFRT
 
Coding style for good synthesis
Coding style for good synthesisCoding style for good synthesis
Coding style for good synthesis
 
Interrupts on xv6
Interrupts on xv6Interrupts on xv6
Interrupts on xv6
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU DelegatesTFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
 
An Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAn Introduction to RISC-V bootflow
An Introduction to RISC-V bootflow
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)
 
CA presentation of multicore processor
CA presentation of multicore processorCA presentation of multicore processor
CA presentation of multicore processor
 
ARM Introduction.pptx
ARM Introduction.pptxARM Introduction.pptx
ARM Introduction.pptx
 
The Future of Operating Systems on RISC-V
The Future of Operating Systems on RISC-VThe Future of Operating Systems on RISC-V
The Future of Operating Systems on RISC-V
 
TCAMのしくみ
TCAMのしくみTCAMのしくみ
TCAMのしくみ
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
 
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
 
FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)FD.io Vector Packet Processing (VPP)
FD.io Vector Packet Processing (VPP)
 
Versatile tensor accelerator (vta) introduction and usage
Versatile tensor accelerator (vta) introduction and usage Versatile tensor accelerator (vta) introduction and usage
Versatile tensor accelerator (vta) introduction and usage
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology Tutorial
 
Vivado hls勉強会5(axi4 stream)
Vivado hls勉強会5(axi4 stream)Vivado hls勉強会5(axi4 stream)
Vivado hls勉強会5(axi4 stream)
 
Vivado hls勉強会3(axi4 lite slave)
Vivado hls勉強会3(axi4 lite slave)Vivado hls勉強会3(axi4 lite slave)
Vivado hls勉強会3(axi4 lite slave)
 

Similar to Jetson agx xavier and nvdla introduction and usage

[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
OpenStack Korea Community
 
2node cluster
2node cluster2node cluster
2node cluster
sprdd
 

Similar to Jetson agx xavier and nvdla introduction and usage (20)

Teratec Cluster
Teratec ClusterTeratec Cluster
Teratec Cluster
 
Pivot3 overview
Pivot3 overviewPivot3 overview
Pivot3 overview
 
한컴MDS_국산 RTOS NEOS 제품 및 적용 사례
한컴MDS_국산 RTOS NEOS 제품 및 적용 사례한컴MDS_국산 RTOS NEOS 제품 및 적용 사례
한컴MDS_국산 RTOS NEOS 제품 및 적용 사례
 
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
Auto Scalable 한 Deep Learning Production 을 위한 AI Serving Infra 구성 및 AI DevOps...
 
resource on openstack
 resource on openstack resource on openstack
resource on openstack
 
Dragon flow and tricircle
Dragon flow and tricircleDragon flow and tricircle
Dragon flow and tricircle
 
Image Deep Learning 실무적용
Image Deep Learning 실무적용Image Deep Learning 실무적용
Image Deep Learning 실무적용
 
[IBM 김상훈] AI 최적화 플랫폼 IBM AC922 소개와 활용 사례
[IBM 김상훈] AI 최적화 플랫폼 IBM AC922 소개와 활용 사례[IBM 김상훈] AI 최적화 플랫폼 IBM AC922 소개와 활용 사례
[IBM 김상훈] AI 최적화 플랫폼 IBM AC922 소개와 활용 사례
 
SDN - 2018 Zeropage Devil's Camp
SDN - 2018 Zeropage Devil's CampSDN - 2018 Zeropage Devil's Camp
SDN - 2018 Zeropage Devil's Camp
 
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
 
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
 
2nd SDN Interest Group Seminar-Session3 (121218)
2nd SDN Interest Group Seminar-Session3 (121218)2nd SDN Interest Group Seminar-Session3 (121218)
2nd SDN Interest Group Seminar-Session3 (121218)
 
cdit hci zerto '소통하는 세미나' 소개자료(201705)
cdit hci zerto '소통하는 세미나' 소개자료(201705)cdit hci zerto '소통하는 세미나' 소개자료(201705)
cdit hci zerto '소통하는 세미나' 소개자료(201705)
 
Kafka slideshare
Kafka   slideshareKafka   slideshare
Kafka slideshare
 
Infra as Code with Packer, Ansible and Terraform
Infra as Code with Packer, Ansible and TerraformInfra as Code with Packer, Ansible and Terraform
Infra as Code with Packer, Ansible and Terraform
 
XECon2015 :: [1-5] 김훈민 - 서버 운영자가 꼭 알아야 할 Docker
XECon2015 :: [1-5] 김훈민 - 서버 운영자가 꼭 알아야 할 DockerXECon2015 :: [1-5] 김훈민 - 서버 운영자가 꼭 알아야 할 Docker
XECon2015 :: [1-5] 김훈민 - 서버 운영자가 꼭 알아야 할 Docker
 
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
 
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
NDC14 모바일 게임서비스를 위한 사설 클라우드 구축/운영 분투기
 
3rd SDN Interest Group Seminar-Session 3 (130123)
3rd SDN Interest Group Seminar-Session 3 (130123)3rd SDN Interest Group Seminar-Session 3 (130123)
3rd SDN Interest Group Seminar-Session 3 (130123)
 
2node cluster
2node cluster2node cluster
2node cluster
 

More from jemin lee (6)

MobileViTv1
MobileViTv1MobileViTv1
MobileViTv1
 
HAWQ-V3: Dyadic Neural Network Quantization
HAWQ-V3: Dyadic Neural Network QuantizationHAWQ-V3: Dyadic Neural Network Quantization
HAWQ-V3: Dyadic Neural Network Quantization
 
Efficient execution of quantized deep learning models a compiler approach
Efficient execution of quantized deep learning models a compiler approachEfficient execution of quantized deep learning models a compiler approach
Efficient execution of quantized deep learning models a compiler approach
 
Integer quantization for deep learning inference: principles and empirical ev...
Integer quantization for deep learning inference: principles and empirical ev...Integer quantization for deep learning inference: principles and empirical ev...
Integer quantization for deep learning inference: principles and empirical ev...
 
MLPerf an industry standard benchmark suite for machine learning performance
MLPerf an industry standard benchmark suite for machine learning performanceMLPerf an industry standard benchmark suite for machine learning performance
MLPerf an industry standard benchmark suite for machine learning performance
 
PACT19, MOSAIC : Heterogeneity-, Communication-, and Constraint-Aware Model ...
PACT19, MOSAIC : Heterogeneity-, Communication-, and Constraint-Aware Model ...PACT19, MOSAIC : Heterogeneity-, Communication-, and Constraint-Aware Model ...
PACT19, MOSAIC : Heterogeneity-, Communication-, and Constraint-Aware Model ...
 

Jetson agx xavier and nvdla introduction and usage

  • 1. Jetson AGX Xavier 소개 및 활용법 박사 이제민 https://leejaymin.github.io/index.html
  • 2. 목 차 보드 사양1 설정: Jetpack, TensorFlow2 YOLOv3 실행 및 최적화3 | 2 | NVDLA4 유용한 튜토리얼 및 향후 연구5
  • 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
  • 6. 목 차 보드 사양1 설정: Jetpack, TensorFlow2 YOLOv3 실행 및 최적화3 | 6 | NVDLA4 유용한 튜토리얼 및 향후 연구5
  • 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
  • 10. VisionWorks: Feature Tracker Demo 설정: Jetpack, TensorFlow | 10 |
  • 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
  • 16. MNIST TF CNN 모델 학습 시간을 이용한 성능 확인 • https://github.com/leejaymin/TensorFlowLecture/tree/master/5.CNN 보드 성능 테스트 설정: Jetpack, TensorFlow | 16 |
  • 17. 목 차 보드 사양1 설정: Jetpack, TensorFlow2 YOLOv3 실행 및 최적화3 | 17 | NVDLA4 유용한 튜토리얼 및 향후 연구5
  • 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 |
  • 25. 소스다운 • https://github.com/vat-nvidia/deepstream-plugins#note • sources/apps/trt-yolo 설정 • yolo model weights를 다운 받음 data/yolo쪽으로 저장 Makefile.config • CUDA_VER:=10.0 • PLATFORM:=Tegra • cd source/apps/trt-yolo make && sudo make install • config/yolov3.txt • trt-yolo-app --flagfile=./config/yolov3.txt Trt-YOLOv3 실행 YOLOv3 실행 및 최적화 | 25 |
  • 26. --network_type=yolov3 --config_file_path=data/yolo/yolov3.cfg --wts_file_path=data/yolo/yolov3.weights --labels_file_path=data/yolo/labels.txt --precision= [kINT8, kHALF, kFLOAT] --calibration_table_path=data/yolo/calibration/yolov3-calibration.table --engine_file_path= --print_prediction_info=true --print_perf_info=true --batch_size=4 --view_detections=true --save_detections=true --save_detections_path=data/yolo/detections/ --decode=false --seed ./config/yolov3.txt 수정 YOLOv3 실행 및 최적화 | 26 |
  • 27. FP32: full precision YOLOv3 실행 및 최적화 | 27 |
  • 28. FP16: half precision YOLOv3 실행 및 최적화 | 28 |
  • 29. 목 차 보드 사양1 설정: Jetpack, TensorFlow2 YOLOv3 실행 및 최적화3 | 29 | NVDLA4 유용한 튜토리얼 및 향후 연구5
  • 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 |
  • 37. 목 차 보드 사양1 설정: Jetpack, TensorFlow2 YOLOv3 실행 및 최적화3 | 37 | NVDLA4 유용한 튜토리얼 및 향후 연구5
  • 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