From ed86db6b64d6000a860a1b41827e8f75a215000f Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 00:35:34 +0000 Subject: [PATCH 01/12] build start --- .github/workflows/build.yml | 22 ++++++++++++++++++++++ MANIFEST.in | 6 ++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 MANIFEST.in diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..7a1de5b21 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Build +on: + - push +jobs: + main: + runs-on: ubuntu-latest + container: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install build dependencies + run: | + apt update --yes && apt install --yes ninja-build + python -m pip install torch build wheel setuptools + - run: python -m build --no-isolation --config-setting="--build-option=--cpp_ext" --config-setting="--build-option=--cuda_ext" ./ + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..11db5f0c3 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +graft csrc +graft docs +graft tests + +include requirements.txt +include requirements_dev.txt From 1f2b961847012e1b9eb4877b9cc59a3db1eda617 Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 01:22:42 +0000 Subject: [PATCH 02/12] parametrize over (python version, cuda version) --- .github/workflows/build.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a1de5b21..5d7516169 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,17 +3,34 @@ on: - push jobs: main: + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + - '3.12' + cuda: + - container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 + torch-index: https://download.pytorch.org/whl/cu118 + - container: nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 + torch-index: https://download.pytorch.org/whl/cu121 + - container: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 + torch-index: https://pypi.org/simple runs-on: ubuntu-latest - container: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 + container: ${{ matrix.cuda.container }} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: ${{ matrix.python-version }} + cache: pip - name: Install build dependencies run: | apt update --yes && apt install --yes ninja-build - python -m pip install torch build wheel setuptools + python -m pip install build wheel setuptools + python -m pip install --index-url ${{ matrix.cuda.torch-index }} torch~=2.5.0 - run: python -m build --no-isolation --config-setting="--build-option=--cpp_ext" --config-setting="--build-option=--cuda_ext" ./ - name: Upload distributions uses: actions/upload-artifact@v4 From 0d489ea9335029c2c95b5dddf3b75f9304c0ba8b Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 01:25:59 +0000 Subject: [PATCH 03/12] remove 3.8, pip cache --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d7516169..72255bad4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,6 @@ jobs: strategy: matrix: python-version: - - '3.8' - '3.9' - '3.10' - '3.11' @@ -25,7 +24,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: pip - name: Install build dependencies run: | apt update --yes && apt install --yes ninja-build From 7353afa1632263509307902a04243f2308904473 Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 01:50:13 +0000 Subject: [PATCH 04/12] do not fail fast --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72255bad4..a38acf20b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: jobs: main: strategy: + fail-fast: false matrix: python-version: - '3.9' @@ -33,5 +34,5 @@ jobs: - name: Upload distributions uses: actions/upload-artifact@v4 with: - name: dist + name: dist-py${{ matrix.python-version }}-cu${{ env.CUDA_VERSION }} path: dist/ From 4d63b5594300cf12dd5e7dfaeb92714e222da7ff Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 02:05:47 +0000 Subject: [PATCH 05/12] use ppa --- .github/workflows/build.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a38acf20b..549409c1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,15 +22,28 @@ jobs: container: ${{ matrix.cuda.container }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + # We need Python development headers which actions/setup-python does not provide. + # Instead, grab from the deadsnakes ppa - name: Install build dependencies run: | - apt update --yes && apt install --yes ninja-build + DEPS=('ninja-build') + # 3.10 is default on Ubuntu 22 + if [[ '${{ env.python-version }}' != 3.10 ]]; then + DEPS+=('python${{ env.python-version }}-dev' 'python-${{ env.python-version }}-venv') + fi + + add-apt-repository ppa:deadsnakes/ppa + apt update --yes && apt install --yes "${DEPS[@]}" + + python -m venv venv + . venv/bin/activate python -m pip install build wheel setuptools python -m pip install --index-url ${{ matrix.cuda.torch-index }} torch~=2.5.0 - - run: python -m build --no-isolation --config-setting="--build-option=--cpp_ext" --config-setting="--build-option=--cuda_ext" ./ + - run: | + . venv/bin/activate + python -m build --no-isolation --config-setting="--build-option=--cpp_ext" --config-setting="--build-option=--cuda_ext" ./ + - name: Save CUDA version + run: echo "CUDA_VERSION=${CUDA_VERSION}" >> "${GITHUB_ENV}" - name: Upload distributions uses: actions/upload-artifact@v4 with: From f36876d303cf5ccf183d636ca97107217c31851d Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 02:08:48 +0000 Subject: [PATCH 06/12] fix exe --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 549409c1b..cc07a3232 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,17 +25,19 @@ jobs: # We need Python development headers which actions/setup-python does not provide. # Instead, grab from the deadsnakes ppa - name: Install build dependencies + env: + PYTHON: python${{ matrix.python-version }} run: | DEPS=('ninja-build') # 3.10 is default on Ubuntu 22 - if [[ '${{ env.python-version }}' != 3.10 ]]; then - DEPS+=('python${{ env.python-version }}-dev' 'python-${{ env.python-version }}-venv') + if [[ "${PYTHON}" != python3.10 ]]; then + DEPS+=("${PYTHON}-dev" "${PYTHON}-venv") fi add-apt-repository ppa:deadsnakes/ppa apt update --yes && apt install --yes "${DEPS[@]}" - python -m venv venv + "${PYTHON}" -m venv venv . venv/bin/activate python -m pip install build wheel setuptools python -m pip install --index-url ${{ matrix.cuda.torch-index }} torch~=2.5.0 From fe80ff1f45ab52044def631c3e81adce2ef2bcd0 Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 02:14:15 +0000 Subject: [PATCH 07/12] use bash --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc07a3232..aa3119eb4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,7 @@ jobs: - name: Install build dependencies env: PYTHON: python${{ matrix.python-version }} + shell: bash run: | DEPS=('ninja-build') # 3.10 is default on Ubuntu 22 From c5a2b99fbb177e7d99c6b5525362aaf8c358cd11 Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 02:16:56 +0000 Subject: [PATCH 08/12] add-apt-repository --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa3119eb4..1afdefbb8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: DEPS+=("${PYTHON}-dev" "${PYTHON}-venv") fi + apt update --yes && apt install --yes software-properties-common add-apt-repository ppa:deadsnakes/ppa apt update --yes && apt install --yes "${DEPS[@]}" From c2c36c1375fd81273c7fc5ec4d70a7931424e795 Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 02:20:11 +0000 Subject: [PATCH 09/12] noninteractive --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1afdefbb8..c1805968c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,7 @@ jobs: - name: Install build dependencies env: PYTHON: python${{ matrix.python-version }} + DEBIAN_FRONTEND: noninteractive shell: bash run: | DEPS=('ninja-build') From a8a49c8d15b1fcd84545c7178025d105ed1aac1b Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 02:38:33 +0000 Subject: [PATCH 10/12] latest setuptools --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1805968c..cf2fd33d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,19 +30,19 @@ jobs: DEBIAN_FRONTEND: noninteractive shell: bash run: | - DEPS=('ninja-build') - # 3.10 is default on Ubuntu 22 + DEPS=('ninja-build' "${PYTHON}-dev" "${PYTHON}-venv") + + # 3.10 is default on Ubuntu 22, so we don't need to install from ppa if [[ "${PYTHON}" != python3.10 ]]; then - DEPS+=("${PYTHON}-dev" "${PYTHON}-venv") + apt update --yes && apt install --yes software-properties-common + add-apt-repository ppa:deadsnakes/ppa fi - apt update --yes && apt install --yes software-properties-common - add-apt-repository ppa:deadsnakes/ppa apt update --yes && apt install --yes "${DEPS[@]}" "${PYTHON}" -m venv venv . venv/bin/activate - python -m pip install build wheel setuptools + python -m pip install --upgrade build wheel setuptools python -m pip install --index-url ${{ matrix.cuda.torch-index }} torch~=2.5.0 - run: | . venv/bin/activate From 3b0f3264d8ab8753f029cfcce1f009454fe5d40f Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 03:43:00 +0000 Subject: [PATCH 11/12] older ubuntu --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf2fd33d1..ccfe937f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,11 +12,11 @@ jobs: - '3.11' - '3.12' cuda: - - container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 + - container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04 torch-index: https://download.pytorch.org/whl/cu118 - - container: nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 + - container: nvidia/cuda:12.1.1-cudnn8-devel-ubuntu20.04 torch-index: https://download.pytorch.org/whl/cu121 - - container: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 + - container: nvidia/cuda:12.4.1-cudnn-devel-ubuntu20.04 torch-index: https://pypi.org/simple runs-on: ubuntu-latest container: ${{ matrix.cuda.container }} From 1429948bf735b5133e0e7c68075c4499214d89a8 Mon Sep 17 00:00:00 2001 From: Caleb Ho Date: Tue, 17 Dec 2024 03:45:15 +0000 Subject: [PATCH 12/12] py version fix --- .github/workflows/build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccfe937f4..9dd6acfa5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,11 +32,10 @@ jobs: run: | DEPS=('ninja-build' "${PYTHON}-dev" "${PYTHON}-venv") - # 3.10 is default on Ubuntu 22, so we don't need to install from ppa - if [[ "${PYTHON}" != python3.10 ]]; then - apt update --yes && apt install --yes software-properties-common - add-apt-repository ppa:deadsnakes/ppa - fi + # Default on Ubuntu 20 is Python 3.8, so we need to grab the appropriate Python + # from ppa + apt update --yes && apt install --yes software-properties-common + add-apt-repository ppa:deadsnakes/ppa apt update --yes && apt install --yes "${DEPS[@]}"