Add windows cuda tests.

This commit is contained in:
Fangjun Kuang 2022-06-03 11:36:48 +08:00
parent 2adf8a3709
commit 63816e9f19
3 changed files with 311 additions and 12 deletions

View File

@ -0,0 +1,124 @@
# Copyright 2021 Xiaomi Corp. (author: Fangjun Kuang)
# See ../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Nightly tests windows pip cuda
on:
push:
branches:
- nightly-test
schedule:
# minute (0-59)
# hour (0-23)
# day of the month (1-31)
# month (1-12)
# day of the week (0-6)
# nightly build at 23:50 UTC time every day
- cron: "50 23 * * *"
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@v2
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 --for-windows
MATRIX=$(python scripts/github_actions/generate_build_matrix.py --enable-cuda --for-windows)
echo "::set-output name=matrix::${MATRIX}"
run_nightly_tests_windows_pip_cuda:
needs: generate_build_matrix
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
${{ fromJson(needs.generate_build_matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# see https://github.com/microsoft/setup-msbuild
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# See https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts
# for available CUDA versions
- uses: Jimver/cuda-toolkit@v0.2.5
id: cuda-toolkit
with:
cuda: ${{ matrix.cuda }}
- name: Display CUDA version
run: |
echo "Installed cuda version is: ${{ steps.cuda-toolkit.outputs.cuda }}"
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
nvcc --version
- name: Install PyTorch ${{ matrix.torch }}
run: |
version=${{ matrix.cuda }}
major=${version:0:2}
minor=${version:3:1}
python3 -m pip install -qq --upgrade pip
python3 -m pip install -qq wheel twine numpy typing_extensions
python3 -m pip install -qq dataclasses soundfile numpy
python3 -m pip install -qq torch==${{ matrix.torch }}+cu${major}${minor} -f https://download.pytorch.org/whl/torch_stable.html numpy
python3 -c "import torch; print('torch version:', torch.__version__)"
python3 -m torch.utils.collect_env
- name: Install from PyPI
shell: bash
run: |
export KALDIFEAT_MAKE_ARGS="-j 3"
pip install --verbose kaldifeat
- name: Run tests
shell: bash
run: |
cd kaldifeat/python/tests
python3 ./test_fbank.py
python3 ./test_fbank_options.py
python3 ./test_frame_extraction_options.py
python3 ./test_mel_bank_options.py
python3 ./test_mfcc.py
python3 ./test_mfcc_options.py
python3 ./test_plp.py
python3 ./test_plp_options.py
python3 ./test_spectrogram.py
python3 ./test_spectrogram_options.py

View File

@ -0,0 +1,145 @@
# Copyright 2021 Xiaomi Corp. (author: Fangjun Kuang)
# See ../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Run tests windows cuda
on:
push:
branches:
- nightly-test
- master
pull_request:
branches:
- master
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@v2
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 --for-windows
MATRIX=$(python scripts/github_actions/generate_build_matrix.py --enable-cuda --for-windows)
echo "::set-output name=matrix::${MATRIX}"
run_tests_windows_cuda:
needs: generate_build_matrix
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
${{ fromJson(needs.generate_build_matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# see https://github.com/microsoft/setup-msbuild
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# See https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts
# for available CUDA versions
- uses: Jimver/cuda-toolkit@v0.2.5
id: cuda-toolkit
with:
cuda: ${{ matrix.cuda }}
- name: Display CUDA version
run: |
echo "Installed cuda version is: ${{ steps.cuda-toolkit.outputs.cuda }}"
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
nvcc --version
- name: Install PyTorch ${{ matrix.torch }}
run: |
version=${{ matrix.cuda }}
major=${version:0:2}
minor=${version:3:1}
python3 -m pip install -qq --upgrade pip
python3 -m pip install -qq wheel twine numpy typing_extensions
python3 -m pip install -qq dataclasses soundfile numpy
python3 -m pip install -qq torch==${{ matrix.torch }}+cu${major}${minor} -f https://download.pytorch.org/whl/torch_stable.html numpy
python3 -c "import torch; print('torch version:', torch.__version__)"
python3 -m torch.utils.collect_env
- name: Display CMake version
run: |
cmake --version
cmake --help
- name: Configure CMake
shell: bash
run: |
mkdir build_release
cd build_release
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
ls -lh
- name: Build kaldifeat
run: |
cd build_release
cmake --build . --target _kaldifeat --config Release
- name: Display generated files
shell: bash
run: |
cd build_release
ls -lh lib/*/*
- name: Build wheel
shell: bash
run: |
python3 setup.py bdist_wheel
ls -lh dist/
pip install ./dist/*.whl
python3 -c "import kaldifeat; print(kaldifeat.__version__)"
- name: Upload Wheel
uses: actions/upload-artifact@v2
with:
name: python-${{ matrix.python-version }}-${{ matrix.os }}-cuda-${{ matrix.cuda }}
path: dist/*.whl
- name: Build tests
shell: bash
run: |
cd build_release
cmake --build . --target ALL_BUILD --config Release
ls -lh bin/*/*
ctest -C Release --verbose --output-on-failure

View File

@ -14,6 +14,13 @@ def get_args():
help="True to enable CUDA",
)
parser.add_argument(
"--for-windows",
action="store_true",
default=False,
help="True for windows",
)
parser.add_argument(
"--test-only-latest-torch",
action="store_true",
@ -24,7 +31,7 @@ def get_args():
return parser.parse_args()
def generate_build_matrix(enable_cuda, test_only_latest_torch):
def generate_build_matrix(enable_cuda, for_windows, test_only_latest_torch):
matrix = {
# 1.5.x is removed because there are compilation errors.
# See
@ -41,47 +48,69 @@ def generate_build_matrix(enable_cuda, test_only_latest_torch):
# },
"1.6.0": {
"python-version": ["3.6", "3.7", "3.8"],
"cuda": ["10.1", "10.2"],
"cuda": ["10.1", "10.2"]
if not for_windows
else ["10.1.243", "10.2.89"],
},
"1.7.0": {
"python-version": ["3.6", "3.7", "3.8"],
"cuda": ["10.1", "10.2", "11.0"],
"cuda": ["10.1", "10.2", "11.0"]
if not for_windows
else ["10.1.243", "10.2.89", "11.0.3"],
},
"1.7.1": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.1", "10.2", "11.0"],
"cuda": ["10.1", "10.2", "11.0"]
if not for_windows
else ["10.1.243", "10.2.89", "11.0.3"],
},
"1.8.0": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.1", "10.2", "11.1"],
"cuda": ["10.1", "10.2", "11.1"]
if not for_windows
else ["10.1.243", "10.2.89", "11.1.1"],
},
"1.8.1": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.1", "10.2", "11.1"],
"cuda": ["10.1", "10.2", "11.1"]
if not for_windows
else ["10.1.243", "10.2.89", "11.1.1"],
},
"1.9.0": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1"],
"cuda": ["10.2", "11.1"]
if not for_windows
else ["10.2.89", "11.1.1"],
},
"1.9.1": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1"],
"cuda": ["10.2", "11.1"]
if not for_windows
else ["10.2.89", "11.1.1"],
},
"1.10.0": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1", "11.3"],
"cuda": ["10.2", "11.1", "11.3"]
if not for_windows
else ["10.2.89", "11.1.1", "11.3.1"],
},
"1.10.1": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1", "11.3"],
"cuda": ["10.2", "11.1", "11.3"]
if not for_windows
else ["10.2.89", "11.1.1", "11.3.1"],
},
"1.10.2": {
"python-version": ["3.6", "3.7", "3.8", "3.9"],
"cuda": ["10.2", "11.1", "11.3"],
"cuda": ["10.2", "11.1", "11.3"]
if not for_windows
else ["10.2.89", "11.1.1", "11.3.1"],
},
"1.11.0": {
"python-version": ["3.7", "3.8", "3.9", "3.10"],
"cuda": ["10.2", "11.3", "11.5"],
"cuda": ["10.2", "11.3", "11.5"]
if not for_windows
else ["10.2.89", "11.3.1", "11.5.2"],
},
}
if test_only_latest_torch:
@ -107,6 +136,7 @@ def main():
args = get_args()
generate_build_matrix(
enable_cuda=args.enable_cuda,
for_windows=args.for_windows,
test_only_latest_torch=args.test_only_latest_torch,
)