Python at Warp Speed
Andreas Schreiber
Department for Intelligent and Distributed Systems
German Aerospace Center (DLR), Cologne/Berlin
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 1
Introduction
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 2
Scientist,
Head of department
Co-Founder, Data
Scientist, and Patient
Communities
Python at Warp Speed
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 3
High-
Performance
Computing
Distributed
Computing
Quantum
Computing
Algorithmic View
Input x – Algorithm A – Output y
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 4
High-Perf.
Computing
•
Compute
Distributed
Computing
•
Learn
Quantum
Computing
•
Optimize
High-Performance
Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 5
High raw computing power for large science applications
• Huge performance on a single / multi-core processors
• Huge machines with up to millions of cores
High-Performance Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 6
Images: DLR & https://sciencenode.org
Sunway TaihuLight
10.649.600 Cores, 93 PetaFLOPS
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 7
Tianhe-2 (天河二号)
3.120.000 Cores, 33,8 PetaFLOPS
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 8
Titan
560.640 Cores, 17,5 PetaFLOPS
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 9
Programming HPC
Technologies
• MPI (Message Passing Interface)
• OpenMP (Open Multi-Processing)
• OpenACC (Open Accelerators)
• Global Arrays Toolkit
• CUDA (GPGPUs)
• OpenCL (GPGPUs)
Languages
• Fortran
• Fortran
• C/C++
• Python
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 10
Performance Fortran vs. Python
Helicopter Simulation
Fortran Code
• Developed 1994-1996
• parallelized with MPI
• Performance optimization
2013/14 with MPI und
OpenACC
Performance Comparison
• Multi-core CPUs
• Cython mit OpenMP
• Python bindings for Global
Array Toolkit
• GPGPUs
• NumbaPro
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 11
Core Computation Loops in Pure Python
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 12
for iblades in range(numberOfBlades):
for iradial in range(1, dimensionInRadialDirection):
for iazimutal in range(dimensionInAzimualDirectionTotal):
for i1 in range(len(vx[0])):
for i2 in range(len(vx[0][0])):
for i3 in range(len(vx[0][0][0])):
# wilin-Aufruf 1
for iblades in range(numberOfBlades):
for iradial in range(dimensionInRadialDirection):
for iazimutal in range(1, dimensionInAzimualDirectionTotal):
for i1 in range(len(vx[0])):
for i2 in range(len(vx[0][0])):
for i3 in range(len(vx[0][0][0])):
# wilin-Aufruf 2
for iDir in range(3):
for i in range(numberOfBlades):
for j in range(dimensionInRadialDirection):
for k in range(dimensionInAzimualDirectionTotal):
x[iDir][i][j][k] = x[iDir][i][j][k] +
dt * vx[iDir][i][j][k]
Performance Fortran vs. Python
Single Core (Xeon E5645, 6 Cores)
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 13
2.51
1.09
0.27
0.46
0.01
0
0.5
1
1.5
2
2.5
3
Fortran Cython Numba Numpy Python
GFlops
Performance Fortran vs. Python
Multi-Core (Xeon E5645, 6 Cores)
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 14
13.64
5.78
1.38
0
2
4
6
8
10
12
14
16
Fortran Cython Global Arrays
GFlops
Performance Fortran vs. Python
GPGPU (NVIDIA Tesla C2075, 448 CUDA-Cores)
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 15
69.77
7.79
0
10
20
30
40
50
60
70
80
Fortran Numba
GFlops
Performance-Productivity-Space
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 16
C++ /
FORTRAN
Cython
NumPy /
Numba
Pure
Python
Performance
Productivity/Simplicity
Python’s productivity is great
• Allows to write code quickly
• Wide range of applications
Python’s performance still needs improvements
• Code optimization with tools for profiling, code examination, …
• Optimized libraries for parallel processing with MPI etc.
Excited to see advancements by community and companies
Productivity vs. Performance of Python
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 17
Annual scientific workshop, in conjunction
with Supercomputing conference
State-of-the-art in
• Hybrid programming
• Comparison with other languages for HPC
• Interactive parallel computing
• High-performance computing applications
• Performance analysis, profiling, and debugging
PyHPC 2016
• 6th edition, Nov 14, 2016, Salt Lake City
• http://www.dlr.de/sc/pyhpc2016
Workshop „Python for High-Performance and
Scientific Computing“ (PyHPC)
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 18
Tools Example
Intel® VTune™ Amplifier for Profiling
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 19
https://software.intel.com/en-us/intel-vtune-amplifier-xe/
Tools Example
mpi4py with Intel MPI Library and Cython
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 20
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
name = MPI.Get_processor_name()
if rank == 0:
print "Rank %d of %d running on %s"
% (rank, size, name)
for i in xrange(1, size):
rank, size, name = comm.recv(source=i, tag=1)
print “Rank %d of %d running on %s"
% (rank, size, name)
else:
comm.send((rank, size, name), dest=0, tag=1)
http://pythonhosted.org/mpi4py/
https://software.intel.com/en-us/intel-mpi-library
mpi4py
Cython
Intel MPI
Library
Distributed Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 21
Distributed Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 22
Paul Baran. On Distributed Communication Networks. IEEE Transactions on Communications, 12(1):1–9, March 1964
Driven by data science, machine learning, predictive analytics, …
• Tabular data
• Time Series
• Stream data
• Connected data
Scaling up with increased data size
from from laptops to clusters
• Many-Task-Computing
• Distributed scheduling
• Peer-to-peer data sharing
Distributed Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 23
Space Debris: Object Correlation from Sensor Data
and Real-Time Collision Detection
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 24
29,000 Objects Larger than 10 cm
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 25
750,000 Objects Larger than 1 cm
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 26
150M Objects Larger than 1 mm
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 27
Space Debris: Graph of Computations
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 28
Directed Acyclic Graph (DAG)
Python has great tools to execute graphs on distributed resources
Graphs
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 29
A
B
E F
G
D
C
PySpark
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 30
https://spark.apache.org/
https://spark.apache.org/docs/0.9.0/python-programming-guide.html
from pyspark import SparkContext
logFile = “myfile.txt“
sc = SparkContext("local", "Simple App")
logData = sc.textFile(logFile).cache()
numAs = logData.filter(lambda s: 'a' in s).count()
numBs = logData.filter(lambda s: 'b' in s).count()
print("Lines with a: %i, lines with b: %i" % (numAs, numBs))
Dask
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 31
http://dask.pydata.org/
import dask.dataframe as dd
df = dd.read_csv('2015-*-*.csv')
df.groupby(df.user_id).value.mean().compute()
d = {'x': 1,
'y': (inc, 'x'),
'z': (add, 'y', 10)}
TensorFlow
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 32
import tensorflow as tf
with tf.Session() as sess:
with tf.device("/gpu:1"):
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
https://www.tensorflow.org/
Quantum Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 33
Design optimization and robust design
• Space systems and air transportation systems
• Design and evaluation of systems with consideration of
uncertainties
Optimization Problems in Aeronautics & Space
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 34
Machine Learning
• Deep learning, pattern recognition, clustering, images recognition,
stream reasoning
Anomaly detection
• Monitoring of space systems
Mission planning
• Optimization in relation to time, resource allocation, energy
consumption, costs etc.
Verification and validation
• Software, embedded systems
Optimization Problems in Aeronautics & Space
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 35
Discrete optimization is basis for many kinds of problems
 Packaging
 Partitioning
 Mapping
 Scheduling
