34
© Copyright 2019 Xilinx Louis Liu Senior Application Engineer [email protected] Python Productivity for Zynq

Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

  • Upload
    others

  • View
    33

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Louis Liu

Senior Application Engineer

[email protected]

Python Productivity for Zynq

Page 2: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

PYNQ Python Productivity for Zynq

Targeting the data centerartificial intelligence,

machine learning,data science

New users are not hardware designers,or embedded systems designers

HardwareEngineers

Embedded softwareEngineers

Domain Experts

Enable more people to program Xilinx

processing platforms, more productively

>> 2

Page 3: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Productivity Languages & Hardware Overlays

Zynq / Zynq UltraScale+

Users:

Apps Programmers:

Device driver writers:

Kernel developers:

Programmers(embedded):

Embedded

Applications

Programmers

Python

Overlays

C/C++

Small group of experts create APSoC overlays and C API/drivers

Many more users build applications in C/Python

>> 3

Page 4: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Python is increasingly the Language of Choice

https://spectrum.ieee.org/at-work/innovation/the-2018-top-programming-languages

Top Programming Languages,IEEE Spectrum, July’17

Python is the fastest growing language: driven by data science, AI, ML and academia

Top Programming Languages,IEEE Spectrum, July’18

Python is listed as an

embedded language

for the first time

https://stackoverflow.blog/2017/09/06/incredible-growth-python/

Projected

https://stackoverflow.blog/2017/09/06/incredible-growth-python/

To date

>> 4

Page 5: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

PYNQ: Python productivity for Zynq

>> 5

Jupyter notebooks/lab,browser-based interface

PYNQ enables Jupyteron Zynq and ZU+

Ubuntu-based Linux

Jupyter web server

IPython kernel

PS: ARM

Overlays/designs

PL: Fabric

Hardware drivers wrappedin Python libraries

Optimized for developer productivity

All the Linux libraries and drivers you expect

Pre-built SD image

Ubuntu/Debian ecosystem & community

110,000,000 Google hits

Page 6: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

IPython Notebooks to Jupyter Notebooks

>> 6

Jupyter … Julia, Python, R

Default engine of data science

Taught to 1,000+ Berkeleystudents every semester

2+ million notebookson GitHub

Jupyter notebooks Visualization

TerminalCode editor

Jupyter Notebooks to JupyterLab IDE

Next-gen browser IDE

Includes Jupyter Notebooks

2017 ACM

Software System Award

Page 7: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

PYNQ’s Ubuntu-based Linux

>> 7

Kernel, Bootloader

Ubuntu Root File System

PYNQ’s

Ubuntu-based Linux

Python

Packages

Dev

Tools

PYNQ 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

Ubuntu/

Debian

Packages

Package

Manager/

Repository

PYNQ uses Ubuntu’s:

• Root file system (RFS)

• Package manager (apt-get)

• Repositories

PYNQ bundles :

• Development tools

• Cross-compilers

• Latest Python packages

Page 8: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Ubuntu-based Linux versus embedded Linux

>> 8

Embedded Linux

Ubuntu-based Linux

Optimized for deployment efficiency

Selective Linux libraries and drivers

Commonly delivered in flash memory on board

PetaLinux ecosystem:

143,000 Google hits

Optimized for developer productivity

All the Linux libraries and drivers you expect

Pre-built SD card image

Ubuntu/Debian ecosystem & community

145,000,000 Google hits

3 orders of magnitude difference

Page 9: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Hundreds Overlays in PYNQ Community- Need your contributions too

>> 9

Page 10: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

PYNQ provides Linux Drivers for PS-PL Interfaces …

>> 10

1 532 4

wrapped in Python Libraries

1

2

3

4

5

Zynq

Page 11: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

How MMIO works

>> 11

Page 12: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

is a Framework - The key of productivity is the Unified

API

APIs

Drivers

Bitstreams

AppsJupyter/

