Skip to content

Commit 1fd5792

Browse files
committed
Move TorchVision conda package to use pytorch-mutex
This is follow up after pytorch/builder#823 that gets rids of `feature` and migrate it to `run_constrained`
1 parent 972ca65 commit 1fd5792

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

packaging/pkg_helpers.bash

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ setup_conda_pytorch_constraint() {
287287

288288
# Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT
289289
setup_conda_cudatoolkit_constraint() {
290-
export CONDA_CPUONLY_FEATURE=""
290+
export CONDA_BUILD_VARIANT="cuda"
291291
if [[ "$(uname)" == Darwin ]]; then
292-
export CONDA_CUDATOOLKIT_CONSTRAINT=""
292+
export CONDA_BUILD_VARIANT="cpu"
293293
else
294294
case "$CU_VERSION" in
295295
cu113)
@@ -318,7 +318,7 @@ setup_conda_cudatoolkit_constraint() {
318318
;;
319319
cpu)
320320
export CONDA_CUDATOOLKIT_CONSTRAINT=""
321-
export CONDA_CPUONLY_FEATURE="- cpuonly"
321+
export CONDA_BUILD_VARIANT="cpu"
322322
;;
323323
*)
324324
echo "Unrecognized CU_VERSION=$CU_VERSION"
@@ -329,10 +329,10 @@ setup_conda_cudatoolkit_constraint() {
329329
}
330330

331331
setup_conda_cudatoolkit_plain_constraint() {
332-
export CONDA_CPUONLY_FEATURE=""
332+
export CONDA_BUILD_VARIANT="cuda"
333333
export CMAKE_USE_CUDA=1
334334
if [[ "$(uname)" == Darwin ]]; then
335-
export CONDA_CUDATOOLKIT_CONSTRAINT=""
335+
export CONDA_BUILD_VARIANT="cpu"
336336
export CMAKE_USE_CUDA=0
337337
else
338338
case "$CU_VERSION" in
@@ -359,7 +359,7 @@ setup_conda_cudatoolkit_plain_constraint() {
359359
;;
360360
cpu)
361361
export CONDA_CUDATOOLKIT_CONSTRAINT=""
362-
export CONDA_CPUONLY_FEATURE="cpuonly"
362+
export CONDA_BUILD_VARIANT="cpu"
363363
export CMAKE_USE_CUDA=0
364364
;;
365365
*)

packaging/torchvision/meta.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% set build_variant = environ.get('CONDA_BUILD_VARIANT', 'cpu') %}
12
package:
23
name: torchvision
34
version: "{{ environ.get('BUILD_VERSION') }}"
@@ -16,9 +17,9 @@ requirements:
1617
host:
1718
- python
1819
- setuptools
20+
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
1921
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }}
2022
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
21-
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
2223

2324
run:
2425
- python
@@ -27,9 +28,18 @@ requirements:
2728
- ffmpeg >=4.2 # [not win]
2829
- jpeg
2930
- pillow >=5.3.0
31+
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
3032
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
3133
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
3234

35+
{% if build_variant == 'cpu' %}
36+
run_constrained:
37+
- cpuonly
38+
{% elif not osx %}
39+
run_constrained:
40+
- cpuonly <0
41+
{% endif %}
42+
3343
build:
3444
string: py{{py}}_{{ environ['CU_VERSION'] }}
3545
script: python setup.py install --single-version-externally-managed --record=record.txt
@@ -38,8 +48,6 @@ build:
3848
- FORCE_CUDA
3949
- BUILD_VERSION
4050
- TORCH_CUDA_ARCH_LIST
41-
features:
42-
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
4351

4452
test:
4553
imports:

0 commit comments

Comments
 (0)