Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b1604bb
[WIP] Add CircleCI for CI
fmassa Sep 4, 2019
9b80188
Make jobs only run on master
fmassa Sep 4, 2019
6174567
Add initial CI
fmassa Sep 4, 2019
f13c67c
[wip] testing if works
fmassa Sep 4, 2019
956893f
Trying some basic GPU tests
fmassa Sep 4, 2019
203a913
[WIP] maybe it will work?
fmassa Sep 4, 2019
10821c3
[WIP] One more try
fmassa Sep 4, 2019
835eac5
Pin versions
fmassa Sep 5, 2019
3a0dfe3
Simplify and reuse
fmassa Sep 5, 2019
9a28ffe
Fix
fmassa Sep 5, 2019
fdf9685
[WIP] testing windows
fmassa Sep 5, 2019
16cff57
[WIP] testing windows
fmassa Sep 5, 2019
e6d580c
Try windows
peterjc123 Sep 6, 2019
200ece2
Try Windows
peterjc123 Sep 6, 2019
a7728b7
Try windows
peterjc123 Sep 6, 2019
5b8e019
Try windows
peterjc123 Sep 6, 2019
98493b5
Try windows
peterjc123 Sep 6, 2019
0f25a04
Try windows
peterjc123 Sep 6, 2019
5c9b577
Try windows
peterjc123 Sep 6, 2019
5ac46c7
Try windows
peterjc123 Sep 6, 2019
b68da99
Windows speedup
peterjc123 Sep 6, 2019
420b6e7
Windows multicores
peterjc123 Sep 6, 2019
71c4d0f
Add parallel flags for Windows
peterjc123 Sep 6, 2019
9980677
Skip some tests on Windows
fmassa Sep 6, 2019
7a309c3
Sync config.yml and config.yml.in
fmassa Sep 6, 2019
2f0685e
Regenerate
fmassa Sep 6, 2019
a94edd1
Run all tests
fmassa Sep 6, 2019
cb7a33d
Limit python and cuda version for finding pytorch
peterjc123 Sep 6, 2019
d6ba43f
Skip darwin for previous check
peterjc123 Sep 6, 2019
24ebf1e
Add description
peterjc123 Sep 6, 2019
ac53f1a
Fix logic
peterjc123 Sep 6, 2019
0e58a69
Remove space
peterjc123 Sep 6, 2019
f3c23c6
Add CUDA test back
fmassa Sep 9, 2019
274b84c
Add back .travis.yml for now and remove duplicate test
fmassa Sep 9, 2019
2755fbc
Add newline
fmassa Sep 9, 2019
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
95 changes: 95 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ version: 2.1
# - Replace binary_linux_wheel_py3.7 with the name of the job you want to test.
# Job names are 'name:' key.

orbs:
win: circleci/windows@1.0.0

binary_common: &binary_common
parameters:
# Edit these defaults to do a release`
Expand Down Expand Up @@ -81,6 +84,90 @@ jobs:
paths:
- "*"

binary_linux_conda_cuda:
<<: *binary_common
machine:
image: ubuntu-1604:201903-01
resource_class: gpu.medium
steps:
- checkout
- run:
name: Setup environment
command: |
set -e

curl -L https://packagecloud.io/circleci/trusty/gpgkey | sudo apt-key add -
curl -L https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

sudo apt-get update

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

sudo apt-get update
export DOCKER_VERSION="5:19.03.2~3-0~ubuntu-xenial"
sudo apt-get install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} containerd.io

# Add the package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

export NVIDIA_CONTAINER_VERSION="1.0.3-1"
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION}
sudo systemctl restart docker

DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run"
wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
nvidia-smi

- run:
name: Pull docker image
command: |
set -e
export DOCKER_IMAGE=soumith/conda-cuda
echo Pulling docker image $DOCKER_IMAGE
docker pull $DOCKER_IMAGE >/dev/null

- run:
name: Build and run tests
command: |
set -e

cd ${HOME}/project/

export DOCKER_IMAGE=soumith/conda-cuda
export VARS_TO_PASS="-e PYTHON_VERSION -e BUILD_VERSION -e PYTORCH_VERSION -e UNICODE_ABI -e CU_VERSION"

docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${DOCKER_IMAGE} ./packaging/build_conda.sh

