Skip to content

[STABLE ABI] Eliminate Device.h (#4145) #5345

[STABLE ABI] Eliminate Device.h (#4145)

[STABLE ABI] Eliminate Device.h (#4145) #5345

name: Unit-tests on Linux GPU
on:
pull_request:
push:
branches:
- nightly
- main
- release/*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
python-version: ["3.11"]
cuda-version: ["12.8"]
ffmpeg-version: ["7"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
permissions:
id-token: write
contents: read
with:
runner: linux.g5.4xlarge.nvidia.gpu
repository: pytorch/audio
gpu-arch-type: cuda
gpu-arch-version: ${{ matrix.cuda-version }}
timeout: 120
job-name: Run tests
script: |
set -ex
# Set up Environment Variables
export PYTHON_VERSION="${{ matrix.python-version }}"
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
export CU_VERSION_WITHOUT_PERIODS="$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g')"
export PIP_PROGRESS_BAR=off
export CONDA_QUIET=1
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_CUDA_SMALL_MEMORY=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_TEMPORARY_DISABLED=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_demucs=true
export CUBLAS_WORKSPACE_CONFIG=:16:8
# Set UPLOAD_CHANNEL
if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
export UPLOAD_CHANNEL=test
else
export UPLOAD_CHANNEL=nightly
fi
echo "::group::Create conda env"
# Mark Build Directory Safe
git config --global --add safe.directory /__w/audio/audio
conda create -c conda-forge --strict-channel-priority -y --prefix ci_env python="${PYTHON_VERSION}" ffmpeg="${FFMPEG_VERSION}" cmake ninja
conda activate ./ci_env
conda info
python -m pip install --upgrade pip
echo "::endgroup::"
echo "::group::Install PyTorch and TorchCodec"
PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cu${CU_VERSION_WITHOUT_PERIODS}"
python -m pip install numpy
python -m pip install --pre torch torchcodec --index-url="${PYTORCH_WHEEL_INDEX}"
python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")'
echo "::endgroup::"
echo "::group::Build and install TorchAudio"
python -m pip install . -v --no-build-isolation
echo "::endgroup::"
echo "::group::Install Python Dependencies"
pip install parameterized requests coverage pytest pytest-cov scipy expecttest
echo "::endgroup::"
echo "::group::Run tests"
declare -a args=(
'-v'
'--cov=torchaudio'
"--junitxml=${RUNNER_TEST_RESULTS_DIR}/junit.xml"
'--durations' '100'
'-k' '(cuda or gpu) and not (torchscript and rnnt) and not torchscript_consistency'
'-x'
)
cd test
python3 -m torch.utils.collect_env
env | grep TORCHAUDIO || true
pytest "${args[@]}" torchaudio_unittest
coverage html