Home >>> Courses >>> Special Topics >>> NumPy with Cython

What customers say ...


Good course. Very competent trainer for this introduction. The course offers wide spectrum of topics and goes into depth were participants need it most.

Helmut Dittrich, CEO DiFis-Engineering UG, arrow-fix.com, about the German introducation to Django "Einstieg in Django" mehr dazu ...


Highly recommended. Many aha-experiences and took home many positive inspiratons.

Helmut Dittrich, CEO DiFis-Engineering UG, arrow-fix.com, about the German advanced Django course "Django für Fortgeschrittene" mehr dazu ...


Good course. Very fast progress without any prior Python knowledge.

Daniel Fuchs, GIGATRONIK Ingolstadt GmbH, about the German version of the course "Python for Programmers" 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 ...


Mike is an outstanding teacher ... I will look for his classes in the future.

Jannifer Trasti, Software/Systems Engineer, Sandia National Laboratories, Albuquerque, NM, USA more ...


The Python Summer Course was a very good opportunity to know almost all about Python. ... Highly recommended!!

Fabio Lamanna, Ph.D. Complex Transportation Networks, Trieste, Italy more ...


We had a wide range of Python experience in our group and each person gained something valuable to take away....

Dr. Ryan Woodard, Chair of Entrepreneurial Risks, ETH Zurich, Switzerland more ...


I can absolutely recommend this course to everybody who wants become productive with Python very quickly. ...

Dr. med. Beat Meister, Bern, Switzerland more ...


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

Bart Hillaert, Alcatel-Lucent Belgium more ...


[The trainer] knows well what scientists need, so his hints are very practical and valuable. The hands-on course [..] covers a wide range of examples and will be very helpful in my daily work. ...

Dorota Jarecka, University of Warsaw about the course "Python for Scientists and Engineers" more ...


The course "Python for Scientists and Engineers" is a very useful introduction to Python programming for scientific applications ...

Dr Mihai Duta, Oxford Supercomputing Centre more ...


Very good introduction to the programming language.

Matthias Enderle, freelancer programmer more ...


Fast NumPy Processing with Cython


This course is given by a core developer of the Cython open-source project.

Target Audience

The course targets medium level to experienced Python programmers who want to break through the limits of Python performance. A basic understanding of the C language is helpful but not required. Basic understanding of Cython and NumPy as provided in the courses Fast Code with the Cython Compiler and Numerical Calculations with NumPy is necessary.

Motivation

NumPy and SciPy come with a broad set of high-level functionality that allows to express complex computational algorithms concisely and efficiently. However, in many cases, sequential operations on NumPy arrays introduce a considerable overhead. This can happen when arrays are unnecessarily being copied during an operation that does not work in-place, but also due to lacking CPU cache locality when large arrays are being traversed multiple times in a row. In both cases, Cython can provide a substantial speed-up by expressing algorithms more efficiently.

The main features that make Cython so attractive for NumPy users are its ability to access and process the arrays directly at the C level, and the native support for parallel loops based on the OpenMP compiler infrastructure. To work efficiently with arrays and other memory buffers, Cython has native syntax support for the Python buffer protocol, which allows C extensions (like NumPy or image processing libraries) to grant foreign code direct access to their internal data buffers.

Content

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.

Course Duration

1 day

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 CD with all source codes and used software.


The Python Academy is sponsor of PythonCamp 2012.

[PythonCamp 2012]

The Python Academy is sponsor of EuroPython 2012.

[EuroPython 2012]

The Python Academy is sponsor of EuroSciPy.

[EuroSciPy 2012]

News


Python Academy sponsors EuroPython conference 2012
details ...


Python Academy sponsors EuroSciPy conference 2012
details ...


Python Academy sponsors PyCon DE conference 2012
details ...


Next Meeting of Leipzig Python User Group, May 8, 2012
details ...


Course: "Python für Nicht-Programmierer" (German) in Leipzig April 15 - 18, 2012
details ...


Course: "Python für Programmierer" (German) in Leipzig April 16 - 18, 2012
details ...


Course: "Python für Wissenschaftler und Ingenieure" (German) in Leipzig April 19 - 21, 2012
details ...


Course: "Einstieg in Django" (German) in Leipzig April 23 - 25, 2012
details ...


Course: "Django für Fortgeschrittene" (German) in Leipzig April 26 - 27, 2012
details ...


Python for Non-Programmers (English) in Leipzig June 4 - 7, 2012
details ...


Python for Programmers (English) in Leipzig June 5 - 7, 2012
details ...


Python Power Course (English) in Leipzig June 8 - 15, 2012
details ...


Advanced Python (English) in Leipzig June 8 - 10, 2012
details ...


High-Performance Computation with Python (English) in Leipzig June 11 - 15, 2012
details ...


PyPy Sprint in Leipzig June 22 - 27, 2012
details ...


Advanced Python at EuroPython (English) in Florence, Italy July 7, 2012
details ...


Introduction to Django (English) in Leipzig October 15 - 17, 2012
details ...


Advanced Django (English) in Leipzig October 18 - 20, 2012
details ...


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