From ea2be2d8b016f4f514efc1b1a3f2f18f0e0deb4f Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Fri, 19 Jan 2024 11:32:31 -0600 Subject: [PATCH] Install xtensor-python and upgrade xsimd This was required for the compilation with xsimd to succeed. Signed-off-by: Patrick Avery --- conda.recipe/meta.yaml | 1 + .../cpp_sublibrary/src/inverse_distortion.cpp | 1 + scripts/install/install_build_dependencies.py | 28 ++++++++++++++++--- setup.py | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 211273269..9a03d7c34 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -31,6 +31,7 @@ requirements: - pybind11 - xsimd - xtensor + - xtensor-python run: - appdirs diff --git a/hexrd/transforms/cpp_sublibrary/src/inverse_distortion.cpp b/hexrd/transforms/cpp_sublibrary/src/inverse_distortion.cpp index 799f9dfff..196c31394 100644 --- a/hexrd/transforms/cpp_sublibrary/src/inverse_distortion.cpp +++ b/hexrd/transforms/cpp_sublibrary/src/inverse_distortion.cpp @@ -1,4 +1,5 @@ #define FORCE_IMPORT_ARRAY +#define XTENSOR_USE_XSIMD #include #include diff --git a/scripts/install/install_build_dependencies.py b/scripts/install/install_build_dependencies.py index 451efc189..abc5299f0 100755 --- a/scripts/install/install_build_dependencies.py +++ b/scripts/install/install_build_dependencies.py @@ -55,6 +55,26 @@ def download_xtensor(path): return str(target_path) +def download_xtensor_python(path): + url = 'https://github.com/xtensor-stack/xtensor-python/archive/refs/tags/0.26.1.tar.gz' # noqa + md5sum = '5d05edf71ac948dc620968229320c791' + out_dir_name = 'xtensor-python-0.26.1' + + with tempfile.TemporaryDirectory() as temp_dir: + download_and_extract_tgz(url, md5sum, temp_dir) + + target_path = Path(path) / 'xtensor-python' + if target_path.exists(): + shutil.rmtree(target_path) + + os.makedirs(path, exist_ok=True) + shutil.move( + str(Path(temp_dir) / out_dir_name / 'include/xtensor-python'), + str(Path(path) / 'xtensor-python/xtensor-python')) + + return str(target_path) + + def download_xtl(path): url = 'https://github.com/xtensor-stack/xtl/archive/refs/tags/0.7.7.tar.gz' # noqa md5sum = '6df56ae8bc30471f6773b3f18642c8ab' @@ -75,9 +95,9 @@ def download_xtl(path): def download_xsimd(path): - url = 'https://github.com/xtensor-stack/xsimd/archive/refs/tags/7.6.0.tar.gz' # noqa - md5sum = '6e52c2af8b3cb4688993a0e70825f4e8' - out_dir_name = 'xsimd-7.6.0' + url = 'https://github.com/xtensor-stack/xsimd/archive/refs/tags/12.1.1.tar.gz' # noqa + md5sum = 'e8887de343bd6036bdfa1f4a4752dc64' + out_dir_name = 'xsimd-12.1.1' with tempfile.TemporaryDirectory() as temp_dir: download_and_extract_tgz(url, md5sum, temp_dir) @@ -125,7 +145,6 @@ def download_pybind11(path): shutil.move(str(Path(temp_dir) / out_dir_name / 'include/pybind11'), str(Path(path) / 'pybind11/pybind11')) - return str(target_path) @@ -134,6 +153,7 @@ def download_pybind11(path): 'pybind11': download_pybind11, 'xsimd': download_xsimd, 'xtensor': download_xtensor, + 'xtensor-python': download_xtensor_python, 'xtl': download_xtl, } diff --git a/setup.py b/setup.py index 7c1dd8c0f..785a82391 100644 --- a/setup.py +++ b/setup.py @@ -119,6 +119,7 @@ def get_cpp_extensions(): include_dirs = [ get_include_path('xsimd'), get_include_path('xtensor'), + get_include_path('xtensor-python'), get_include_path('xtl'), get_pybind11_include_path(), numpy.get_include(),