Skip to content

Commit

Permalink
Move TorchVision 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 972ca65 commit 1fd5792
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
12 changes: 6 additions & 6 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,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 @@ -318,7 +318,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 All @@ -329,10 +329,10 @@ setup_conda_cudatoolkit_constraint() {
}

setup_conda_cudatoolkit_plain_constraint() {
export CONDA_CPUONLY_FEATURE=""
export CONDA_BUILD_VARIANT="cuda"
export CMAKE_USE_CUDA=1
if [[ "$(uname)" == Darwin ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_BUILD_VARIANT="cpu"
export CMAKE_USE_CUDA=0
else
case "$CU_VERSION" in
Expand All @@ -359,7 +359,7 @@ setup_conda_cudatoolkit_plain_constraint() {
;;
cpu)
export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_CPUONLY_FEATURE="cpuonly"
export CONDA_BUILD_VARIANT="cpu"
export CMAKE_USE_CUDA=0
;;
*)
Expand Down
14 changes: 11 additions & 3 deletions packaging/torchvision/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: torchvision
version: "{{ environ.get('BUILD_VERSION') }}"
Expand All @@ -16,9 +17,9 @@ requirements:
host:
- python
- setuptools
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
{{ environ.get('CONDA_CPUONLY_FEATURE') }}

run:
- python
Expand All @@ -27,9 +28,18 @@ requirements:
- ffmpeg >=4.2 # [not win]
- jpeg
- pillow >=5.3.0
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
{{ 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['CU_VERSION'] }}
script: python setup.py install --single-version-externally-managed --record=record.txt
Expand All @@ -38,8 +48,6 @@ build:
- FORCE_CUDA
- BUILD_VERSION
- TORCH_CUDA_ARCH_LIST
features:
{{ environ.get('CONDA_CPUONLY_FEATURE') }}

test:
imports:
Expand Down

0 comments on commit 1fd5792

Please sign in to comment.