diff --git a/setup.py b/setup.py index e22bcf68b..5003a6404 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,20 @@ vars = sysconfig.get_config_vars() vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-shared') extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix] + +# Default compile args +extra_compile_args=['-fstrict-aliasing', '-O3','-std=c99','-Wno-unknown-pragmas', ghash_arg, '-DLIBREBOUND', '-D_GNU_SOURCE', '-fPIC'] + +# Option to disable FMA in CLANG. +FFP_CONTRACT_OFF = os.environ.get("FFP_CONTRACT_OFF", None) +if FFP_CONTRACT_OFF: + extra_compile_args.append('-ffp-contract=off') + +# Option to enable AVX512 enabled integrators (WHFast512). +AVX512 = os.environ.get("AVX512", None) +if AVX512: + extra_compile_args.append('-march=native') + extra_compile_args.append('-DAVX512') libreboundmodule = Extension('librebound', sources = [ 'src/rebound.c', @@ -57,11 +71,8 @@ ], include_dirs = ['src'], define_macros=[ ('LIBREBOUND', None) ], - # Uncomment the following line for the non-AVX512 version of REBOUND - extra_compile_args=['-fstrict-aliasing', '-O3','-std=c99','-Wno-unknown-pragmas', ghash_arg, '-DLIBREBOUND', '-D_GNU_SOURCE', '-fPIC'], - # Uncomment the following line to enable AVX512 - # extra_compile_args=['-fstrict-aliasing', '-O3','-std=c99','-Wno-unknown-pragmas', ghash_arg, '-DLIBREBOUND', '-D_GNU_SOURCE', '-fPIC', '-march=native', '-DAVX512'], extra_link_args=extra_link_args, + extra_compile_args=extra_compile_args, ) here = os.path.abspath(os.path.dirname(__file__))