From ff44e778e648228f9e51f7d310e73257cc52ce1a Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 12:25:03 +0100 Subject: [PATCH 01/35] add ci for building wheels --- .github/workflows/build_flashmm.yaml | 123 +++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/workflows/build_flashmm.yaml diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml new file mode 100644 index 0000000..e627965 --- /dev/null +++ b/.github/workflows/build_flashmm.yaml @@ -0,0 +1,123 @@ +name: Build FlashMM Wheels with CUDA + +on: + push: + tags: + - "v*" + +jobs: + release: + # Retrieve tag and create release + name: Create Release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Extract branch info + shell: bash + run: | + echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Create Release + id: create_release + uses: "actions/github-script@v6" + env: + RELEASE_TAG: ${{ env.release_tag }} + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + script: | + const script = require('.github/workflows/scripts/github_create_release.js') + await script(github, context, core) + + build_wheels: + name: Build FlashMM Wheels + runs-on: ${{ matrix.os }} + needs: release + + strategy: + matrix: + os: [ubuntu-20.04, windows-latest] + pyver: ["3.8", "3.9", "3.10", "3.11"] + cuda: ["11.8.0", "12.1.1"] + defaults: + run: + shell: pwsh + env: + PYPI_CUDA_VERSION: "12.1.1" + CUDA_VERSION: ${{ matrix.cuda }} + + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@v1.3.0 + if: runner.os == 'Linux' + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: false + + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.pyver }} + + - name: Setup Mamba + uses: conda-incubator/setup-miniconda@v2.2.0 + with: + activate-environment: "build" + python-version: ${{ matrix.pyver }} + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + add-pip-as-python-dependency: true + auto-activate-base: false + + - name: Install Dependencies + run: | + # Install CUDA toolkit + mamba install -y 'cuda' -c "nvidia/label/cuda-${env:CUDA_VERSION}" + + # Env variables + $env:CUDA_PATH = $env:CONDA_PREFIX + $env:CUDA_HOME = $env:CONDA_PREFIX + + # Install torch + $cudaVersion = $env:CUDA_VERSION.Replace('.', '') + $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) + if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} + python -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch + python -m pip install build setuptools wheel ninja + + # Print version information + python --version + python -c "import torch; print('PyTorch:', torch.__version__)" + python -c "import torch; print('CUDA:', torch.version.cuda)" + python -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" + python -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" + + - name: Build Wheel + run: | + $env:CUDA_PATH = $env:CONDA_PREFIX + $env:CUDA_HOME = $env:CONDA_PREFIX + + # Only add +cu118 to wheel if not releasing on PyPi + if ( $env:CUDA_VERSION -eq $env:PYPI_CUDA_VERSION ){ + $env:PYPI_BUILD = 1 + } + + cd csrc/flashmm + + python setup.py sdist bdist_wheel + + - name: Upload Assets + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./csrc/flashmm/dist/*.whl \ No newline at end of file From 5c1cf2b63590dd71d2f35227e3bad67f3fe9f683 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 12:26:27 +0100 Subject: [PATCH 02/35] update ci rule --- .github/workflows/build_flashmm.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index e627965..3e03b51 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -2,8 +2,9 @@ name: Build FlashMM Wheels with CUDA on: push: + # push on github tags that start with "wheel" tags: - - "v*" + - "wheel*" jobs: release: From dd21cacbb560b25f81b1ef506ee0721f88602c5c Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 12:28:03 +0100 Subject: [PATCH 03/35] update release tag --- .github/workflows/build_flashmm.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 3e03b51..8ec2fa9 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -22,16 +22,16 @@ jobs: run: | echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Create Release - id: create_release - uses: "actions/github-script@v6" - env: - RELEASE_TAG: ${{ env.release_tag }} - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - script: | - const script = require('.github/workflows/scripts/github_create_release.js') - await script(github, context, core) + # - name: Create Release + # id: create_release + # uses: "actions/github-script@v6" + # env: + # RELEASE_TAG: ${{ env.release_tag }} + # with: + # github-token: "${{ secrets.GITHUB_TOKEN }}" + # script: | + # const script = require('.github/workflows/scripts/github_create_release.js') + # await script(github, context, core) build_wheels: name: Build FlashMM Wheels From 573ebceb4c2f4c6a8df34d64eccdeb6359ec9c7e Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 12:47:37 +0100 Subject: [PATCH 04/35] gh release iterate --- .github/workflows/build_flashmm.yaml | 48 +++++++++++++++++----------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 8ec2fa9..4c6194e 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -7,20 +7,20 @@ on: - "wheel*" jobs: - release: - # Retrieve tag and create release - name: Create Release - runs-on: ubuntu-latest - outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} - steps: - - name: Checkout - uses: actions/checkout@v3 + # release: + # # Retrieve tag and create release + # name: Create Release + # runs-on: ubuntu-latest + # outputs: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # steps: + # - name: Checkout + # uses: actions/checkout@v3 - - name: Extract branch info - shell: bash - run: | - echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + # - name: Extract branch info + # shell: bash + # run: | + # echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # - name: Create Release # id: create_release @@ -40,8 +40,9 @@ jobs: strategy: matrix: - os: [ubuntu-20.04, windows-latest] - pyver: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-20.04] #, windows-latest] + # pyver: ["3.8", "3.9", "3.10", "3.11"] + pyver: ["3.10"] cuda: ["11.8.0", "12.1.1"] defaults: run: @@ -117,8 +118,17 @@ jobs: python setup.py sdist bdist_wheel - - name: Upload Assets - uses: shogo82148/actions-upload-release-asset@v1 + - name: Release with Notes + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') with: - upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ./csrc/flashmm/dist/*.whl \ No newline at end of file + files: | + ./csrc/flashmm/dist/*.whl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Upload Assets + # uses: shogo82148/actions-upload-release-asset@v1 + # with: + # upload_url: ${{ needs.release.outputs.upload_url }} + # asset_path: ./csrc/flashmm/dist/*.whl \ No newline at end of file From 489139e3a3be3119275048695ac2ff21056d34b3 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 12:49:44 +0100 Subject: [PATCH 05/35] fix release --- .github/workflows/build_flashmm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 4c6194e..4104a9a 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -36,7 +36,7 @@ jobs: build_wheels: name: Build FlashMM Wheels runs-on: ${{ matrix.os }} - needs: release + # needs: release strategy: matrix: From 36c07a2299caf832a97b26bc9ebf60ddbb4738be Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 13:09:55 +0100 Subject: [PATCH 06/35] update wheel policy --- .github/workflows/build_flashmm.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 4104a9a..9f6919f 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -40,8 +40,8 @@ jobs: strategy: matrix: - os: [ubuntu-20.04] #, windows-latest] - # pyver: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-20.04, windows-latest] + pyver: ["3.8", "3.9", "3.10", "3.11"] pyver: ["3.10"] cuda: ["11.8.0", "12.1.1"] defaults: @@ -116,7 +116,13 @@ jobs: cd csrc/flashmm - python setup.py sdist bdist_wheel + python setup.py sdist bdist_wheel + + # rename wheel to include cuda version and torch version bash: + # usually wheel_name=flashmm-0.x-cp310-cp310-linux_x86_64.whl + wheel_name=$(ls dist/*.whl) + wheel_name=${wheel_name}-cu${env:CUDA_VERSION}-torch${pytorchVersion#torch==}.whl + mv dist/*.whl $wheel_name - name: Release with Notes uses: softprops/action-gh-release@v1 From 2d21fc12b5deea137ee57b4ebd3fc10d77783906 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 13:10:39 +0100 Subject: [PATCH 07/35] update matrix --- .github/workflows/build_flashmm.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 9f6919f..b57d73a 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -40,8 +40,8 @@ jobs: strategy: matrix: - os: [ubuntu-20.04, windows-latest] - pyver: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-20.04] #, windows-latest] + # pyver: ["3.8", "3.9", "3.10", "3.11"] pyver: ["3.10"] cuda: ["11.8.0", "12.1.1"] defaults: From cb644888cc6d45b9a17124db750ebb0983fd6239 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 14:08:18 +0100 Subject: [PATCH 08/35] update flashmm wheels --- .github/workflows/build_flashmm.yaml | 40 ++++++---------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index b57d73a..288d821 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -7,36 +7,10 @@ on: - "wheel*" jobs: - # release: - # # Retrieve tag and create release - # name: Create Release - # runs-on: ubuntu-latest - # outputs: - # upload_url: ${{ steps.create_release.outputs.upload_url }} - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - - # - name: Extract branch info - # shell: bash - # run: | - # echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - # - name: Create Release - # id: create_release - # uses: "actions/github-script@v6" - # env: - # RELEASE_TAG: ${{ env.release_tag }} - # with: - # github-token: "${{ secrets.GITHUB_TOKEN }}" - # script: | - # const script = require('.github/workflows/scripts/github_create_release.js') - # await script(github, context, core) build_wheels: name: Build FlashMM Wheels runs-on: ${{ matrix.os }} - # needs: release strategy: matrix: @@ -115,14 +89,16 @@ jobs: } cd csrc/flashmm - + # build the wheel python setup.py sdist bdist_wheel - # rename wheel to include cuda version and torch version bash: - # usually wheel_name=flashmm-0.x-cp310-cp310-linux_x86_64.whl - wheel_name=$(ls dist/*.whl) - wheel_name=${wheel_name}-cu${env:CUDA_VERSION}-torch${pytorchVersion#torch==}.whl - mv dist/*.whl $wheel_name + # rename wheel to reflect cuda version and torch version bash: dist/*.whl + $VERSION_APPENDIX = python -c "import torch; print('-torch' + (torch.__version__.split('+')[0] + '-cu' + torch.version.cuda).replace('.', ''))" + $originalPattern = '^(flashmm-.*)\.whl$' + $newPattern = '${1}' + $VERSION_APPENDIX + '.whl' + # Get the .whl file in the dist directory and rename + $file = Get-ChildItem -Path dist/*.whl + $file | Rename-Item -NewName { $_.Name -replace $originalPattern, $newPattern } - name: Release with Notes uses: softprops/action-gh-release@v1 From f500bb44162e0ec7c8ada37c62fb8c0177fb16ee Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 14:24:45 +0100 Subject: [PATCH 09/35] add cuda arch list --- .github/workflows/build_flashmm.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 288d821..9b0de4d 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -14,16 +14,18 @@ jobs: strategy: matrix: - os: [ubuntu-20.04] #, windows-latest] - # pyver: ["3.8", "3.9", "3.10", "3.11"] - pyver: ["3.10"] + os: [ubuntu-20.04, windows-latest] + pyver: ["3.8", "3.9", "3.10", "3.11"] cuda: ["11.8.0", "12.1.1"] + cudaarchlist: ["6.0;6.1;6.2;7.0;7.5;8.0;8.6+PTX", "6.0;6.1;6.2;7.0;7.5;7.0;7.5"] defaults: run: shell: pwsh env: PYPI_CUDA_VERSION: "12.1.1" CUDA_VERSION: ${{ matrix.cuda }} + # Do not set archlist for now. + # CUDA_ARCH_LIST: ${{ matrix.cudaarchlist }} steps: - name: Free Disk Space @@ -95,7 +97,7 @@ jobs: # rename wheel to reflect cuda version and torch version bash: dist/*.whl $VERSION_APPENDIX = python -c "import torch; print('-torch' + (torch.__version__.split('+')[0] + '-cu' + torch.version.cuda).replace('.', ''))" $originalPattern = '^(flashmm-.*)\.whl$' - $newPattern = '${1}' + $VERSION_APPENDIX + '.whl' + $newPattern = '${1}' + $VERSION_APPENDIX + (($env:CUDA_ARCH_LIST -split ';')[-1] -replace '\+', '') + '.whl' # Get the .whl file in the dist directory and rename $file = Get-ChildItem -Path dist/*.whl $file | Rename-Item -NewName { $_.Name -replace $originalPattern, $newPattern } From 1096dddabd83a32d8c14fbfa1869a2a276efa095 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 14:26:10 +0100 Subject: [PATCH 10/35] remove cudaarchlist --- .github/workflows/build_flashmm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 9b0de4d..3b3a4e7 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -17,7 +17,7 @@ jobs: os: [ubuntu-20.04, windows-latest] pyver: ["3.8", "3.9", "3.10", "3.11"] cuda: ["11.8.0", "12.1.1"] - cudaarchlist: ["6.0;6.1;6.2;7.0;7.5;8.0;8.6+PTX", "6.0;6.1;6.2;7.0;7.5;7.0;7.5"] + # cudaarchlist: ["6.0;6.1;6.2;7.0;7.5;8.0;8.6+PTX", "6.0;6.1;6.2;7.0;7.5;7.0;7.5"] defaults: run: shell: pwsh From ce5b10f0ff6d2fc08b07e46153726a145b938a55 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 14:34:26 +0100 Subject: [PATCH 11/35] update cuda arch path --- .github/workflows/build_flashmm.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 3b3a4e7..d11942a 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -1,3 +1,6 @@ +# MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels +# https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows + name: Build FlashMM Wheels with CUDA on: @@ -95,9 +98,11 @@ jobs: python setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl + $LASTCUDAARCH = ((($env:CUDA_ARCH_LIST -split ';')[-1] -replace '\+', '') -replace '\.', '') + $VERSION_APPENDIX = python -c "import torch; print('-torch' + (torch.__version__.split('+')[0] + '-cu' + torch.version.cuda).replace('.', ''))" $originalPattern = '^(flashmm-.*)\.whl$' - $newPattern = '${1}' + $VERSION_APPENDIX + (($env:CUDA_ARCH_LIST -split ';')[-1] -replace '\+', '') + '.whl' + $newPattern = '${1}' + $VERSION_APPENDIX + $LASTCUDAARCH + '.whl' # Get the .whl file in the dist directory and rename $file = Get-ChildItem -Path dist/*.whl $file | Rename-Item -NewName { $_.Name -replace $originalPattern, $newPattern } From 378dd60a8f324c1235babcc2c21188bee0d4a4bd Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 15:25:32 +0100 Subject: [PATCH 12/35] refine pipeline --- .github/workflows/build_flashmm.yaml | 22 +++++-------------- .../scripts/rename_whl_with_torch_version.py | 13 +++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/scripts/rename_whl_with_torch_version.py diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index d11942a..4f38761 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -17,15 +17,15 @@ jobs: strategy: matrix: - os: [ubuntu-20.04, windows-latest] - pyver: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-20.04] # , windows-latest] + # pyver: ["3.8", "3.9", "3.10", "3.11"] + pyver: ["3.10"] cuda: ["11.8.0", "12.1.1"] # cudaarchlist: ["6.0;6.1;6.2;7.0;7.5;8.0;8.6+PTX", "6.0;6.1;6.2;7.0;7.5;7.0;7.5"] defaults: run: shell: pwsh env: - PYPI_CUDA_VERSION: "12.1.1" CUDA_VERSION: ${{ matrix.cuda }} # Do not set archlist for now. # CUDA_ARCH_LIST: ${{ matrix.cudaarchlist }} @@ -88,24 +88,12 @@ jobs: $env:CUDA_PATH = $env:CONDA_PREFIX $env:CUDA_HOME = $env:CONDA_PREFIX - # Only add +cu118 to wheel if not releasing on PyPi - if ( $env:CUDA_VERSION -eq $env:PYPI_CUDA_VERSION ){ - $env:PYPI_BUILD = 1 - } - - cd csrc/flashmm # build the wheel + cd csrc/flashmm python setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl - $LASTCUDAARCH = ((($env:CUDA_ARCH_LIST -split ';')[-1] -replace '\+', '') -replace '\.', '') - - $VERSION_APPENDIX = python -c "import torch; print('-torch' + (torch.__version__.split('+')[0] + '-cu' + torch.version.cuda).replace('.', ''))" - $originalPattern = '^(flashmm-.*)\.whl$' - $newPattern = '${1}' + $VERSION_APPENDIX + $LASTCUDAARCH + '.whl' - # Get the .whl file in the dist directory and rename - $file = Get-ChildItem -Path dist/*.whl - $file | Rename-Item -NewName { $_.Name -replace $originalPattern, $newPattern } + python ../../.github/workflows/scripts/rename_whl_with_torch_version.py - name: Release with Notes uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/scripts/rename_whl_with_torch_version.py b/.github/workflows/scripts/rename_whl_with_torch_version.py new file mode 100644 index 0000000..e5510c4 --- /dev/null +++ b/.github/workflows/scripts/rename_whl_with_torch_version.py @@ -0,0 +1,13 @@ +import os, shutil, glob, re +import torch + +torch_name = 'torch' + (torch.__version__.split('+')[0] + '-cu' + torch.version.cuda).replace('.', '') +arch_last = os.environ.get('CUDA_ARCH_LIST',';').split(';')[-1].replace('+', '') +# get the .whl file in the dist directory and rename +file = glob.glob(os.path.join('dist', '*.whl')) +if file: + file = file[0] + insert_pos = re.search(r'cp[0-9]+-cp[0-9]+-', file).start() + new_name = f'{file[:insert_pos]}{torch_name}{arch_last}-{file[insert_pos:]}' + print(f'move whl from {file} to {new_name}') + shutil.move(file, new_name) \ No newline at end of file From ca34caa67a51b577f02f6ab1b6c8db7b5e3aac5f Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 15:33:23 +0100 Subject: [PATCH 13/35] update pipeline --- .github/workflows/build_flashmm.yaml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 4f38761..b9cfc27 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -17,18 +17,14 @@ jobs: strategy: matrix: - os: [ubuntu-20.04] # , windows-latest] - # pyver: ["3.8", "3.9", "3.10", "3.11"] - pyver: ["3.10"] + os: [ubuntu-20.04, windows-latest] + pyver: ["3.8", "3.9", "3.10", "3.11"] cuda: ["11.8.0", "12.1.1"] - # cudaarchlist: ["6.0;6.1;6.2;7.0;7.5;8.0;8.6+PTX", "6.0;6.1;6.2;7.0;7.5;7.0;7.5"] defaults: run: shell: pwsh env: CUDA_VERSION: ${{ matrix.cuda }} - # Do not set archlist for now. - # CUDA_ARCH_LIST: ${{ matrix.cudaarchlist }} steps: - name: Free Disk Space @@ -103,9 +99,3 @@ jobs: ./csrc/flashmm/dist/*.whl env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Upload Assets - # uses: shogo82148/actions-upload-release-asset@v1 - # with: - # upload_url: ${{ needs.release.outputs.upload_url }} - # asset_path: ./csrc/flashmm/dist/*.whl \ No newline at end of file From 4de0988ec1f5dd435eaa11f7ea5495bbbc736446 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:04:34 +0100 Subject: [PATCH 14/35] update windows build --- .github/workflows/build_flashmm.yaml | 4 ++-- .github/workflows/scripts/rename_whl_with_torch_version.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index b9cfc27..c6999fe 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -69,8 +69,8 @@ jobs: $cudaVersion = $env:CUDA_VERSION.Replace('.', '') $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} - python -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch - python -m pip install build setuptools wheel ninja + python -m pip3 install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch + python -m pip3 install build setuptools wheel ninja numpy # Print version information python --version diff --git a/.github/workflows/scripts/rename_whl_with_torch_version.py b/.github/workflows/scripts/rename_whl_with_torch_version.py index e5510c4..52b09ae 100644 --- a/.github/workflows/scripts/rename_whl_with_torch_version.py +++ b/.github/workflows/scripts/rename_whl_with_torch_version.py @@ -1,13 +1,13 @@ import os, shutil, glob, re import torch -torch_name = 'torch' + (torch.__version__.split('+')[0] + '-cu' + torch.version.cuda).replace('.', '') -arch_last = os.environ.get('CUDA_ARCH_LIST',';').split(';')[-1].replace('+', '') +torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '') + # get the .whl file in the dist directory and rename file = glob.glob(os.path.join('dist', '*.whl')) if file: file = file[0] insert_pos = re.search(r'cp[0-9]+-cp[0-9]+-', file).start() - new_name = f'{file[:insert_pos]}{torch_name}{arch_last}-{file[insert_pos:]}' + new_name = f'{file[:insert_pos]}+{torch_name}-{file[insert_pos:]}' print(f'move whl from {file} to {new_name}') shutil.move(file, new_name) \ No newline at end of file From 2e50135c8a9593a5e286b69bf45c49cd224b816c Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:35:41 +0100 Subject: [PATCH 15/35] update python to python3 --- .github/workflows/build_flashmm.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index c6999fe..73b5e4e 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -69,15 +69,15 @@ jobs: $cudaVersion = $env:CUDA_VERSION.Replace('.', '') $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} - python -m pip3 install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch - python -m pip3 install build setuptools wheel ninja numpy + python3 -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch + python3 -m pip install build setuptools wheel ninja numpy # Print version information - python --version - python -c "import torch; print('PyTorch:', torch.__version__)" - python -c "import torch; print('CUDA:', torch.version.cuda)" - python -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" - python -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" + python3 --version + python3 -c "import torch; print('PyTorch:', torch.__version__)" + python3 -c "import torch; print('CUDA:', torch.version.cuda)" + python3 -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" + python3 -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" - name: Build Wheel run: | @@ -86,10 +86,10 @@ jobs: # build the wheel cd csrc/flashmm - python setup.py sdist bdist_wheel + python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl - python ../../.github/workflows/scripts/rename_whl_with_torch_version.py + python3 ../../.github/workflows/scripts/rename_whl_with_torch_version.py - name: Release with Notes uses: softprops/action-gh-release@v1 From df8450e930a3de004457acbcf7f2c0202693f5b7 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:43:20 +0100 Subject: [PATCH 16/35] abstract file path --- .github/workflows/build_flashmm.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 73b5e4e..63d7a52 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -1,7 +1,7 @@ # MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels # https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows -name: Build FlashMM Wheels with CUDA +name: Build Wheels with CUDA on: push: @@ -12,7 +12,7 @@ on: jobs: build_wheels: - name: Build FlashMM Wheels + name: Build Cuda Wheels for torch runs-on: ${{ matrix.os }} strategy: @@ -25,6 +25,8 @@ jobs: shell: pwsh env: CUDA_VERSION: ${{ matrix.cuda }} + # define where the setup.py is located + FILE_PATH: ${{ github.workspace }}/csrc/flashmm steps: - name: Free Disk Space @@ -85,7 +87,7 @@ jobs: $env:CUDA_HOME = $env:CONDA_PREFIX # build the wheel - cd csrc/flashmm + cd $env:FILE_PATH python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl @@ -96,6 +98,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: | - ./csrc/flashmm/dist/*.whl + "${{ env.FILE_PATH }}/dist/*.whl" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 5b2b8d2862837d1c438324a134c848dcc0063507 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:49:03 +0100 Subject: [PATCH 17/35] release wheels --- .github/workflows/build_cuda_wheels.yaml | 12 ++++++++++++ .github/workflows/build_flashmm.yaml | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build_cuda_wheels.yaml diff --git a/.github/workflows/build_cuda_wheels.yaml b/.github/workflows/build_cuda_wheels.yaml new file mode 100644 index 0000000..2ef0072 --- /dev/null +++ b/.github/workflows/build_cuda_wheels.yaml @@ -0,0 +1,12 @@ +name: install_wheels_cuda + +on: + workflow_call: + inputs: + setuppypath: + required: true + type: string + description: "path to the dir of the setup.py that should be built." + +env: + FILE_PATH: ${{ inputs.setuppypath }} \ No newline at end of file diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 63d7a52..d580c29 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -26,7 +26,7 @@ jobs: env: CUDA_VERSION: ${{ matrix.cuda }} # define where the setup.py is located - FILE_PATH: ${{ github.workspace }}/csrc/flashmm + SETUPPYPATH: ${{ github.workspace }}/csrc/flashmm steps: - name: Free Disk Space @@ -87,17 +87,17 @@ jobs: $env:CUDA_HOME = $env:CONDA_PREFIX # build the wheel - cd $env:FILE_PATH + cd $env:SETUPPYPATH python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl - python3 ../../.github/workflows/scripts/rename_whl_with_torch_version.py + python3 ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py - name: Release with Notes uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: | - "${{ env.FILE_PATH }}/dist/*.whl" + "${{ env.SETUPPYPATH }}/dist/*.whl" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2eaf8c8d9ea47dedf3a24c361bded142b6da5ae7 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:52:07 +0100 Subject: [PATCH 18/35] improve file path --- .github/workflows/scripts/rename_whl_with_torch_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scripts/rename_whl_with_torch_version.py b/.github/workflows/scripts/rename_whl_with_torch_version.py index 52b09ae..7d36b72 100644 --- a/.github/workflows/scripts/rename_whl_with_torch_version.py +++ b/.github/workflows/scripts/rename_whl_with_torch_version.py @@ -7,7 +7,7 @@ file = glob.glob(os.path.join('dist', '*.whl')) if file: file = file[0] - insert_pos = re.search(r'cp[0-9]+-cp[0-9]+-', file).start() - new_name = f'{file[:insert_pos]}+{torch_name}-{file[insert_pos:]}' + insert_pos = re.search(r'-cp[0-9]+-cp[0-9]+-', file).start() + new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}' print(f'move whl from {file} to {new_name}') shutil.move(file, new_name) \ No newline at end of file From 5dddd1de19a4a5cbe02bba9e5e1ca965faea590f Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:53:48 +0100 Subject: [PATCH 19/35] remove yaml temp --- .github/workflows/build_cuda_wheels.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_cuda_wheels.yaml b/.github/workflows/build_cuda_wheels.yaml index 2ef0072..91e8c62 100644 --- a/.github/workflows/build_cuda_wheels.yaml +++ b/.github/workflows/build_cuda_wheels.yaml @@ -1,12 +1,12 @@ -name: install_wheels_cuda +# name: install_wheels_cuda -on: - workflow_call: - inputs: - setuppypath: - required: true - type: string - description: "path to the dir of the setup.py that should be built." +# on: +# workflow_call: +# inputs: +# setuppypath: +# required: true +# type: string +# description: "path to the dir of the setup.py that should be built." -env: - FILE_PATH: ${{ inputs.setuppypath }} \ No newline at end of file +# env: +# FILE_PATH: ${{ inputs.setuppypath }} \ No newline at end of file From 1877df33a37670dc782475cb5629fcc3098336d1 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:55:49 +0100 Subject: [PATCH 20/35] add pipeline --- .github/workflows/build_cuda_wheels.yaml | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_cuda_wheels.yaml b/.github/workflows/build_cuda_wheels.yaml index 91e8c62..1f7622c 100644 --- a/.github/workflows/build_cuda_wheels.yaml +++ b/.github/workflows/build_cuda_wheels.yaml @@ -1,12 +1,20 @@ -# name: install_wheels_cuda +name: install_wheels_cuda -# on: -# workflow_call: -# inputs: -# setuppypath: -# required: true -# type: string -# description: "path to the dir of the setup.py that should be built." +on: + workflow_call: + inputs: + setuppypath: + required: true + type: string + description: "path to the dir of the setup.py that should be built." -# env: -# FILE_PATH: ${{ inputs.setuppypath }} \ No newline at end of file +env: + FILE_PATH: ${{ inputs.setuppypath }} + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: pass + run: | + echo pass \ No newline at end of file From f856910f6d605c9f907d355e497057e501536d1c Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 16:57:29 +0100 Subject: [PATCH 21/35] improve script --- .github/workflows/scripts/rename_whl_with_torch_version.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/scripts/rename_whl_with_torch_version.py b/.github/workflows/scripts/rename_whl_with_torch_version.py index 7d36b72..25034df 100644 --- a/.github/workflows/scripts/rename_whl_with_torch_version.py +++ b/.github/workflows/scripts/rename_whl_with_torch_version.py @@ -1,8 +1,5 @@ -import os, shutil, glob, re -import torch - +import os, shutil, glob, re, torch torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '') - # get the .whl file in the dist directory and rename file = glob.glob(os.path.join('dist', '*.whl')) if file: From 9a30e0e415f4b327987afe8422639a5089f4f795 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 17:18:02 +0100 Subject: [PATCH 22/35] updated paths --- .github/workflows/build_flashmm.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index d580c29..0de5a83 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -98,6 +98,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: | - "${{ env.SETUPPYPATH }}/dist/*.whl" + "${{ github.workspace }}/${{ env.SETUPPYPATH }}/dist/*.whl" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9a2e671343db6862274d1cd8c8b41e4cd6f96e25 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 17:26:59 +0100 Subject: [PATCH 23/35] update --- .github/workflows/build_flashmm.yaml | 9 +++++++-- .../workflows/scripts/rename_whl_with_torch_version.py | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 0de5a83..7fcd62b 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -91,13 +91,18 @@ jobs: python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl - python3 ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py + $WHEEL_PATH = python3 ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py + # append to env + echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Release with Notes uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: | - "${{ github.workspace }}/${{ env.SETUPPYPATH }}/dist/*.whl" + "${{ env.WHEEL_PATH }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # from previous step + WHEEL_PATH: ${{ env.WHEEL_PATH }} + diff --git a/.github/workflows/scripts/rename_whl_with_torch_version.py b/.github/workflows/scripts/rename_whl_with_torch_version.py index 25034df..86088d7 100644 --- a/.github/workflows/scripts/rename_whl_with_torch_version.py +++ b/.github/workflows/scripts/rename_whl_with_torch_version.py @@ -2,9 +2,10 @@ torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '') # get the .whl file in the dist directory and rename file = glob.glob(os.path.join('dist', '*.whl')) +current_dir = os.getcwd() if file: file = file[0] insert_pos = re.search(r'-cp[0-9]+-cp[0-9]+-', file).start() new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}' - print(f'move whl from {file} to {new_name}') + print(os.path.join(os.getcwd(), new_name)) shutil.move(file, new_name) \ No newline at end of file From 96d7de470f537ea1d2b0c3d5427f8a870299486d Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 17:41:04 +0100 Subject: [PATCH 24/35] even better file path --- .github/workflows/build_flashmm.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 7fcd62b..1908ec6 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -92,7 +92,7 @@ jobs: # rename wheel to reflect cuda version and torch version bash: dist/*.whl $WHEEL_PATH = python3 ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py - # append to env + # append to powershell env echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Release with Notes @@ -100,7 +100,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: | - "${{ env.WHEEL_PATH }}" + ${{ env.WHEEL_PATH }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # from previous step From 7914672ad3649002a7cabb7bd522ee7f1825d62c Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:07:24 +0100 Subject: [PATCH 25/35] add python script --- .github/workflows/build_flashmm.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 1908ec6..c7132e6 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -91,7 +91,17 @@ jobs: python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl - $WHEEL_PATH = python3 ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py + $WHEEL_PATH = python3 -c " +import os, shutil, glob, re, torch;\ +torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ +file = glob.glob(os.path.join('dist', '*.whl'))[0];\ +current_dir = os.getcwd();\ +insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ +new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ +print(os.path.join(os.getcwd(), new_name));\ +shutil.move(file, new_name);\ +" + ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py # append to powershell env echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append From d4a0235c4f095736f7e850cd5b94d367e724ea3e Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:13:17 +0100 Subject: [PATCH 26/35] update flashmm --- .github/workflows/build_flashmm.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index c7132e6..d3a5923 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -91,16 +91,16 @@ jobs: python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl - $WHEEL_PATH = python3 -c " -import os, shutil, glob, re, torch;\ -torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ -file = glob.glob(os.path.join('dist', '*.whl'))[0];\ -current_dir = os.getcwd();\ -insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ -new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ -print(os.path.join(os.getcwd(), new_name));\ -shutil.move(file, new_name);\ -" + $WHEEL_PATH = python3 -c "if True: \ + import os, shutil, glob, re, torch;\ + torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ + file = glob.glob(os.path.join('dist', '*.whl'))[0];\ + current_dir = os.getcwd();\ + insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ + new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ + print(os.path.join(os.getcwd(), new_name));\ + shutil.move(file, new_name);" + ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py # append to powershell env echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append From 15e8e4e786e2c7c0d275e4448c7be3413c7a3803 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:32:41 +0100 Subject: [PATCH 27/35] build next wheels --- .github/workflows/build_cuda_wheels.yaml | 20 -- .github/workflows/build_flashmm.yaml | 198 +++++++++--------- .github/workflows/build_flashmm_workflow.yaml | 16 ++ .../scripts/rename_whl_with_torch_version.py | 11 - .../workflows/workflow_build_cuda_wheels.yaml | 118 +++++++++++ 5 files changed, 233 insertions(+), 130 deletions(-) delete mode 100644 .github/workflows/build_cuda_wheels.yaml create mode 100644 .github/workflows/build_flashmm_workflow.yaml delete mode 100644 .github/workflows/scripts/rename_whl_with_torch_version.py create mode 100644 .github/workflows/workflow_build_cuda_wheels.yaml diff --git a/.github/workflows/build_cuda_wheels.yaml b/.github/workflows/build_cuda_wheels.yaml deleted file mode 100644 index 1f7622c..0000000 --- a/.github/workflows/build_cuda_wheels.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: install_wheels_cuda - -on: - workflow_call: - inputs: - setuppypath: - required: true - type: string - description: "path to the dir of the setup.py that should be built." - -env: - FILE_PATH: ${{ inputs.setuppypath }} - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: pass - run: | - echo pass \ No newline at end of file diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index d3a5923..b41d7f4 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -1,118 +1,118 @@ -# MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels -# https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows +# # MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels +# # https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows -name: Build Wheels with CUDA +# name: Build Wheels with CUDA -on: - push: - # push on github tags that start with "wheel" - tags: - - "wheel*" +# on: +# push: +# # push on github tags that start with "wheel" +# tags: +# - "wheel*" -jobs: +# jobs: - build_wheels: - name: Build Cuda Wheels for torch - runs-on: ${{ matrix.os }} +# build_wheels: +# name: Build Cuda Wheels for torch +# runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04, windows-latest] - pyver: ["3.8", "3.9", "3.10", "3.11"] - cuda: ["11.8.0", "12.1.1"] - defaults: - run: - shell: pwsh - env: - CUDA_VERSION: ${{ matrix.cuda }} - # define where the setup.py is located - SETUPPYPATH: ${{ github.workspace }}/csrc/flashmm +# strategy: +# matrix: +# os: [ubuntu-20.04, windows-latest] +# pyver: ["3.8", "3.9", "3.10", "3.11"] +# cuda: ["11.8.0", "12.1.1"] +# defaults: +# run: +# shell: pwsh +# env: +# CUDA_VERSION: ${{ matrix.cuda }} +# # define where the setup.py is located +# SETUPPYPATH: ${{ github.workspace }}/csrc/flashmm - steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@v1.3.0 - if: runner.os == 'Linux' - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: false +# steps: +# - name: Free Disk Space +# uses: jlumbroso/free-disk-space@v1.3.0 +# if: runner.os == 'Linux' +# with: +# tool-cache: false +# android: true +# dotnet: true +# haskell: true +# large-packages: false +# docker-images: true +# swap-storage: false - - uses: actions/checkout@v3 +# - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.pyver }} +# - uses: actions/setup-python@v3 +# with: +# python-version: ${{ matrix.pyver }} - - name: Setup Mamba - uses: conda-incubator/setup-miniconda@v2.2.0 - with: - activate-environment: "build" - python-version: ${{ matrix.pyver }} - miniforge-variant: Mambaforge - miniforge-version: latest - use-mamba: true - add-pip-as-python-dependency: true - auto-activate-base: false +# - name: Setup Mamba +# uses: conda-incubator/setup-miniconda@v2.2.0 +# with: +# activate-environment: "build" +# python-version: ${{ matrix.pyver }} +# miniforge-variant: Mambaforge +# miniforge-version: latest +# use-mamba: true +# add-pip-as-python-dependency: true +# auto-activate-base: false - - name: Install Dependencies - run: | - # Install CUDA toolkit - mamba install -y 'cuda' -c "nvidia/label/cuda-${env:CUDA_VERSION}" +# - name: Install Dependencies +# run: | +# # Install CUDA toolkit +# mamba install -y 'cuda' -c "nvidia/label/cuda-${env:CUDA_VERSION}" - # Env variables - $env:CUDA_PATH = $env:CONDA_PREFIX - $env:CUDA_HOME = $env:CONDA_PREFIX +# # Env variables +# $env:CUDA_PATH = $env:CONDA_PREFIX +# $env:CUDA_HOME = $env:CONDA_PREFIX - # Install torch - $cudaVersion = $env:CUDA_VERSION.Replace('.', '') - $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) - if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} - python3 -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch - python3 -m pip install build setuptools wheel ninja numpy +# # Install torch +# $cudaVersion = $env:CUDA_VERSION.Replace('.', '') +# $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) +# if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} +# python3 -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch +# python3 -m pip install build setuptools wheel ninja numpy - # Print version information - python3 --version - python3 -c "import torch; print('PyTorch:', torch.__version__)" - python3 -c "import torch; print('CUDA:', torch.version.cuda)" - python3 -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" - python3 -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" +# # Print version information +# python3 --version +# python3 -c "import torch; print('PyTorch:', torch.__version__)" +# python3 -c "import torch; print('CUDA:', torch.version.cuda)" +# python3 -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" +# python3 -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" - - name: Build Wheel - run: | - $env:CUDA_PATH = $env:CONDA_PREFIX - $env:CUDA_HOME = $env:CONDA_PREFIX +# - name: Build Wheel +# run: | +# $env:CUDA_PATH = $env:CONDA_PREFIX +# $env:CUDA_HOME = $env:CONDA_PREFIX - # build the wheel - cd $env:SETUPPYPATH - python3 setup.py sdist bdist_wheel +# # build the wheel +# cd $env:SETUPPYPATH +# python3 setup.py sdist bdist_wheel - # rename wheel to reflect cuda version and torch version bash: dist/*.whl - $WHEEL_PATH = python3 -c "if True: \ - import os, shutil, glob, re, torch;\ - torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ - file = glob.glob(os.path.join('dist', '*.whl'))[0];\ - current_dir = os.getcwd();\ - insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ - new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ - print(os.path.join(os.getcwd(), new_name));\ - shutil.move(file, new_name);" +# # rename wheel to reflect cuda version and torch version bash: dist/*.whl +# $WHEEL_PATH = python3 -c "if True: \ +# import os, shutil, glob, re, torch;\ +# torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ +# file = glob.glob(os.path.join('dist', '*.whl'))[0];\ +# current_dir = os.getcwd();\ +# insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ +# new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ +# print(os.path.join(os.getcwd(), new_name));\ +# shutil.move(file, new_name);" - ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py - # append to powershell env - echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append +# ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py +# # append to powershell env +# echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Release with Notes - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - ${{ env.WHEEL_PATH }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # from previous step - WHEEL_PATH: ${{ env.WHEEL_PATH }} +# - name: Release with Notes +# uses: softprops/action-gh-release@v1 +# if: startsWith(github.ref, 'refs/tags/') +# with: +# files: | +# ${{ env.WHEEL_PATH }} +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# # from previous step +# WHEEL_PATH: ${{ env.WHEEL_PATH }} diff --git a/.github/workflows/build_flashmm_workflow.yaml b/.github/workflows/build_flashmm_workflow.yaml new file mode 100644 index 0000000..eb32136 --- /dev/null +++ b/.github/workflows/build_flashmm_workflow.yaml @@ -0,0 +1,16 @@ +name: Build Wheels + +on: + push: + # push on github tags that start with "wheel" + tags: + - "wheel*" + +jobs: + flashmm_wheels: + uses: + ./m.github/workflows/workflow_build_cuda_wheels.yaml + with: + # working-directory: libs/infinity_emb + setuppath: ${{ github.workspace }}/csrc/flashmm + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/scripts/rename_whl_with_torch_version.py b/.github/workflows/scripts/rename_whl_with_torch_version.py deleted file mode 100644 index 86088d7..0000000 --- a/.github/workflows/scripts/rename_whl_with_torch_version.py +++ /dev/null @@ -1,11 +0,0 @@ -import os, shutil, glob, re, torch -torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '') -# get the .whl file in the dist directory and rename -file = glob.glob(os.path.join('dist', '*.whl')) -current_dir = os.getcwd() -if file: - file = file[0] - insert_pos = re.search(r'-cp[0-9]+-cp[0-9]+-', file).start() - new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}' - print(os.path.join(os.getcwd(), new_name)) - shutil.move(file, new_name) \ No newline at end of file diff --git a/.github/workflows/workflow_build_cuda_wheels.yaml b/.github/workflows/workflow_build_cuda_wheels.yaml new file mode 100644 index 0000000..894cb11 --- /dev/null +++ b/.github/workflows/workflow_build_cuda_wheels.yaml @@ -0,0 +1,118 @@ +name: install_wheels_cuda + +on: + workflow_call: + inputs: + setuppypath: + required: true + type: string + description: "path to the dir of the setup.py that should be built." + +env: + SETUPPYPATH: ${{ inputs.setuppypath }} + +jobs: + build_wheels: + name: Build Cuda Wheels for torch + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-20.04, windows-latest] + pyver: ["3.8", "3.9", "3.10", "3.11"] + cuda: ["11.8.0", "12.1.1"] + defaults: + run: + shell: pwsh + env: + CUDA_VERSION: ${{ matrix.cuda }} + # define where the setup.py is located + + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@v1.3.0 + if: runner.os == 'Linux' + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: false + + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.pyver }} + + - name: Setup Mamba + uses: conda-incubator/setup-miniconda@v2.2.0 + with: + activate-environment: "build" + python-version: ${{ matrix.pyver }} + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + add-pip-as-python-dependency: true + auto-activate-base: false + + - name: Install Dependencies + run: | + # Install CUDA toolkit + mamba install -y 'cuda' -c "nvidia/label/cuda-${env:CUDA_VERSION}" + + # Env variables + $env:CUDA_PATH = $env:CONDA_PREFIX + $env:CUDA_HOME = $env:CONDA_PREFIX + + # Install torch + $cudaVersion = $env:CUDA_VERSION.Replace('.', '') + $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) + if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} + python3 -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch + python3 -m pip install build setuptools wheel ninja numpy + + # Print version information + python3 --version + python3 -c "import torch; print('PyTorch:', torch.__version__)" + python3 -c "import torch; print('CUDA:', torch.version.cuda)" + python3 -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" + python3 -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" + + - name: Build Wheel + run: | + $env:CUDA_PATH = $env:CONDA_PREFIX + $env:CUDA_HOME = $env:CONDA_PREFIX + + # build the wheel + cd $env:SETUPPYPATH + python3 setup.py sdist bdist_wheel + + # rename wheel to reflect cuda version and torch version bash: dist/*.whl + $WHEEL_PATH = python3 -c "if True: \ + import os, shutil, glob, re, torch;\ + torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ + file = glob.glob(os.path.join('dist', '*.whl'))[0];\ + current_dir = os.getcwd();\ + insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ + new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ + print(os.path.join(os.getcwd(), new_name));\ + shutil.move(file, new_name);" + + ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py + # append to powershell env + echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Release with Notes + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + ${{ env.WHEEL_PATH }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # from previous step + WHEEL_PATH: ${{ env.WHEEL_PATH }} + From 89262b07c7838930ebe2c50bd91bf79302eb0bec Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:35:00 +0100 Subject: [PATCH 28/35] update path --- .github/workflows/build_flashmm_workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm_workflow.yaml b/.github/workflows/build_flashmm_workflow.yaml index eb32136..d68f475 100644 --- a/.github/workflows/build_flashmm_workflow.yaml +++ b/.github/workflows/build_flashmm_workflow.yaml @@ -9,7 +9,7 @@ on: jobs: flashmm_wheels: uses: - ./m.github/workflows/workflow_build_cuda_wheels.yaml + ./.github/workflows/workflow_build_cuda_wheels.yaml with: # working-directory: libs/infinity_emb setuppath: ${{ github.workspace }}/csrc/flashmm From 42133ba43eb3474c326f8233d55c2a1fd6f64386 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:37:29 +0100 Subject: [PATCH 29/35] add missing yaml --- .github/workflows/build_flashmm.yaml | 72 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index b41d7f4..b0ee3f5 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -1,45 +1,45 @@ -# # MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels -# # https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows +# MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels +# https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows -# name: Build Wheels with CUDA +name: Build Wheels with CUDA -# on: -# push: -# # push on github tags that start with "wheel" -# tags: -# - "wheel*" +on: + push: + # push on github tags that start with "wheel" + tags: + - "wheel*" -# jobs: +jobs: -# build_wheels: -# name: Build Cuda Wheels for torch -# runs-on: ${{ matrix.os }} + build_wheels: + name: Build Cuda Wheels for torch + runs-on: ${{ matrix.os }} -# strategy: -# matrix: -# os: [ubuntu-20.04, windows-latest] -# pyver: ["3.8", "3.9", "3.10", "3.11"] -# cuda: ["11.8.0", "12.1.1"] -# defaults: -# run: -# shell: pwsh -# env: -# CUDA_VERSION: ${{ matrix.cuda }} -# # define where the setup.py is located -# SETUPPYPATH: ${{ github.workspace }}/csrc/flashmm + strategy: + matrix: + os: [ubuntu-20.04, windows-latest] + # pyver: ["3.8", "3.9", "3.10", "3.11"] + cuda: ["11.8.0", "12.1.1"] + defaults: + run: + shell: pwsh + env: + CUDA_VERSION: ${{ matrix.cuda }} + # define where the setup.py is located + SETUPPYPATH: ${{ github.workspace }}/csrc/flashmm -# steps: -# - name: Free Disk Space -# uses: jlumbroso/free-disk-space@v1.3.0 -# if: runner.os == 'Linux' -# with: -# tool-cache: false -# android: true -# dotnet: true -# haskell: true -# large-packages: false -# docker-images: true -# swap-storage: false + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@v1.3.0 + if: runner.os == 'Linux' + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: false # - uses: actions/checkout@v3 From 15be2cca35ddaf7acef478024a916ad26d08fc59 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:38:58 +0100 Subject: [PATCH 30/35] fix setuppypath --- .github/workflows/build_flashmm_workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_flashmm_workflow.yaml b/.github/workflows/build_flashmm_workflow.yaml index d68f475..3714277 100644 --- a/.github/workflows/build_flashmm_workflow.yaml +++ b/.github/workflows/build_flashmm_workflow.yaml @@ -12,5 +12,5 @@ jobs: ./.github/workflows/workflow_build_cuda_wheels.yaml with: # working-directory: libs/infinity_emb - setuppath: ${{ github.workspace }}/csrc/flashmm + setuppypath: ${{ github.workspace }}/csrc/flashmm secrets: inherit \ No newline at end of file From 0bc1564281a70a40d91527a5f70a13b3b689c7bf Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:43:55 +0100 Subject: [PATCH 31/35] update workflows --- .github/workflows/build_flashmm.yaml | 117 ++---------------- .github/workflows/build_flashmm_workflow.yaml | 16 --- 2 files changed, 7 insertions(+), 126 deletions(-) delete mode 100644 .github/workflows/build_flashmm_workflow.yaml diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index b0ee3f5..5e82d41 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -1,7 +1,4 @@ -# MIT Licence, (c) Michael Feil, adapted from Casper Hansen's aws wheels -# https://github.com/casper-hansen/AutoAWQ/tree/main/.github/workflows - -name: Build Wheels with CUDA +name: Build Wheels on: push: @@ -10,109 +7,9 @@ on: - "wheel*" jobs: - - build_wheels: - name: Build Cuda Wheels for torch - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-20.04, windows-latest] - # pyver: ["3.8", "3.9", "3.10", "3.11"] - cuda: ["11.8.0", "12.1.1"] - defaults: - run: - shell: pwsh - env: - CUDA_VERSION: ${{ matrix.cuda }} - # define where the setup.py is located - SETUPPYPATH: ${{ github.workspace }}/csrc/flashmm - - steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@v1.3.0 - if: runner.os == 'Linux' - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: false - -# - uses: actions/checkout@v3 - -# - uses: actions/setup-python@v3 -# with: -# python-version: ${{ matrix.pyver }} - -# - name: Setup Mamba -# uses: conda-incubator/setup-miniconda@v2.2.0 -# with: -# activate-environment: "build" -# python-version: ${{ matrix.pyver }} -# miniforge-variant: Mambaforge -# miniforge-version: latest -# use-mamba: true -# add-pip-as-python-dependency: true -# auto-activate-base: false - -# - name: Install Dependencies -# run: | -# # Install CUDA toolkit -# mamba install -y 'cuda' -c "nvidia/label/cuda-${env:CUDA_VERSION}" - -# # Env variables -# $env:CUDA_PATH = $env:CONDA_PREFIX -# $env:CUDA_HOME = $env:CONDA_PREFIX - -# # Install torch -# $cudaVersion = $env:CUDA_VERSION.Replace('.', '') -# $cudaVersionPytorch = $cudaVersion.Substring(0, $cudaVersion.Length - 1) -# if ([int]$cudaVersionPytorch -gt 118) { $pytorchVersion = "torch==2.1.0" } else {$pytorchVersion = "torch==2.0.1"} -# python3 -m pip install --upgrade --no-cache-dir $pytorchVersion+cu$cudaVersionPytorch --index-url https://download.pytorch.org/whl/cu$cudaVersionPytorch -# python3 -m pip install build setuptools wheel ninja numpy - -# # Print version information -# python3 --version -# python3 -c "import torch; print('PyTorch:', torch.__version__)" -# python3 -c "import torch; print('CUDA:', torch.version.cuda)" -# python3 -c "import os; print('CUDA_HOME:', os.getenv('CUDA_HOME', None))" -# python3 -c "from torch.utils import cpp_extension; print (cpp_extension.CUDA_HOME)" - -# - name: Build Wheel -# run: | -# $env:CUDA_PATH = $env:CONDA_PREFIX -# $env:CUDA_HOME = $env:CONDA_PREFIX - -# # build the wheel -# cd $env:SETUPPYPATH -# python3 setup.py sdist bdist_wheel - -# # rename wheel to reflect cuda version and torch version bash: dist/*.whl -# $WHEEL_PATH = python3 -c "if True: \ -# import os, shutil, glob, re, torch;\ -# torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ -# file = glob.glob(os.path.join('dist', '*.whl'))[0];\ -# current_dir = os.getcwd();\ -# insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ -# new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ -# print(os.path.join(os.getcwd(), new_name));\ -# shutil.move(file, new_name);" - -# ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py -# # append to powershell env -# echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - -# - name: Release with Notes -# uses: softprops/action-gh-release@v1 -# if: startsWith(github.ref, 'refs/tags/') -# with: -# files: | -# ${{ env.WHEEL_PATH }} -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# # from previous step -# WHEEL_PATH: ${{ env.WHEEL_PATH }} - + flashmm_wheels: + uses: + ./.github/workflows/workflow_build_cuda_wheels.yaml + with: + setuppypath: ${{ github.workspace }}/csrc/flashmm + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/build_flashmm_workflow.yaml b/.github/workflows/build_flashmm_workflow.yaml deleted file mode 100644 index 3714277..0000000 --- a/.github/workflows/build_flashmm_workflow.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: Build Wheels - -on: - push: - # push on github tags that start with "wheel" - tags: - - "wheel*" - -jobs: - flashmm_wheels: - uses: - ./.github/workflows/workflow_build_cuda_wheels.yaml - with: - # working-directory: libs/infinity_emb - setuppypath: ${{ github.workspace }}/csrc/flashmm - secrets: inherit \ No newline at end of file From 40e9fba7159fb583dab1043aa4b58b13ec6f5d3f Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:53:11 +0100 Subject: [PATCH 32/35] update paths --- .github/workflows/build_flashmm.yaml | 4 ++-- .github/workflows/workflow_build_cuda_wheels.yaml | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index 5e82d41..ad3485b 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -10,6 +10,6 @@ jobs: flashmm_wheels: uses: ./.github/workflows/workflow_build_cuda_wheels.yaml - with: - setuppypath: ${{ github.workspace }}/csrc/flashmm + with: # ${{ github.workspace }} + setuppypath: ./csrc/flashmm secrets: inherit \ No newline at end of file diff --git a/.github/workflows/workflow_build_cuda_wheels.yaml b/.github/workflows/workflow_build_cuda_wheels.yaml index 894cb11..9d063fb 100644 --- a/.github/workflows/workflow_build_cuda_wheels.yaml +++ b/.github/workflows/workflow_build_cuda_wheels.yaml @@ -100,8 +100,7 @@ jobs: new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ print(os.path.join(os.getcwd(), new_name));\ shutil.move(file, new_name);" - - ${{ github.workspace }}/.github/workflows/scripts/rename_whl_with_torch_version.py + # append to powershell env echo "WHEEL_PATH=$WHEEL_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append From 12f628699c5578011f8238340ba0e57fdea0946c Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 18:59:17 +0100 Subject: [PATCH 33/35] update path --- .github/workflows/build_flashmm.yaml | 2 +- .github/workflows/workflow_build_cuda_wheels.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_flashmm.yaml b/.github/workflows/build_flashmm.yaml index ad3485b..7c9567f 100644 --- a/.github/workflows/build_flashmm.yaml +++ b/.github/workflows/build_flashmm.yaml @@ -11,5 +11,5 @@ jobs: uses: ./.github/workflows/workflow_build_cuda_wheels.yaml with: # ${{ github.workspace }} - setuppypath: ./csrc/flashmm + setuppypath: "csrc/flashmm" secrets: inherit \ No newline at end of file diff --git a/.github/workflows/workflow_build_cuda_wheels.yaml b/.github/workflows/workflow_build_cuda_wheels.yaml index 9d063fb..4c652de 100644 --- a/.github/workflows/workflow_build_cuda_wheels.yaml +++ b/.github/workflows/workflow_build_cuda_wheels.yaml @@ -87,7 +87,7 @@ jobs: $env:CUDA_HOME = $env:CONDA_PREFIX # build the wheel - cd $env:SETUPPYPATH + cd ${{ github.workspace }}/$env:SETUPPYPATH python3 setup.py sdist bdist_wheel # rename wheel to reflect cuda version and torch version bash: dist/*.whl From d7024224c78540cf8e2660ff29a62030d53c26e0 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 19:16:30 +0100 Subject: [PATCH 34/35] update setup --- .github/workflows/workflow_build_cuda_wheels.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow_build_cuda_wheels.yaml b/.github/workflows/workflow_build_cuda_wheels.yaml index 4c652de..a77701b 100644 --- a/.github/workflows/workflow_build_cuda_wheels.yaml +++ b/.github/workflows/workflow_build_cuda_wheels.yaml @@ -93,11 +93,13 @@ jobs: # rename wheel to reflect cuda version and torch version bash: dist/*.whl $WHEEL_PATH = python3 -c "if True: \ import os, shutil, glob, re, torch;\ - torch_name = 'torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ + torch_name = '+torch' + (torch.__version__.split('+')[0] + 'cu' + torch.version.cuda).replace('.', '');\ file = glob.glob(os.path.join('dist', '*.whl'))[0];\ current_dir = os.getcwd();\ - insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file).start();\ - new_name = f'{file[:insert_pos]}+{torch_name}{file[insert_pos:]}';\ + insert_pos = re.search('-cp[0-9]+-cp[0-9]+-', file);\ + torch_name = '' if insert_pos is None else torch_name;\ + insert_pos = re.search('-py3', file).start() if insert_pos is None else insert_pos.start();\ + new_name = f'{file[:insert_pos]}{torch_name}{file[insert_pos:]}';\ print(os.path.join(os.getcwd(), new_name));\ shutil.move(file, new_name);" From 16d5e719597633a6f92d6638241a200821080e64 Mon Sep 17 00:00:00 2001 From: michaelfeil Date: Fri, 12 Jan 2024 20:40:08 +0100 Subject: [PATCH 35/35] update setup --- .github/workflows/workflow_build_cuda_wheels.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/workflow_build_cuda_wheels.yaml b/.github/workflows/workflow_build_cuda_wheels.yaml index a77701b..f73d04d 100644 --- a/.github/workflows/workflow_build_cuda_wheels.yaml +++ b/.github/workflows/workflow_build_cuda_wheels.yaml @@ -10,6 +10,7 @@ on: env: SETUPPYPATH: ${{ inputs.setuppypath }} + MAX_JOBS: "2" jobs: build_wheels: