mirror of
https://github.com/csukuangfj/kaldifeat.git
synced 2025-08-10 02:22:16 +00:00
194 lines
6.9 KiB
YAML
194 lines
6.9 KiB
YAML
name: build-wheels-cuda-ubuntu
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- wheel
|
|
tags:
|
|
- '*'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: build-wheels-cuda-ubuntu-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
generate_build_matrix:
|
|
# see https://github.com/pytorch/pytorch/pull/50633
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Generating build matrix
|
|
id: set-matrix
|
|
run: |
|
|
# outputting for debugging purposes
|
|
python ./scripts/github_actions/generate_build_matrix.py --enable-cuda
|
|
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda)
|
|
|
|
# python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch
|
|
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch)
|
|
echo "::set-output name=matrix::${MATRIX}"
|
|
|
|
build-manylinux-wheels:
|
|
needs: generate_build_matrix
|
|
name: ${{ matrix.torch }} ${{ matrix.python-version }} cuda${{ matrix.cuda }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
${{ fromJson(needs.generate_build_matrix.outputs.matrix) }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Free space
|
|
shell: bash
|
|
run: |
|
|
df -h
|
|
rm -rf /opt/hostedtoolcache
|
|
df -h
|
|
echo "pwd: $PWD"
|
|
echo "github.workspace ${{ github.workspace }}"
|
|
|
|
# see https://github.com/pytorch/test-infra/blob/9e3d392690719fac85bad0c9b67f530e48375ca1/tools/scripts/generate_binary_build_matrix.py
|
|
# https://github.com/pytorch/builder/tree/main/manywheel
|
|
# https://github.com/pytorch/builder/pull/476
|
|
# https://github.com/k2-fsa/k2/issues/733
|
|
# https://github.com/pytorch/pytorch/pull/50633 (generate build matrix)
|
|
- name: Run the build process with Docker
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: ${{ matrix.image }}
|
|
options: -v ${{ github.workspace }}:/var/www -e IS_2_28=${{ matrix.is_2_28 }} -e PYTHON_VERSION=${{ matrix.python-version }} -e TORCH_VERSION=${{ matrix.torch }} -e CUDA_VERSION=${{ matrix.cuda }}
|
|
run: |
|
|
echo "pwd: $PWD"
|
|
uname -a
|
|
id
|
|
cat /etc/*release
|
|
gcc --version
|
|
python3 --version
|
|
which python3
|
|
|
|
ls -lh /opt/python/
|
|
|
|
echo "---"
|
|
|
|
ls -lh /opt/python/cp*
|
|
|
|
ls -lh /opt/python/*/bin
|
|
|
|
echo "---"
|
|
find /opt/python/cp* -name "libpython*"
|
|
echo "-----"
|
|
find /opt/_internal/cp* -name "libpython*"
|
|
|
|
echo "-----"
|
|
find / -name "libpython*"
|
|
|
|
# cp36-cp36m
|
|
# cp37-cp37m
|
|
# cp38-cp38
|
|
# cp39-cp39
|
|
# cp310-cp310
|
|
# cp311-cp311
|
|
# cp312-cp312
|
|
# cp313-cp313
|
|
# cp313-cp313t (no gil)
|
|
if [[ $PYTHON_VERSION == "3.6" ]]; then
|
|
python_dir=/opt/python/cp36-cp36m
|
|
export PYTHONPATH=/opt/python/cp36-cp36m/lib/python3.6/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.7" ]]; then
|
|
python_dir=/opt/python/cp37-cp37m
|
|
export PYTHONPATH=/opt/python/cp37-cp37m/lib/python3.7/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.8" ]]; then
|
|
python_dir=/opt/python/cp38-cp38
|
|
export PYTHONPATH=/opt/python/cp38-cp38/lib/python3.8/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.9" ]]; then
|
|
python_dir=/opt/python/cp39-cp39
|
|
export PYTHONPATH=/opt/python/cp39-cp39/lib/python3.9/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.10" ]]; then
|
|
python_dir=/opt/python/cp310-cp310
|
|
export PYTHONPATH=/opt/python/cp310-cp310/lib/python3.10/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.11" ]]; then
|
|
python_dir=/opt/python/cp311-cp311
|
|
export PYTHONPATH=/opt/python/cp311-cp311/lib/python3.11/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.12" ]]; then
|
|
python_dir=/opt/python/cp312-cp312
|
|
export PYTHONPATH=/opt/python/cp312-cp312/lib/python3.12/site-packages:$PYTHONPATH
|
|
elif [[ $PYTHON_VERSION == "3.13" ]]; then
|
|
python_dir=/opt/python/cp313-cp313
|
|
export PYTHONPATH=/opt/python/cp313-cp313/lib/python3.13/site-packages:$PYTHONPATH
|
|
else
|
|
echo "Unsupported Python version $PYTHON_VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
export PYTHON_INSTALL_DIR=$python_dir
|
|
export PATH=$PYTHON_INSTALL_DIR/bin:$PATH
|
|
|
|
# There are no libpython.so inside $PYTHON_INSTALL_DIR
|
|
# since they are statically linked.
|
|
|
|
python3 --version
|
|
which python3
|
|
|
|
pushd /usr/local
|
|
rm cuda
|
|
ln -s cuda-$CUDA_VERSION cuda
|
|
popd
|
|
which nvcc
|
|
nvcc --version
|
|
|
|
cp /var/www/scripts/github_actions/install_torch.sh .
|
|
chmod +x install_torch.sh
|
|
|
|
/var/www/scripts/github_actions/build-ubuntu-cuda.sh
|
|
|
|
- name: Display wheels
|
|
shell: bash
|
|
run: |
|
|
ls -lh ./wheelhouse/
|
|
|
|
- name: Upload Wheel
|
|
if: false
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-ubuntu-latest-cuda-is_2_28-${{ matrix.is_2_28 }}
|
|
path: wheelhouse/*.whl
|
|
|
|
# https://huggingface.co/docs/hub/spaces-github-actions
|
|
- name: Publish to huggingface
|
|
if: github.repository_owner == 'csukuangfj'
|
|
env:
|
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
uses: nick-fields/retry@v2
|
|
with:
|
|
max_attempts: 20
|
|
timeout_seconds: 200
|
|
shell: bash
|
|
command: |
|
|
git config --global user.email "csukuangfj@gmail.com"
|
|
git config --global user.name "Fangjun Kuang"
|
|
|
|
rm -rf huggingface
|
|
export GIT_LFS_SKIP_SMUDGE=1
|
|
|
|
git clone https://huggingface.co/csukuangfj/kaldifeat huggingface
|
|
cd huggingface
|
|
git pull
|
|
|
|
d=cuda/1.25.5.dev20241029/linux
|
|
mkdir -p $d
|
|
cp -v ../wheelhouse/*.whl ./$d
|
|
git status
|
|
git lfs track "*.whl"
|
|
git add .
|
|
git commit -m "upload ubuntu-cuda wheel for torch ${{ matrix.torch }} python ${{ matrix.python-version }}"
|
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/kaldifeat main
|