Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PR test to build kernels and upload artifacts #14

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build-kernels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Kernels

on:
pull_request:

jobs:
build:

runs-on: [self-hosted, cpu]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: environment
run: |
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 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

- uses: actions/upload-artifact@v3
with:
name: deepspeed-kernels-whl
path: dist/*.whl
8 changes: 6 additions & 2 deletions builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ def build_extension(self, ext):
abs_build_lib = os.path.join(os.path.abspath(self.build_lib),
"dskernels")

subprocess.check_call(['cmake', '-B', abs_build_temp,
subprocess.check_call(['cmake', '-B', abs_build_temp,
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 is not None else "make -j"
subprocess.check_call(make_cmd.split(" "), cwd=abs_build_temp)
3 changes: 3 additions & 0 deletions release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ set -ex

rm -rf dist

# enable to reduce overall memory consumption if running on a small VM
#export DS_KERNELS_MAKE_JOBS=10
loadams marked this conversation as resolved.
Show resolved Hide resolved

ts=$(date +%s)
DS_KERNELS_BUILD_STRING=".dev${ts}" CUDA_ARCH_LIST="80;86" python setup.py bdist_wheel

Expand Down