IPython

Linux kernel

Python

FPGA

Overlay

xdevcfg sysgpio uio

numpy opencvscikit-learnmatplotlib

devmem

dma

GPIOPL Interrupt

axi_intc

PYNQ notebooks

PYNQ libs

XLNK

xlnk

libsds.soMMIO

PYNQ IPs

PYNQ overlays

User designs

>> 12

video audio

pynqmicroblaze

axi_gpio

Page 13: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Software-style packaging & distribution of designsEnabled by new hybrid libraries

>> 13

xDNN, A. Sirasao et al OpenCV, K. Denolf et alIIoT, C. Fritsch et alQNN, M. Blott et al

Download a design from GitHub with a single Python command:

pip install git+https://github.com/Xilinx/pynqDL.git

Page 14: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Loading a design into Zynq using PYNQ

>> 14

from pynq import Overlayresizer = Overlay(‘./resizer.bit’)

PYNQ automatically configures many design parameters

based on data parsed from hybrid library

1

2

3

4

5

Page 15: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx>> 15

Page 16: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Realtime and Graphic analysis

>> 16

Page 17: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

How Python helps, really a lot..

>> 17

Page 18: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Ecosystem Advantage: there’s a Library for that…

CPython is written in C … and most popular C/C++ frameworks have Python libraries>> 18

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 …

Page 19: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Base Python libraries used for all Use Case

>> 19

A Matlab™ like

framework for

numerical computing.

2D plotting library

for static and

interactive data

visualizations

Data wrangling for

easy-to-use data

ingestion,

transformation,

and export

functions

Acquire,

Transform,

Organize,

Display

Page 20: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

What is NumPy

˃ NumPy is the fundamental package for scientific computing with Python. It

contains among other things:

a powerful N-dimensional array object

sophisticated (broadcasting) functions

tools for integrating C/C++ and Fortran code

useful 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.

Page 21: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

How Numpy interacts with Programmable Logic?

Contiguous Array

in DDR Memory

Shared Object Physical memoryPhysical memory

Array, Matrix

Virtual memory

Xlnk

Hard Real Time

Offload CPU and OS

Dedicated “Accelerator”

PL

A

X

I

H

P

Page 22: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Provide a Numpy Array (or Arrays) with collected dataOr Pandas structure

>> 22

Your Job is done

Customer can take from it

Page 23: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Connect other Python Libraries -

Quick Prototyping

Embedded Acceleration

OVERLAYS

RTL Acceleration

Page 24: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Edge-to-cloud co-design

>> 25

Common JupyterLab tooling at edge and cloud

PYNQ enables ML experts

and radio engineers

to 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

Page 25: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

AWS IoT Greengrass(Base on MQTT)

>> 26

Page 26: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

RF_QPSK Demo

>> 27

Page 27: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Student contest designs base on PYNQMore and more are on the way

>> 28

Page 28: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© 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

• Academic discounts & donations

available

>> 29

$119 to everyone in US

Page 29: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

PYNQ on other Boards

Page

30

Page 30: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Next steps: scaling across platforms and domains

>> 31

Page 31: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Efficient porting PYNQ to any Zynq-based platform

Page 32

PetaLinux build

tools/BSP

Available for any Xilinx-supported board;

Instructions for building for custom boards available1

PYNQ Software Core

(board independent)

Pre-built images available

Expected to take less than 1 day to port 2

Target-specific PYNQ

components

Board-specific porting

Common interfaces available for re-use3

Page 32: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

http://www.pynq.io

>> 33

Page 33: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

New open source HLS book

Reply “pp4fpgas” in wechat console

>> 34

http://kastner.ucsd.edu/hlsbook/

Page 34: Python Productivity for Zynq · Title: Python Productivity for Zynq Author: Xilinx Created Date: 4/23/2019 6:44:53 PM

© Copyright 2019 Xilinx

Adaptable.

Intelligent.