Hope: Quantum Computers solve those problems faster than classical
computers
New Research Field: Quantum Computing
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 36
NP-hard problems!
Bits and Qubits
Classical Bits Quantum bits (Qubits)
• “0” or “1”
• Electric voltage
• Superposition of complex base
states
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 37
1
0
Quantum Computer
To date, one Quantum Computer
is available commercially
• D-Wave Systems, Inc.,
Canada
• System with ~2000 Qubits
(„D-Wave 2X“)
• Adiabatic QC
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 38
Images: © D-Wave Systems, Inc.
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 39
Image: © D-Wave Systems, Inc.
Inside D-Wave 2
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 40
Images: © D-Wave Systems, Inc.
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 41
Image: © D-Wave Systems, Inc.
D-Wave Qubit Topology – Chimera Graph
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 42
Rewrite the problem as discrete optimization problem
• QUBO: Quadratic unconstrained binary optimization
“Programming” a Quantum Computer – Step 1
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 43
𝐸 𝑞1, … , 𝑞 𝑛 = 𝑔𝑖
𝑛
𝑖=1
𝑞𝑖 + 𝑠𝑖𝑗 𝑞𝑖 𝑞𝑗
𝑛
𝑖,𝑗=1
𝑖>𝑗
Mapping to hardware
topology
 Chimera-QUBO
