Skip to content

Commit

Permalink
[msonpy] handle transonic
Browse files Browse the repository at this point in the history
  • Loading branch information
ogiorgis committed Dec 20, 2023
1 parent 5d181d0 commit 2f8340b
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 2 deletions.
10 changes: 10 additions & 0 deletions fluidsim/base/output/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ python_sources = [
'time_signals_fft.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/output'
)

run_command(
['transonic', '--meson', '--backend', backend, 'increments.py', 'spatiotemporal_spectra.py'],
check: true
)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/base/time_stepping/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ py.install_sources(
python_sources,
subdir: 'fluidsim/base/time_stepping'
)

run_command(['transonic', '--meson', '--backend', backend, 'pseudo_spect.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/operators/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ py.install_sources(
)

subdir('test')

run_command(['transonic', '--meson', '--backend', backend, 'operators2d.py', 'operators3d.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/solvers/ns2d/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ py.install_sources(
subdir('bouss')
subdir('output')
subdir('strat')

run_command(['transonic', '--meson', '--backend', backend, 'solver.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/solvers/ns2d/output/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ py.install_sources(
python_sources,
subdir: 'fluidsim/solvers/ns2d/output',
)

run_command(['transonic', '--meson', '--backend', backend, 'spatiotemporal_spectra.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/solvers/ns3d/forcing/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ py.install_sources(
python_sources,
subdir: 'fluidsim/solvers/ns3d/forcing',
)

run_command(['transonic', '--meson', '--backend', backend, 'watu.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/solvers/ns3d/output/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ py.install_sources(
python_sources,
subdir: 'fluidsim/solvers/ns3d/output',
)

run_command(['transonic', '--meson', '--backend', backend, 'spatiotemporal_spectra.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/solvers/ns3d/strat/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ py.install_sources(
)

subdir('output')

run_command(['transonic', '--meson', '--backend', backend, 'solver.py'], check: true)
subdir('__pythran__')
3 changes: 3 additions & 0 deletions fluidsim/util/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ py.install_sources(

subdir('console')
subdir('scripts')

run_command(['transonic', '--meson', '--backend', backend, 'mini_oper_modif_resol.py'], check: true)
subdir('__pythran__')
40 changes: 39 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
project(
'fluidsim',
'cpp',
version: '0.7.4',
license: 'CeCILL',
meson_version: '>= 1.1.0',
Expand All @@ -10,9 +11,46 @@ project(
],
)

backend = get_option('deps_backend')

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

incdir_numpy = run_command(
py,
[
'-c',
'''import os
import numpy as np
try:
incdir = os.path.relpath(np.get_include())
except Exception:
incdir = np.get_include()
print(incdir)'''
],
check: true
).stdout().strip()

inc_np = include_directories(incdir_numpy)
np_dep = declare_dependency(include_directories: inc_np)

incdir_pythran = run_command(
py,
[
'-c',
'''import os
import pythran;
incdir = os.path.dirname(pythran.__file__)
try:
incdir = os.path.relpath(incdir)
except Exception:
pass
print(incdir)'''
],
check: true
).stdout().strip()

pythran = find_program('pythran', native: true)
pythran_dep = declare_dependency(
Expand Down
1 change: 1 addition & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('deps_backend', type: 'string', value: 'pythran', description: 'pythran(default), cython, numpy, numba')
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
[build-system]
# Further build requirements - like pythran and mpi4py - come from setup.py via
# the PEP 517 interface.
requires = [ "meson-python>=0.15.0", "wheel", "numpy", "transonic", "pythran>=0.9.7", "cython", "setuptools"]
requires = [
"meson-python",
"wheel",
"numpy",
"transonic@hg+https://foss.heptapod.net/fluiddyn/transonic",
"pythran>=0.9.7",
"cython",
"setuptools",
]
build-backend = 'mesonpy'

[project]
Expand Down

0 comments on commit 2f8340b

Please sign in to comment.