Home >>> Courses >>> HPC

What customers say ...


Mr. Müller explained very well and exhasutively. Alle question were answered. The learned material will definitely speed up my daily work. Thank you very much!

Martin Siemann, German Aerospace Stuttgart about the course "Python für Programmierer und Python für Wissenschaftler und Ingenieure" more...


Very competent trainer. Highly recommended training.

Raout Femmali, German Aerospace Stuttgart about the course "Python für Programmierer und Python für Wissenschaftler und Ingenieure" more...


Very nice course, got many useful suggestions.

Dr.-Ing. Ralf Wieland, Institut für Landschaftssystemanalyse, Leibniz-Zentrum für Agrarlandschaftsforschung e.V. about the German version of the course "Python for Scientists and Engineers" more...


A useful and quite comprehensive introduction to Python.

Emil Simon, Researcher about the course "Python for Scientists and Engineers" more...


The standard Python for programmers and the customized "Python for Experts" course where a great success. ..

Bart Hillaert, Alcatel-Lucent, Belgium more...


High-Performance Computing with Python

Dates for Open Courses

Course available as open and in-house training. Currently no dates for open courses. Please ask us at info@python-academy.de

Intended Audience

Programmers, scientists and engineers with basic to intermediate knowledge of Python. This course can be combined with introductory courses (see Recommended Module Combinations) to achieve appropriate Python skills.

Motivation

Python is a great programming language. It has the reputation of being slow for computational tasks. While this can be true for pure Python programs, there are many tools and libraries that can help you to get very close to the speed of programs written in C or other compiled languages. Because you still get most of the advantages of Python, you can spent more time on experimenting with different algorithms and may have a faster program as if you would have spent the same time in a lower-level language.

This course gives an overview over some tools and libraries for fast computations in Python. It covers the most common tools and helps to get you started on HPC with Python

Course Content

Day 1: Profiling, Algorithms and Parallel Computation

Profiling

One of the most important steps toward a fast program is profiling to find out where your program spends its time. There are several tools for Python that help you to quantify the run times of your program. The course gives introduction to this topic.

Algorithms

Often the best speed improvements can be achieved by finding a better algorithm. Python offers several data structures that come with efficient algorithms. The course gives an overview of common Python data structures and the run time complexity.

Multiprocessing

Python comes with the multiprocessing module that allows to distribute calculation over several processes and this way parallelize applications. Its API is closed model after that of the threading module. You will learn how to use multiprocessing.

Pyro4

There are many libraries for Python to do distributed programming for clusters or networked computers. Pyro is a very mature solution. The course introduces version 4 with some examples.

Day 2: Beyond Pure Python

Python is very good glue language to connect existing systems. There is a long tradition to write modules in other languages. There are also some newer developments that increase the usefulness of Python HPC computing. The course presents some of them.

Numba

Numba is a new module that still undergoes considerable changes. It allows to compile pure Python code in to machine code via the LLVM. This means, many pure Python algorithms can run as fast as if they would have been written in C. The course shows how numba works and presents some implementations of algorithms.

PyPy

PyPy is a different implementation that has a Just-in-Time-Complier (JIT). It is full Python 2.7 compliant implementation that has several very innovative features. The course introduces to the work with PyPy.

f2py

Wrapping existing Fortran programs becomes much simpler with f2py. You will learn how to use f2py to wrap Fortran programs. Furthermore, the course covers accessing common memory in Fortran modules and calling Python functions from wrapped Fortran.

Day 3 NumPy for Fast Computations

The library NumPy is the defacto standard for the work with arrays. You will get a solid introduction to NumPy and learn some of its more advanced features.

Introduction to NumPy

  • Array construction and array properties
  • Data types
  • Slicing and broadcasting
  • Universal functions

Advanced NumPy

  • Masked arrays
  • Customizing error handling
  • Testing NumPy programs

NumPy and C

  • A look into the implementation of ndarrays
  • Working with ndarrays from C

Numexpr

Numexpr can evaluate numerical expressions such as 5 * a + 3 * b - 2 * c. The evaluations, especially of complex expressions, are faster and use less memory than using NumPy calculations of these exprssiosn.

Numexpr can run evaluation in parallel using multiple cores. It also supports the Math Kernel Library (MKL) for even more speed improvements.

Algorithms and SciPy

Examples of algorithms in NumPy and solutions in SciPy showcase solutions for common numerical problems.

Day 4: Cython for Speed

My first Cython extension

  • using pyximport to quickly (re-)build extension modules
  • using cython.inline() to compile code at runtime
  • building extension modules with distutils

Speeding up Python code with Cython

  • fast access to Python's builtin types
  • fast looping over Python iterables and C types
  • string processing
  • fast arithmetic
  • incrementally optimizing Cython code
  • multi-threading outside of the GIL (Global Interpreter Lock)

Interfacing with external C code

  • calling into external C libraries
  • building against C libraries
  • writing Python wrapper APIs
  • calling C functions across extension module boundaries

Day 5 Cython and NumPy