“Programming” a Quantum Computer – Step 2
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 44
Bringing the problem to the QC
• Copy weights and coupling
strengths to physical Qubits
“Programming” a Quantum Computer – Step 3
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 45
Starting the actual “computation”:
• Adiabatic process from start energy level to target energy level,
which represents solution of the optimization problem
• Result are the voltages after this process
“Programming” a Quantum Computer – Step 4
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 46
Energy
Start System End System
Time
Energy Level
Adiabatic Change
Defines
runtime
D-Wave Software Environment
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 47
Programming with Python
Import API and Connect to Machine
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 48
import dwave_sapi2.remote as remote
import dwave_sapi2.embedding as embedding
import dwave_sapi2.util as util
import dwave_sapi2.core as core
# print "Connect to DWave machine ...”
# create a remote connection
try:
conn = remote.RemoteConnection(myToken.myUrl,
myToken.myToken)
# get the solver
solver = conn.get_solver('C12')
except:
print 'Unable to establish connection'
exit(1)
Programming with Python
Prepare the Problem (“Embedding”)
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 49
hwa = get_hardware_adjacency(solver)
embeddings[eIndex] = embedding.find_embedding(J, hwa)
h_embedded[eIndex], j0, jc, new_embed =
embedding.embed_problem(h, J, embeddings[eIndex], hwa)
J_embedded[eIndex] = jc
J_embedded[eIndex].update(j0)
embeddings[eIndex] = new_embed
Programming with Python
Solve the Problem (“Ising”)
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 50
getEmbeddedIsing(eIndex)
# print "Annealing ...”
result = core.solve_ising(solver,
h_embedded[eIndex],
J_embedded[eIndex],
annealing_time=20,
num_reads=1000)
unembedded_result = embedding.unembed_answer(
result['solutions'],
embeddings[eIndex],
'minimize_energy', h, J)
# take the lowest energy solution
rawsolution_phys = (np.array(result['solutions']) + 1)/2
rawsolution_log = (np.array(unembedded_result) + 1)/2
Result Distribution
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 51
Summary
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 52
High
Performance
Data Science
Future
Architectures
Python is or will become standard in programming for...
> PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 53
Thank You!
Questions?
Andreas.Schreiber@dlr.de
www.DLR.de/sc | @onyame

