Python Productivity For Zynq - Xilinx

Transcription

Python Productivity for ZynqLouis LiuSenior Application Engineerweli@xilinx.com Copyright 2019 Xilinx

PYNQ Python Productivity for ZynqTargeting the data centerartificial intelligence,machine learning,data scienceDomainExpertsEmbedded softwareEngineersHardwareEngineers 2New users are not hardware designers,or embedded systems designersEnable more people to program Xilinxprocessing platforms, more productively Copyright 2019 Xilinx

Productivity Languages & Hardware OverlaysZynq / Zynq UltraScale Users:Apps mers(embedded):PythonDevice driver writers:C/C Kernel developers:OverlaysSmall group of experts create APSoC overlays and C API/driversMany more users build applications in C/Python 3 Copyright 2019 Xilinx

Python is increasingly the Language of ChoiceTop Programming Languages,July’17IEEE Spectrum, July’18ProjectedTo datePython is listed as anembedded languagefor the first on is the fastest growing language: driven by data science, AI, ML and academia 4 Copyright 2019 Xilinx

PYNQ: Python productivity for ZynqPYNQ enables Jupyteron Zynq and ZU Jupyter notebooks/lab,browser-based interfaceJupyter webserverIPython kernelHardware drivers wrappedin Python librariesUbuntu-basedLinuxOverlays/designsPS: ARMPL: FabricOptimized for developer productivityAll the Linux libraries and drivers you expectPre-built SD imageUbuntu/Debian ecosystem & community110,000,000 Google hits 5 Copyright 2019 Xilinx

Jupyter Notebooks to JupyterLabIDEIPythonJupyter NotebooksCode editorTerminal2017 ACMSoftware System AwardJupyter Julia, Python, RDefault engine of data scienceTaught to 1,000 Berkeleystudents every semester2 million notebookson GitHubNext-gen browser IDEJupyter notebooks 6Visualization Copyright 2019 XilinxIncludes Jupyter Notebooks

PYNQ’s Ubuntu-based LinuxPYNQ uses Ubuntu’s: Root file system (RFS) Package manager (apt-get) RepositoriesPackageManager/RepositoryPYNQ bundles : Development tools Cross-compilers Latest Python sUbuntu Root File SystemKernel, BootloaderPYNQ uses the PetaLinux build flow and board support package: Access to all Xilinx kernel patches Works with any Xilinx supported board Configured with additional drivers for PS-PL interfaces 7 Copyright 2019 XilinxPYNQ’sUbuntu-based Linux

Ubuntu-based Linux versus embedded LinuxUbuntu-based LinuxOptimized for developer productivityAll the Linux libraries and drivers you expectPre-built SD card imageUbuntu/Debian ecosystem & community145,000,000 Google hitsEmbedded LinuxOptimized for deployment efficiencySelective Linux libraries and drivers3 orders of magnitude differenceCommonly delivered in flash memory on boardPetaLinux ecosystem:143,000 Google hits 8 Copyright 2019 Xilinx

Hundreds Overlays in PYNQ Community- Need your contributions too 9 Copyright 2019 Xilinx

PYNQ provides Linux Drivers for PS-PL Interfaces wrapped in Python LibrariesZynq123415 10 Copyright 2019 Xilinx2345

How MMIO works 11 Copyright 2019 Xilinx

is a Framework- The key of productivity is the UnifiedAPIJupyter/IPythonPYNQ PYNQ libsPythonOverlayopencvaxi .soxdevcfgsysgpiouiodevmemxlnkLinux kernelAPIsDriversaxi intcUser designsFPGAPYNQ overlaysPYNQ IPs 12 Copyright 2019 XilinxBitstreams

Software-style packaging & distribution of designsEnabled by new hybrid librariesDownload a design from GitHub with a single Python command:QNN, M.pipBlott etinstallalIIoT,C. Fritsch et alxDNN, A. Sirasao et alOpenCV, K. Denolf et algit https://github.com/Xilinx/pynqDL.git 13 Copyright 2019 Xilinx

