Skip to content

Commit

Permalink
Merge branch 'topic/default/meson-build' into 'branch/default'
Browse files Browse the repository at this point in the history
Topic/default/meson build

See merge request fluiddyn/fluidsim!346
  • Loading branch information
paugier committed Dec 28, 2023
2 parents f5ddea8 + c5adebd commit 89f8624
Show file tree
Hide file tree
Showing 71 changed files with 1,069 additions and 673 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
ignore = E501,E225,E226,E303,E201,E202,E203,W503
4 changes: 1 addition & 3 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
defaults:
run:
shell: bash -l {0}
env:
FLUIDSIM_TRANSONIC_BACKEND: "python"
strategy:
matrix:
python-version: ["3.10"]
Expand All @@ -27,7 +25,7 @@ jobs:
use-mamba: true
- name: Install
run: |
pip install -e . -v
pip install . -v
- name: Tests
run: |
python -m pip install pytest-allclose pytest-mock
Expand Down
7 changes: 7 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ tests:
script:
- pip install -U pip tox --user
- tox -e py39,py39-fft,codecov

lint:
image: fluiddyn/python3-stable:lastest
script:
- pip install -U pip tox --user
- tox -e lint
- tox -e black
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ SHELL := bash
RELEASE=$(shell hg tags -T "{node|short}\n" | sed -n 2p)
MPI_NUM_PROCS ?= 2

.PHONY: black clean clean_pyc clean_so cleantransonic coverage_short develop develop_lib develop_user dist lint _report_coverage shortlog tests _tests_coverage tests_mpi
.PHONY: black black_check clean clean_pyc clean_so cleantransonic coverage_short develop develop_lib develop_user dist lint _report_coverage shortlog tests _tests_coverage tests_mpi

develop: develop_lib
pip install -v -e .[dev] | grep -v link
pip install meson-python ninja numpy "pythran>=0.9.7"
pip install --force-reinstall transonic@hg+https://foss.heptapod.net/fluiddyn/transonic
pip install -e .[dev] --no-build-isolation

develop_lib:
cd lib && pip install -e .

develop_user:
pip install -v -e .[dev] --user | grep -v link

develop_no-build-isolation: develop_lib
pip install -e .[dev] --no-build-isolation

