Skip to content

Commit

Permalink
fix: use correct torch version for intel mac (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcm-at-zama authored and RomanBredehoft committed Aug 1, 2024
1 parent cd9dd2e commit d5f8f6c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 35 deletions.
20 changes: 3 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ POETRY_VERSION:=1.7.1
APIDOCS_OUTPUT?="./docs/references/api"
OPEN_PR="true"

# Force the installation of a Concrete Python version, which is very useful with nightly versions
# /!\ WARNING /!\: This version should NEVER be a wildcard as it might create some
# issues when trying to run it in the future.
CONCRETE_PYTHON_VERSION="concrete-python==2.7.0.dev20240731"

# Force the installation of Concrete Python's latest version, release-candidates included
# CONCRETE_PYTHON_VERSION="$$(poetry run python \
# ./script/make_utils/pyproject_version_parser_helper.py \
# --pyproject-toml-file pyproject.toml \
# --get-pip-install-spec-for-dependency concrete-python)"

# At the end of the command, we currently need to force an 'import skorch' in Python in order to
# avoid an obscure bug that led to all pytest commands to fail when installing dependencies with
# Poetry >= 1.3. It is however not very clear how this import fixes the issue, as the bug was
Expand All @@ -53,8 +42,6 @@ setup_env:
fi
echo "Finished installing poetry lock."

echo "Installing $(CONCRETE_PYTHON_VERSION)" && \
poetry run python -m pip install -U --pre --extra-index-url https://pypi.zama.ai/cpu "$(CONCRETE_PYTHON_VERSION)"
"$(MAKE)" fix_omp_issues_for_intel_mac
poetry run python -c "import skorch" || true # Details above
poetry run python -c "from brevitas.core.scaling import AccumulatorAwareParameterPreScaling" || true # Details above
Expand Down Expand Up @@ -566,17 +553,16 @@ show_commit_rules:

.PHONY: licenses # Generate the list of licenses of dependencies
licenses:
./script/make_utils/licenses.sh --cp_version "$(CONCRETE_PYTHON_VERSION)"
./script/make_utils/licenses.sh

.PHONY: force_licenses # Generate the list of licenses of dependencies (force the regeneration)
force_licenses:
./script/make_utils/licenses.sh --cp_version "$(CONCRETE_PYTHON_VERSION)" --force_update
./script/make_utils/licenses.sh --force_update

.PHONY: check_licenses # Check if the licenses of dependencies have changed
check_licenses:
@TMP_OUT="$$(mktemp)" && \
if ! poetry run env bash ./script/make_utils/licenses.sh --check \
--cp_version "$(CONCRETE_PYTHON_VERSION)" > "$${TMP_OUT}"; then \
if ! poetry run env bash ./script/make_utils/licenses.sh --check > "$${TMP_OUT}"; then \
cat "$${TMP_OUT}"; \
rm -f "$${TMP_OUT}"; \
echo "Error while checking licenses, see log above."; \
Expand Down
2 changes: 1 addition & 1 deletion deps_licenses/licenses_linux_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4c5946ebf8d2349587bb18874b83606e
7fd944cd8040c63f357a50cd33da1ad8
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 @@
4c5946ebf8d2349587bb18874b83606e
7fd944cd8040c63f357a50cd33da1ad8
2 changes: 1 addition & 1 deletion deps_licenses/licenses_mac_silicon_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4c5946ebf8d2349587bb18874b83606e
7fd944cd8040c63f357a50cd33da1ad8
17 changes: 2 additions & 15 deletions script/make_utils/licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ DO_USER_LICENSES=1

OUTPUT_DIRECTORY="${LICENSE_DIRECTORY}"
DO_FORCE_UPDATE=0
CP_VERSION="concrete-python[full]"

while [ -n "$1" ]
do
Expand All @@ -25,11 +24,6 @@ do
DO_FORCE_UPDATE=1
;;

"--cp_version" )
shift
CP_VERSION="${1}"
;;

*)
echo "Unknown param : $1"
exit 1
Expand All @@ -38,12 +32,6 @@ do
shift
done

# Temp file with CP version inside. We can't have a dynamic TMP_FILE_CP_VERSION filename, since it
# changes the md5
TMP_FILE_CP_VERSION="/tmp/cp_version.txt"
rm -f TMP_FILE_CP_VERSION
echo "${CP_VERSION}" > ${TMP_FILE_CP_VERSION}

UNAME=$(uname)
if [ "$UNAME" == "Darwin" ]
then
Expand Down Expand Up @@ -74,7 +62,7 @@ then

# If the dependencies have not changed, don't do anything
MD5_OLD_DEPENDENCIES=$(cat ${LICENSES_FILENAME}.md5)
MD5_NEW_DEPENDENCIES=$(openssl md5 poetry.lock ${TMP_FILE_CP_VERSION} | sed -e "s@(stdin)= @@g" | openssl md5 | sed -e "s@MD5@@g" | sed -e "s@(stdin)= @@g")
MD5_NEW_DEPENDENCIES=$(openssl md5 poetry.lock | sed -e "s@(stdin)= @@g" | openssl md5 | sed -e "s@MD5@@g" | sed -e "s@(stdin)= @@g")

echo "MD5 of the poetry.lock for which dependencies have been listed: ${MD5_OLD_DEPENDENCIES}"
echo "MD5 of the current poetry.lock: ${MD5_NEW_DEPENDENCIES}"
Expand Down Expand Up @@ -131,7 +119,6 @@ then
fi

poetry install --only main
python -m pip install -U --pre --extra-index-url https://pypi.zama.ai/cpu "${CP_VERSION}"
python -m pip install pip-licenses

# In --format=csv such that the column length (and so, the diff) do not change with longer
Expand Down Expand Up @@ -203,7 +190,7 @@ then
echo "Success: no update in $LICENSES_FILENAME"
else
# Update the .md5 files
openssl md5 poetry.lock ${TMP_FILE_CP_VERSION} | sed -e "s@(stdin)= @@g" | openssl md5 | sed -e "s@MD5@@g" | sed -e "s@(stdin)= @@g" > ${LICENSES_FILENAME}.md5
openssl md5 poetry.lock | sed -e "s@(stdin)= @@g" | openssl md5 | sed -e "s@MD5@@g" | sed -e "s@(stdin)= @@g" > ${LICENSES_FILENAME}.md5
fi
fi

Expand Down

0 comments on commit d5f8f6c

Please sign in to comment.