Loading a design into Zynq using PYNQfrom pynq import Overlayresizer Overlay(‘./resizer.bit’)12345PYNQ automatically configures many design parametersbased on data parsed from hybrid library 14 Copyright 2019 Xilinx

15 Copyright 2019 Xilinx

Realtime and Graphic analysis 16 Copyright 2019 Xilinx

How Python helps, really a lot. 17 Copyright 2019 Xilinx

Ecosystem Advantage: there’s a Library for that Standard Python comes with comprehensive libraries for common operations (web, regex, os, etc)In addition to this ‘batteries included’ strategy, there is a massive external ecosystem CPython is written in C and most popular C/C frameworks have Python libraries 18 Copyright 2019 Xilinx

Base Python libraries used for all Use CaseA Matlab likeframework fornumerical computing. 192D plotting libraryfor static andinteractive datavisualizationsData wrangling foreasy-to-use dataingestion,transformation,and exportfunctions Copyright 2019 XilinxAcquire,Transform,Organize,Display

What is NumPy NumPy is the fundamental package for scientific computing with Python. Itcontains among other things:a powerful N-dimensional array objectsophisticated (broadcasting) functionstools for integrating C/C and Fortran codeuseful linear algebra, Fourier transform NumPy can also be used as:An efficient multi-dimensional container of generic data.Arbitrary data-types can be defined.This allows NumPy to seamlessly and speedily integrate with a wide variety of databases. Copyright 2019 Xilinx

How Numpy interacts with Programmable Logic?Array, MatrixHard Real TimeOffload CPU and OSDedicated “Accelerator”Virtual memoryXlnkPhysical memoryContiguous Arrayin DDR MemoryShared ObjectPhysical memoryAXIHP Copyright 2019 XilinxPL

Provide a Numpy Array (or Arrays) with collected dataOr Pandas structureYour Job is doneCustomer can take from it 22 Copyright 2019 Xilinx

Connect other Python Libraries -Quick PrototypingEmbedded AccelerationOVERLAYSRTL Acceleration Copyright 2019 Xilinx

Edge-to-cloud co-designCommon JupyterLab tooling at edge and cloudPYNQ enables ML expertsand radio engineersto focus on their ‘value-add’Edge-to-cloud co-design trade-offs: Maximize on-chip processing Minimize edge-to-cloud data exchange Exploit scalability of cloud processing Aggregate intelligence between and across multiple edge nodes Co-optimize the above for best system performance 25 Copyright 2019 Xilinx

AWS IoT Greengrass(Base on MQTT) 26 Copyright 2019 Xilinx

RF QPSK Demo 27 Copyright 2019 Xilinx

Student contest designs base on PYNQMore and more are on the way 28 Copyright 2019 Xilinx

PYNQ-Z2 Board-design for starter New PYNQ reference platform New stereo audio with on-board codec New Raspberry Pi connector Open source design Z2 manufactured in Taiwan by TUL Distributed globally by Premier Farnell Also Newegg in US 119 to everyone in US Academic discounts & donationsavailable 29 Copyright 2019 Xilinx

PYNQ on other BoardsPage30

Next steps: scaling across platforms and domains 31 Copyright 2019 Xilinx

Efficient porting PYNQ to any Zynq-based platform3Target-specific PYNQcomponentsBoard-specific portingCommon interfaces available for re-use2PYNQ Software Core(board independent)Pre-built images availableExpected to take less than 1 day to port1PetaLinux buildtools/BSPPage 32Available for any Xilinx-supported board;Instructions for building for custom boards available Copyright 2019 Xilinx

http://www.pynq.io 33 Copyright 2019 Xilinx

New open source HLS bookReply “pp4fpgas” in wechat consolehttp://kastner.ucsd.edu/hlsbook/ 34 Copyright 2019 Xilinx

Adaptable.Intelligent. Copyright 2019 Xilinx

PYNQ: Python productivity for Zynq 5 Jupyter notebooks/lab, browser-based interface PYNQ enables Jupyter on Zynq and ZU Ubuntu-based Linux Jupyter web server IPython kernel PS: ARM Overlays/designs PL: Fabric Hardware drivers wrapped in Python libraries Optimized for developer productivity All the Linux libraries and drivers you expect Pre .