Skip to content

Commit 14435f3

Browse files
committed
Fix build
1 parent be903fa commit 14435f3

File tree

12 files changed

+266
-230
lines changed

12 files changed

+266
-230
lines changed

.circleci/config.yml

Lines changed: 205 additions & 198 deletions
Large diffs are not rendered by default.

.circleci/config.yml.in

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ binary_common: &binary_common
7171
python_version:
7272
description: "Python version to build against (e.g., 3.8)"
7373
type: string
74-
cuda_version:
74+
cu_version:
7575
description: "CUDA version to build against (e.g., cpu, cu101)"
7676
type: string
7777
default: "cpu"
@@ -87,7 +87,7 @@ binary_common: &binary_common
8787
PYTHON_VERSION: << parameters.python_version >>
8888
BUILD_VERSION: << parameters.build_version >>
8989
PYTORCH_VERSION: << parameters.pytorch_version >>
90-
CU_VERSION: << parameters.cuda_version >>
90+
CU_VERSION: << parameters.cu_version >>
9191

9292
smoke_test_common: &smoke_test_common
9393
<<: *binary_common
@@ -143,6 +143,7 @@ jobs:
143143
resource_class: 2xlarge+
144144
steps:
145145
- checkout
146+
- designate_upload_channel
146147
- attach_workspace:
147148
at: third_party
148149
- run: packaging/build_wheel.sh
@@ -160,6 +161,7 @@ jobs:
160161
resource_class: 2xlarge+
161162
steps:
162163
- checkout
164+
- designate_upload_channel
163165
- load_conda_channel_flags
164166
- attach_workspace:
165167
at: third_party
@@ -178,6 +180,7 @@ jobs:
178180
steps:
179181
- checkout
180182
- install_build_tools_macos
183+
- designate_upload_channel
181184
- load_conda_channel_flags
182185
- attach_workspace:
183186
at: third_party
@@ -204,6 +207,7 @@ jobs:
204207
steps:
205208
- checkout
206209
- install_build_tools_macos
210+
- designate_upload_channel
207211
- load_conda_channel_flags
208212
- attach_workspace:
209213
at: third_party
@@ -227,6 +231,7 @@ jobs:
227231
name: windows-cpu
228232
steps:
229233
- checkout
234+
- designate_upload_channel
230235
- load_conda_channel_flags
231236
- run:
232237
name: build
@@ -247,6 +252,7 @@ jobs:
247252
name: windows-cpu
248253
steps:
249254
- checkout
255+
- designate_upload_channel
250256
- load_conda_channel_flags
251257
- run:
252258
name: build
@@ -462,7 +468,7 @@ jobs:
462468
command: docker run -t --gpus all -e PYTHON_VERSION -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
463469
- run:
464470
name: Install torchaudio
465-
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
471+
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
466472
- run:
467473
name: Run tests
468474
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
@@ -499,7 +505,7 @@ jobs:
499505
name: windows-gpu
500506
environment:
501507
<<: *environment
502-
CUDA_VERSION: "10.2"
508+
CU_VERSION: "10.2"
503509
steps:
504510
- checkout
505511
- designate_upload_channel
@@ -526,10 +532,10 @@ jobs:
526532
steps:
527533
- checkout
528534
- install_build_tools_macos
535+
- designate_upload_channel
529536
- load_conda_channel_flags
530537
- attach_workspace:
531538
at: third_party
532-
- designate_upload_channel
533539
- run:
534540
name: Setup
535541
command: .circleci/unittest/linux/scripts/setup_env.sh
@@ -569,6 +575,7 @@ jobs:
569575
- attach_workspace:
570576
at: ~/workspace
571577
- checkout
578+
- designate_upload_channel
572579
- load_conda_channel_flags
573580
- run:
574581
name: Install pytorch-audio

.circleci/regenerate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def generate_base_workflow(base_workflow_name, python_version, cu_version, filte
126126
d = {
127127
"name": base_workflow_name,
128128
"python_version": python_version,
129-
"cuda_version": cu_version,
129+
"cu_version": cu_version,
130130
}
131131

132132
if os_type in ['linux', 'macos']:
@@ -180,7 +180,7 @@ def generate_smoketest_workflow(pydistro, base_workflow_name, filter_branch, pyt
180180
"name": f"{base_workflow_name}_{smoke_suffix}",
181181
"requires": [required_build_name],
182182
"python_version": python_version,
183-
"cuda_version": cu_version,
183+
"cu_version": cu_version,
184184
}
185185

186186
if filter_branch:
@@ -205,7 +205,7 @@ def unittest_workflows(indentation=6):
205205
job = {
206206
"name": f"unittest_{os_type}_{device_type}_py{python_version}",
207207
"python_version": python_version,
208-
"cuda_version": 'cpu' if device_type=="cpu" else "cu102",
208+
"cu_version": 'cpu' if device_type=="cpu" else "cu102",
209209
}
210210

211211
if os_type != "windows":
@@ -218,7 +218,7 @@ def unittest_workflows(indentation=6):
218218
"stylecheck": {
219219
"name": f"stylecheck_py{python_version}",
220220
"python_version": python_version,
221-
"cuda_version": 'cpu' if device_type=="cpu" else "cu102",
221+
"cu_version": 'cpu' if device_type=="cpu" else "cu102",
222222
}
223223
})
224224
return indent(indentation, jobs)

.circleci/unittest/linux/docker/build_and_push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -euo pipefail
44

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

.circleci/unittest/linux/scripts/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ eval "$("${conda_dir}/bin/conda" shell.bash hook)"
2323
conda activate "${env_dir}"
2424

2525
# 1. Install PyTorch
26-
if [ -z "${CUDA_VERSION:-}" ] ; then
26+
if [ -z "${CU_VERSION:-}" ] ; then
2727
if [ "${os}" == MacOSX ] ; then
2828
cudatoolkit=''
2929
else
3030
cudatoolkit="cpuonly"
3131
fi
3232
else
33-
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
33+
version="$(python -c "print('.'.join(\"${CU_VERSION}\".split('.')[:2]))")"
3434
cudatoolkit="cudatoolkit=${version}"
3535
fi
3636
printf "Installing PyTorch with %s\n" "${cudatoolkit}"

.circleci/unittest/windows/scripts/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ eval "$("${conda_dir}/Scripts/conda.exe" 'shell.bash' 'hook')"
1818
conda activate "${env_dir}"
1919

2020
# 1. Install PyTorch
21-
if [ -z "${CUDA_VERSION:-}" ] ; then
21+
if [ -z "${CU_VERSION:-}" ] ; then
2222
cudatoolkit="cpuonly"
2323
else
24-
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
24+
version="$(python -c "print('.'.join(\"${CU_VERSION}\".split('.')[:2]))")"
2525
cudatoolkit="cudatoolkit=${version}"
2626
fi
2727
printf "Installing PyTorch with %s\n" "${cudatoolkit}"

build_tools/setup_helpers/extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _get_build(var, default=False):
3838
_BUILD_KALDI = False if platform.system() == 'Windows' else _get_build("BUILD_KALDI", True)
3939
_BUILD_TRANSDUCER = _get_build("BUILD_TRANSDUCER")
4040
_USE_ROCM = _get_build("USE_ROCM")
41-
_USE_CUDA = torch.cuda.is_available()
41+
_USE_CUDA = _get_build("FORCE_CUDA") or torch.cuda.is_available()
4242

4343

4444
def get_ext_modules():

packaging/build_conda.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
55
. "$script_dir/pkg_helpers.bash"
66

77
export BUILD_TYPE="conda"
8-
export NO_CUDA_PACKAGE=1
8+
if [[ "${CU_VERSION}" = rocm* ]]; then
9+
export NO_CUDA_PACKAGE=1
10+
fi
911
setup_env 0.10.0
1012
export SOURCE_ROOT_DIR="$PWD"
1113
setup_conda_pytorch_constraint
14+
setup_conda_cudatoolkit_constraint
1215
setup_visual_studio_constraint
1316
conda build $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio

packaging/build_wheel.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
55
. "$script_dir/pkg_helpers.bash"
66

77
export BUILD_TYPE="wheel"
8-
export NO_CUDA_PACKAGE=1
8+
if [[ "${CU_VERSION}" = rocm* ]]; then
9+
export NO_CUDA_PACKAGE=1
10+
fi
911
setup_env 0.10.0
1012
setup_wheel_python
1113
pip_install numpy future cmake ninja

packaging/pkg_helpers.bash

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# Precondition: CUDA versions are installed in their conventional locations in
2121
# /usr/local/cuda-*
2222
#
23+
# TODO: Once the CUDA code reaches beta, remove things around NO_CUDA_PACKAGE
2324
# NOTE: Why VERSION_SUFFIX versus PYTORCH_VERSION_SUFFIX? If you're building
2425
# a package with CUDA on a platform we support CUDA on, VERSION_SUFFIX ==
2526
# PYTORCH_VERSION_SUFFIX and everyone is happy. However, if you are building a
@@ -45,7 +46,7 @@ setup_cuda() {
4546
export VERSION_SUFFIX="$PYTORCH_VERSION_SUFFIX"
4647
# If the suffix is non-empty, we will use a wheel subdirectory
4748
if [[ -n "$PYTORCH_VERSION_SUFFIX" ]]; then
48-
export WHEEL_DIR="$PYTORCH_VERSION_SUFFIX/"
49+
export WHEEL_DIR="${CU_VERSION}/"
4950
fi
5051
fi
5152
fi
@@ -108,7 +109,7 @@ setup_cuda() {
108109
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0"
109110
;;
110111
rocm*)
111-
export FORCE_CUDA=1
112+
export FORCE_CUDA=0
112113
export USE_ROCM=1
113114
;;
114115
cpu)
@@ -177,14 +178,6 @@ setup_wheel_python() {
177178
conda activate "env$PYTHON_VERSION"
178179
else
179180
case "$PYTHON_VERSION" in
180-
2.7)
181-
if [[ -n "$UNICODE_ABI" ]]; then
182-
python_abi=cp27-cp27mu
183-
else
184-
python_abi=cp27-cp27m
185-
fi
186-
;;
187-
3.5) python_abi=cp35-cp35m ;;
188181
3.6) python_abi=cp36-cp36m ;;
189182
3.7) python_abi=cp37-cp37m ;;
190183
3.8) python_abi=cp38-cp38 ;;
@@ -224,12 +217,11 @@ setup_pip_pytorch_version() {
224217
#
225218
# You MUST have populated PYTORCH_VERSION_SUFFIX before hand.
226219
setup_conda_pytorch_constraint() {
227-
CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS}"
228220
if [[ -z "$PYTORCH_VERSION" ]]; then
229221
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch-nightly"
230222
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']))")"
231223
else
232-
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch -c pytorch-test -c pytorch-nightly"
224+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch -c pytorch-${UPLOAD_CHANNEL}"
233225
fi
234226
# Some dependencies for Python 3.9 are only on conda-forge
235227
if [[ "${PYTHON_VERSION}" = "3.9" ]]; then
@@ -239,6 +231,7 @@ setup_conda_pytorch_constraint() {
239231
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION${PYTORCH_VERSION_SUFFIX}"
240232
export CONDA_PYTORCH_CONSTRAINT="- pytorch==$PYTORCH_VERSION"
241233
else
234+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c conda-forge"
242235
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==${PYTORCH_VERSION}${PYTORCH_VERSION_SUFFIX}"
243236
export CONDA_PYTORCH_CONSTRAINT="- pytorch==${PYTORCH_VERSION}${PYTORCH_VERSION_SUFFIX}"
244237
fi
@@ -251,7 +244,22 @@ setup_conda_cudatoolkit_constraint() {
251244
export CONDA_CUDATOOLKIT_CONSTRAINT=""
252245
else
253246
case "$CU_VERSION" in
254-
cu100)
247+
cu112)
248+
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.2,<11.3 # [not osx]"
249+
;;
250+
cu111)
251+
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.1,<11.2 # [not osx]"
252+
;;
253+
cu111)
254+
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=11.0,<11.1 # [not osx]"
255+
;;
256+
cu102)
257+
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.2,<10.3 # [not osx]"
258+
;;
259+
cu101)
260+
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.1,<10.2 # [not osx]"
261+
;;
262+
cu100)
255263
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.0,<10.1 # [not osx]"
256264
;;
257265
cu92)

0 commit comments

Comments
 (0)