From c172520006ffd99e34576540ca6b4506be4d8f5b Mon Sep 17 00:00:00 2001 From: Benoit Chevallier-Mames Date: Mon, 15 Apr 2024 15:04:14 +0200 Subject: [PATCH] chore: fixing OMP lib installation issues on intel mac for other python version --- .../fix_omp_issues_for_intel_mac.sh | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/script/make_utils/fix_omp_issues_for_intel_mac.sh b/script/make_utils/fix_omp_issues_for_intel_mac.sh index d38b4803ae..61cf76b0ff 100755 --- a/script/make_utils/fix_omp_issues_for_intel_mac.sh +++ b/script/make_utils/fix_omp_issues_for_intel_mac.sh @@ -9,8 +9,7 @@ UNAME=$(uname) MACHINE=$(uname -m) PYTHON_VERSION=$(python --version | cut -d' ' -f2 | cut -d'.' -f1,2) -# The error does not seem to happen on python 3.10 (on MacOS 13.6.6) -if [ "$UNAME" == "Darwin" ] && [ "$MACHINE" != "arm64" ] && [ "$PYTHON_VERSION" != "3.10" ] +if [ "$UNAME" == "Darwin" ] && [ "$MACHINE" != "arm64" ] then # We need to source the venv here, since it's not done in the CI @@ -22,11 +21,23 @@ then 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 + # The error is specific to python version + if [ "$PYTHON_VERSION" == "3.9" ] + then + 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 + + elif [ "$PYTHON_VERSION" == "3.10" ] + then + 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/torch/.dylibs/libiomp5.dylib + ln -s "${WHICH_VENV}"/lib/"${WHICH_PYTHON}"/site-packages/concrete/.dylibs/libomp.dylib "${WHICH_VENV}"lib/"${WHICH_PYTHON}"/site-packages/torch/.dylibs/libiomp5.dylib + else + echo "Please have a look to libraries libiomp5.dylib related to torch and then" + echo "apply appropriate fix" + exit -1 + fi fi - - -