Cython provides a convenient interface to perform shared-memory parallel processing through OpenMP. This lets you write extremely efficient parallel code directly in Cython without having to create a C wrapper.
OpenMP is a specification to write multithreaded programs, and includes series of C preprocessor directives to manage threads; these include communication patterns, load balancing, and synchronization features. Several C/C++ and Fortran compilers (including GCC) implement the OpenMP API.
Let's introduce Cython parallel features with a small example. Cython provides a simple API based on OpenMP in the
cython.parallel module. The simplest construct is
prange: a construct that automatically distributes loop operations ...