dist:
cd lib && python setup.py sdist bdist_wheel
python setup.py sdist
pip install build
cd lib && python -m build
python -m build
mv -f lib/dist/* dist/

clean_so:
Expand All @@ -46,6 +43,9 @@ shortlog:
black:
black -l 82 fluidsim scripts bench doc lib --exclude "/(__pythran__|doc/_build|\.ipynb_checkpoints/*)/"

black_check:
black --check -l 82 fluidsim scripts bench doc lib --exclude "/(__pythran__|doc/_build|\.ipynb_checkpoints/*)/"

tests:
pytest -v lib
fluidsim-test -v
Expand All @@ -70,8 +70,9 @@ _tests_coverage:
coverage run -p -m pytest -v --exitfirst fluidsim/operators/test/test_operators3d.py::TestCoarse
FLUIDSIM_TYPE_FFT=fft3d.mpi_with_p3dfft TRANSONIC_NO_REPLACE=1 mpirun -np 4 --oversubscribe \
coverage run -p -m pytest -v --exitfirst fluidsim/operators/test/test_operators3d.py::TestCoarse
$(call _test_mpi_fft_lib,fft3d.mpi_with_pfft,2)
$(call _test_mpi_fft_lib,fft3d.mpi_with_pfft,4)
# There is a problem in the CI with a test using mpi_with_pfft
# $(call _test_mpi_fft_lib,fft3d.mpi_with_pfft,2)
# $(call _test_mpi_fft_lib,fft3d.mpi_with_pfft,4)
coverage run -p -m fluidsim.util.testing -v
TRANSONIC_NO_REPLACE=1 coverage run -p -m fluidsim.util.testing -v
TRANSONIC_NO_REPLACE=1 mpirun -np 2 --oversubscribe coverage run -p -m fluidsim.util.testing -v --exitfirst
Expand Down Expand Up @@ -114,7 +115,7 @@ coverage_short:

pytest_cov_html:
$(call _init_coverage)
TRANSONIC_NO_REPLACE=1 pytest -v --cov --cov-config=setup.cfg $(PYTEST_ARGS) --durations=10 -x
TRANSONIC_NO_REPLACE=1 pytest -v --cov --cov-config=pyproject.toml $(PYTEST_ARGS) --durations=10 -x
$(call _end_coverage)

pytest_cov_html_mpi:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"metadata": {},
"outputs": [],
"source": [
"#%%bash\n",
"# %%bash\n",
"# echo $I_MPI_PMI_LIBRARY\n",
"# module list\n",
"# which python\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
"outputs": [],
"source": [
"def customize(result, sim):\n",
"\n",
" EKh = result[\"EKh\"]\n",
" EKz = result[\"EKz\"]\n",
" EK = EKh + EKz\n",
Expand Down
28 changes: 28 additions & 0 deletions fluidsim/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import importlib_metadata

__version__ = importlib_metadata.version(__package__)


__all__ = ["__version__", "get_local_version", "__about__"]

try:
from pyfiglet import figlet_format

__about__ = figlet_format("fluidsim", font="big")
except ImportError:
__about__ = r"""
__ _ _ _ _
/ _| | (_) | | (_)
| |_| |_ _ _ __| |___ _ _ __ ___
| _| | | | | |/ _` / __| | '_ ` _ \
| | | | |_| | | (_| \__ \ | | | | | |
|_| |_|\__,_|_|\__,_|___/_|_| |_| |_|
"""

__about__ = __about__.rstrip() + f"\n\n{28 * ' '} v. {__version__}\n"


def get_local_version():
"""Get a long "local" version."""

return __version__
61 changes: 0 additions & 61 deletions fluidsim/_version.tpl

This file was deleted.

14 changes: 14 additions & 0 deletions fluidsim/base/forcing/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
python_sources = [
'__init__.py',
'anisotropic.py',
'base.py',
'kolmogorov.py',
'milestone.py',
'specific.py',
'test_kolmogorov.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/forcing'
)
21 changes: 21 additions & 0 deletions fluidsim/base/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
python_sources = [
'__init__.py',
'init_fields.py',
'setofvariables.py',
'state.py',
'params.py',
]

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

subdir('forcing')
subdir('output')
subdir('preprocess')
subdir('solvers')
subdir('sphericalharmo')
subdir('time_stepping')
subdir('turb_model')
subdir('test')
32 changes: 32 additions & 0 deletions fluidsim/base/output/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
python_sources = [
'__init__.py',
'base.py',
'cross_corr3d.py',
'horiz_means.py',
'increments.py',
'phys_fields1d.py',
'phys_fields2d.py',
'phys_fields3d.py',
'phys_fields.py',
'print_stdout.py',
'prob_dens_func.py',
'spatial_means.py',
'spatiotemporal_spectra.py',
'spect_energy_budget.py',
'spectra3d.py',
'spectra_multidim.py',
'spectra.py',
'temporal_spectra.py',
'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('__' + backend + '__')
11 changes: 11 additions & 0 deletions fluidsim/base/preprocess/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
python_sources = [
'__init__.py',
'base.py',
'pseudo_spect.py',
'test.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/preprocess'
)
12 changes: 12 additions & 0 deletions fluidsim/base/solvers/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python_sources = [
'__init__.py',
'base.py',
'finite_diff.py',
'info_base.py',
'pseudo_spect.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/solvers'
)
12 changes: 12 additions & 0 deletions fluidsim/base/sphericalharmo/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python_sources = [
'__init__.py',
'output.py',
'phys_fields.py',
'solver.py',
'state.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/sphericalharmo'
)
11 changes: 11 additions & 0 deletions fluidsim/base/test/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
python_sources = [
'__init__.py',
'test_base_solver_ps.py',
'test_base_solver.py',
'test_params.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/test'
)
15 changes: 15 additions & 0 deletions fluidsim/base/time_stepping/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
python_sources = [
'__init__.py',
'base.py',
'finite_diff.py',
'pseudo_spect.py',
'simple.py',
]

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

run_command(['transonic', '--meson', '--backend', backend, 'pseudo_spect.py'], check: true)
subdir('__' + backend + '__')
12 changes: 12 additions & 0 deletions fluidsim/base/turb_model/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python_sources = [
'__init__.py',
'base.py',
'smagorinsky.py',
'stress_tensor.py',
'test_turb_model.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/base/turb_model'
)
9 changes: 9 additions & 0 deletions fluidsim/extend_simul/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
python_sources = [
'__init__.py',
'spatial_means_regions_milestone.py',
]

py.install_sources(
python_sources,
subdir: 'fluidsim/extend_simul'
)
24 changes: 24 additions & 0 deletions fluidsim/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
python_sources = [
'__init__.py',
'_version.py',
'magic.py',
'build_conf.txt',
]

run_command(
'sh',
'-c',
'echo transonic_backend=' + backend + ' > ' + 'build_conf.txt',
)


py.install_sources(
python_sources,
subdir: 'fluidsim'
)

subdir('base')
subdir('solvers')
subdir('extend_simul')
subdir('operators')
subdir('util')
Loading

0 comments on commit 89f8624

Please sign in to comment.