Skip to content

Commit

Permalink
Install xtensor-python and upgrade xsimd
Browse files Browse the repository at this point in the history
This was required for the compilation with xsimd to succeed.

Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Jan 19, 2024
1 parent 11956d6 commit ea2be2d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ requirements:
- pybind11
- xsimd
- xtensor
- xtensor-python

run:
- appdirs
Expand Down
1 change: 1 addition & 0 deletions hexrd/transforms/cpp_sublibrary/src/inverse_distortion.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define FORCE_IMPORT_ARRAY
#define XTENSOR_USE_XSIMD

#include <pybind11/pybind11.h>
#include <xtensor/xmath.hpp>
Expand Down
28 changes: 24 additions & 4 deletions scripts/install/install_build_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand Down Expand Up @@ -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)


Expand All @@ -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,
}

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit ea2be2d

Please sign in to comment.