Skip to content

Commit 1a170d8

Browse files
author
Junxian Guo
committed
[minor] update publish.yml
1 parent 2e56e32 commit 1a170d8

File tree

1 file changed

+37
-43
lines changed

1 file changed

+37
-43
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,46 @@ jobs:
4343
# Using ubuntu-20.04 instead of 22.04 for more compatibility (glibc). Ideally we'd use the
4444
# manylinux docker image, but I haven't figured out how to install CUDA on manylinux.
4545
os: [ubuntu-20.04]
46-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
47-
torch-version: ['2.2.2', '2.3.1', '2.4.0', '2.5.1', '2.6.0']
48-
cuda-version: ['12.4.1']
46+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
47+
torch-version: ['1.12.1', '1.13.1', '2.0.1', '2.1.1', '2.2.0']
48+
cuda-version: ['11.8.0', '12.2.0']
4949
# We need separate wheels that either uses C++11 ABI (-D_GLIBCXX_USE_CXX11_ABI) or not.
5050
# Pytorch wheels currently don't use it, but nvcr images have Pytorch compiled with C++11 ABI.
5151
# Without this we get import error (undefined symbol: _ZN3c105ErrorC2ENS_14SourceLocationESs)
5252
# when building without C++11 ABI and using it on nvcr images.
5353
cxx11_abi: ['FALSE', 'TRUE']
5454
exclude:
55-
# see https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix
56-
# Pytorch < 2.5 does not support Python 3.13
57-
- torch-version: '2.2.2'
58-
python-version: '3.13'
59-
- torch-version: '2.3.1'
60-
python-version: '3.13'
61-
- torch-version: '2.4.0'
62-
python-version: '3.13'
55+
# Pytorch <= 1.12 does not support Python 3.11
56+
- torch-version: '1.12.1'
57+
python-version: '3.11'
58+
# Pytorch >= 2.0 only supports Python >= 3.8
59+
- torch-version: '2.0.1'
60+
python-version: '3.7'
61+
- torch-version: '2.1.1'
62+
python-version: '3.7'
63+
- torch-version: '2.2.0'
64+
python-version: '3.7'
65+
# Pytorch <= 2.0 only supports CUDA <= 11.8
66+
- torch-version: '1.12.1'
67+
cuda-version: '12.2.0'
68+
- torch-version: '1.13.1'
69+
cuda-version: '12.2.0'
70+
- torch-version: '2.0.1'
71+
cuda-version: '12.2.0'
6372

6473
steps:
6574
- name: Checkout
66-
uses: actions/checkout@v4
75+
uses: actions/checkout@v3
6776

6877
- name: Set up Python
69-
uses: actions/setup-python@v5
78+
uses: actions/setup-python@v4
7079
with:
7180
python-version: ${{ matrix.python-version }}
7281

7382
- name: Set CUDA and PyTorch versions
7483
run: |
7584
echo "MATRIX_CUDA_VERSION=$(echo ${{ matrix.cuda-version }} | awk -F \. {'print $1 $2'})" >> $GITHUB_ENV
7685
echo "MATRIX_TORCH_VERSION=$(echo ${{ matrix.torch-version }} | awk -F \. {'print $1 "." $2'})" >> $GITHUB_ENV
77-
echo "WHEEL_CUDA_VERSION=$(echo ${{ matrix.cuda-version }} | awk -F \. {'print $1'})" >> $GITHUB_ENV
78-
echo "MATRIX_PYTHON_VERSION=$(echo ${{ matrix.python-version }} | awk -F \. {'print $1 $2'})" >> $GITHUB_ENV
7986
8087
- name: Free up disk space
8188
if: ${{ runner.os == 'Linux' }}
@@ -94,40 +101,30 @@ jobs:
94101

95102
- name: Install CUDA ${{ matrix.cuda-version }}
96103
if: ${{ matrix.cuda-version != 'cpu' }}
97-
uses: Jimver/cuda-toolkit@v0.2.19
104+
uses: Jimver/cuda-toolkit@v0.2.11
98105
id: cuda-toolkit
99106
with:
100107
cuda: ${{ matrix.cuda-version }}
101108
linux-local-args: '["--toolkit"]'
102109
# default method is "local", and we're hitting some error with caching for CUDA 11.8 and 12.1
103110
# method: ${{ (matrix.cuda-version == '11.8.0' || matrix.cuda-version == '12.1.0') && 'network' || 'local' }}
104111
method: 'network'
105-
sub-packages: '["nvcc"]'
112+
# We need the cuda libraries (e.g. cuSparse, cuSolver) for compiling PyTorch extensions,
113+
# not just nvcc
114+
# sub-packages: '["nvcc"]'
106115

