Skip to content

Commit

Permalink
Move TorchAudio conda package to use pytorch-mutex
Browse files Browse the repository at this point in the history
This is follow up after pytorch/builder#823 that gets rids of `feature` and migrate it to `run_constrained`
  • Loading branch information
malfet committed Oct 19, 2021
1 parent 234627f commit dc33416
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ setup_conda_pytorch_constraint() {

# Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT
setup_conda_cudatoolkit_constraint() {
export CONDA_CPUONLY_FEATURE=""
export CONDA_BUILD_VARIANT="cuda"
if [[ "$(uname)" == Darwin ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_BUILD_VARIANT="cpu"
else
case "$CU_VERSION" in
cu113)
Expand Down Expand Up @@ -277,7 +277,7 @@ setup_conda_cudatoolkit_constraint() {
;;
cpu)
export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_CPUONLY_FEATURE="- cpuonly"
export CONDA_BUILD_VARIANT="cpu"
;;
*)
echo "Unrecognized CU_VERSION=$CU_VERSION"
Expand Down
15 changes: 11 additions & 4 deletions packaging/torchaudio/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% set build_variant = environ.get('CONDA_BUILD_VARIANT', 'cpu') %}
package:
name: torchaudio
version: "{{ environ.get('BUILD_VERSION', '0.0.0') }}"
Expand All @@ -18,23 +19,29 @@ requirements:
- defaults::numpy >=1.11
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT', 'pytorch') }}
{{ environ.get('CONDA_EXTRA_BUILD_CONSTRAINT', '') }}
{{ environ.get('CONDA_CPUONLY_FEATURE', '') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT', '') }}

run:
- python
- defaults::numpy >=1.11
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
{{ environ.get('CONDA_PYTORCH_CONSTRAINT', 'pytorch') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT', '') }}

{% if build_variant == 'cpu' %}
run_constrained:
- cpuonly
{% elif not osx %}
run_constrained:
- cpuonly <0
{% endif %}

build:
string: py{{py}}_{{ environ.get('CU_VERSION', 'cpu') }}
script_env:
- BUILD_VERSION
- USE_CUDA
- TORCH_CUDA_ARCH_LIST
features:
{{ environ.get('CONDA_CPUONLY_FEATURE', '') }}

test:
imports:
Expand All @@ -52,7 +59,7 @@ test:
# Ideally we would test this, but conda doesn't provide librosa
# - librosa >=0.4.3
- scipy
{{ environ.get('CONDA_CPUONLY_FEATURE', '') }}
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]

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

0 comments on commit dc33416

Please sign in to comment.