Contribute Media
A thank you to everyone who makes this possible: Read More

Cython: Speed up Python and NumPy, Pythonize C, C++, and Fortran, SciPy2013 Tutorial, Part 3 of 4

Summary

Presenter: Kurt Smith

Description Cython is a flexible and multi-faceted tool that brings down the barrier between Python and other languages. With cython, you can add type information to your Python code to yield dramatic performance improvements. Cython also allows you to wrap C, C++ and Fortran libraries to work with Python and NumPy. It is used extensively in research environments and in end-user applications.

This hands-on tutorial will cover Cython from the ground up, and will include the newest Cython features, including typed memoryviews.

Target audience:

Developers, researchers, scientists, and engineers who use Python and NumPy and who routinely hit bottlenecks and need improved performance.

C / C++ / Fortran users who would like their existing code to work with Python.

Expected level of knowledge:

Intermediate and / or regular user of Python and NumPy. Have used Python's decorators, exceptions, and classes. Knowledge of NumPy arrays, array views, fancy indexing, and NumPy dtypes. Have programmed in at least one of C, C++, or Fortran.

Some familiarity with the Python or NumPy C-API a plus. Familiarity with memoryviews and buffers a plus. Familiarity with OpenMP a plus. Array-based inter-language programming between Python and C, C++, or Fortran a plus.

Required Packages

All necessary packages are available with an academic / full EPD installation, Anaconda, easy_install, or pip.

Users must have Cython v 0.16 or better for the course.

The tutorial material (slides, exercises & demos) will be available for download and on USB drives.

Documentation

Basic slide content is based on Enthought's Cython training slides. These slides will be reworked significantly for this tutorial. In particular, the NumPy buffer declarations will be taken out and replaced with the typed memoryview content listed in the outline. Other content (an IPython notebook with the start of the capstone project) is available as well:

http://public.enthought.com/~ksmith/scipy2013_cython/

Details

Improve this page