logo资料库

ug1327-dnndk-user-guide.pdf

第1页 / 共147页
第2页 / 共147页
第3页 / 共147页
第4页 / 共147页
第5页 / 共147页
第6页 / 共147页
第7页 / 共147页
第8页 / 共147页
资料共147页,剩余部分请下载后查看
DNNDK User Guide
Revision History
Table of Contents
Ch. 1: Quick Start
Downloading DNNDK
Setting Up the Host
Installing the GPU Platform Software
Caffe Version: Installing Dependent Libraries
TensorFlow Version: Installing with Anaconda
Installing the DNNDK Host Tools
Setting Up the Evaluation Board
Supported Evaluation Boards
Setting Up the Ultra96 Board
Setting Up the ZCU102 Evaluation Board
Setting Up the ZCU104 Evaluation Board
Flash the OS Image to the SD Card
Booting the Evaluation Board
Accessing the Evaluation Board
Configuring UART
Using the Ethernet Interface
Using the ZCU102 as a Standalone Embedded System
Copying DNNDK Tools to the Evaluation Board
Support
Ch. 2: Copyright and Version
Copyright
Version
Host Package
Ultra96 Board Version Information
ZCU102 Board Version Information
ZCU104 Board Version Information
Target Package
Ultra96 Component Versions
ZCU102 Component Versions
ZCU104 Component Versions
Ch. 3: Upgrading and Porting
Since v3.0
Toolchain Changes
DECENT
DNNC
Example Changes
Since v2.08
Toolchain Changes
DECENT
DNNC
Exception Handling Changes
API Changes
Example Changes
Since v2.07
Toolchain Changes
DNNC
Since v2.06
Toolchain Changes
DECENT
DNNC
DExplorer
Changes in API
Example Changes
Since v1.10
Toolchain Changes
DECENT
DNNC
DExplorer
DSight
Changes in API
New API
Changed API
Upgrading from Previous Versions
From v1.10 to v2.06
From v1.07 to v1.10
Ch. 4: DNNDK
Overview
Deep-Learning Processor Unit
DNNDK Framework
DECENT
DNNC
N2Cube
DNNAS
Profiler
Ch. 5: Network Deployment Overview
Overview
Network Compression (Caffe Version)
Network Compression (TensorFlow Version)
Network Compilation
Compiling Caffe ResNet-50
Compiling TensorFlow ResNet-50
Output Kernels
Programming with DNNDK
Compiling the Hybrid Executable
Running the Application
Ch. 6: Network Compression
DECENT Overview
DECENT Working Flow
DECENT (Caffe Version) Usage
DECENT (Caffe Version) Working Flow
Prepare the Neural Network Model
Run DECENT
Output
DECENT (TensorFlow Version) Usage
Preparing the Neural Network Model
How to Get the Frozen Graph
How to Get the Calibration Dataset and Input Function
Pre-Defined Input Function
Run DECENT_Q
Output
Ch. 7: Network Compilation
DNNC Overview
Using DNNC
DNNC Options
DNNC Compilation Mode
Compiling ResNet50
Ch. 8: Programming with DNNDK
Programming Model
DPU Kernel
DPU Task
DPU Node
DPU Tensor
Programming Interface
Ch. 9: Hybrid Compilation
Ch. 10: Running
Ch. 11: Utilities
DExplorer
Check DNNDK version
Check DPU status
Configure DPU Running Mode
Normal Mode
Profile Mode
Debug Mode
DPU Signature
DSight
Ch. 12: Programming APIs
Library libn2cube
Overview
APIs
dpuOpen()
dpuClose()
dpuLoadKernel()
dpuDestroyKernel()
dpuCreateTask()
dpuDestroyTask()
dpuRunTask()
dpuEnableTaskProfile()
dpuEnableTaskDump()
dpuGetTaskProfile()
dpuGetNodeProfile()
dpuGetInputTensorCnt()
dpuGetInputTensor()
dpuGetInputTensorAddress()
dpuGetInputTensorSize()
dpuGetInputTensorScale()
dpuGetInputTensorHeight()
dpuGetInputTensorWidth()
dpuGetInputTensorChannel()
dpuGetOutputTensorCnt()
dpuGetOutputTensor()
dpuGetOutputTensorAddress()
dpuGetOutputTensorSize()
dpuGetOutputTensorScale()
dpuGetOutputTensorHeight()
dpuGetOutputTensorWidth()
dpuGetOutputTensorChannel()
dpuGetTensorSize()
dpuGetTensorScale()
dpuGetTensorHeight()
dpuGetTensorWidth()
dpuGetTensorChannel()
dpuSetInputTensorInCHWInt8()
dpuSetInputTensorInCHWFP32()
dpuSetInputTensorInHWCInt8()
dpuSetInputTensorInHWCFP32()
dpuGetOutputTensorInCHWInt8()
dpuGetOutputTensorInCHWFP32()
dpuGetOutputTensorInHWCInt8()
dpuGetOutputTensorInHWCFP32()
dpuRunSoftmax()
dpuSetExceptionMode()
dpuGetExceptionMode()
dpuGetExceptionMessage()
Library libdputils
Overview
APIs
dpuSetInputImage()
dpuSetInputImage2()
dpuSetInputImageWithScale()
Appx. A: Legal Notices
Please Read: Important Legal Notices
DNNDK User Guide UG1327 (v1.5) June 7, 2019
Revision History The following table shows the revision history for this document. Section Revision Summary 06/07/2019 Version 1.5 Chapter 1: Quick Start • Updated the example package name for the DNNDK v3.0 release. • Added a note in the Installing the DNNDK Host Tools section. • Updated Figure 2. Chapter 2: Copyright and Version • Updated board information. • Updated component version information. Chapter 7: Network Compilation • Updated the --dpu parameter description. 04/29/2019 Version 1.4 Chapter 1: Quick Start • Removed all content related to DP-8020 and DP-N1 boards. • Updated installation information; added installing TensorFlow version details. • Updated information for Ultra96, ZCU102, and ZCU104 boards. • Removed DNNDK examples. Chapter 2: Copyright and Version • Updated board information. • Updated component version information. Chapter 3: Upgrading and Porting • Added information about Upgrading from v3.0. Chapter 5: Network Deployment Overview • Added TensorFlow model information. • Added information about network compression for TensorFlow version. • Added content about compiling Caffe ResNet-50 and TensorFlow ResNet-50. • Updated Output Kernels. • Updated Programming with DNNDK. Chapter 6: Network Compression • Updated DECENT Working Flow. • Updated information about using DECENT for Caffe version. • Added information about DECENT_Q for TensorFlow version. Chapter 7: Network Compilation • Updated information about using DNNC with both deployment and dummy compilation modes. • Updated details about compiling ResNet50. DNNDK User Guide UG1327 (v1.5) June 7, 2019 2 Send Feedback
Chapter 12: Programming APIs Added v2.06 information to the following APIs: • dpuSetInputTensorInCHWInt8() • dpuSetInputTensorInCHWFP32() • dpuSetInputTensorInHWCInt8() • dpuSetInputTensorInHWCFP32() • dpuGetOutputTensorInCHWFP32() • dpuGetOutputTensorInHWCInt8() • dpuGetOutputTensorInHWCFP32() • dpuSetInputImage() • dpuSetInputImage2() 02/28/2019 Version 1.3 Downloading DNNDK Setting Up the Host Chapter 3: Upgrading and Porting Added DNNDK support for non-GPU host machines. Network Compression DECENT Overview Downloading DNNDK 02/19/2019 Version 1.2 Setting Up the Evaluation Board Updated links to Xilinx product page with information about Setting Up the DP-8020 Evaluation Board DNNDK-supported evaluation boards. Setting Up the DP-N1 Board Setting Up the Host General updates 02/07/2019 Version 1.1 Updated information. Added liability notice. 01/22/2019 Version 1.0 Initial Xilinx release. DNNDK User Guide UG1327 (v1.5) June 7, 2019 3 Send Feedback
Table of Contents Revision History .......................................................................................................................................................................... 2 Table of Contents ........................................................................................................................................................................... 4 Chapter 1: Quick Start ................................................................................................................................................................... 6 Downloading DNNDK .............................................................................................................................................................. 6 Setting Up the Host .................................................................................................................................................................. 7 Setting Up the Evaluation Board .......................................................................................................................................... 9 Support ....................................................................................................................................................................................... 21 Chapter 2: Copyright and Version ......................................................................................................................................... 22 Copyright ................................................................................................................................................................................... 22 Version ........................................................................................................................................................................................ 22 Chapter 3: Upgrading and Porting........................................................................................................................................ 25 Since v3.0 ................................................................................................................................................................................... 25 Since v2.08 ................................................................................................................................................................................. 26 Since v2.07 ................................................................................................................................................................................. 27 Since v2.06 ................................................................................................................................................................................. 28 Since v1.10 ................................................................................................................................................................................. 29 Upgrading from Previous Versions .................................................................................................................................. 30 Chapter 4: DNNDK ...................................................................................................................................................................... 32 Overview ..................................................................................................................................................................................... 32 Deep-Learning Processor Unit ........................................................................................................................................... 33 DNNDK Framework ................................................................................................................................................................ 34 Chapter 5: Network Deployment Overview ....................................................................................................................... 36 Overview ..................................................................................................................................................................................... 36 Network Compression (Caffe Version) ............................................................................................................................ 37 Network Compression (TensorFlow Version) ............................................................................................................... 38 Network Compilation ............................................................................................................................................................ 39 Programming with DNNDK ................................................................................................................................................. 42 Compiling the Hybrid Executable ..................................................................................................................................... 43 DNNDK User Guide UG1327 (v1.5) June 7, 2019 4 Send Feedback
Table of Contents Running the Application ...................................................................................................................................................... 43 Chapter 6: Network Compression ......................................................................................................................................... 44 DECENT Overview ................................................................................................................................................................... 44 DECENT Working Flow .......................................................................................................................................................... 45 DECENT (Caffe Version) Usage .......................................................................................................................................... 46 DECENT (Caffe Version) Working Flow ........................................................................................................................... 47 DECENT (TensorFlow Version) Usage .............................................................................................................................. 48 Chapter 7: Network Compilation ........................................................................................................................................... 54 DNNC Overview ....................................................................................................................................................................... 54 Using DNNC .............................................................................................................................................................................. 54 Compiling ResNet50 .............................................................................................................................................................. 57 Chapter 8: Programming with DNNDK ............................................................................................................................... 60 Programming Model ............................................................................................................................................................. 60 Programming Interface ......................................................................................................................................................... 62 Chapter 9: Hybrid Compilation............................................................................................................................................... 63 Chapter 10: Running ................................................................................................................................................................... 64 Chapter 11: Utilities..................................................................................................................................................................... 65 DExplorer .................................................................................................................................................................................... 65 DSight .......................................................................................................................................................................................... 68 Chapter 12: Programming APIs .............................................................................................................................................. 70 Library libn2cube ..................................................................................................................................................................... 70 Library libdputils .................................................................................................................................................................... 138 Legal Notices ............................................................................................................................................................................... 147 Please Read: Important Legal Notices .......................................................................................................................... 147 DNNDK User Guide UG1327 (v1.5) June 7, 2019 5 Send Feedback
Chapter 1: Quick Start Downloading DNNDK The Deep Neural Network Development Kit (DNNDK) package can be freely downloaded after registration from the Xilinx website: https://www.xilinx.com/products/design-tools/ai-inference/edge-ai- platform.html. Using a DNNDK-supported evaluation board is recommended to allow you to become familiar with the DNNDK toolchain. Refer to https://www.xilinx.com/products/design-tools/ai-inference/ai-developer- hub.html#edge for more details about the DNNDK-supported evaluation boards. The package name for the DNNDK v3.0 release is xilinx_dnndk_v3.0_yymm.tar.gz, in which yy is the year and mm is the month. For example, the current released package name is xilinx_dnndk_v3.0_1905.tar.gz. The directory structure for the DNNDK release package is shown in the following figure. In the rest of this document, $dnndk_pkg is used to represent the name of xilinx_dnndk_v3.0 for simplicity. The evaluation boards supported for this release are: • Xilinx® ZCU102 • Xilinx ZCU104 • Avnet Ultra96 The host_x86 folder contains files that need to be copied to the host computer running the 64-bit version of Ubuntu 14.04 LTS or Ubuntu 16.04 LTS. The folder contains files to be used on the evaluation board. The actual name of the folder corresponds to the DNNDK-supported boards: Ultra96, ZCU102, or ZCU104. Utility tools, Deep- learning Processor Unit (DPU) drivers, DPU runtime and development libraries are device-specific, and will be different for the various boards. DNNDK User Guide UG1327 (v1.5) June 7, 2019 6 Send Feedback
$dnndk_pkg Chapter 1: Quick Start | -- install.sh | -- models | -- pkgs |-- ubuntu14.04 |-- ubuntu16.04 | -- COPYRIGHT | -- host_x86 | | | | | | -- board_name | -- install.sh | -- pkgs | -- | -- bin | -- | -- driver | -- | -- include | -- | -- lib Setting Up the Host The “host_x86” folder contains the Deep Compression Tool (DECENT) and Deep Neural Network Compiler (DNNC) host tools, which allow neural networks to be optimized and accelerated on the DPU inference engine. IMPORTANT: Carefully read the capitalized text that follows. NOTICE: BY RUNNING THE COMMAND BELOW, YOU WILL CAUSE TO BE DOWNLOADED AND INSTALLED ON YOUR MACHINE CERTAIN THIRD-PARTY OPEN SOURCE SOFTWARE GOVERNED EXCLUSIVELY BY OPEN SOURCE LICENSES. BY RUNNING THE COMMAND BELOW AND DOWNLOADING AND USING THE THIRD- PARTY OPEN SOURCE SOFTWARE, YOU AGREE ON BEHALF OF YOURSELF AND YOUR EMPLOYER (IF APPLICABLE) TO BE BOUND BY THIS INFORMATION AND THE OPEN SOURCE LICENSE AGREEMENTS APPLICABLE TO THE SPECIFIC THIRD-PARTY SOFTWARE INSTALLED ON YOUR MACHINE. IF YOU OR YOUR EMPLOYER DO NOT AGREE TO ALL OF THE INFORMATION AND APPLICABLE OPEN SOURCE LICENSE AGREEMENTS, DO NOT RUN THIS COMMAND. THE LIST OF THIRD-PARTY OPEN SOURCE SOFTWARE, AND THE COMMAND IS MADE AVAILABLE “AS-IS” AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE. XILINX SHALL NOT BE LIABLE (WHETHER IN CONTRACT OR TORT, INCLUDING NEGLIGENCE, OR UNDER ANY OTHER THEORY OF LIABILITY) FOR ANY LOSS OR DAMAGE OF ANY KIND OR NATURE RELATED TO, ARISING UNDER, OR IN CONNECTION WITH, YOUR USE OF THIS THIRD-PARTY OPEN SOURCE SOFTWARE (INCLUDING YOUR USE OF THE COMMAND), INCLUDING FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL LOSS OR DAMAGE (INCLUDING LOSS OF DATA, PROFITS, GOODWILL, OR ANY TYPE OF LOSS OR DAMAGE SUFFERED AS A RESULT OF ANY ACTION BROUGHT BY A THIRD PARTY) EVEN IF SUCH DAMAGE OR LOSS WAS REASONABLY FORESEEABLE OR XILINX HAD BEEN ADVISED OF THE POSSIBILITY OF THE SAME. DNNDK User Guide UG1327 (v1.5) June 7, 2019 7 Send Feedback
Chapter 1: Quick Start Installing the GPU Platform Software The current DNNDK release can be used on the X86 host machine with or without GPU. With GPU support, DECENT is able to run faster. If GPU is available in the X86 host machine, install the necessary GPU platform software in accordance with your GPU product documentation. Ensure all versions are compatible with the version of DNNDK. For questions, contact your account manager or submit a support case to https://www.xilinx.com. Caffe Version: Installing Dependent Libraries Run the following command to install the dependent libraries required by Caffe v1.0. $ apt-get install -y --force-yes build-essential autoconf libtool libopenblas- dev libgflags-dev libgoogle-glog-dev libopencv-dev protobuf-compiler libleveldb- dev liblmdb-dev libhdf5-dev libsnappy-dev libboost-all-dev libssl-dev TensorFlow Version: Installing with Anaconda The DECENT_Q for TensorFlow supports operating system of Ubuntu 14.04 and 16.04 platforms, and have both CPU and GPU versions. Xilinx provides installation packages for common environments listed below, users can download the right package. If you are working under other environments, contact Xilinx. Table 1: Supported 64-bit Host OS Platforms and Required Packages OS Platform Version Required Packages Ubuntu 14.04 LTS GPU CUDA 8.0 (GA2), cuDNN 7.0.5 CPU Only None GPU Ubuntu 16.04 LTS CUDA 9.0, cuDNN 7.0.5 CUDA 9.0, cuDNN 7.0.5 CPU Only None Python Package Name 2.7 3.6 2.7 3.6 2.7 3.6 2.7 3.6 tensorflow_gpu-1.9.0-cp27-cp27mu-linux_x86_64.whl tensorflow_gpu-1.9.0-cp36-cp36m-linux_x86_64.whl tensorflow-1.9.0-cp27-cp27mu-linux_x86_64.whl tensorflow-1.9.0-cp36-cp36m-linux_x86_64.whl tensorflow_gpu-1.9.0-cp27-cp27mu-linux_x86_64.whl tensorflow_gpu-1.9.0-cp36-cp36m-linux_x86_64.whl tensorflow-1.9.0-cp27-cp27mu-linux_x86_64.whl tensorflow-1.9.0-cp36-cp36m-linux_x86_64.whl DNNDK User Guide UG1327 (v1.5) June 7, 2019 8 Send Feedback
分享到:
收藏