|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +# This script was adapted from: https://github.com/pytorch/vision/blob/master/.circleci/config.yml.in |
| 4 | + |
| 5 | +# How to test the Linux jobs: |
| 6 | +# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/ |
| 7 | +# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.7 |
| 8 | +# - Replace binary_linux_wheel_py3.7 with the name of the job you want to test. |
| 9 | +# Job names are 'name:' key. |
| 10 | + |
| 11 | +orbs: |
| 12 | + |
| 13 | + |
| 14 | +binary_common: &binary_common |
| 15 | + parameters: |
| 16 | + # Edit these defaults to do a release` |
| 17 | + build_version: |
| 18 | + description: "version number of release binary; by default, build a nightly" |
| 19 | + type: string |
| 20 | + default: "" |
| 21 | + pytorch_version: |
| 22 | + description: "PyTorch version to build against; by default, use a nightly" |
| 23 | + type: string |
| 24 | + default: "" |
| 25 | + # Don't edit these |
| 26 | + python_version: |
| 27 | + description: "Python version to build against (e.g., 3.7)" |
| 28 | + type: string |
| 29 | + cu_version: |
| 30 | + description: "CUDA version to build against, in CU format (e.g., cpu or cu100)" |
| 31 | + type: string |
| 32 | + unicode_abi: |
| 33 | + description: "Python 2.7 wheel only: whether or not we are cp27mu (default: no)" |
| 34 | + type: string |
| 35 | + default: "" |
| 36 | + wheel_docker_image: |
| 37 | + description: "Wheel only: what docker image to use" |
| 38 | + type: string |
| 39 | + default: "soumith/manylinux-cuda100" |
| 40 | + environment: |
| 41 | + PYTHON_VERSION: << parameters.python_version >> |
| 42 | + BUILD_VERSION: << parameters.build_version >> |
| 43 | + PYTORCH_VERSION: << parameters.pytorch_version >> |
| 44 | + UNICODE_ABI: << parameters.unicode_abi >> |
| 45 | + CU_VERSION: << parameters.cu_version >> |
| 46 | + |
| 47 | +jobs: |
| 48 | + circleci_consistency: |
| 49 | + docker: |
| 50 | + - image: circleci/python:3.7 |
| 51 | + steps: |
| 52 | + - checkout |
| 53 | + - run: |
| 54 | + command: | |
| 55 | + pip install --user --progress-bar off jinja2 pyyaml |
| 56 | + python .circleci/regenerate.py |
| 57 | + git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1) |
| 58 | +
|
| 59 | + binary_linux_wheel: |
| 60 | + <<: *binary_common |
| 61 | + docker: |
| 62 | + - image: << parameters.wheel_docker_image >> |
| 63 | + resource_class: 2xlarge+ |
| 64 | + steps: |
| 65 | + - checkout |
| 66 | + - run: test_community_repos/run_all.sh |
| 67 | + - store_artifacts: |
| 68 | + path: dist |
| 69 | + - persist_to_workspace: |
| 70 | + root: dist |
| 71 | + paths: |
| 72 | + - "*" |
| 73 | + |
| 74 | + binary_linux_conda: |
| 75 | + <<: *binary_common |
| 76 | + docker: |
| 77 | + - image: "soumith/conda-cuda" |
| 78 | + resource_class: 2xlarge+ |
| 79 | + steps: |
| 80 | + - checkout |
| 81 | + - run: test_community_repos/run_all.sh |
| 82 | + - store_artifacts: |
| 83 | + path: /opt/conda/conda-bld/linux-64 |
| 84 | + - persist_to_workspace: |
| 85 | + root: /opt/conda/conda-bld/linux-64 |
| 86 | + paths: |
| 87 | + - "*" |
| 88 | + |
| 89 | + binary_linux_conda_cuda: |
| 90 | + <<: *binary_common |
| 91 | + machine: |
| 92 | + image: ubuntu-1604:201903-01 |
| 93 | + resource_class: gpu.medium |
| 94 | + steps: |
| 95 | + - checkout |
| 96 | + - run: |
| 97 | + name: Setup environment |
| 98 | + command: | |
| 99 | + set -e |
| 100 | +
|
| 101 | + curl -L https://packagecloud.io/circleci/trusty/gpgkey | sudo apt-key add - |
| 102 | + curl -L https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - |
| 103 | +
|
| 104 | + sudo apt-get update |
| 105 | +
|
| 106 | + sudo apt-get install \ |
| 107 | + apt-transport-https \ |
| 108 | + ca-certificates \ |
| 109 | + curl \ |
| 110 | + gnupg-agent \ |
| 111 | + software-properties-common |
| 112 | +
|
| 113 | + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 114 | +
|
| 115 | + sudo add-apt-repository \ |
| 116 | + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
| 117 | + $(lsb_release -cs) \ |
| 118 | + stable" |
| 119 | +
|
| 120 | + sudo apt-get update |
| 121 | + export DOCKER_VERSION="5:19.03.2~3-0~ubuntu-xenial" |
| 122 | + sudo apt-get install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} containerd.io |
| 123 | +
|
| 124 | + # Add the package repositories |
| 125 | + distribution=$(. /etc/os-release;echo $ID$VERSION_ID) |
| 126 | + curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - |
| 127 | + curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list |
| 128 | +
|
| 129 | + export NVIDIA_CONTAINER_VERSION="1.0.3-1" |
| 130 | + sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit=${NVIDIA_CONTAINER_VERSION} |
| 131 | + sudo systemctl restart docker |
| 132 | +
|
| 133 | + DRIVER_FN="NVIDIA-Linux-x86_64-410.104.run" |
| 134 | + wget "https://s3.amazonaws.com/ossci-linux/nvidia_driver/$DRIVER_FN" |
| 135 | + sudo /bin/bash "$DRIVER_FN" -s --no-drm || (sudo cat /var/log/nvidia-installer.log && false) |
| 136 | + nvidia-smi |
| 137 | +
|
| 138 | + - run: |
| 139 | + name: Pull docker image |
| 140 | + command: | |
| 141 | + set -e |
| 142 | + export DOCKER_IMAGE=soumith/conda-cuda |
| 143 | + echo Pulling docker image $DOCKER_IMAGE |
| 144 | + docker pull $DOCKER_IMAGE >/dev/null |
| 145 | +
|
| 146 | + - run: |
| 147 | + name: Build and run tests |
| 148 | + command: | |
| 149 | + set -e |
| 150 | +
|
| 151 | + cd ${HOME}/project/ |
| 152 | +
|
| 153 | + export DOCKER_IMAGE=soumith/conda-cuda |
| 154 | + export VARS_TO_PASS="-e PYTHON_VERSION -e BUILD_VERSION -e PYTORCH_VERSION -e UNICODE_ABI -e CU_VERSION" |
| 155 | +
|
| 156 | + docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${DOCKER_IMAGE} ./test_community_repos/run_all.sh |
| 157 | +
|
| 158 | + binary_win_conda: |
| 159 | + <<: *binary_common |
| 160 | + executor: |
| 161 | + name: win/vs2019 |
| 162 | + shell: bash.exe |
| 163 | + steps: |
| 164 | + - checkout |
| 165 | + - run: |
| 166 | + command: | |
| 167 | + choco install miniconda3 |
| 168 | + $env:PATH = "C:\tools\miniconda3;C:\tools\miniconda3\Library\usr\bin;C:\tools\miniconda3\Scripts;C:\tools\miniconda3\bin" + $env:PATH |
| 169 | + conda install -yq conda-build |
| 170 | + bash test_community_repos/run_all.sh |
| 171 | + shell: powershell.exe |
| 172 | + |
| 173 | + binary_macos_wheel: |
| 174 | + <<: *binary_common |
| 175 | + macos: |
| 176 | + xcode: "9.0" |
| 177 | + steps: |
| 178 | + - checkout |
| 179 | + - run: |
| 180 | + # Cannot easily deduplicate this as source'ing activate |
| 181 | + # will set environment variables which we need to propagate |
| 182 | + # to build_wheel.sh |
| 183 | + command: | |
| 184 | + curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh |
| 185 | + sh conda.sh -b |
| 186 | + source $HOME/miniconda3/bin/activate |
| 187 | + test_community_repos/run_all.sh |
| 188 | + - store_artifacts: |
| 189 | + path: dist |
| 190 | + - persist_to_workspace: |
| 191 | + root: dist |
| 192 | + paths: |
| 193 | + - "*" |
| 194 | + |
| 195 | + binary_macos_conda: |
| 196 | + <<: *binary_common |
| 197 | + macos: |
| 198 | + xcode: "9.0" |
| 199 | + steps: |
| 200 | + - checkout |
| 201 | + - run: |
| 202 | + command: | |
| 203 | + curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh |
| 204 | + sh conda.sh -b |
| 205 | + source $HOME/miniconda3/bin/activate |
| 206 | + conda install -yq conda-build |
| 207 | + test_community_repos/run_all.sh |
| 208 | + - store_artifacts: |
| 209 | + path: /Users/distiller/miniconda3/conda-bld/osx-64 |
| 210 | + - persist_to_workspace: |
| 211 | + root: /Users/distiller/miniconda3/conda-bld/osx-64 |
| 212 | + paths: |
| 213 | + - "*" |
| 214 | + |
| 215 | + |
| 216 | +workflows: |
| 217 | + build: |
| 218 | +{%- if True %} |
| 219 | + jobs: |
| 220 | + - circleci_consistency |
| 221 | + {{ workflows() }} |
| 222 | + - binary_linux_conda_cuda: |
| 223 | + name: torchvision_linux_py3.7_cu100 |
| 224 | + python_version: "3.7" |
| 225 | + cu_version: "cu100" |
| 226 | + - binary_win_conda: |
| 227 | + name: torchvision_win_py3.6_cpu |
| 228 | + python_version: "3.6" |
| 229 | + cu_version: "cpu" |
| 230 | + |
| 231 | + nightly: |
| 232 | + triggers: |
| 233 | + - schedule: |
| 234 | + cron: "0 9 * * *" |
| 235 | + filters: |
| 236 | + branches: |
| 237 | + only: |
| 238 | + - master |
| 239 | +{%- endif %} |
| 240 | + jobs: |
| 241 | + - circleci_consistency |
| 242 | + {{ workflows(prefix="nightly_", upload=True) }} |
0 commit comments