Skip to content

Commit

Permalink
Better Meson+Pythran
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Jan 12, 2024
1 parent 9e6a4a9 commit 520b69a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
18 changes: 12 additions & 6 deletions doc/build-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,27 @@ pip install . -v -C setup-args=-Doptimization=2
````

```{admonition} Advanced compilation configuration
The environment variables `CC`, `CXX`, `CFLAGS`, `CXXFLAGS` and `LDFLAGS`
are honored. So for example, one could compile with
`CXXFLAGS="-march=native -Ofast"`.
Note that Fluidsim builds are not sensible to the [`~/.pythranrc` file](pythranrc)!
```

```{todo}
- How to use `-march=native -Ofast`? How to differentiate a native build from a
- How to differentiate a native build from a
regular build to produce binaries usable on other computers?
- How to do what was done with the `[compiler]` section of `~/.pythranrc` (described [here](https://pythran.readthedocs.io/en/latest/MANUAL.html#customizing-your-pythranrc))?
- How to know which compilers and compilation flags are used?
- How to `USE_XSIMD`? How to check if XSIMD was indeed used?
- How to check if XSIMD was indeed used?
- How to produce a wheel for other architectures (cross-compilation)?
- Default for `pythran-complex-hook`? Depending on OS?
```

### Setup a full developer environment with editable installation
Expand Down
1 change: 1 addition & 0 deletions fluidsim/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ run_command(
'sh',
'-c',
'echo transonic_backend=' + backend + ' > ' + 'build_conf.txt',
check=true,
)


Expand Down
15 changes: 10 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ print(incdir)'''

pythran = find_program('pythran', native: true)

cpp_args_pythran = [
'-DENABLE_PYTHON_MODULE',
'-D__PYTHRAN__=3',
'-DPYTHRAN_BLAS_NONE'
]

if get_option('use-xsimd') == true
# xsimd is unvendored from pythran by conda-forge, and due to a compiler
# activation bug the default <prefix>/include/ may not be visible (see
Expand All @@ -70,19 +76,18 @@ print(incdir)'''
include_directories: incdir_pythran,
dependencies: xsimd_dep,
)
cpp_args_pythran += ['-DUSE_XSIMD']
else
pythran_dep = declare_dependency(
include_directories: incdir_pythran,
)
endif

cpp_args_pythran = [
'-DENABLE_PYTHON_MODULE',
'-D__PYTHRAN__=3',
'-DPYTHRAN_BLAS_NONE'
]

pythran_complex_hook = get_option('pythran-complex-hook')
if pythran_complex_hook == 'os-dependent'
pythran_complex_hook = host_machine.system() == 'linux'
endif

endif

Expand Down
7 changes: 4 additions & 3 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ option(
'pythran,python,numba (default), cython, numpy, numba; ' +
'or comma separated value representing multi-backends'
)
option('use-xsimd', type: 'boolean', value: true, description: 'use xsimd')
option('use-xsimd', type: 'boolean', value: true, description: 'Use xsimd')
option(
'pythran-complex-hook',
type: 'boolean',
value: true,
type : 'combo',
choices : ['os-dependent', 'true', 'false'],
value : 'os-dependent',
description: 'Pythran complex_hook option'
)

0 comments on commit 520b69a

Please sign in to comment.