Unverified Commit a3541eb2 authored by Nikita Shulga's avatar Nikita Shulga Committed by GitHub
Browse files

Move TorchVision to conda package to use pytorch-mutex (#4661)

* Move TorchVision conda package to use pytorch-mutex

This is follow up after https://github.com/pytorch/builder/pull/823

 that gets rids of `feature` and migrate it to `run_constrained`

* Update packaging/torchvision/meta.yaml
Co-authored-by: default avatarEli Uriegas <1700823+seemethere@users.noreply.github.com>

* Update packaging/torchvision/meta.yaml
Co-authored-by: default avatarEli Uriegas <1700823+seemethere@users.noreply.github.com>
Co-authored-by: default avatarEli Uriegas <1700823+seemethere@users.noreply.github.com>
parent fd7e9641
...@@ -36,7 +36,13 @@ else ...@@ -36,7 +36,13 @@ else
MKL_CONSTRAINT='' MKL_CONSTRAINT=''
fi fi
conda install -yq \pytorch=$PYTORCH_VERSION $CONDA_CUDATOOLKIT_CONSTRAINT $CONDA_CPUONLY_FEATURE $MKL_CONSTRAINT -c "pytorch-${UPLOAD_CHANNEL}" if [[ $CONDA_BUILD_VARIANT == "cpu" ]]; then
PYTORCH_MUTEX_CONSTRAINT='pytorch-mutex=1.0=cpu'
else
PYTORCH_MUTEX_CONSTRAINT=''
fi
conda install -yq \pytorch=$PYTORCH_VERSION $CONDA_CUDATOOLKIT_CONSTRAINT $PYTORCH_MUTEX_CONSTRAINT $MKL_CONSTRAINT -c "pytorch-${UPLOAD_CHANNEL}"
TORCH_PATH=$(dirname $(python -c "import torch; print(torch.__file__)")) TORCH_PATH=$(dirname $(python -c "import torch; print(torch.__file__)"))
if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
......
...@@ -287,9 +287,9 @@ setup_conda_pytorch_constraint() { ...@@ -287,9 +287,9 @@ setup_conda_pytorch_constraint() {
# Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT # Translate CUDA_VERSION into CUDA_CUDATOOLKIT_CONSTRAINT
setup_conda_cudatoolkit_constraint() { setup_conda_cudatoolkit_constraint() {
export CONDA_CPUONLY_FEATURE="" export CONDA_BUILD_VARIANT="cuda"
if [[ "$(uname)" == Darwin ]]; then if [[ "$(uname)" == Darwin ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="" export CONDA_BUILD_VARIANT="cpu"
else else
case "$CU_VERSION" in case "$CU_VERSION" in
cu113) cu113)
...@@ -318,7 +318,7 @@ setup_conda_cudatoolkit_constraint() { ...@@ -318,7 +318,7 @@ setup_conda_cudatoolkit_constraint() {
;; ;;
cpu) cpu)
export CONDA_CUDATOOLKIT_CONSTRAINT="" export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_CPUONLY_FEATURE="- cpuonly" export CONDA_BUILD_VARIANT="cpu"
;; ;;
*) *)
echo "Unrecognized CU_VERSION=$CU_VERSION" echo "Unrecognized CU_VERSION=$CU_VERSION"
...@@ -329,10 +329,10 @@ setup_conda_cudatoolkit_constraint() { ...@@ -329,10 +329,10 @@ setup_conda_cudatoolkit_constraint() {
} }
setup_conda_cudatoolkit_plain_constraint() { setup_conda_cudatoolkit_plain_constraint() {
export CONDA_CPUONLY_FEATURE="" export CONDA_BUILD_VARIANT="cuda"
export CMAKE_USE_CUDA=1 export CMAKE_USE_CUDA=1
if [[ "$(uname)" == Darwin ]]; then if [[ "$(uname)" == Darwin ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="" export CONDA_BUILD_VARIANT="cpu"
export CMAKE_USE_CUDA=0 export CMAKE_USE_CUDA=0
else else
case "$CU_VERSION" in case "$CU_VERSION" in
...@@ -359,7 +359,7 @@ setup_conda_cudatoolkit_plain_constraint() { ...@@ -359,7 +359,7 @@ setup_conda_cudatoolkit_plain_constraint() {
;; ;;
cpu) cpu)
export CONDA_CUDATOOLKIT_CONSTRAINT="" export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_CPUONLY_FEATURE="cpuonly" export CONDA_BUILD_VARIANT="cpu"
export CMAKE_USE_CUDA=0 export CMAKE_USE_CUDA=0
;; ;;
*) *)
......
{% set build_variant = environ.get('CONDA_BUILD_VARIANT', 'cpu') %}
package: package:
name: torchvision name: torchvision
version: "{{ environ.get('BUILD_VERSION') }}" version: "{{ environ.get('BUILD_VERSION') }}"
...@@ -16,9 +17,9 @@ requirements: ...@@ -16,9 +17,9 @@ requirements:
host: host:
- python - python
- setuptools - setuptools
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }} {{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }} {{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT', '') }}
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
run: run:
- python - python
...@@ -27,8 +28,17 @@ requirements: ...@@ -27,8 +28,17 @@ requirements:
- ffmpeg >=4.2 # [not win] - ffmpeg >=4.2 # [not win]
- jpeg - jpeg
- pillow >=5.3.0 - pillow >=5.3.0
- pytorch-mutex 1.0 {{ build_variant }} # [not osx ]
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }} {{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }} {{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT', '') }}
{% if build_variant == 'cpu' %}
run_constrained:
- cpuonly
{% elif not osx %}
run_constrained:
- cpuonly <0
{% endif %}
build: build:
string: py{{py}}_{{ environ['CU_VERSION'] }} string: py{{py}}_{{ environ['CU_VERSION'] }}
...@@ -38,8 +48,6 @@ build: ...@@ -38,8 +48,6 @@ build:
- FORCE_CUDA - FORCE_CUDA
- BUILD_VERSION - BUILD_VERSION
- TORCH_CUDA_ARCH_LIST - TORCH_CUDA_ARCH_LIST
features:
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
test: test:
imports: imports:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment