Skip to content
Closed
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
403 changes: 205 additions & 198 deletions .circleci/config.yml

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ binary_common: &binary_common
python_version:
description: "Python version to build against (e.g., 3.8)"
type: string
cuda_version:
cu_version:
description: "CUDA version to build against (e.g., cpu, cu101)"
type: string
default: "cpu"
Expand All @@ -87,7 +87,7 @@ binary_common: &binary_common
PYTHON_VERSION: << parameters.python_version >>
BUILD_VERSION: << parameters.build_version >>
PYTORCH_VERSION: << parameters.pytorch_version >>
CU_VERSION: << parameters.cuda_version >>
CU_VERSION: << parameters.cu_version >>

smoke_test_common: &smoke_test_common
<<: *binary_common
Expand Down Expand Up @@ -143,6 +143,7 @@ jobs:
resource_class: 2xlarge+
steps:
- checkout
- designate_upload_channel
- attach_workspace:
at: third_party
- run: packaging/build_wheel.sh
Expand All @@ -160,6 +161,7 @@ jobs:
resource_class: 2xlarge+
steps:
- checkout
- designate_upload_channel
- load_conda_channel_flags
- attach_workspace:
at: third_party
Expand All @@ -178,6 +180,7 @@ jobs:
steps:
- checkout
- install_build_tools_macos
- designate_upload_channel
- load_conda_channel_flags
- attach_workspace:
at: third_party
Expand All @@ -204,6 +207,7 @@ jobs:
steps:
- checkout
- install_build_tools_macos
- designate_upload_channel
- load_conda_channel_flags
- attach_workspace:
at: third_party
Expand All @@ -227,6 +231,7 @@ jobs:
name: windows-cpu
steps:
- checkout
- designate_upload_channel
- load_conda_channel_flags
- run:
name: build
Expand All @@ -247,6 +252,7 @@ jobs:
name: windows-cpu
steps:
- checkout
- designate_upload_channel
- load_conda_channel_flags
- run:
name: build
Expand Down Expand Up @@ -462,7 +468,7 @@ jobs:
command: docker run -t --gpus all -e PYTHON_VERSION -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
- run:
name: Install torchaudio
command: docker run -t --gpus all -e UPLOAD_CHANNEL -e CONDA_CHANNEL_FLAGS -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
command: docker run -t --gpus all -e UPLOAD_CHANNEL -e CONDA_CHANNEL_FLAGS -e CU_VERSION -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e "TORCHAUDIO_TEST_FORCE_CUDA=1" "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
Expand Down Expand Up @@ -499,7 +505,7 @@ jobs:
name: windows-gpu
environment:
<<: *environment
CUDA_VERSION: "10.2"
CU_VERSION: "10.2"
steps:
- checkout
- designate_upload_channel
Expand All @@ -526,10 +532,10 @@ jobs:
steps:
- checkout
- install_build_tools_macos
- designate_upload_channel
- load_conda_channel_flags
- attach_workspace:
at: third_party
- designate_upload_channel
- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
Expand Down Expand Up @@ -569,6 +575,7 @@ jobs:
- attach_workspace:
at: ~/workspace
- checkout
- designate_upload_channel
- load_conda_channel_flags
- run:
name: Install pytorch-audio
Expand Down
8 changes: 4 additions & 4 deletions .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def generate_base_workflow(base_workflow_name, python_version, cu_version, filte
d = {
"name": base_workflow_name,
"python_version": python_version,
"cuda_version": cu_version,
"cu_version": cu_version,
}

if os_type in ['linux', 'macos']:
Expand Down Expand Up @@ -180,7 +180,7 @@ def generate_smoketest_workflow(pydistro, base_workflow_name, filter_branch, pyt
"name": f"{base_workflow_name}_{smoke_suffix}",
"requires": [required_build_name],
"python_version": python_version,
"cuda_version": cu_version,
"cu_version": cu_version,
}

if filter_branch:
Expand All @@ -205,7 +205,7 @@ def unittest_workflows(indentation=6):
job = {
"name": f"unittest_{os_type}_{device_type}_py{python_version}",
"python_version": python_version,
"cuda_version": 'cpu' if device_type=="cpu" else "cu102",
"cu_version": 'cpu' if device_type=="cpu" else "cu102",
}

if os_type != "windows":
Expand All @@ -218,7 +218,7 @@ def unittest_workflows(indentation=6):
"stylecheck": {
"name": f"stylecheck_py{python_version}",
"python_version": python_version,
"cuda_version": 'cpu' if device_type=="cpu" else "cu102",
"cu_version": 'cpu' if device_type=="cpu" else "cu102",
}
})
return indent(indentation, jobs)
Expand Down
2 changes: 1 addition & 1 deletion .circleci/unittest/linux/docker/build_and_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euo pipefail

if [ $# -ne 1 ]; then
printf "Usage %s <CUDA_VERSION>\n\n" "$0"
printf "Usage %s <CU_VERSION>\n\n" "$0"
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions .circleci/unittest/linux/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ eval "$("${conda_dir}/bin/conda" shell.bash hook)"
conda activate "${env_dir}"

# 1. Install PyTorch
if [ -z "${CUDA_VERSION:-}" ] ; then
if [ -z "${CU_VERSION:-}" ] ; then
if [ "${os}" == MacOSX ] ; then
cudatoolkit=''
else
cudatoolkit="cpuonly"
fi
else
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
version="$(python -c "print('.'.join(\"${CU_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}"
fi
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
Expand Down
4 changes: 2 additions & 2 deletions .circleci/unittest/windows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ eval "$("${conda_dir}/Scripts/conda.exe" 'shell.bash' 'hook')"
conda activate "${env_dir}"

# 1. Install PyTorch
if [ -z "${CUDA_VERSION:-}" ] ; then
if [ -z "${CU_VERSION:-}" ] ; then
cudatoolkit="cpuonly"
else
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
version="$(python -c "print('.'.join(\"${CU_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}"
fi
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
Expand Down
2 changes: 1 addition & 1 deletion build_tools/setup_helpers/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _get_build(var, default=False):
_BUILD_KALDI = False if platform.system() == 'Windows' else _get_build("BUILD_KALDI", True)
_BUILD_TRANSDUCER = _get_build("BUILD_TRANSDUCER")
_USE_ROCM = _get_build("USE_ROCM")
_USE_CUDA = torch.cuda.is_available()
_USE_CUDA = _get_build("FORCE_CUDA") or torch.cuda.is_available()


def get_ext_modules():
Expand Down
5 changes: 4 additions & 1 deletion packaging/build_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
. "$script_dir/pkg_helpers.bash"

export BUILD_TYPE="conda"
export NO_CUDA_PACKAGE=1
if [[ "${CU_VERSION}" = rocm* ]]; then
export NO_CUDA_PACKAGE=1
fi
setup_env 0.10.0
export SOURCE_ROOT_DIR="$PWD"
setup_conda_pytorch_constraint
setup_conda_cudatoolkit_constraint
setup_visual_studio_constraint
conda build $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio
4 changes: 3 additions & 1 deletion packaging/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
. "$script_dir/pkg_helpers.bash"

export BUILD_TYPE="wheel"
export NO_CUDA_PACKAGE=1
if [[ "${CU_VERSION}" = rocm* ]]; then
export NO_CUDA_PACKAGE=1
fi
setup_env 0.10.0
setup_wheel_python
pip_install numpy future cmake ninja
Expand Down
34 changes: 21 additions & 13 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Precondition: CUDA versions are installed in their conventional locations in
# /usr/local/cuda-*
#
# TODO: Once the CUDA code reaches beta, remove things around NO_CUDA_PACKAGE
# NOTE: Why VERSION_SUFFIX versus PYTORCH_VERSION_SUFFIX? If you're building
# a package with CUDA on a platform we support CUDA on, VERSION_SUFFIX ==
# PYTORCH_VERSION_SUFFIX and everyone is happy. However, if you are building a
Expand All @@ -45,7 +46,7 @@ setup_cuda() {
export VERSION_SUFFIX="$PYTORCH_VERSION_SUFFIX"
# If the suffix is non-empty, we will use a wheel subdirectory
if [[ -n "$PYTORCH_VERSION_SUFFIX" ]]; then
export WHEEL_DIR="$PYTORCH_VERSION_SUFFIX/"
export WHEEL_DIR="${CU_VERSION}/"
fi
fi
fi
Expand Down Expand Up @@ -108,7 +109,7 @@ setup_cuda() {
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0"
;;
rocm*)
export FORCE_CUDA=1
export FORCE_CUDA=0
export USE_ROCM=1
;;
cpu)
Expand Down Expand Up @@ -177,14 +178,6 @@ setup_wheel_python() {
conda activate "env$PYTHON_VERSION"
else
case "$PYTHON_VERSION" in
2.7)
if [[ -n "$UNICODE_ABI" ]]; then
python_abi=cp27-cp27mu
else
python_abi=cp27-cp27m
fi
;;
3.5) python_abi=cp35-cp35m ;;
3.6) python_abi=cp36-cp36m ;;
3.7) python_abi=cp37-cp37m ;;
3.8) python_abi=cp38-cp38 ;;
Expand Down Expand Up @@ -224,12 +217,11 @@ setup_pip_pytorch_version() {
#
# You MUST have populated PYTORCH_VERSION_SUFFIX before hand.
setup_conda_pytorch_constraint() {
CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS}"
if [[ -z "$PYTORCH_VERSION" ]]; then
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch-nightly"
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | python -c "import sys, json, re; print(re.sub(r'\\+.*$', '', json.load(sys.stdin)['pytorch'][-1]['version']))")"
else
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch -c pytorch-test -c pytorch-nightly"
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch -c pytorch-${UPLOAD_CHANNEL}"
fi
# Some dependencies for Python 3.9 are only on conda-forge
if [[ "${PYTHON_VERSION}" = "3.9" ]]; then
Expand All @@ -239,6 +231,7 @@ setup_conda_pytorch_constraint() {
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION${PYTORCH_VERSION_SUFFIX}"
export CONDA_PYTORCH_CONSTRAINT="- pytorch==$PYTORCH_VERSION"
else
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c conda-forge"
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==${PYTORCH_VERSION}${PYTORCH_VERSION_SUFFIX}"
export CONDA_PYTORCH_CONSTRAINT="- pytorch==${PYTORCH_VERSION}${PYTORCH_VERSION_SUFFIX}"
fi
Expand All @@ -251,7 +244,22 @@ setup_conda_cudatoolkit_constraint() {
export CONDA_CUDATOOLKIT_CONSTRAINT=""
else
case "$CU_VERSION" in
cu100)
cu112)
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.2,<11.3 # [not osx]"
;;
cu111)
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.1,<11.2 # [not osx]"
;;
cu111)
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.0,<11.1 # [not osx]"
;;
cu102)
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.2,<10.3 # [not osx]"
;;
cu101)
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.1,<10.2 # [not osx]"
;;
cu100)
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.0,<10.1 # [not osx]"
;;
cu92)
Expand Down
1 change: 1 addition & 0 deletions packaging/torchaudio/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -ex

env
BUILD_TRANSDUCER=1 BUILD_SOX=1 python setup.py install --single-version-externally-managed --record=record.txt
12 changes: 10 additions & 2 deletions packaging/torchaudio/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@ requirements:
host:
- python
- setuptools
- cpuonly
- cmake
- ninja
- defaults::numpy >=1.11
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }}

run:
- python
- defaults::numpy >=1.11
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}

build:
string: py{{py}}
script_env:
- CUDA_HOME
- FORCE_CUDA
- BUILD_VERSION
- TORCH_CUDA_ARCH_LIST
features:
{{ environ.get('CONDA_CPUONLY_FEATURE') }}

test:
imports:
Expand All @@ -43,7 +51,7 @@ test:
# Ideally we would test this, but conda doesn't provide librosa
# - librosa >=0.4.3
- scipy
- cpuonly
{{ environ.get('CONDA_CPUONLY_FEATURE') }}

about:
home: https://github.com/pytorch/audio
Expand Down