| 1 |
OpenMP helpers |
| 2 |
============== |
| 3 |
|
| 4 |
We provide a helper function |
| 5 |
:func:`~extension_helpers.add_openmp_flags_if_available` that can |
| 6 |
be used to automatically add OpenMP flags for C/Cython extensions, based on |
| 7 |
whether OpenMP is available and produces executable code. To use this, edit the |
| 8 |
``setup_package.py`` file where you define a C extension, import the helper |
| 9 |
function:: |
| 10 |
|
| 11 |
from extension_helpers import add_openmp_flags_if_available |
| 12 |
|
| 13 |
then once you have defined the extension and before returning it, use it as:: |
| 14 |
|
| 15 |
extension = Extension(...) |
| 16 |
|
| 17 |
add_openmp_flags_if_available(extension) |
| 18 |
|
| 19 |
return [extension] |