Use of Python's buffer interface from Cython code

  • directly accessing data buffers of other Python extensions
  • retrieving meta data about the buffer layout
  • setting up efficient memory views on external buffers

Implementing fast Cython loops over NumPy arrays

  • looping over NumPy exported buffers
  • implementing a simple image processing algorithm
  • using "fused types" (simple templating) to implement an algorithm once and run it efficiently on different C data types

Use of parallel loops to make use of multiple processing cores

  • building modules with OpenMP
  • processing data in parallel
  • speeding up an existing loop using OpenMP threads

Note: the part on parallel processing requires a C compiler that supports OpenMP, e.g. gcc starting with 4.2, preferably 4.4 or later. It should be readily available in recent installations of both Linux and MacOS-X. Note that recent versions of XCode use the "clang" compiler, which does not support OpenMP. On these systems, please install gcc separately and make sure it can be used from your CPython installation. Users of Microsoft Windows must install the C compiler that was used to build their Python installation, e.g. the VS2008 Express or MinGW for Python 2.7.

Case studies

The participants are encouraged to send in short code examples from their own experience that they would like to see running faster by using Cython. Based on general interest and practicality, one or two of these examples will be examined as a case study. These examples must be available to the teacher at least one week before the course, and must be short but complete executable examples, including sufficient input data for benchmarking. Please be aware that example code that requires a substantial amount of explanation or background knowledge about a specific application domain will not be accepted.

Course Duration

5 days

Exercises

The participants can follow all steps directly on their computers. There are exercises at the end of each unit providing ample opportunity to apply the freshly learned knowledge.

Course Material

Every participant receives comprehensive printed materials that cover the whole course content as wells a electronic copies of all source codes and used software.



The Python Academy is sponsor of PyConIE 2017.

[PyConIE 2017]

The Python Academy is sponsor of EuroPython 2017.

[EuroPython 2017]

The Python Academy is sponsor of PyCon US 2017.

[PyCon US 2017]

The Python Academy is sponsor of PythonCamp Köln 2017.

[PythonCamp 2017]“ border=

The Python Academy is sponsor of Django Girls Leipzig 2016

[Django Girls Leipzig 2016]

The Python Academy is sponsor of PyCon DE 2016.

[PyCon DE 2016]

The Python Academy is sponsor of PyCon Ireland 2016.

[PyCon IE 2016]

The Python Academy is sponsor of EuroSciPy 2016.

[EuroSciPy 2016]

The Python Academy is sponsor of PyCon US 2016.

[PyCon US 2016]

The Python Academy is sponsor of PyData Berlin 2016.

[PyData Berlin 2016]

The Python Academy is sponsor of PyCon Sweden 2016.

[PyCon SE 2016]

The Python Academy is sponsor of Python Unconference 2015.

[PyUnconf 2015]

The Python Academy is sponsor of EuroSciPy 2015.

[EuroSciPy 2015]

The Python Academy is sponsor of EuroPython 2015.

[EuroPython 2015]

The Python Academy is sponsor of PyData Berlin 2015.

[PyData Berlin 2015]

The Python Academy is sponsor of PyCon Montréal 2015.

[PyCon Montréal 2015]

The Python Academy is sponsor of Python BarCamp Köln 2015.

[Python BarCamp 2015]“ border=

The Python Academy is sponsor of Chemnitzer Linux-Tage 2015.

Chemnitzer Linux-Tage 2015 - 21. und 22. März 2015

The Python Academy is sponsor of Django Girls Wroclaw 2015.

[Django Girls Wroclaw 2015]

The Python Academy is sponsor of PyCon Ireland 2014.

[PyCon Ireland 2014]

The Python Academy is sponsor of EuroSciPy 2014.

[EuroSciPy 2014]

The Python Academy is sponsor of PyData London 2014.

[PyData London 2014]

The Python Academy is sponsor of EuroPython 2014.

[EuroPython 2014]

The Python Academy is sponsor of PyCon 2014 Montréal.

[PyCon 2014 Montréal]

The Python Academy is sponsor of Python BarCamp Köln 2014.

[Python BarCamp 2014]

The Python Academy is sponsor of PyConDE 2013.

[PyCon DE 2013]

The Python Academy is sponsor of EuroPython 2013.

[EuroPython 2013]

The Python Academy is sponsor of PyCon US 2013.

[PyCon US 2013]

The Python Academy is sponsor of EuroSciPy 2013.

[EuroSciPy 2013]

The Python Academy is sponsor of PyConPL 2012.

[PyCon PL 2012]

News


The next open cousers
details ...


Python Academy sponsors EuroPython conference 2013
details ...


Python Academy sponsors EuroSciPy conference 2013
details ...


Python Academy sponsors Python BarCamp in Cologne
details ...


Next Meeting of Leipzig Python User Group, November 12, 2013
details ...


Introduction to Django, November 11 - 13, 2013
details ...


Professional Testing with Python, November 25 - 27, 2013
details ...


Advanced Django, January 13 - 15, 2014
details ...


Python Academy sponsors PyCon US conference 2013
details ...


Python Academy founder receives PSF Community Service Award
details ...