From a200c0b19528ad23ad7d876c026f163973c13d2b Mon Sep 17 00:00:00 2001 From: paugier Date: Fri, 12 Jan 2024 13:53:29 +0100 Subject: [PATCH] Build option for perf and not portable --- doc/build-from-source.md | 13 +++++++++++-- meson.build | 5 ++++- meson.options | 23 +++++++++++++++++------ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/doc/build-from-source.md b/doc/build-from-source.md index b06aa90d..25600d9f 100644 --- a/doc/build-from-source.md +++ b/doc/build-from-source.md @@ -97,6 +97,16 @@ There are 3 levels: ``` +````{important} + +One can activate a performance oriented and not portable build using: + +```sh +pip install . -v -C setup-args=-Dnative=true +``` + +```` + ````{note} Recent versions of `pip` allow one to specify different options like so: @@ -107,7 +117,6 @@ pip install . -v \ -C setup-args=-Duse-xsimd=false ``` - ```` Of course, one can also change values of @@ -140,8 +149,8 @@ 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"`. +are honored. So for example, one could compile with Note that Fluidsim builds are not sensible to the [`~/.pythranrc` file](pythranrc)! diff --git a/meson.build b/meson.build index 4100bfa1..47aa4c6e 100644 --- a/meson.build +++ b/meson.build @@ -83,12 +83,15 @@ print(incdir)''' ) endif - pythran_complex_hook = get_option('pythran-complex-hook') if pythran_complex_hook == 'os-dependent' pythran_complex_hook = host_machine.system() == 'linux' endif + if get_option('native') + cpp_args_pythran += ['-march=native', '-Ofast'] + endif + endif subdir('fluidsim') diff --git a/meson.options b/meson.options index ff44f3cd..b5c8ca59 100644 --- a/meson.options +++ b/meson.options @@ -4,13 +4,24 @@ option( value: 'pythran,python,numba', description: 'pythran,python,numba (default), cython, numpy, numba; ' + - 'or comma separated value representing multi-backends' + 'or comma separated value representing multi-backends', +) +option( + 'native', + type: 'boolean', + value: true, + description: 'Performance oriented and not portable build', +) +option( + 'use-xsimd', + type: 'boolean', + value: true, + description: 'Turns on xsimd vectorization' ) -option('use-xsimd', type: 'boolean', value: true, description: 'Use xsimd') option( 'pythran-complex-hook', - type : 'combo', - choices : ['os-dependent', 'true', 'false'], - value : 'os-dependent', - description: 'Pythran complex_hook option' + type: 'combo', + choices: ['os-dependent', 'true', 'false'], + value: 'os-dependent', + description: 'Pythran complex_hook option', )