Skip to content

Commit

Permalink
[BE] Remove macos x86 build statements, remove python <3.8 (pytorch#1745
Browse files Browse the repository at this point in the history
)

* [BE] Remove macos x86 build statements, remove python <3.8

* fix

* deprecate
  • Loading branch information
atalman committed Apr 4, 2024
1 parent c217c11 commit b9122f1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 143 deletions.
17 changes: 3 additions & 14 deletions manywheel/build_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,7 @@ fi
# in this case
if [[ -n "$DESIRED_PYTHON" && "$DESIRED_PYTHON" != cp* ]]; then
python_nodot="$(echo $DESIRED_PYTHON | tr -d m.u)"
case ${DESIRED_PYTHON} in
3.[6-7]*)
DESIRED_PYTHON="cp${python_nodot}-cp${python_nodot}m"
;;
# Should catch 3.8+
3.*)
DESIRED_PYTHON="cp${python_nodot}-cp${python_nodot}"
;;
esac
DESIRED_PYTHON="cp${python_nodot}-cp${python_nodot}"
fi

if [[ ${python_nodot} -ge 310 ]]; then
Expand Down Expand Up @@ -119,10 +111,7 @@ pushd "$PYTORCH_ROOT"
python setup.py clean
retry pip install -qr requirements.txt
case ${DESIRED_PYTHON} in
cp36-cp36m)
retry pip install -q numpy==1.11
;;
cp3[7-8]*)
cp38*)
retry pip install -q numpy==1.15
;;
cp310*)
Expand Down Expand Up @@ -280,7 +269,7 @@ replace_needed_sofiles() {
patchedname=$3
if [[ "$origname" != "$patchedname" ]] || [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
set +e
origname=$($PATCHELF_BIN --print-needed $sofile | grep "$origname.*")
origname=$($PATCHELF_BIN --print-needed $sofile | grep "$origname.*")
ERRCODE=$?
set -e
if [ "$ERRCODE" -eq "0" ]; then
Expand Down
89 changes: 0 additions & 89 deletions manywheel/conda_build.sh

This file was deleted.

47 changes: 11 additions & 36 deletions wheel/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,8 @@ fi
whl_tmp_dir="${MAC_PACKAGE_WORK_DIR}/dist"
mkdir -p "$whl_tmp_dir"

if [[ -n "$CROSS_COMPILE_ARM64" || $(uname -m) == "arm64" ]]; then
mac_version='macosx_11_0_arm64'
libtorch_arch='arm64'
else
mac_version='macosx_10_9_x86_64'
libtorch_arch='x86_64'
fi
mac_version='macosx_11_0_arm64'
libtorch_arch='arm64'

# Create a consistent wheel package name to rename the wheel to
wheel_filename_new="${TORCH_PACKAGE_NAME}-${build_version}${build_number_prefix}-cp${python_nodot}-none-${mac_version}.whl"
Expand Down Expand Up @@ -163,13 +158,9 @@ case $desired_python in
;;
3.8)
echo "Using 3.8 deps"
if [[ "$(uname -m)" == "arm64" ]]; then
SETUPTOOLS_PINNED_VERSION=">=46.0.0"
PYYAML_PINNED_VERSION=">=5.3"
NUMPY_PINNED_VERSION="=1.19"
else
NUMPY_PINNED_VERSION="=1.17"
fi
SETUPTOOLS_PINNED_VERSION=">=46.0.0"
PYYAML_PINNED_VERSION=">=5.3"
NUMPY_PINNED_VERSION="=1.19"
;;
*)
echo "Using default deps"
Expand All @@ -182,30 +173,19 @@ tmp_env_name="wheel_py$python_nodot"
conda create ${EXTRA_CONDA_INSTALL_FLAGS} -yn "$tmp_env_name" python="$desired_python"
source activate "$tmp_env_name"

retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq "numpy${NUMPY_PINNED_VERSION}" nomkl "setuptools${SETUPTOOLS_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" typing_extensions requests

if [[ "$(uname -m)" == "arm64" ]]; then
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq cmake ninja
else
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq cmake ninja mkl-include==2022.2.1 mkl-static==2022.2.1 -c intel
fi
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq "numpy${NUMPY_PINNED_VERSION}" nomkl cmake ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" typing_extensions requests
retry pip install -qr "${pytorch_rootdir}/requirements.txt" || true

# For USE_DISTRIBUTED=1 on macOS, need libuv and pkg-config to find libuv.
export USE_DISTRIBUTED=1
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq libuv pkg-config

if [[ -n "$CROSS_COMPILE_ARM64" || "$(uname -m)" == "arm64" ]]; then
if [[ -n "$CROSS_COMPILE_ARM64" ]]; then
export CMAKE_OSX_ARCHITECTURES=arm64
fi
export USE_MKLDNN=OFF
export USE_QNNPACK=OFF
export BUILD_TEST=OFF
elif [[ "$(uname -m)" == "x86_64" ]]; then
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq llvmdev=9
export USE_LLVM="${CONDA_PREFIX}"
if [[ -n "$CROSS_COMPILE_ARM64" ]]; then
export CMAKE_OSX_ARCHITECTURES=arm64
fi
export USE_MKLDNN=OFF
export USE_QNNPACK=OFF
export BUILD_TEST=OFF

pushd "$pytorch_rootdir"
echo "Calling setup.py bdist_wheel at $(date)"
Expand Down Expand Up @@ -289,9 +269,4 @@ else
zip -rq "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" libtorch
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-latest.zip"
if [[ "${libtorch_arch}" == "x86_64" ]]; then
# For backward compatibility make unarched latest to point to x86_64
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-latest.zip"
fi
fi
2 changes: 0 additions & 2 deletions windows/condaenv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ FOR %%v IN (%DESIRED_PYTHON%) DO (
set PYTHON_VERSION_STR=%%v
set PYTHON_VERSION_STR=!PYTHON_VERSION_STR:.=!
conda remove -n py!PYTHON_VERSION_STR! --all -y || rmdir %CONDA_HOME%\envs\py!PYTHON_VERSION_STR! /s
if "%%v" == "3.7" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 "mkl=2020.2" pyyaml boto3 cmake ninja typing_extensions python=%%v
if "%%v" == "3.8" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 "mkl=2020.2" pyyaml boto3 cmake ninja typing_extensions python=%%v
if "%%v" == "3.9" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy>=1.11 "mkl=2020.2" pyyaml boto3 cmake ninja typing_extensions python=%%v
if "%%v" == "3.10" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.21.3 "mkl=2020.2" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v
if "%%v" == "3.11" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.23.4 "mkl=2020.2" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v
if "%%v" == "3.12" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=1.26.0 "mkl=2023.1" intel-openmp=2023.2.0 pyyaml boto3 "cmake=3.19.6" ninja typing_extensions python=%%v
if "%%v" == "3" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 "mkl=2020.2" pyyaml boto3 cmake ninja typing_extensions python=%%v
)
endlocal

Expand Down
2 changes: 0 additions & 2 deletions windows/internal/smoke_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ if "%DESIRED_PYTHON%" == "3.11" set "PYTHON_INSTALLER_URL=https://www.python.org
if "%DESIRED_PYTHON%" == "3.10" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe"
if "%DESIRED_PYTHON%" == "3.9" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe"
if "%DESIRED_PYTHON%" == "3.8" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.8.2/python-3.8.2-amd64.exe"
if "%DESIRED_PYTHON%" == "3.7" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe"
if "%DESIRED_PYTHON%" == "3.6" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe"
if "%PYTHON_INSTALLER_URL%" == "" (
echo Python %DESIRED_PYTHON% not supported yet
)
Expand Down

0 comments on commit b9122f1

Please sign in to comment.