PyCompArch: Python-Based Modules for Exploring Computer Architecture Concepts Dan Connors, Kyle Dunn, Ryan Bueter Department of Electrical Engineering University of Colorado Denver Workshop on Computer Architecture Education 2015
PyCompArch: Python-Based Modules for Exploring Computer Architecture
Concepts
Dan Connors, Kyle Dunn, Ryan Bueter Department of Electrical Engineering
University of Colorado Denver
Workshop on Computer Architecture Education 2015
Overview
Ø Motivation Ø IPython Notebook Ø PyCompArch Concept Notebooks Ø Multiprocessing: Mandelbrot, Amdahl’s, Speedup,
and Efficiency Ø ParallelSchedule: Job Scheduling Ø Synthetic Speedup: Interactive Ø PyCompArch Concept Notebooks Ø Dynamic frequency scaling Ø Computer Vision (CV) Ø Code Box
Motivation
Ø Visualization of concepts of parallelism Ø Explore concepts from learner’s perspective versus
single static graph of parameters Ø Explore/perform experiments on hands-on devices Ø Raspberry PI Ø Streamline collection, comparison, and visualization
IPython Notebook Overview Ø The IPython Notebook is a
web-based interactive computational environment
Ø A well-structured code development environment
Ø A framework for observing and recording and results of code execution
Ø Linking text such as comments, equation generators for mathematics
Ø Embedded plots and other rich media formatting options
Ø The cloud coding advantage is that the IPython Notebook Viewer renders the code as a web page and users can read and interact with a remote system without having to install anything on their device.
Ø Changes can be rolled back also, encouraging experimentation without creating excessive copies of source material
At Scale Learning – MOOC
Example: Jupyter (www.jupyter.org) 5
PyCompArch
Matplotlib
Visualization
Raspberry Pi Explore
Collect Results
DVFS
Concepts Explore
Code Box
Parallel
Amdahl’s Law
Parameters
Python
Ø IPython Notebooks Ø Interactive lectures Ø Code and see: embed visualization of parallel
performance trade-offs Ø Assignment template
Ø Related work: ISCA 2015 Workshop PyMTL and Pydgin Tutorial: Python Frameworks for Highly Productive Computer Architecture Research Ø PyMTL is a hardware modeling framework Ø Pydgin is a framework for rapidly developing
instruction-set simulators (ISSs) from a Python-based architecture description language.
IPython
Ø Computer Architecture Concepts - Python Parallelism Ø Multithreading and multiprocessing support Ø Speedup and efficiency Ø Amdahl’s law Ø Overhead
Ø Explore Experiments Ø Benchmarking (Example: OpenCV) Ø Collecting, displaying, and comparing results Ø Dynamic frequency scaling on Raspberry Pi
Mandelbrot Calculation : Block Size
Ø Overhead of work assignment
Parallelism – Python’s Multiprocessing Module
Speedup and Efficiency
Base Graph
Parallelism Exploration
Slider control in IPython figure
Parallel Exploration
Ø Serial fraction
Ø Overhead
Execution Time
Speedup
Efficiency
Amdahl Law’s Evaluation
Amdahl Law’s Evaluation
Single Job Timeline
Parallel Job Scheduling Timeline (8 cores)
Worker Workload Summary
Computer Architecture Education and Raspberry PI
Ø http://www.raspberrypi.org Ø Center piece of course
Raspberry PI Stats
Ø $35 is inexpensive…must be a toy?
Ø “It’s just a slightly under-powered computer without a screen, and anything you can do on it you could do on a laptop”
Ø True, but also: Ø Students can’t destroy the
systems with software. Ø It changes mindsets because
the systems are easily accessible.
Ø What about Arduino? Ø Similar aims, but Raspberry Pi
runs Linux- full operating system, is a modern 32-bit ARM processor
OpenCV Algorithm Evaluation on Raspberry Pi 25
Ø Evaluate selected set of various OpenCV functions Ø rotate, convolution, sobel, median blur, resize, histogram, erosion, etc Ø Benchmark various image file sizes: 720x480 1280x720 1920x1080
3840x2160
Raspberry Pi- DFS (Dynamic Frequency Scaling)
Code Box Ø Code compiled
Code Box Ø Execution
time observed
Summary and Future Plans
Ø New opportunities for exploring concepts related to computer architecture Ø Theoretical concepts – Amdahl’s law Ø Evaluation of Python multiprocessing module for parallelism Ø Code Box – Evaluation of performance of small code examples Ø Sharing content between developers [github]
Ø Raspberry Pi support Ø Enhance development of projects and independent learning by
having set functions for gathering performance results Ø Dynamic frequency scaling Ø OpenCV evaluation
Ø Future work: Python-based Numba generates optimized machine code using the LLVM compiler infrastructure at import time, runtime, or statically (using the included pycc tool). Ø Numba supports compilation of Python to run on either CPU or
GPU hardware.