Skip to content

Commit

Permalink
Fix building wheels for torch 2.2.0. (#1269)
Browse files Browse the repository at this point in the history
See also pytorch/pytorch#120020
We need to use gcc >=9 to build against pytorch 2.2.0
  • Loading branch information
csukuangfj authored Feb 18, 2024
1 parent aa96d78 commit 525cfa5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/macos-cpu-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
# python ./scripts/github_actions/generate_build_matrix.py --for-macos
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos)
python ./scripts/github_actions/generate_build_matrix.py --for-macos
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos)
python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch)
# python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}"
build_wheels_macos_cpu:
Expand Down
2 changes: 1 addition & 1 deletion scripts/github_actions/build-ubuntu-cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ cd /var/www

export CMAKE_CUDA_COMPILER_LAUNCHER=
export K2_CMAKE_ARGS=" -DPYTHON_EXECUTABLE=$PYTHON_INSTALL_DIR/bin/python3 "
export K2_MAKE_ARGS=" -j "
export K2_MAKE_ARGS=" -j2 "

python3 setup.py bdist_wheel

Expand Down
20 changes: 20 additions & 0 deletions scripts/github_actions/generate_build_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
import json


def version_ge(a, b):
a_major, a_minor = list(map(int, a.split(".")))[:2]
b_major, b_minor = list(map(int, b.split(".")))[:2]
if a_major > b_major:
return True

if a_major == b_major and a_minor >= b_minor:
return True

return False


def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -253,6 +265,14 @@ def generate_build_matrix(
ans.append({"torch": torch, "python-version": p})
elif for_macos or for_macos_m1:
ans.append({"torch": torch, "python-version": p})
elif version_ge(torch, "2.2.0"):
ans.append(
{
"torch": torch,
"python-version": p,
"image": "pytorch/manylinux-builder:cpu-2.2",
}
)
else:
ans.append(
{
Expand Down

0 comments on commit 525cfa5

Please sign in to comment.