binary_win_conda:
<<: *binary_common
executor:
name: win/vs2019
shell: bash.exe
steps:
- checkout
- run:
command: |
choco install miniconda3
$env:PATH = "C:\tools\miniconda3;C:\tools\miniconda3\Library\usr\bin;C:\tools\miniconda3\Scripts;C:\tools\miniconda3\bin" + $env:PATH
conda install -yq conda-build
bash packaging/build_conda.sh
shell: powershell.exe

binary_macos_wheel:
<<: *binary_common
macos:
Expand Down Expand Up @@ -328,6 +415,14 @@ workflows:
name: binary_macos_conda_py3.7_cpu
python_version: "3.7"
cu_version: "cpu"
- binary_linux_conda_cuda:
name: torchvision_linux_py3.7_cu100
python_version: "3.7"
cu_version: "cu100"
- binary_win_conda:
name: torchvision_win_py3.6_cpu
python_version: "3.6"
cu_version: "cpu"

nightly:
triggers:
Expand Down
95 changes: 95 additions & 0 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ version: 2.1
# - Replace binary_linux_wheel_py3.7 with the name of the job you want to test.
# Job names are 'name:' key.

orbs:
win: circleci/windows@1.0.0

binary_common: &binary_common
parameters:
# Edit these defaults to do a release`
Expand Down Expand Up @@ -81,6 +84,90 @@ jobs:
paths:
- "*"

binary_linux_conda_cuda:
<<: *binary_common
machine:
image: ubuntu-1604:201903-01
resource_class: gpu.medium
steps:
- checkout
- run:
name: Setup environment
command: |
set -e

curl -L https://packagecloud.io/circleci/trusty/gpgkey | sudo apt-key add -
curl -L https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

sudo apt-get update

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

sudo apt-get update
export DOCKER_VERSION="5:19.03.2~3-0~ubuntu-xenial"
sudo apt-get install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} containerd.io

# Add the package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

export NVIDIA_CONTAINER_VERSION="1.0.3-1"
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION}
sudo systemctl restart docker

DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run"
wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN"
sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false)
nvidia-smi

- run:
name: Pull docker image
command: |
set -e
export DOCKER_IMAGE=soumith/conda-cuda
echo Pulling docker image $DOCKER_IMAGE
docker pull $DOCKER_IMAGE >/dev/null

- run:
name: Build and run tests
command: |
set -e

cd ${HOME}/project/

export DOCKER_IMAGE=soumith/conda-cuda
export VARS_TO_PASS="-e PYTHON_VERSION -e BUILD_VERSION -e PYTORCH_VERSION -e UNICODE_ABI -e CU_VERSION"

docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${DOCKER_IMAGE} ./packaging/build_conda.sh

binary_win_conda:
<<: *binary_common
executor:
name: win/vs2019
shell: bash.exe
steps:
- checkout
- run:
command: |
choco install miniconda3
$env:PATH = "C:\tools\miniconda3;C:\tools\miniconda3\Library\usr\bin;C:\tools\miniconda3\Scripts;C:\tools\miniconda3\bin" + $env:PATH
conda install -yq conda-build
bash packaging/build_conda.sh
shell: powershell.exe

binary_macos_wheel:
<<: *binary_common
macos:
Expand Down Expand Up @@ -214,6 +301,14 @@ workflows:
jobs:
- circleci_consistency
{{ workflows() }}
- binary_linux_conda_cuda:
name: torchvision_linux_py3.7_cu100
python_version: "3.7"
cu_version: "cu100"
- binary_win_conda:
name: torchvision_win_py3.6_cpu
python_version: "3.6"
cu_version: "cpu"

