Skip to content

Commit

Permalink
Merge pull request #2167 from kif/2162_openmp
Browse files Browse the repository at this point in the history
Disable openmp via environment variable
  • Loading branch information
kif authored May 17, 2024
2 parents 9a941c3 + 63c646c commit d7c16ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ jobs:
env:
# Use silx wheelhouse: needed for ppc64le
CIBW_ENVIRONMENT_LINUX: "PIP_FIND_LINKS=https://www.silx.org/pub/wheelhouse/ PIP_TRUSTED_HOST=www.silx.org"
# diable OpenMP under windows
CIBW_BEFORE_BUILD_WINDOWS: echo False > PYFAI_WITH_OPENMP
CIBW_ENVIRONMENT_WINDOWS: "PYFAI_WITH_OPENMP=False"
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*
# Do not build for pypy and muslinux
CIBW_SKIP: pp* *-musllinux_*
Expand Down
18 changes: 11 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@ project('pyFAI',
default_options: ['buildtype=plain', ],
)

py_mod = import('python')
py = py_mod.find_installation()
os = import('fs')

# Seek the backend
if meson.backend() != 'ninja'
error('Ninja backend required')
endif

# Read configuration files to disable OpenMP:
# 'PYFAI_WITH_OPENMP' file should contain 'False'
os = import('fs')
# How to disable OpenMP:
# The 'PYFAI_WITH_OPENMP' file should contain 'False'
if os.is_file('PYFAI_WITH_OPENMP')
openmp_var = os.read('PYFAI_WITH_OPENMP').strip()
else
openmp_var = ''
res = run_command(py, '-c', 'import os; print(os.environ["PYFAI_WITH_OPENMP"])')
if res.returncode() == 0
openmp_var = res.stdout().strip()
else
openmp_var = ''
endif
endif


cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
cy = meson.get_compiler('cython')
Expand All @@ -34,8 +40,6 @@ if m_dep.found()
endif

# https://mesonbuild.com/Python-module.html
py_mod = import('python')
py = py_mod.find_installation()
py_dep = py.dependency()

py.install_sources([
Expand Down

0 comments on commit d7c16ed

Please sign in to comment.