Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packaging/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ else
MKL_CONSTRAINT=''
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__)"))

if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
Expand Down
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
18 changes: 13 additions & 5 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') }}
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT', '') }}

run:
- python
Expand All @@ -27,8 +28,17 @@ 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') }}
{{ 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'] }}
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