|
| 1 | +# run python regenerate.py to generate config.yml from config.yml.in |
| 2 | + |
1 | 3 | version: 2.1
|
| 4 | + |
| 5 | +executors: |
| 6 | + windows-with-nvidia-gpu: |
| 7 | + machine: |
| 8 | + resource_class: windows.gpu.nvidia.medium |
| 9 | + image: windows-server-2019-nvidia:stable |
| 10 | + shell: bash.exe |
| 11 | + |
| 12 | +install_official_git_client: &install_official_git_client |
| 13 | + name: Install Official Git Client |
| 14 | + no_output_timeout: "1h" |
| 15 | + command: | |
| 16 | + set -e |
| 17 | + sudo apt-get -qq update |
| 18 | + sudo apt-get -qq install openssh-client git |
| 19 | +
|
| 20 | +# This system setup script is meant to run before the CI-related scripts, e.g., |
| 21 | +# installing Git client, checking out code, setting up CI env, and |
| 22 | +# building/testing. |
| 23 | +setup_linux_system_environment: &setup_linux_system_environment |
| 24 | + name: Set Up System Environment |
| 25 | + no_output_timeout: "1h" |
| 26 | + command: | |
| 27 | + set -ex |
| 28 | +
|
| 29 | + # Stop background apt updates. Hypothetically, the kill should not |
| 30 | + # be necessary, because stop is supposed to send a kill signal to |
| 31 | + # the process, but we've added it for good luck. Also |
| 32 | + # hypothetically, it's supposed to be unnecessary to wait for |
| 33 | + # the process to block. We also have that line for good luck. |
| 34 | + # If you like, try deleting them and seeing if it works. |
| 35 | + sudo systemctl stop apt-daily.service || true |
| 36 | + sudo systemctl kill --kill-who=all apt-daily.service || true |
| 37 | +
|
| 38 | + sudo systemctl stop unattended-upgrades.service || true |
| 39 | + sudo systemctl kill --kill-who=all unattended-upgrades.service || true |
| 40 | +
|
| 41 | + # wait until `apt-get update` has been killed |
| 42 | + while systemctl is-active --quiet apt-daily.service |
| 43 | + do |
| 44 | + sleep 1; |
| 45 | + done |
| 46 | + while systemctl is-active --quiet unattended-upgrades.service |
| 47 | + do |
| 48 | + sleep 1; |
| 49 | + done |
| 50 | +
|
| 51 | + # See if we actually were successful |
| 52 | + systemctl list-units --all | cat |
| 53 | +
|
| 54 | + sudo apt-get purge -y unattended-upgrades |
| 55 | +
|
| 56 | + cat /etc/apt/sources.list |
| 57 | +
|
| 58 | + ps auxfww | grep [a]pt |
| 59 | + ps auxfww | grep dpkg |
| 60 | +
|
| 61 | +pytorch_tutorial_build_defaults: &pytorch_tutorial_build_defaults |
| 62 | + machine: |
| 63 | + image: ubuntu-2004-cuda-11.4:202110-01 |
| 64 | + steps: |
| 65 | + - checkout |
| 66 | + - run: |
| 67 | + <<: *setup_linux_system_environment |
| 68 | + - run: |
| 69 | + name: Set Up CI Environment |
| 70 | + no_output_timeout: "1h" |
| 71 | + command: | |
| 72 | + set -e |
| 73 | +
|
| 74 | + sudo apt-get -y update |
| 75 | + sudo apt-get -y install expect-dev moreutils |
| 76 | +
|
| 77 | + sudo pip3 -q install awscli==1.16.35 |
| 78 | +
|
| 79 | + if [ -n "${CUDA_VERSION}" ]; then |
| 80 | + nvidia-smi |
| 81 | + fi |
| 82 | +
|
| 83 | + # This IAM user only allows read-write access to ECR |
| 84 | + export AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_ECR_READ_ONLY} |
| 85 | + export AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_ECR_READ_ONLY} |
| 86 | + eval $(aws ecr get-login --region us-east-1 --no-include-email) |
| 87 | + - run: |
| 88 | + name: Build |
| 89 | + no_output_timeout: "20h" |
| 90 | + command: | |
| 91 | + set -e |
| 92 | +
|
| 93 | + # for some reason, pip installs it in a different place than what is looked at in the py file |
| 94 | + sudo pip3 install requests --target=/opt/circleci/.pyenv/versions/3.9.4/lib/python3.9/site-packages |
| 95 | + export pyTorchDockerImageTag=$(python3 .jenkins/get_docker_tag.py) |
| 96 | + echo "PyTorchDockerImageTag: "${pyTorchDockerImageTag} |
| 97 | +
|
| 98 | + cat >/home/circleci/project/ci_build_script.sh \<<EOL |
| 99 | + # =================== The following code will be executed inside Docker container =================== |
| 100 | + set -ex |
| 101 | +
|
| 102 | + .jenkins/build.sh |
| 103 | + # =================== The above code will be executed inside Docker container =================== |
| 104 | + EOL |
| 105 | + chmod +x /home/circleci/project/ci_build_script.sh |
| 106 | +
|
| 107 | + export DOCKER_IMAGE=${DOCKER_IMAGE}:${pyTorchDockerImageTag} |
| 108 | + echo "DOCKER_IMAGE: "${DOCKER_IMAGE} |
| 109 | + docker pull ${DOCKER_IMAGE} >/dev/null |
| 110 | + if [ -n "${CUDA_VERSION}" ]; then |
| 111 | + export id=$(docker run --gpus all -t -d -w /var/lib/jenkins ${DOCKER_IMAGE}) |
| 112 | + else |
| 113 | + export id=$(docker run -t -d -w /var/lib/jenkins ${DOCKER_IMAGE}) |
| 114 | + fi |
| 115 | +
|
| 116 | + echo "declare -x JOB_BASE_NAME=${CIRCLE_JOB}" > /home/circleci/project/env |
| 117 | + echo "declare -x COMMIT_ID=${CIRCLE_SHA1}" >> /home/circleci/project/env |
| 118 | + echo "declare -x COMMIT_SOURCE=${CIRCLE_BRANCH}" >> /home/circleci/project/env |
| 119 | + # DANGER! DO NOT REMOVE THE `set +x` SETTING HERE! |
| 120 | + set +x |
| 121 | + if [[ "$CIRCLE_BRANCH" == master || "$CIRCLE_BRANCH" == main ]]; then |
| 122 | + if [ -z "${CIRCLECI_AWS_ACCESS_KEY_FOR_PYTORCH_TUTORIAL_BUILD_MASTER_S3_BUCKET}" ]; then exit 1; fi |
| 123 | + if [ -z "${CIRCLECI_AWS_SECRET_KEY_FOR_PYTORCH_TUTORIAL_BUILD_MASTER_S3_BUCKET}" ]; then exit 1; fi |
| 124 | + if [ -z "${GITHUB_PYTORCHBOT_USERNAME}" ]; then exit 1; fi |
| 125 | + if [ -z "${GITHUB_PYTORCHBOT_TOKEN}" ]; then exit 1; fi |
| 126 | +
|
| 127 | + echo "declare -x AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_PYTORCH_TUTORIAL_BUILD_MASTER_S3_BUCKET}" >> /home/circleci/project/env |
| 128 | + echo "declare -x AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_PYTORCH_TUTORIAL_BUILD_MASTER_S3_BUCKET}" >> /home/circleci/project/env |
| 129 | + echo "declare -x GITHUB_PYTORCHBOT_USERNAME=${GITHUB_PYTORCHBOT_USERNAME}" >> /home/circleci/project/env |
| 130 | + echo "declare -x GITHUB_PYTORCHBOT_TOKEN=${GITHUB_PYTORCHBOT_TOKEN}" >> /home/circleci/project/env |
| 131 | + else |
| 132 | + echo "declare -x AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_PYTORCH_TUTORIAL_BUILD_PR_S3_BUCKET}" >> /home/circleci/project/env |
| 133 | + echo "declare -x AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_PYTORCH_TUTORIAL_BUILD_PR_S3_BUCKET}" >> /home/circleci/project/env |
| 134 | + fi |
| 135 | + set -x |
| 136 | +
|
| 137 | + echo 'rm /opt/cache/bin/*' | docker exec -u root -i "$id" bash |
| 138 | + docker cp /home/circleci/project/. "$id:/var/lib/jenkins/workspace" |
| 139 | +
|
| 140 | + export COMMAND='((echo "source ./workspace/env" && echo "sudo chown -R jenkins workspace && cd workspace && ./ci_build_script.sh") | docker exec -u jenkins -i "$id" bash) 2>&1' |
| 141 | + echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts |
| 142 | + # Copy docs with plot to a docs dir |
| 143 | + if docker exec -it "$id" sh -c "test -d ./workspace/docs_with_plot/docs/"; then |
| 144 | + mkdir /home/circleci/project/docs |
| 145 | + docker cp "$id:/var/lib/jenkins/workspace/docs_with_plot/docs/." /home/circleci/project/docs |
| 146 | + echo "Directory copied successfully" |
| 147 | + else |
| 148 | + echo "No docs_with_plot directory. Skipping..." |
| 149 | + fi |
| 150 | +
|
| 151 | + - store_artifacts: |
| 152 | + path: ./docs |
| 153 | + destination: tutorials |
| 154 | + |
| 155 | +pytorch_tutorial_build_worker_defaults: &pytorch_tutorial_build_worker_defaults |
| 156 | + environment: |
| 157 | + DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-bionic-cuda12.1-cudnn8-py3-gcc9" |
| 158 | + CUDA_VERSION: "9" |
| 159 | + resource_class: gpu.nvidia.small |
| 160 | + <<: *pytorch_tutorial_build_defaults |
| 161 | + |
| 162 | +pytorch_tutorial_build_manager_defaults: &pytorch_tutorial_build_manager_defaults |
| 163 | + environment: |
| 164 | + DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-bionic-cuda12.1-cudnn8-py3-gcc9" |
| 165 | + resource_class: medium |
| 166 | + |
| 167 | + |
| 168 | + <<: *pytorch_tutorial_build_defaults |
| 169 | + |
| 170 | +pytorch_windows_build_worker: &pytorch_windows_build_worker |
| 171 | + executor: windows-with-nvidia-gpu |
| 172 | + steps: |
| 173 | + - checkout |
| 174 | + - run: |
| 175 | + name: Install Cuda |
| 176 | + no_output_timeout: 30m |
| 177 | + command: | |
| 178 | + .circleci/scripts/windows_cuda_install.sh |
| 179 | + - run: |
| 180 | + name: Generate cache key |
| 181 | + # This will refresh cache on Sundays, build should generate new cache. |
| 182 | + command: echo "$(date +"%Y-%U")" > .circleci-weekly |
| 183 | + - restore_cache: |
| 184 | + keys: |
| 185 | + - data-{{ checksum "Makefile" }}-{{ checksum ".circleci-weekly" }} |
| 186 | + - run: |
| 187 | + name: test |
| 188 | + no_output_timeout: "1h" |
| 189 | + command: | |
| 190 | + .circleci/scripts/build_for_windows.sh |
| 191 | + - save_cache: |
| 192 | + key: data-{{ checksum "Makefile" }}-{{ checksum ".circleci-weekly" }} |
| 193 | + paths: |
| 194 | + - advanced_source/data |
| 195 | + - beginner_source/data |
| 196 | + - intermediate_source/data |
| 197 | + - prototype_source/data |
| 198 | + |
| 199 | +jobs: |
| 200 | + pytorch_tutorial_pr_build_manager: |
| 201 | + <<: *pytorch_tutorial_build_manager_defaults |
| 202 | + pytorch_tutorial_pr_build_worker_0: |
| 203 | + <<: *pytorch_tutorial_build_worker_defaults |
| 204 | + resource_class: gpu.nvidia.small.multi |
| 205 | + pytorch_tutorial_pr_build_worker_1: |
| 206 | + <<: *pytorch_tutorial_build_worker_defaults |
| 207 | + resource_class: gpu.nvidia.large |
| 208 | + pytorch_tutorial_pr_build_worker_10: |
| 209 | + <<: *pytorch_tutorial_build_worker_defaults |
| 210 | + pytorch_tutorial_pr_build_worker_11: |
| 211 | + <<: *pytorch_tutorial_build_worker_defaults |
| 212 | + pytorch_tutorial_pr_build_worker_12: |
| 213 | + <<: *pytorch_tutorial_build_worker_defaults |
| 214 | + pytorch_tutorial_pr_build_worker_13: |
| 215 | + <<: *pytorch_tutorial_build_worker_defaults |
| 216 | + pytorch_tutorial_pr_build_worker_14: |
| 217 | + <<: *pytorch_tutorial_build_worker_defaults |
| 218 | + pytorch_tutorial_pr_build_worker_15: |
| 219 | + <<: *pytorch_tutorial_build_worker_defaults |
| 220 | + pytorch_tutorial_pr_build_worker_16: |
| 221 | + <<: *pytorch_tutorial_build_worker_defaults |
| 222 | + pytorch_tutorial_pr_build_worker_17: |
| 223 | + <<: *pytorch_tutorial_build_worker_defaults |
| 224 | + pytorch_tutorial_pr_build_worker_18: |
| 225 | + <<: *pytorch_tutorial_build_worker_defaults |
| 226 | + pytorch_tutorial_pr_build_worker_19: |
| 227 | + <<: *pytorch_tutorial_build_worker_defaults |
| 228 | + pytorch_tutorial_pr_build_worker_2: |
| 229 | + <<: *pytorch_tutorial_build_worker_defaults |
| 230 | + pytorch_tutorial_pr_build_worker_3: |
| 231 | + <<: *pytorch_tutorial_build_worker_defaults |
| 232 | + pytorch_tutorial_pr_build_worker_4: |
| 233 | + <<: *pytorch_tutorial_build_worker_defaults |
| 234 | + pytorch_tutorial_pr_build_worker_5: |
| 235 | + <<: *pytorch_tutorial_build_worker_defaults |
| 236 | + pytorch_tutorial_pr_build_worker_6: |
| 237 | + <<: *pytorch_tutorial_build_worker_defaults |
| 238 | + pytorch_tutorial_pr_build_worker_7: |
| 239 | + <<: *pytorch_tutorial_build_worker_defaults |
| 240 | + pytorch_tutorial_pr_build_worker_8: |
| 241 | + <<: *pytorch_tutorial_build_worker_defaults |
| 242 | + pytorch_tutorial_pr_build_worker_9: |
| 243 | + <<: *pytorch_tutorial_build_worker_defaults |
| 244 | + |
| 245 | + pytorch_tutorial_trunk_build_manager: |
| 246 | + <<: *pytorch_tutorial_build_manager_defaults |
| 247 | + pytorch_tutorial_trunk_build_worker_0: |
| 248 | + <<: *pytorch_tutorial_build_worker_defaults |
| 249 | + resource_class: gpu.nvidia.small.multi |
| 250 | + pytorch_tutorial_trunk_build_worker_1: |
| 251 | + <<: *pytorch_tutorial_build_worker_defaults |
| 252 | + resource_class: gpu.nvidia.large |
| 253 | + pytorch_tutorial_trunk_build_worker_10: |
| 254 | + <<: *pytorch_tutorial_build_worker_defaults |
| 255 | + pytorch_tutorial_trunk_build_worker_11: |
| 256 | + <<: *pytorch_tutorial_build_worker_defaults |
| 257 | + pytorch_tutorial_trunk_build_worker_12: |
| 258 | + <<: *pytorch_tutorial_build_worker_defaults |
| 259 | + pytorch_tutorial_trunk_build_worker_13: |
| 260 | + <<: *pytorch_tutorial_build_worker_defaults |
| 261 | + pytorch_tutorial_trunk_build_worker_14: |
| 262 | + <<: *pytorch_tutorial_build_worker_defaults |
| 263 | + pytorch_tutorial_trunk_build_worker_15: |
| 264 | + <<: *pytorch_tutorial_build_worker_defaults |
| 265 | + pytorch_tutorial_trunk_build_worker_16: |
| 266 | + <<: *pytorch_tutorial_build_worker_defaults |
| 267 | + pytorch_tutorial_trunk_build_worker_17: |
| 268 | + <<: *pytorch_tutorial_build_worker_defaults |
| 269 | + pytorch_tutorial_trunk_build_worker_18: |
| 270 | + <<: *pytorch_tutorial_build_worker_defaults |
| 271 | + pytorch_tutorial_trunk_build_worker_19: |
| 272 | + <<: *pytorch_tutorial_build_worker_defaults |
| 273 | + pytorch_tutorial_trunk_build_worker_2: |
| 274 | + <<: *pytorch_tutorial_build_worker_defaults |
| 275 | + pytorch_tutorial_trunk_build_worker_3: |
| 276 | + <<: *pytorch_tutorial_build_worker_defaults |
| 277 | + pytorch_tutorial_trunk_build_worker_4: |
| 278 | + <<: *pytorch_tutorial_build_worker_defaults |
| 279 | + pytorch_tutorial_trunk_build_worker_5: |
| 280 | + <<: *pytorch_tutorial_build_worker_defaults |
| 281 | + pytorch_tutorial_trunk_build_worker_6: |
| 282 | + <<: *pytorch_tutorial_build_worker_defaults |
| 283 | + pytorch_tutorial_trunk_build_worker_7: |
| 284 | + <<: *pytorch_tutorial_build_worker_defaults |
| 285 | + pytorch_tutorial_trunk_build_worker_8: |
| 286 | + <<: *pytorch_tutorial_build_worker_defaults |
| 287 | + pytorch_tutorial_trunk_build_worker_9: |
| 288 | + <<: *pytorch_tutorial_build_worker_defaults |
| 289 | + |
| 290 | + pytorch_tutorial_windows_pr_build_worker_0: |
| 291 | + <<: *pytorch_windows_build_worker |
| 292 | + pytorch_tutorial_windows_pr_build_worker_1: |
| 293 | + <<: *pytorch_windows_build_worker |
| 294 | + pytorch_tutorial_windows_pr_build_worker_2: |
| 295 | + <<: *pytorch_windows_build_worker |
| 296 | + pytorch_tutorial_windows_pr_build_worker_3: |
| 297 | + <<: *pytorch_windows_build_worker |
| 298 | + pytorch_tutorial_windows_trunk_build_worker_0: |
| 299 | + <<: *pytorch_windows_build_worker |
| 300 | + pytorch_tutorial_windows_trunk_build_worker_1: |
| 301 | + <<: *pytorch_windows_build_worker |
| 302 | + pytorch_tutorial_windows_trunk_build_worker_2: |
| 303 | + <<: *pytorch_windows_build_worker |
| 304 | + pytorch_tutorial_windows_trunk_build_worker_3: |
| 305 | + <<: *pytorch_windows_build_worker |
| 306 | + |
| 307 | +workflows: |
| 308 | + build: |
| 309 | + when: << pipeline.parameters.this_should_never_be_true >> |
| 310 | + jobs: |
| 311 | + # Build jobs that only run on PR |
| 312 | + - pytorch_tutorial_pr_build_worker_0: |
| 313 | + filters: |
| 314 | + branches: |
| 315 | + ignore: |
| 316 | + - master |
| 317 | + - main |
0 commit comments