Want to keep learning?

This content is taken from the Partnership for Advanced Computing in Europe (PRACE)'s online course, Python in High Performance Computing. Join the course to learn more.

Hands-on: utilizing C code

Using C code in the heat equation

The code for this exercise is located under interface/c.

~/hpc-python$ cd interface/c

Using cffi

The files evolve.h and evolve.c contain a pure C implementation of the single time step in heat equation. The C implemention can be built into a shared library with the provided Makefile by executing make command. Use cffi for utilizing the library function instead of the Python function in heat.py. Compare the performance to Cython implementation

Share this article:

This article is from the free online course:

Python in High Performance Computing

Partnership for Advanced Computing in Europe (PRACE)