nightly:
triggers:
Expand Down
15 changes: 13 additions & 2 deletions packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ setup_cuda() {
export VERSION_SUFFIX="$PYTORCH_VERSION_SUFFIX"
# If the suffix is non-empty, we will use a wheel subdirectory
if [[ -n "$PYTORCH_VERSION_SUFFIX" ]]; then
export WHEEL_DIR="$PYTORCH_VERSION_SUFFIX/"
export WHEEL_DIR="$CU_VERSION/"
fi
fi
fi
Expand Down Expand Up @@ -181,7 +181,18 @@ setup_pip_pytorch_version() {
setup_conda_pytorch_constraint() {
if [[ -z "$PYTORCH_VERSION" ]]; then
export CONDA_CHANNEL_FLAGS="-c pytorch-nightly"
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | python -c "import sys, json, re; print(re.sub(r'\\+.*$', '', json.load(sys.stdin)['pytorch'][-1]['version']))")"
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | \
python -c "import os, sys, json, re; cuver = os.environ.get('CU_VERSION'); \
cuver = (cuver[:-1] + '.' + cuver[-1]).replace('cu', 'cuda') if cuver != 'cpu' else cuver; \
print(re.sub(r'\\+.*$', '', \
[x['version'] for x in json.load(sys.stdin)['pytorch'] \
if (x['platform'] == 'darwin' or cuver in x['fn']) \
and 'py' + os.environ['PYTHON_VERSION'] in x['fn']][-1]))")"
if [[ -z "$PYTORCH_VERSION" ]]; then
echo "PyTorch version auto detection failed"
echo "No package found for CU_VERSION=$CU_VERSION and PYTHON_VERSION=$PYTHON_VERSION"
exit 1
fi
else
export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-nightly"
fi
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def get_extensions():
if sys.platform == 'win32':
define_macros += [('torchvision_EXPORTS', None)]

extra_compile_args.setdefault('cxx', [])
extra_compile_args['cxx'].append('/MP')

sources = [os.path.join(extensions_dir, s) for s in sources]

include_dirs = [extensions_dir]
Expand Down
2 changes: 2 additions & 0 deletions test/test_datasets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import os
import unittest
import mock
Expand Down Expand Up @@ -149,6 +150,7 @@ def test_cifar100(self, mock_ext_check, mock_int_check):
img, target = dataset[0]
self.assertEqual(dataset.class_to_idx[dataset.classes[0]], target)

@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_cityscapes(self):
with cityscapes_root() as root:

Expand Down
3 changes: 3 additions & 0 deletions test/test_datasets_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def test_download_url_dont_exist(self):
with self.assertRaises(URLError):
utils.download_url(url, temp_dir)

@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_extract_zip(self):
with get_tmp_dir() as temp_dir:
with tempfile.NamedTemporaryFile(suffix='.zip') as f:
Expand All @@ -83,6 +84,7 @@ def test_extract_zip(self):
data = nf.read()
self.assertEqual(data, 'this is the content')

@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_extract_tar(self):
for ext, mode in zip(['.tar', '.tar.gz'], ['w', 'w:gz']):
with get_tmp_dir() as temp_dir:
Expand All @@ -98,6 +100,7 @@ def test_extract_tar(self):
data = nf.read()
self.assertEqual(data, 'this is the content')

@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_extract_gzip(self):
with get_tmp_dir() as temp_dir:
with tempfile.NamedTemporaryFile(suffix='.gz') as f:
Expand Down
3 changes: 3 additions & 0 deletions test/test_datasets_video_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import contextlib
import sys
import os
import torch
import unittest
Expand Down Expand Up @@ -58,6 +59,7 @@ def test_unfold(self):
self.assertTrue(r.equal(expected))

@unittest.skipIf(not io.video._av_available(), "this test requires av")
@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_video_clips(self):
with get_list_of_videos(num_videos=3) as video_list:
video_clips = VideoClips(video_list, 5, 5)
Expand Down Expand Up @@ -112,6 +114,7 @@ def test_video_sampler_unequal(self):
self.assertTrue(count.equal(torch.tensor([3, 3])))

@unittest.skipIf(not io.video._av_available(), "this test requires av")
@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_video_clips_custom_fps(self):
with get_list_of_videos(num_videos=3, sizes=[12, 12, 12], fps=[3, 4, 6]) as video_list:
num_frames = 4
Expand Down
1 change: 1 addition & 0 deletions test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def temp_video(num_frames, height, width, fps, lossless=False, video_codec=None,


@unittest.skipIf(av is None, "PyAV unavailable")
@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
class Tester(unittest.TestCase):
# compression adds artifacts, thus we add a tolerance of
# 6 in 0-255 range
Expand Down
3 changes: 3 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import tempfile
import torch
import torchvision.utils as utils
Expand Down Expand Up @@ -37,12 +38,14 @@ def test_normalize_in_make_grid(self):
assert torch.equal(norm_max, rounded_grid_max), 'Normalized max is not equal to 1'
assert torch.equal(norm_min, rounded_grid_min), 'Normalized min is not equal to 0'

@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_save_image(self):
with tempfile.NamedTemporaryFile(suffix='.png') as f:
t = torch.rand(2, 3, 64, 64)
utils.save_image(t, f.name)
assert os.path.exists(f.name), 'The image is not present after save'

@unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows')
def test_save_image_single_pixel(self):
with tempfile.NamedTemporaryFile(suffix='.png') as f:
t = torch.rand(1, 3, 1, 1)
Expand Down