Skip to content

Commit

Permalink
Enable 3.13t builds for Linux and MacOS for ecosystem libraries (#6242)
Browse files Browse the repository at this point in the history
Should mostly address pytorch/pytorch#144357

 Uses approach described here:

[conda-forge.org/blog/2024/09/26/python-313](https://conda-forge.org/blog/2024/09/26/python-313/)

Linux builds and MacOS are successful
TODO: Windows
  • Loading branch information
atalman authored Feb 6, 2025
1 parent 8f2607d commit 9839619
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 23 deletions.
34 changes: 19 additions & 15 deletions .github/actions/setup-binary-builds/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,28 @@ runs:
run: |
set -euxo pipefail
CONDA_ENV="${RUNNER_TEMP}/conda_environment_${GITHUB_RUN_ID}"
if [[ "${PACKAGE_TYPE:-}" == "conda" ]]; then
# For conda package host python version is irrelevant
export PYTHON_VERSION=3.9
export CONDA_BUILD_EXTRA="conda=24.4.0 conda-build=24.3.0 python-libarchive-c=2.9"
else
# For wheel builds we don't need neither conda nor conda-build
export CONDA_BUILD_EXTRA=""
export CONDA_EXTRA_PARAM=""
if [[ "${PYTHON_VERSION:-}" == "3.13t" ]]; then
export PYTHON_VERSION=3.13
export CONDA_EXTRA_PARAM=" python-freethreading -c conda-forge"
if [[ "$(uname)" != Darwin ]]; then
# Pin conda and conda-libmamba-solver for 3.13t linux build
# this solver allows us to install anaconda dependencies on
# python-freethreading on conda-forge environment
conda install conda==24.7.1 conda-libmamba-solver=24.1.0
fi
fi
conda create \
--yes --quiet \
--prefix "${CONDA_ENV}" \
"python=${PYTHON_VERSION}" \
cmake=3.26 \
ninja=1.10 \
pkg-config=0.29 \
${CONDA_BUILD_EXTRA} \
wheel=0.37
--yes --quiet \
--prefix "${CONDA_ENV}" \
"python=${PYTHON_VERSION}" \
cmake=3.26 \
ninja=1.12.1 \
pkg-config=0.29 \
wheel=0.37 \
${CONDA_EXTRA_PARAM}
echo "CONDA_ENV=${CONDA_ENV}" >> "${GITHUB_ENV}"
echo "CONDA_RUN=conda run -p ${CONDA_ENV}" >> "${GITHUB_ENV}"
15 changes: 8 additions & 7 deletions tools/pkg-helpers/pytorch_pkg_helpers/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@


def get_python_path_variables(python_version: str) -> List[str]:
m = ""
# For some reason python versions <= 3.7 require an m
# probably better not to ask why
if float(python_version) <= 3.7:
m = "m"
python_nodot = python_version.replace(".", "")
python_abi = f"cp{python_nodot}-cp{python_nodot}{m}"
t = ""
if python_version.endswith("t"):
python_nodot = python_version[:-1].replace(".", "")
t = "t"
else:
python_nodot = python_version.replace(".", "")

python_abi = f"cp{python_nodot}-cp{python_nodot}{t}"
return [f'export PATH="/opt/python/{python_abi}/bin:${{PATH}}"']


Expand Down
8 changes: 7 additions & 1 deletion tools/scripts/generate_binary_build_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


PYTHON_ARCHES_DICT = {
"nightly": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"nightly": ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"],
"test": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"release": ["3.9", "3.10", "3.11", "3.12", "3.13"],
}
Expand Down Expand Up @@ -485,6 +485,12 @@ def generate_wheels_matrix(
"" if arch_version in [CPU, CPU_AARCH64, XPU] else arch_version
)

# TODO: Enable python 3.13t on xpu and cpu-s390x or Windows
if (
(gpu_arch_type in ["xpu", "cpu-s390x"]) or os == WINDOWS
) and python_version == "3.13t":
continue

desired_cuda = translate_desired_cuda(gpu_arch_type, gpu_arch_version)
entry = {
"python_version": python_version,
Expand Down
105 changes: 105 additions & 0 deletions tools/tests/assets/build_matrix_linux_wheel_cuda.json
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,111 @@
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cpu",
"gpu_arch_version": "",
"desired_cuda": "cpu",
"container_image": "pytorch/manylinux2_28-builder:cpu",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cpu",
"validation_runner": "linux.2xlarge",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "11.8",
"desired_cuda": "cu118",
"container_image": "pytorch/manylinux2_28-builder:cuda11.8",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda11_8",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.4",
"desired_cuda": "cu124",
"container_image": "pytorch/manylinux2_28-builder:cuda12.4",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_4",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.6",
"desired_cuda": "cu126",
"container_image": "pytorch/manylinux2_28-builder:cuda12.6",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_6",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu126",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.8",
"desired_cuda": "cu128",
"container_image": "pytorch/manylinux2_28-builder:cuda12.8",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_8",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "rocm",
"gpu_arch_version": "6.2.4",
"desired_cuda": "rocm6.2.4",
"container_image": "pytorch/manylinux2_28-builder:rocm6.2.4",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-rocm6_2_4",
"validation_runner": "linux.2xlarge",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2.4",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "rocm",
"gpu_arch_version": "6.3",
"desired_cuda": "rocm6.3",
"container_image": "pytorch/manylinux2_28-builder:rocm6.3",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-rocm6_3",
"validation_runner": "linux.2xlarge",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.3",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
}
]
}
75 changes: 75 additions & 0 deletions tools/tests/assets/build_matrix_linux_wheel_cuda_norocm.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,81 @@
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cpu",
"gpu_arch_version": "",
"desired_cuda": "cpu",
"container_image": "pytorch/manylinux2_28-builder:cpu",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cpu",
"validation_runner": "linux.2xlarge",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "11.8",
"desired_cuda": "cu118",
"container_image": "pytorch/manylinux2_28-builder:cuda11.8",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda11_8",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.4",
"desired_cuda": "cu124",
"container_image": "pytorch/manylinux2_28-builder:cuda12.4",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_4",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.6",
"desired_cuda": "cu126",
"container_image": "pytorch/manylinux2_28-builder:cuda12.6",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_6",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu126",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.8",
"desired_cuda": "cu128",
"container_image": "pytorch/manylinux2_28-builder:cuda12.8",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_8",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
}
]
}
90 changes: 90 additions & 0 deletions tools/tests/assets/build_matrix_linux_wheel_nocpu.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,96 @@
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "11.8",
"desired_cuda": "cu118",
"container_image": "pytorch/manylinux2_28-builder:cuda11.8",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda11_8",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.4",
"desired_cuda": "cu124",
"container_image": "pytorch/manylinux2_28-builder:cuda12.4",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_4",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.6",
"desired_cuda": "cu126",
"container_image": "pytorch/manylinux2_28-builder:cuda12.6",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_6",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu126",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "cuda",
"gpu_arch_version": "12.8",
"desired_cuda": "cu128",
"container_image": "pytorch/manylinux2_28-builder:cuda12.8",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-cuda12_8",
"validation_runner": "linux.g5.4xlarge.nvidia.gpu",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "rocm",
"gpu_arch_version": "6.2.4",
"desired_cuda": "rocm6.2.4",
"container_image": "pytorch/manylinux2_28-builder:rocm6.2.4",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-rocm6_2_4",
"validation_runner": "linux.2xlarge",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2.4",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
},
{
"python_version": "3.13t",
"gpu_arch_type": "rocm",
"gpu_arch_version": "6.3",
"desired_cuda": "rocm6.3",
"container_image": "pytorch/manylinux2_28-builder:rocm6.3",
"package_type": "manywheel",
"build_name": "manywheel-py3_13t-rocm6_3",
"validation_runner": "linux.2xlarge",
"installation": "pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.3",
"channel": "nightly",
"upload_to_base_bucket": "no",
"stable_version": "2.6.0",
"use_split_build": false
}
]
}
Loading

0 comments on commit 9839619

Please sign in to comment.