Skip to content

Commit

Permalink
fix: fix issues with OMP library
Browse files Browse the repository at this point in the history
there are path problems between torch and concrete omp libraries

closes #3951
  • Loading branch information
bcm-at-zama committed Sep 12, 2023
1 parent b153b29 commit 2b61846
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ setup_env:

echo "Installing $(CP_VERSION_SPEC_FOR_RC)" && \
poetry run python -m pip install -U --pre "$(CP_VERSION_SPEC_FOR_RC)" --no-deps
"$(MAKE)" fix_omp_issues_for_intel_mac

.PHONY: sync_env # Synchronise the environment
sync_env: check_poetry_version
Expand All @@ -56,6 +57,13 @@ sync_env: check_poetry_version
fi
"$(MAKE)" setup_env

.PHONY: fix_omp_issues_for_intel_mac # Fix OMP issues for macOS Intel, https://github.com/zama-ai/concrete-ml-internal/issues/3951
fix_omp_issues_for_intel_mac:
if [[ $$(uname) == "Darwin" ]]; then \
./script/make_utils/fix_omp_issues_for_intel_mac.sh; \
fi


.PHONY: update_env # Same as sync_env, sets the venv state to be synced with the rpo
update_env: sync_env

Expand Down
6 changes: 4 additions & 2 deletions deps_licenses/licenses_mac_intel_user.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name, Version, License
GitPython, 3.1.34, BSD License
PyYAML, 6.0.1, MIT License
anyio, 3.7.1, MIT License
attrs, 23.1.0, MIT License
boto3, 1.28.32, Apache Software License
botocore, 1.31.32, Apache Software License
brevitas, 0.8.0, UNKNOWN
Expand All @@ -19,6 +19,7 @@ fastapi, 0.93.0, MIT License
filelock, 3.12.2, The Unlicense (Unlicense)
flatbuffers, 2.0.7, Apache Software License
fsspec, 2023.6.0, BSD License
gitdb, 4.0.10, BSD License
h11, 0.14.0, MIT License
huggingface-hub, 0.16.4, Apache Software License
humanfriendly, 10.0, MIT License
Expand All @@ -41,7 +42,7 @@ protobuf, 3.20.3, BSD-3-Clause
psutil, 5.9.5, BSD License
pycparser, 2.21, BSD License
pydantic, 1.10.12, MIT License
pytest, 7.2.0, MIT License
pytest, 7.4.1, MIT License
pytest-json-report, 1.5.0, MIT
pytest-metadata, 3.0.0, MIT License
python-dateutil, 2.8.2, Apache Software License; BSD License
Expand All @@ -56,6 +57,7 @@ six, 1.16.0, MIT License
skl2onnx, 1.12, Apache Software License
skops, 0.5.0, MIT
skorch, 0.11.0, new BSD 3-Clause
smmap, 5.0.0, BSD License
sniffio, 1.3.0, Apache Software License; MIT License
starlette, 0.25.0, BSD License
sympy, 1.12, BSD License
Expand Down
2 changes: 1 addition & 1 deletion deps_licenses/licenses_mac_intel_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2a63f48f89c4f3baf86030ef350daf40
2e7e123fa7eb6a3a27d370d507994557
28 changes: 28 additions & 0 deletions script/make_utils/fix_omp_issues_for_intel_mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Fix OMP issues for macOS Intel, https://github.com/zama-ai/concrete-ml-internal/issues/3951

set -ex

UNAME=$(uname)

if [ "$UNAME" == "Darwin" ]
then

# We need to source the venv here, since it's not done in the CI
# shellcheck disable=SC1090,SC1091
source .venv/bin/activate

# In the following, `command -v python` is for `which python` in a way which is approved by our
# shell lint
WHICH_VENV=$(command -v python | sed -e "s@bin/python@@")
WHICH_PYTHON=$(python -c 'import sys; print(f"python{sys.version_info.major}.{sys.version_info.minor}")')

rm "${WHICH_VENV}"/lib/"${WHICH_PYTHON}"/site-packages/torch/lib/libiomp5.dylib
ln -s "${WHICH_VENV}"/lib/"${WHICH_PYTHON}"/site-packages/concrete/.dylibs/libomp.dylib "${WHICH_VENV}"/lib/"${WHICH_PYTHON}"/site-packages/torch/lib/libiomp5.dylib
rm "${WHICH_VENV}"/lib/"${WHICH_PYTHON}"/site-packages/functorch/.dylibs/libiomp5.dylib
ln -s "${WHICH_VENV}"/lib/"${WHICH_PYTHON}"/site-packages/concrete/.dylibs/libomp.dylib "${WHICH_VENV}"lib/"${WHICH_PYTHON}"/site-packages/functorch/.dylibs/libiomp5.dylib
fi



0 comments on commit 2b61846

Please sign in to comment.