From fc5ce82026aa5a4a7ea25650067287faa687aae2 Mon Sep 17 00:00:00 2001 From: Chris Hold Date: Mon, 15 Jan 2024 16:24:24 +0200 Subject: [PATCH] Switch performance libs default for apple OS --- README.md | 1 + safpy_build.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 988ff28..528720a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Running `pip install -e .` builds it automatically By default, it assumes SAF in a subdirectory, which is obtained by `git submodule update --init --recursive `. You can simply adapt the variable `saf_path` in `safpy_build.py` if needed. +There you also have access to change the performance library options. If in trouble you can have a look at the CI steps [here](https://github.com/chris-hld/SAFpy/blob/master/.github/workflows/python-safpy.yml). diff --git a/safpy_build.py b/safpy_build.py index 051a272..c3efba6 100644 --- a/safpy_build.py +++ b/safpy_build.py @@ -1,4 +1,5 @@ import os.path +import sys from cffi import FFI ffibuilder = FFI() @@ -16,8 +17,14 @@ saf_performance_lib = [] extra_link_args = [] -saf_performance_lib.extend(["openblas", "lapacke"]) -#extra_link_args.extend(['-Wl,-framework', '-Wl,Accelerate']) +# Sensible default, please adjust if needed +if sys.platform == "darwin": + print("SAFPY using default Apple Accelerate") + extra_link_args.extend(['-Wl,-framework', '-Wl,Accelerate']) +else: + print("SAFPY using default OpenBLAS/LAPACKE") + saf_performance_lib.extend(["openblas", "lapacke"]) + # cdef() expects a single string declaring the C types, functions and # globals needed to use the shared object. It must be in valid C syntax.