Python at Warp Speed

  • 1.
    Python at WarpSpeed Andreas Schreiber Department for Intelligent and Distributed Systems German Aerospace Center (DLR), Cologne/Berlin > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 1
  • 2.
    Introduction > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 2 Scientist, Head of department Co-Founder, Data Scientist, and Patient Communities
  • 3.
    Python at WarpSpeed > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 3 High- Performance Computing Distributed Computing Quantum Computing
  • 4.
    Algorithmic View Input x– Algorithm A – Output y > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 4 High-Perf. Computing • Compute Distributed Computing • Learn Quantum Computing • Optimize
  • 5.
    High-Performance Computing > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 5
  • 6.
    High raw computingpower for large science applications • Huge performance on a single / multi-core processors • Huge machines with up to millions of cores High-Performance Computing > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 6 Images: DLR & https://sciencenode.org
  • 7.
    Sunway TaihuLight 10.649.600 Cores,93 PetaFLOPS > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 7
  • 8.
    Tianhe-2 (天河二号) 3.120.000 Cores,33,8 PetaFLOPS > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 8
  • 9.
    Titan 560.640 Cores, 17,5PetaFLOPS > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 9
  • 10.
    Programming HPC Technologies • MPI(Message Passing Interface) • OpenMP (Open Multi-Processing) • OpenACC (Open Accelerators) • Global Arrays Toolkit • CUDA (GPGPUs) • OpenCL (GPGPUs) Languages • Fortran • Fortran • C/C++ • Python > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 10
  • 11.
    Performance Fortran vs.Python Helicopter Simulation Fortran Code • Developed 1994-1996 • parallelized with MPI • Performance optimization 2013/14 with MPI und OpenACC Performance Comparison • Multi-core CPUs • Cython mit OpenMP • Python bindings for Global Array Toolkit • GPGPUs • NumbaPro > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 11
  • 12.
    Core Computation Loopsin Pure Python > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 12 for iblades in range(numberOfBlades): for iradial in range(1, dimensionInRadialDirection): for iazimutal in range(dimensionInAzimualDirectionTotal): for i1 in range(len(vx[0])): for i2 in range(len(vx[0][0])): for i3 in range(len(vx[0][0][0])): # wilin-Aufruf 1 for iblades in range(numberOfBlades): for iradial in range(dimensionInRadialDirection): for iazimutal in range(1, dimensionInAzimualDirectionTotal): for i1 in range(len(vx[0])): for i2 in range(len(vx[0][0])): for i3 in range(len(vx[0][0][0])): # wilin-Aufruf 2 for iDir in range(3): for i in range(numberOfBlades): for j in range(dimensionInRadialDirection): for k in range(dimensionInAzimualDirectionTotal): x[iDir][i][j][k] = x[iDir][i][j][k] + dt * vx[iDir][i][j][k]
  • 13.
    Performance Fortran vs.Python Single Core (Xeon E5645, 6 Cores) > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 13 2.51 1.09 0.27 0.46 0.01 0 0.5 1 1.5 2 2.5 3 Fortran Cython Numba Numpy Python GFlops
  • 14.
    Performance Fortran vs.Python Multi-Core (Xeon E5645, 6 Cores) > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 14 13.64 5.78 1.38 0 2 4 6 8 10 12 14 16 Fortran Cython Global Arrays GFlops
  • 15.
    Performance Fortran vs.Python GPGPU (NVIDIA Tesla C2075, 448 CUDA-Cores) > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 15 69.77 7.79 0 10 20 30 40 50 60 70 80 Fortran Numba GFlops
  • 16.
    Performance-Productivity-Space > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 16 C++ / FORTRAN Cython NumPy / Numba Pure Python Performance Productivity/Simplicity
  • 17.
    Python’s productivity isgreat • Allows to write code quickly • Wide range of applications Python’s performance still needs improvements • Code optimization with tools for profiling, code examination, … • Optimized libraries for parallel processing with MPI etc. Excited to see advancements by community and companies Productivity vs. Performance of Python > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 17
  • 18.
    Annual scientific workshop,in conjunction with Supercomputing conference State-of-the-art in • Hybrid programming • Comparison with other languages for HPC • Interactive parallel computing • High-performance computing applications • Performance analysis, profiling, and debugging PyHPC 2016 • 6th edition, Nov 14, 2016, Salt Lake City • http://www.dlr.de/sc/pyhpc2016 Workshop „Python for High-Performance and Scientific Computing“ (PyHPC) > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 18
  • 19.
    Tools Example Intel® VTune™Amplifier for Profiling > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 19 https://software.intel.com/en-us/intel-vtune-amplifier-xe/
  • 20.
    Tools Example mpi4py withIntel MPI Library and Cython > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 20 from mpi4py import MPI comm = MPI.COMM_WORLD size = comm.Get_size() rank = comm.Get_rank() name = MPI.Get_processor_name() if rank == 0: print "Rank %d of %d running on %s" % (rank, size, name) for i in xrange(1, size): rank, size, name = comm.recv(source=i, tag=1) print “Rank %d of %d running on %s" % (rank, size, name) else: comm.send((rank, size, name), dest=0, tag=1) http://pythonhosted.org/mpi4py/ https://software.intel.com/en-us/intel-mpi-library mpi4py Cython Intel MPI Library
  • 21.
    Distributed Computing > PyConDE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 21
  • 22.
    Distributed Computing > PyConDE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 22 Paul Baran. On Distributed Communication Networks. IEEE Transactions on Communications, 12(1):1–9, March 1964
  • 23.
    Driven by datascience, machine learning, predictive analytics, … • Tabular data • Time Series • Stream data • Connected data Scaling up with increased data size from from laptops to clusters • Many-Task-Computing • Distributed scheduling • Peer-to-peer data sharing Distributed Computing > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 23
  • 24.
    Space Debris: ObjectCorrelation from Sensor Data and Real-Time Collision Detection > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 24
  • 25.
    29,000 Objects Largerthan 10 cm > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 25
  • 26.
    750,000 Objects Largerthan 1 cm > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 26
  • 27.
    150M Objects Largerthan 1 mm > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 27
  • 28.
    Space Debris: Graphof Computations > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 28
  • 29.
    Directed Acyclic Graph(DAG) Python has great tools to execute graphs on distributed resources Graphs > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 29 A B E F G D C
  • 30.
    PySpark > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 30 https://spark.apache.org/ https://spark.apache.org/docs/0.9.0/python-programming-guide.html from pyspark import SparkContext logFile = “myfile.txt“ sc = SparkContext("local", "Simple App") logData = sc.textFile(logFile).cache() numAs = logData.filter(lambda s: 'a' in s).count() numBs = logData.filter(lambda s: 'b' in s).count() print("Lines with a: %i, lines with b: %i" % (numAs, numBs))
  • 31.
    Dask > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 31 http://dask.pydata.org/ import dask.dataframe as dd df = dd.read_csv('2015-*-*.csv') df.groupby(df.user_id).value.mean().compute() d = {'x': 1, 'y': (inc, 'x'), 'z': (add, 'y', 10)}
  • 32.
    TensorFlow > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 32 import tensorflow as tf with tf.Session() as sess: with tf.device("/gpu:1"): matrix1 = tf.constant([[3., 3.]]) matrix2 = tf.constant([[2.],[2.]]) product = tf.matmul(matrix1, matrix2) https://www.tensorflow.org/
  • 33.
    Quantum Computing > PyConDE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 33
  • 34.
    Design optimization androbust design • Space systems and air transportation systems • Design and evaluation of systems with consideration of uncertainties Optimization Problems in Aeronautics & Space > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 34
  • 35.
    Machine Learning • Deeplearning, pattern recognition, clustering, images recognition, stream reasoning Anomaly detection • Monitoring of space systems Mission planning • Optimization in relation to time, resource allocation, energy consumption, costs etc. Verification and validation • Software, embedded systems Optimization Problems in Aeronautics & Space > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 35
  • 36.
    Discrete optimization isbasis for many kinds of problems  Packaging  Partitioning  Mapping  Scheduling Hope: Quantum Computers solve those problems faster than classical computers New Research Field: Quantum Computing > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 36 NP-hard problems!
  • 37.
    Bits and Qubits ClassicalBits Quantum bits (Qubits) • “0” or “1” • Electric voltage • Superposition of complex base states > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 37 1 0
  • 38.
    Quantum Computer To date,one Quantum Computer is available commercially • D-Wave Systems, Inc., Canada • System with ~2000 Qubits („D-Wave 2X“) • Adiabatic QC > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 38 Images: © D-Wave Systems, Inc.
  • 39.
    > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 39 Image: © D-Wave Systems, Inc.
  • 40.
    Inside D-Wave 2 >PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 40 Images: © D-Wave Systems, Inc.
  • 41.
    > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 41 Image: © D-Wave Systems, Inc.
  • 42.
    D-Wave Qubit Topology– Chimera Graph > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 42
  • 43.
    Rewrite the problemas discrete optimization problem • QUBO: Quadratic unconstrained binary optimization “Programming” a Quantum Computer – Step 1 > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 43 𝐸 𝑞1, … , 𝑞 𝑛 = 𝑔𝑖 𝑛 𝑖=1 𝑞𝑖 + 𝑠𝑖𝑗 𝑞𝑖 𝑞𝑗 𝑛 𝑖,𝑗=1 𝑖>𝑗
  • 44.
    Mapping to hardware topology Chimera-QUBO “Programming” a Quantum Computer – Step 2 > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 44
  • 45.
    Bringing the problemto the QC • Copy weights and coupling strengths to physical Qubits “Programming” a Quantum Computer – Step 3 > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 45
  • 46.
    Starting the actual“computation”: • Adiabatic process from start energy level to target energy level, which represents solution of the optimization problem • Result are the voltages after this process “Programming” a Quantum Computer – Step 4 > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 46 Energy Start System End System Time Energy Level Adiabatic Change Defines runtime
  • 47.
    D-Wave Software Environment >PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 47
  • 48.
    Programming with Python ImportAPI and Connect to Machine > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 48 import dwave_sapi2.remote as remote import dwave_sapi2.embedding as embedding import dwave_sapi2.util as util import dwave_sapi2.core as core # print "Connect to DWave machine ...” # create a remote connection try: conn = remote.RemoteConnection(myToken.myUrl, myToken.myToken) # get the solver solver = conn.get_solver('C12') except: print 'Unable to establish connection' exit(1)
  • 49.
    Programming with Python Preparethe Problem (“Embedding”) > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 49 hwa = get_hardware_adjacency(solver) embeddings[eIndex] = embedding.find_embedding(J, hwa) h_embedded[eIndex], j0, jc, new_embed = embedding.embed_problem(h, J, embeddings[eIndex], hwa) J_embedded[eIndex] = jc J_embedded[eIndex].update(j0) embeddings[eIndex] = new_embed
  • 50.
    Programming with Python Solvethe Problem (“Ising”) > PyCon DE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 50 getEmbeddedIsing(eIndex) # print "Annealing ...” result = core.solve_ising(solver, h_embedded[eIndex], J_embedded[eIndex], annealing_time=20, num_reads=1000) unembedded_result = embedding.unembed_answer( result['solutions'], embeddings[eIndex], 'minimize_energy', h, J) # take the lowest energy solution rawsolution_phys = (np.array(result['solutions']) + 1)/2 rawsolution_log = (np.array(unembedded_result) + 1)/2
  • 51.
    Result Distribution > PyConDE 2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 51
  • 52.
    Summary > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 52 High Performance Data Science Future Architectures Python is or will become standard in programming for...
  • 53.
    > PyCon DE2016 > Andreas Schreiber • Python at Warp Speed > 30.10.2016DLR.de • Chart 53 Thank You! Questions? Andreas.Schreiber@dlr.de www.DLR.de/sc | @onyame