From 957e60774a5b08601f380b8fd4c431ca29d0d78b Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 25 Oct 2023 16:12:27 -0700 Subject: [PATCH 01/22] Add sample release flow --- .github/workflows/release.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a55022b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,6 @@ +name: Build and publish DeepSpeed release + +on: + push: + tags: + - 'v*.*.*' From 5a68c0c9c1a13c82f4a035c32391ba962181b71a Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 25 Oct 2023 16:24:16 -0700 Subject: [PATCH 02/22] Test build --- .github/workflows/build.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bdaaff5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: build + +on: + pull_request: + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-20.04 + container: + image: nvcr.io/nvidia/pytorch:22.12-py3 + + steps: + - uses: actions/checkout@v3 + + - name: environment + run: | + which python + python --version + + - name: build + run: | + git config --global --add safe.directory /__w/DeepSpeed-Kernels/DeepSpeed-Kernels + git submodule update --init --recursive + + ts=$(date +%s) + DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + fname=$(ls dist) + nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') + mv "dist/$fname" "dist/$nname" From c56bfaa22215f927d2ead9fa9bcc653aef93eed9 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 25 Oct 2023 16:24:54 -0700 Subject: [PATCH 03/22] Remove release for now --- .github/workflows/release.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a55022b..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: Build and publish DeepSpeed release - -on: - push: - tags: - - 'v*.*.*' From 6ede8dcfc94f7eec6bd2124af6600524fcb49fd4 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 25 Oct 2023 16:30:36 -0700 Subject: [PATCH 04/22] Fix YML error --- .github/workflows/build.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bdaaff5..df8ea03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,6 @@ name: build on: pull_request: - workflow_dispatch: jobs: build: @@ -14,18 +13,18 @@ jobs: steps: - uses: actions/checkout@v3 - - name: environment - run: | - which python - python --version + - name: environment + run: | + which python + python --version - - name: build - run: | - git config --global --add safe.directory /__w/DeepSpeed-Kernels/DeepSpeed-Kernels - git submodule update --init --recursive + - name: build + run: | + git config --global --add safe.directory /__w/DeepSpeed-Kernels/DeepSpeed-Kernels + git submodule update --init --recursive - ts=$(date +%s) - DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel - fname=$(ls dist) - nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') - mv "dist/$fname" "dist/$nname" + ts=$(date +%s) + DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + fname=$(ls dist) + nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') + mv "dist/$fname" "dist/$nname" From df1bd08b36b9b8f81b297e0ebb40bcbb68bc8a0c Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 25 Oct 2023 16:46:47 -0700 Subject: [PATCH 05/22] Test self-hosted cpu pool --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df8ea03..7d9c637 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: [self-hosted, cpu] container: image: nvcr.io/nvidia/pytorch:22.12-py3 From b299b4dac714e8e67ae93ad50f9c73fdfe2af9f8 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Fri, 27 Oct 2023 13:33:52 -0700 Subject: [PATCH 06/22] Disable docker for now as this doesn't have docker installed --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d9c637..2effd48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,8 @@ jobs: build: runs-on: [self-hosted, cpu] - container: - image: nvcr.io/nvidia/pytorch:22.12-py3 +# container: +# image: nvcr.io/nvidia/pytorch:22.12-py3 steps: - uses: actions/checkout@v3 From b8b92983977868e2c116916a9897dd30f81c8d55 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Fri, 27 Oct 2023 13:35:05 -0700 Subject: [PATCH 07/22] Remove reference git add safe directories --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2effd48..cd2e3d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,6 @@ jobs: - name: build run: | - git config --global --add safe.directory /__w/DeepSpeed-Kernels/DeepSpeed-Kernels git submodule update --init --recursive ts=$(date +%s) From 2b12b8140b34abd6de5e0c4f9425b0334675a7d7 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Fri, 27 Oct 2023 13:38:03 -0700 Subject: [PATCH 08/22] Re-enable docker --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd2e3d3..ddfe077 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,8 @@ jobs: build: runs-on: [self-hosted, cpu] -# container: -# image: nvcr.io/nvidia/pytorch:22.12-py3 + container: + image: nvcr.io/nvidia/pytorch:22.12-py3 steps: - uses: actions/checkout@v3 From e6c96b2bc3e7ae37366d34309ddaa08f5a3be61e Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Fri, 27 Oct 2023 15:08:08 -0700 Subject: [PATCH 09/22] Add info about the environment --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ddfe077..05c255f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,6 @@ jobs: build: runs-on: [self-hosted, cpu] - container: - image: nvcr.io/nvidia/pytorch:22.12-py3 steps: - uses: actions/checkout@v3 @@ -17,9 +15,14 @@ jobs: run: | which python python --version + nvcc --version + python -c "import torch; print('torch:', torch.__version__, torch)" + python -c "import torch; print('CUDA available:', torch.cuda.is_available())" - name: build run: | + pwd + ls -al git submodule update --init --recursive ts=$(date +%s) From b3d89e3d8bae46a577d051e2371c37e1b626da23 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Fri, 27 Oct 2023 15:16:47 -0700 Subject: [PATCH 10/22] Add submodule in checkout --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05c255f..d342717 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: environment run: | @@ -23,8 +25,6 @@ jobs: run: | pwd ls -al - git submodule update --init --recursive - ts=$(date +%s) DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel fname=$(ls dist) From 387e37df80b4d3203c45de329bf5498ae72f8ec5 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Fri, 27 Oct 2023 15:18:22 -0700 Subject: [PATCH 11/22] Recurseively checkout submodules --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d342717..aae2abb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - submodules: 'true' + submodules: 'recursive' - name: environment run: | From 6db2562a6f84eedf869b98e52c528941bb7fd350 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Tue, 31 Oct 2023 17:08:48 -0700 Subject: [PATCH 12/22] Test without cloning submodules --- .github/workflows/build.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aae2abb..eb0c177 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,8 +10,8 @@ jobs: steps: - uses: actions/checkout@v3 - with: - submodules: 'recursive' +# with: +# submodules: 'recursive' - name: environment run: | @@ -20,13 +20,14 @@ jobs: nvcc --version python -c "import torch; print('torch:', torch.__version__, torch)" python -c "import torch; print('CUDA available:', torch.cuda.is_available())" + git --version - name: build run: | pwd ls -al - ts=$(date +%s) - DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel - fname=$(ls dist) - nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') - mv "dist/$fname" "dist/$nname" + #ts=$(date +%s) + #DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + #fname=$(ls dist) + #nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') + #mv "dist/$fname" "dist/$nname" From 00c56c6b4cb5b50ce7ca01d8403761d8198bf5f7 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 1 Nov 2023 11:43:25 -0700 Subject: [PATCH 13/22] Re-enable submodules --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb0c177..9451e00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,8 +10,8 @@ jobs: steps: - uses: actions/checkout@v3 -# with: -# submodules: 'recursive' + with: + submodules: 'recursive' - name: environment run: | From c02b99e05cd6e55ac83f56acc3abb1abde7803be Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 1 Nov 2023 11:44:48 -0700 Subject: [PATCH 14/22] Enable more of build flow --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9451e00..513f4ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,9 @@ jobs: run: | pwd ls -al - #ts=$(date +%s) - #DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel - #fname=$(ls dist) - #nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') - #mv "dist/$fname" "dist/$nname" + ts=$(date +%s) + DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + fname=$(ls dist) + nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') + mv "dist/$fname" "dist/$nname" + ls -al From e101e0d01d6fcbfc98b453b9ad4626261f03bfe8 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 1 Nov 2023 11:48:50 -0700 Subject: [PATCH 15/22] Reduce compute capability since the image that is being used for testing only support cu11.6 --- .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 513f4ec..905a631 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,8 @@ jobs: pwd ls -al ts=$(date +%s) - DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel + #DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel fname=$(ls dist) nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') mv "dist/$fname" "dist/$nname" From 57c1c39c40aaf3fb36a770d745fd551703ab7444 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 1 Nov 2023 12:13:33 -0700 Subject: [PATCH 16/22] Test nvcc version/runtime --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 905a631..ad1682e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,9 @@ jobs: run: | which python python --version + which nvcc nvcc --version + /usr/local/cuda/bin/nvcc --version python -c "import torch; print('torch:', torch.__version__, torch)" python -c "import torch; print('CUDA available:', torch.cuda.is_available())" git --version From 26905727cb48620738a26d1fdb0ba7d973974a97 Mon Sep 17 00:00:00 2001 From: Jeff Rasley Date: Tue, 7 Nov 2023 18:44:35 -0800 Subject: [PATCH 17/22] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad1682e..fd231a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: pwd ls -al ts=$(date +%s) - DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel + DS_KERNELS_MAKE_JOBS=10 DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel #DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel fname=$(ls dist) nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') From 9fd5bf3bbc215f98e8f4476bdce73723fd53023b Mon Sep 17 00:00:00 2001 From: Jeff Rasley Date: Tue, 7 Nov 2023 18:45:04 -0800 Subject: [PATCH 18/22] allow user to specify make parallelism degree (#12) --- README.md | 8 +++++--- builder/builder.py | 7 ++++++- release/release.sh | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index feddb1a..345699c 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,15 @@ # DeepSpeed Kernels -TODO: add short description of what this repo is for +DeepSpeed-Kernels is a backend library that is used to power [DeepSpeed-FastGen](https://github.com/microsoft/DeepSpeed/tree/master/blogs/deepspeed-fastgen) to achieve accelerated text-generation inference through [DeepSpeed-MII](https://github.com/microsoft/deepspeed-mii). This library is not intended to be an independent user package, but is open-source to benefit the community and show how DeepSpeed is accelerating text-generation. + +The resulting binaries that are compiled from this repo and included in the PyPI release are torch and python agnostic, this allows the core backend to be as portable as possible and leaves the task of compiling torch and python bindings to DeepSpeed itself using it's [JIT op builder](https://github.com/microsoft/DeepSpeed/tree/master/op_builder). # Installation ## PyPI -If your environment supports it you can quickly install DeepSpeed-Kernels from [PyPI](https://pypi.org/project/deepspeed-kernels/) (see below). +If your environment supports it you can quickly install DeepSpeed-Kernels from [PyPI](https://pypi.org/project/deepspeed-kernels/) (see below). We've tested the portability of the PyPI release on A100, A6000, and H100. The release on PyPI should work with the following assumptions about your environment: * NVIDIA GPU(s) with compute capability of: 8.0, 8.6, 8.9, 9.0 @@ -30,5 +32,5 @@ pip install -v . You can create a pre-compiled portable wheel that supports different CUDA architectures via the `CUDA_ARCH_LIST` environment variable. By default the kernels will be compiled using the `native` compute capability. If you want to compile for more than one you can set the `CUDA_ARCH_LIST` environment variable. We currently only support Ampere and above architectures (i.e., 8.0+). See example below to build for GPUs like A100 and A6000: ```bash -CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel +CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel ``` diff --git a/builder/builder.py b/builder/builder.py index 23d6fbb..f94a688 100644 --- a/builder/builder.py +++ b/builder/builder.py @@ -76,4 +76,9 @@ def build_extension(self, ext): f'-DLIB_OUTPUT_DIR={abs_build_lib}', f'-DCUDA_ARCH_LIST={cuda_arch_list}'], cwd=ext.source) - subprocess.check_call(['make', '-j'], cwd=abs_build_temp) + + # Allow user to specify degree of make parallelism + make_jobs = os.environ.get('DS_KERNELS_MAKE_JOBS', None) + make_cmd = f"make -j {make_jobs}" if make_jobs else "make -j" + subprocess.check_call(make_cmd.split(" "), cwd=abs_build_temp) + diff --git a/release/release.sh b/release/release.sh index 748b66d..822766a 100644 --- a/release/release.sh +++ b/release/release.sh @@ -2,6 +2,8 @@ set -ex rm -rf dist +#export DS_KERNELS_MAKE_JOBS=10 + ts=$(date +%s) DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel From 01ffe08908086e9ab352775fdaf050901aa04932 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 8 Nov 2023 15:22:05 -0800 Subject: [PATCH 19/22] Build with more cuda archs --- .github/workflows/build.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd231a9..80cd913 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: build +name: Build Kernels on: pull_request: @@ -19,18 +19,13 @@ jobs: python --version which nvcc nvcc --version - /usr/local/cuda/bin/nvcc --version python -c "import torch; print('torch:', torch.__version__, torch)" python -c "import torch; print('CUDA available:', torch.cuda.is_available())" - git --version - name: build run: | - pwd - ls -al ts=$(date +%s) - DS_KERNELS_MAKE_JOBS=10 DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel - #DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + DS_KERNELS_MAKE_JOBS=10 DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel fname=$(ls dist) nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') mv "dist/$fname" "dist/$nname" From e017f20eba3871fced65558b9cd86604cff08ded Mon Sep 17 00:00:00 2001 From: Jeff Rasley Date: Wed, 8 Nov 2023 16:51:43 -0800 Subject: [PATCH 20/22] add upload --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80cd913..e6563b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,3 +30,8 @@ jobs: nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') mv "dist/$fname" "dist/$nname" ls -al + + - uses: actions/upload-artifact@v3 + with: + name: deepspeed-kernels-whl + path: dist/*.whl From 1bf139244353aaa106d516349dd81e3c431660fa Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Tue, 14 Nov 2023 09:44:21 -0800 Subject: [PATCH 21/22] Add release helper scripts and modify existing release.yml --- .github/workflows/build.yml | 32 ----------------- .github/workflows/release.yml | 62 ++++++++++++++++++++++++++++++++ release/bump_patch_version.py | 22 ++++++++++++ release/check_release_version.py | 20 +++++++++++ 4 files changed, 104 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml create mode 100644 release/bump_patch_version.py create mode 100644 release/check_release_version.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 80cd913..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build Kernels - -on: - pull_request: - -jobs: - build: - - runs-on: [self-hosted, cpu] - - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: environment - run: | - which python - python --version - which nvcc - nvcc --version - python -c "import torch; print('torch:', torch.__version__, torch)" - python -c "import torch; print('CUDA available:', torch.cuda.is_available())" - - - name: build - run: | - ts=$(date +%s) - DS_KERNELS_MAKE_JOBS=10 DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel - fname=$(ls dist) - nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') - mv "dist/$fname" "dist/$nname" - ls -al diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..12d8c81 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Build and publish DeepSpeed-Kernels release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + deploy: + runs-on: [self-hosted, cpu] + environment: release-env + + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Check environment + run: | + which python + python --version + which nvcc + nvcc --version + python -c "import torch; print('torch:', torch.__version__, torch)" + python -c "import torch; print('CUDA available:', torch.cuda.is_available())" + - name: Get release version from tag + run: | + echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV + - name: Check release version + run: | + pip install packaging + python release/check_release_version.py --release_version ${{ env.RELEASE_VERSION }} + - name: Build DeepSpeed-Kernels + run: | + ts=$(date +%s) + DS_KERNELS_MAKE_JOBS=10 DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86;89;90" python setup.py bdist_wheel + fname=$(ls dist) + nname=$(echo $fname | sed 's/cp[0-9]\+-cp[0-9]\+/py3-none/' | sed 's/linux/manylinux1/') + mv "dist/$fname" "dist/$nname" + ls -al + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + repository-url: https://upload.pypi.org/legacy/ + - name: Bump version + run: | + python release/bump_patch_version.py --current_version ${{ env.RELEASE_VERSION }} + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GH_PAT }} + add-paths: | + version.txt + body: | + **Auto-generated PR to update version.txt after a DeepSpeed release** + Released version - ${{ env.RELEASE_VERSION }} + Author - @${{ github.actor }} + branch: AutoPR/${{ env.RELEASE_VERSION }} + assignees: ${{ github.actor }} + title: "Update version.txt after ${{ env.RELEASE_VERSION }} release" + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> \ No newline at end of file diff --git a/release/bump_patch_version.py b/release/bump_patch_version.py new file mode 100644 index 0000000..2bd70d4 --- /dev/null +++ b/release/bump_patch_version.py @@ -0,0 +1,22 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 + +# DeepSpeed Team + +import argparse +from packaging import version as pkg_version + +parser = argparse.ArgumentParser() + +parser.add_argument("--current_version", + type=str, + help="The current version being published to help set the next version.") + +args = parser.parse_args() + +current_version = pkg_version.parse(args.current_version) + +with open('./version.txt', 'w') as fd: + fd.write(f'{current_version.major}.{current_version.minor}.{current_version.micro + 1}\n') + +print(f'{current_version} -> {current_version.major}.{current_version.minor}.{current_version.micro + 1}') \ No newline at end of file diff --git a/release/check_release_version.py b/release/check_release_version.py new file mode 100644 index 0000000..70db4cd --- /dev/null +++ b/release/check_release_version.py @@ -0,0 +1,20 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 + +# DeepSpeed Team + +import argparse +from packaging import version as pkg_version + +parser = argparse.ArgumentParser() + +parser.add_argument("--release_version", type=str, help="The new version being published.") + +args = parser.parse_args() + +release_version = pkg_version.parse(args.release_version) + +with open('./version.txt') as fd: + repo_version = pkg_version.parse(fd.read()) + +assert repo_version == release_version, f"{repo_version=} does not match {release_version=}, unable to proceed" \ No newline at end of file From ccdc9d6c0bdd27b821c94999fb6225bbee26d4a4 Mon Sep 17 00:00:00 2001 From: Logan Adams Date: Wed, 15 Nov 2023 13:34:25 -0800 Subject: [PATCH 22/22] Fix whitespace/formatting/line endings --- .github/workflows/release.yml | 4 ++-- release/bump_patch_version.py | 2 +- release/check_release_version.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12d8c81..ade46d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: deploy: runs-on: [self-hosted, cpu] - environment: release-env + environment: release-env steps: - uses: actions/checkout@v3 @@ -59,4 +59,4 @@ jobs: branch: AutoPR/${{ env.RELEASE_VERSION }} assignees: ${{ github.actor }} title: "Update version.txt after ${{ env.RELEASE_VERSION }} release" - author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> \ No newline at end of file + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> diff --git a/release/bump_patch_version.py b/release/bump_patch_version.py index 2bd70d4..719f4d4 100644 --- a/release/bump_patch_version.py +++ b/release/bump_patch_version.py @@ -19,4 +19,4 @@ with open('./version.txt', 'w') as fd: fd.write(f'{current_version.major}.{current_version.minor}.{current_version.micro + 1}\n') -print(f'{current_version} -> {current_version.major}.{current_version.minor}.{current_version.micro + 1}') \ No newline at end of file +print(f'{current_version} -> {current_version.major}.{current_version.minor}.{current_version.micro + 1}') diff --git a/release/check_release_version.py b/release/check_release_version.py index 70db4cd..266094b 100644 --- a/release/check_release_version.py +++ b/release/check_release_version.py @@ -17,4 +17,4 @@ with open('./version.txt') as fd: repo_version = pkg_version.parse(fd.read()) -assert repo_version == release_version, f"{repo_version=} does not match {release_version=}, unable to proceed" \ No newline at end of file +assert repo_version == release_version, f"{repo_version=} does not match {release_version=}, unable to proceed"