107116
- name: Install PyTorch ${{ matrix.torch-version }}+cu${{ matrix.cuda-version }}
108117
run: |
109118
pip install --upgrade pip
110-
# For some reason torch 2.2.0 on python 3.12 errors saying no setuptools
111-
pip install setuptools==75.8.0
112-
# With python 3.13 and torch 2.5.1, unless we update typing-extensions, we get error
113-
# AttributeError: attribute '__default__' of 'typing.ParamSpec' objects is not writable
114-
pip install typing-extensions==4.12.2
119+
# If we don't install before installing Pytorch, we get error for torch 2.0.1
120+
# ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
121+
pip install lit
115122
# We want to figure out the CUDA version to download pytorch
116123
# e.g. we can have system CUDA version being 11.7 but if torch==1.12 then we need to download the wheel from cu116
117-
# see https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix
118124
# This code is ugly, maybe there's a better way to do this.
119-
export TORCH_CUDA_VERSION=$(python -c "from os import environ as env; \
120-
minv = {'2.2': 118, '2.3': 118, '2.4': 118, '2.5': 118, '2.6': 118}[env['MATRIX_TORCH_VERSION']]; \
121-
maxv = {'2.2': 121, '2.3': 121, '2.4': 124, '2.5': 124, '2.6': 124}[env['MATRIX_TORCH_VERSION']]; \
122-
print(minv if int(env['MATRIX_CUDA_VERSION']) < 120 else maxv)" \
123-
)
125+
export TORCH_CUDA_VERSION=$(python -c "import os; minv = {'1.12': 113, '1.13': 116, '2.0': 117, '2.1': 118, '2.2': 118}[os.environ['MATRIX_TORCH_VERSION']]; maxv = {'1.12': 116, '1.13': 117, '2.0': 118, '2.1': 121, '2.2': 121}[os.environ['MATRIX_TORCH_VERSION']]; print(max(min(int(os.environ['MATRIX_CUDA_VERSION']), maxv), minv))")
124126
if [[ ${{ matrix.torch-version }} == *"dev"* ]]; then
125-
# pip install --no-cache-dir --pre torch==${{ matrix.torch-version }} --index-url https://download.pytorch.org/whl/nightly/cu${TORCH_CUDA_VERSION}
126-
# Can't use --no-deps because we need cudnn etc.
127-
# Hard-coding this version of pytorch-triton for torch 2.6.0.dev20241001
128-
pip install jinja2
129-
pip install https://download.pytorch.org/whl/nightly/pytorch_triton-3.1.0%2Bcf34004b8a-cp${MATRIX_PYTHON_VERSION}-cp${MATRIX_PYTHON_VERSION}-linux_x86_64.whl
130-
pip install --no-cache-dir --pre https://download.pytorch.org/whl/nightly/cu${TORCH_CUDA_VERSION}/torch-${{ matrix.torch-version }}%2Bcu${TORCH_CUDA_VERSION}-cp${MATRIX_PYTHON_VERSION}-cp${MATRIX_PYTHON_VERSION}-linux_x86_64.whl
127+
pip install --no-cache-dir --pre torch==${{ matrix.torch-version }} --index-url https://download.pytorch.org/whl/nightly/cu${TORCH_CUDA_VERSION}
131128
else
132129
pip install --no-cache-dir torch==${{ matrix.torch-version }} --index-url https://download.pytorch.org/whl/cu${TORCH_CUDA_VERSION}
133130
fi
@@ -144,14 +141,13 @@ jobs:
144141
# We want setuptools >= 49.6.0 otherwise we can't compile the extension if system CUDA version is 11.7 and pytorch cuda version is 11.6
145142
# https://github.com/pytorch/pytorch/blob/664058fa83f1d8eede5d66418abff6e20bd76ca8/torch/utils/cpp_extension.py#L810
146143
# However this still fails so I'm using a newer version of setuptools
147-
pip install setuptools==75.8.0
144+
pip install setuptools==68.0.0
148145
pip install ninja packaging wheel
149146
export PATH=/usr/local/nvidia/bin:/usr/local/nvidia/lib64:$PATH
150147
export LD_LIBRARY_PATH=/usr/local/nvidia/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
151148
# Limit MAX_JOBS otherwise the github runner goes OOM
152-
# nvcc 11.8 can compile with 2 jobs, but nvcc 12.3 goes OOM
153-
MAX_JOBS=$([ "$MATRIX_CUDA_VERSION" == "123" ] && echo 1 || echo 2) FLASH_ATTENTION_FORCE_BUILD="TRUE" FLASH_ATTENTION_FORCE_CXX11_ABI=${{ matrix.cxx11_abi}} python setup.py bdist_wheel --dist-dir=dist
154-
tmpname=cu${WHEEL_CUDA_VERSION}torch${MATRIX_TORCH_VERSION}cxx11abi${{ matrix.cxx11_abi }}
149+
MAX_JOBS=2 FLASH_ATTENTION_FORCE_BUILD="TRUE" FLASH_ATTENTION_FORCE_CXX11_ABI=${{ matrix.cxx11_abi}} python setup.py bdist_wheel --dist-dir=dist
150+
tmpname=cu${MATRIX_CUDA_VERSION}torch${MATRIX_TORCH_VERSION}cxx11abi${{ matrix.cxx11_abi }}
155151
wheel_name=$(ls dist/*whl | xargs -n 1 basename | sed "s/-/+$tmpname-/2")
156152
ls dist/*whl |xargs -I {} mv {} dist/${wheel_name}
157153
echo "wheel_name=${wheel_name}" >> $GITHUB_ENV
@@ -190,17 +186,15 @@ jobs:
190186
runs-on: ubuntu-latest
191187

192188
steps:
193-
- uses: actions/checkout@v4
189+
- uses: actions/checkout@v3
194190

195-
- uses: actions/setup-python@v5
191+
- uses: actions/setup-python@v4
196192
with:
197193
python-version: '3.10'
198194

199195
- name: Install dependencies
200196
run: |
201-
pip install ninja packaging wheel twine
202-
# Install latest setuptools with support for pypi metadata 2.2 (improved compat w/ uv)
203-
pip install setuptools==75.8.0
197+
pip install ninja packaging setuptools wheel twine
204198
# We don't want to download anything CUDA-related here
205199
pip install torch --index-url https://download.pytorch.org/whl/cpu
206200

0 commit comments

Comments
 (0)