-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add CUDA 11.3 + PyTorch 1.11.0 and 1.12.1 #4205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dc6c90b
265901d
01f3a28
2e0410b
dc9dd78
623785f
b0cfa84
4aed0f5
ed157ba
29e9331
4a4807c
8f70a9b
e906527
1d880b1
4f6c1d8
6c3e0cf
b34a381
f101018
622b649
c408649
69d26ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,22 +8,27 @@ cpu: &cpu | |
| image: ubuntu-2004:202107-02 | ||
| resource_class: medium | ||
|
|
||
| gpu: &gpu | ||
| cuda111: &cuda111 | ||
| machine: | ||
| # NOTE: use a cuda version that's supported by all our pytorch versions | ||
| image: ubuntu-1604-cuda-11.1:202012-01 | ||
| resource_class: gpu.nvidia.small | ||
|
|
||
| cuda114: &cuda114 | ||
| machine: | ||
| image: ubuntu-2004-cuda-11.4:202110-01 | ||
| resource_class: gpu.nvidia.small | ||
|
|
||
| windows-cpu: &windows_cpu | ||
| machine: | ||
| resource_class: windows.medium | ||
| image: windows-server-2019-vs2019:stable | ||
| shell: powershell.exe | ||
| resource_class: windows.medium | ||
| shell: powershell.exe | ||
|
|
||
| # windows-gpu: &windows_gpu | ||
| # machine: | ||
| # resource_class: windows.gpu.nvidia.medium | ||
| # image: windows-server-2019-nvidia:stable | ||
| # resource_class: windows.gpu.nvidia.medium | ||
|
|
||
| version_parameters: &version_parameters | ||
| parameters: | ||
|
|
@@ -36,7 +41,7 @@ version_parameters: &version_parameters | |
| # use test wheels index to have access to RC wheels | ||
| # https://download.pytorch.org/whl/test/torch_test.html | ||
| default: "https://download.pytorch.org/whl/torch_stable.html" | ||
| python_version: # NOTE: only affect linux | ||
| python_version: # NOTE: only affects linux | ||
| type: string | ||
| default: '3.8.6' | ||
|
|
||
|
|
@@ -60,6 +65,37 @@ version_parameters: &version_parameters | |
| # sudo /bin/bash ./NVIDIA-Linux-x86_64-430.40.run -s --no-drm | ||
| # nvidia-smi | ||
|
|
||
| setupcuda113: &setupcuda113 | ||
| run: | ||
| name: Setup CUDA 11.3 | ||
| working_directory: ~/ | ||
| command: | | ||
| wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin | ||
| sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 | ||
| sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub | ||
| sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" | ||
| sudo apt-get update | ||
| sudo apt-get -y install cuda-11-3 | ||
| sudo update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-11.3 50 | ||
| echo "Done installing CUDA 11.3" | ||
| sudo apt autoremove | ||
| sudo apt-get clean | ||
| nvidia-smi | ||
| sudo update-alternatives --display cuda | ||
|
|
||
| removecuda114: &removecuda114 | ||
| run: | ||
| name: Remove CUDA 11.4 | ||
| working_directory: ~/ | ||
| command: | | ||
| echo "Remove CUDA 11.4" | ||
| sudo update-alternatives --remove cuda /usr/local/cuda-11.4 | ||
| sudo apt-get -y remove --purge cuda-11-4 | ||
| sudo apt autoremove | ||
| sudo apt-get clean | ||
| echo "Done removing CUDA 11.4" | ||
| sudo update-alternatives --display cuda | ||
|
|
||
| add_ssh_keys: &add_ssh_keys | ||
| # https://circleci.com/docs/2.0/add-ssh-key/ | ||
| - add_ssh_keys: | ||
|
|
@@ -71,10 +107,10 @@ install_python: &install_python | |
| name: Install Python | ||
| working_directory: ~/ | ||
| command: | | ||
| # upgrade pyenv | ||
| cd /opt/circleci/.pyenv/plugins/python-build/../.. && git pull && cd - | ||
| pyenv install -s $PYTHON_VERSION | ||
| pyenv global $PYTHON_VERSION | ||
| cd /opt/circleci/.pyenv/plugins/python-build/../.. && git pull && cd | ||
| pyenv install -l | ||
| pyenv install -s ${PYTHON_VERSION} | ||
| pyenv global ${PYTHON_VERSION} | ||
| python --version | ||
| which python | ||
| pip install --upgrade pip | ||
|
|
@@ -85,7 +121,7 @@ setup_venv: &setup_venv | |
| working_directory: ~/ | ||
| command: | | ||
| python -m venv ~/venv | ||
| echo ". ~/venv/bin/activate" >> $BASH_ENV | ||
| echo ". ~/venv/bin/activate" >> ${BASH_ENV} | ||
| . ~/venv/bin/activate | ||
| python --version | ||
| which python | ||
|
|
@@ -115,14 +151,30 @@ install_linux_dep: &install_linux_dep | |
| # Don't use pytest-xdist: cuda tests are unstable under multi-process workers. | ||
| # Don't use opencv 4.7.0.68: https://github.com/opencv/opencv-python/issues/765 | ||
| pip install --progress-bar off ninja opencv-python-headless!=4.7.0.68 pytest tensorboard pycocotools onnx | ||
| pip install --progress-bar off torch==$PYTORCH_VERSION -f $PYTORCH_INDEX | ||
| if [[ "$TORCHVISION_VERSION" == "master" ]]; then | ||
| pip install git+https://github.com/pytorch/vision.git | ||
| pip install -v --progress-bar off omegaconf | ||
| if [[ "${PYTORCH_VERSION}" == "master" ]]; then | ||
| echo "Installing torch/torchvision from ${PYTORCH_INDEX}" | ||
| # Remove first, in case it's in the CI cache | ||
| pip uninstall -y torch torchvision | ||
| pip install -v --progress-bar off --pre torch torchvision --extra-index-url ${PYTORCH_INDEX} | ||
| else | ||
| pip install --progress-bar off torchvision==$TORCHVISION_VERSION -f $PYTORCH_INDEX | ||
| LABEL_VERSION=$(echo "${PYTORCH_VERSION}" | cut -d "+" -f 2 -s) | ||
| echo "Installing torch==${PYTORCH_VERSION} and torchvision==${TORCHVISION_VERSION} from ${PYTORCH_INDEX} and label version ${LABEL_VERSION}" | ||
| if [[ "${LABEL_VERSION}" == "cu113" ]]; then | ||
| pip install -v --progress-bar off torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} --extra-index-url ${PYTORCH_INDEX} | ||
| else | ||
| pip install -v --progress-bar off torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} -f ${PYTORCH_INDEX} | ||
| fi | ||
| fi | ||
|
|
||
| python -c 'import torch; print("PyTorch Version:", torch.__version__)' | ||
| python -c 'import torchvision; print("TorchVision Version:", torchvision.__version__)' | ||
| python -c 'import torch; print("CUDA:", torch.cuda.is_available())' | ||
| echo "Python packages" | ||
| python -c "import sys; print(sys.executable)" | ||
| python --version | ||
| pip list | ||
| echo "GCC Compiler" | ||
| gcc --version | ||
|
|
||
| install_detectron2: &install_detectron2 | ||
|
|
@@ -170,7 +222,7 @@ jobs: | |
| # Refresh the key when dependencies should be updated (e.g. when pytorch releases) | ||
| - restore_cache: | ||
| keys: | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827 | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| - <<: *install_python | ||
| - <<: *install_linux_dep | ||
|
|
@@ -182,11 +234,35 @@ jobs: | |
| paths: | ||
| - /opt/circleci/.pyenv | ||
| - ~/.torch | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827 | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| linux_cuda111_tests: | ||
| <<: *cuda111 | ||
| <<: *version_parameters | ||
|
|
||
| working_directory: ~/detectron2 | ||
|
|
||
| steps: | ||
| - checkout | ||
|
|
||
| - restore_cache: | ||
| keys: | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| - <<: *install_python | ||
| - <<: *install_linux_dep | ||
| - <<: *install_detectron2 | ||
| - <<: *run_unittests | ||
| - <<: *uninstall_tests | ||
|
|
||
| linux_gpu_tests: | ||
| <<: *gpu | ||
| - save_cache: | ||
| paths: | ||
| - /opt/circleci/.pyenv | ||
| - ~/.torch | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| linux_cuda113_tests: | ||
| <<: *cuda114 | ||
| <<: *version_parameters | ||
|
|
||
| working_directory: ~/detectron2 | ||
|
|
@@ -196,8 +272,10 @@ jobs: | |
|
|
||
| - restore_cache: | ||
| keys: | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827 | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| - <<: *setupcuda113 | ||
| - <<: *removecuda114 | ||
| - <<: *install_python | ||
| - <<: *install_linux_dep | ||
| - <<: *install_detectron2 | ||
|
|
@@ -208,7 +286,8 @@ jobs: | |
| paths: | ||
| - /opt/circleci/.pyenv | ||
| - ~/.torch | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827 | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There're a lot of duplication between
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not really familiar with CircleCI. I've just winged based on sampels. Any ideas on how to templatize even more? |
||
|
|
||
| windows_cpu_build: | ||
| <<: *windows_cpu | ||
|
|
@@ -221,7 +300,7 @@ jobs: | |
| # Cache the env directory that contains dependencies | ||
| - restore_cache: | ||
| keys: | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210404 | ||
| - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| - run: | ||
| name: Install Dependencies | ||
|
|
@@ -231,12 +310,28 @@ jobs: | |
| pip install opencv-python-headless pytest-xdist pycocotools tensorboard onnx | ||
| pip install -U git+https://github.com/facebookresearch/iopath | ||
| pip install -U git+https://github.com/facebookresearch/fvcore | ||
| pip install torch==$env:PYTORCH_VERSION torchvision==$env:TORCHVISION_VERSION -f $env:PYTORCH_INDEX | ||
| if($env:PYTORCH_VERSION -eq "master"){ | ||
| Write-Output "Installing torch/torchvision from $env:PYTORCH_INDEX" | ||
| pip uninstall -y torch torchvision | ||
| pip install --progress-bar off --pre torch torchvision --extra-index-url $env:PYTORCH_INDEX | ||
| }else{ | ||
| Write-Output "Installing torch==$env:PYTORCH_VERSION and torchvision==$env:TORCHVISION_VERSION from $env:PYTORCH_INDEX" | ||
| pip install --progress-bar off torch==$env:PYTORCH_VERSION torchvision==$env:TORCHVISION_VERSION -f $env:PYTORCH_INDEX | ||
| } | ||
| python -c 'import torch; print("PyTorch Version:", torch.__version__)' | ||
| python -c 'import torchvision; print("TorchVision Version:", torchvision.__version__)' | ||
| python -c 'import torch; print("CUDA:", torch.cuda.is_available())' | ||
| Write-Output "Python packages" | ||
| python -c "import sys; print(sys.executable)" | ||
| python --version | ||
| pip list | ||
| echo "OS Environment Variables" | ||
| dir env: | ||
|
|
||
| - save_cache: | ||
| paths: | ||
| - env | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210404 | ||
| key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20990009 | ||
|
|
||
| - <<: *install_detectron2 | ||
| # TODO: unittest fails for now | ||
|
|
@@ -249,23 +344,60 @@ workflows: | |
| name: linux_cpu_tests_pytorch1.10 | ||
| pytorch_version: '1.10.0+cpu' | ||
| torchvision_version: '0.11.1+cpu' | ||
| - linux_gpu_tests: | ||
| name: linux_gpu_tests_pytorch1.8 | ||
| - linux_cpu_tests: | ||
| name: linux_cpu_tests_pytorch1.11 | ||
| python_version: '3.9.4' | ||
| pytorch_version: '1.11.0' | ||
| torchvision_version: '0.12.0' | ||
| pytorch_index: 'https://download.pytorch.org/whl/cpu' | ||
| - linux_cpu_tests: | ||
| name: linux_cpu_tests_pytorch1.12 | ||
| python_version: '3.9.4' | ||
| pytorch_version: '1.12.1' | ||
| torchvision_version: '0.13.1' | ||
| pytorch_index: 'https://download.pytorch.org/whl/cpu' | ||
| - linux_cuda111_tests: | ||
| name: linux_cuda111_tests_pytorch1.8 | ||
| pytorch_version: '1.8.1+cu111' | ||
| torchvision_version: '0.9.1+cu111' | ||
| - linux_gpu_tests: | ||
| name: linux_gpu_tests_pytorch1.9 | ||
| - linux_cuda111_tests: | ||
| name: linux_cuda111_tests_pytorch1.9 | ||
| pytorch_version: '1.9+cu111' | ||
| torchvision_version: '0.10+cu111' | ||
| - linux_gpu_tests: | ||
| name: linux_gpu_tests_pytorch1.10 | ||
| pytorch_version: '1.10+cu111' | ||
| - linux_cuda111_tests: | ||
| name: linux_cuda111_tests_pytorch1.10 | ||
| pytorch_version: '1.10.0+cu111' | ||
| torchvision_version: '0.11.1+cu111' | ||
thiagocrepaldi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - linux_gpu_tests: | ||
| name: linux_gpu_tests_pytorch1.10_python39 | ||
| pytorch_version: '1.10+cu111' | ||
| - linux_cuda111_tests: | ||
| name: linux_cuda111_tests_pytorch1.10_python39 | ||
| pytorch_version: '1.10.0+cu111' | ||
| torchvision_version: '0.11.1+cu111' | ||
| python_version: '3.9.6' | ||
| - linux_cuda113_tests: | ||
| name: linux_cuda113_tests_pytorch1.11_python39 | ||
| pytorch_version: '1.11.0+cu113' | ||
| torchvision_version: '0.12.0+cu113' | ||
| python_version: '3.9.4' | ||
| pytorch_index: 'https://download.pytorch.org/whl/cu113' | ||
| - linux_cuda113_tests: | ||
| name: linux_cuda113_tests_pytorch1.12_python39 | ||
| pytorch_version: '1.12.1+cu113' | ||
| torchvision_version: '0.13.1+cu113' | ||
| python_version: '3.9.4' | ||
| pytorch_index: 'https://download.pytorch.org/whl/cu113' | ||
| - windows_cpu_build: | ||
| name: windows_cpu_build_pytorch1.10 | ||
| pytorch_version: '1.10+cpu' | ||
| torchvision_version: '0.11.1+cpu' | ||
| - windows_cpu_build: | ||
| name: windows_cpu_build_pytorch_1.11 | ||
| pytorch_version: '1.11.0+cpu' | ||
| torchvision_version: '0.12.0+cpu' | ||
| python_version: '3.7.3' | ||
| pytorch_index: 'https://download.pytorch.org/whl/cpu' | ||
| - windows_cpu_build: | ||
| name: windows_cpu_build_pytorch_1.12 | ||
| pytorch_version: '1.12.1+cpu' | ||
| torchvision_version: '0.13.1+cpu' | ||
| python_version: '3.7.3' | ||
| pytorch_index: 'https://download.pytorch.org/whl/cpu' | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it remove 114 first then setup 113?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing 11.4 first and installing 11.3 would result in uninstalling several shared components only to reinstall later, increasing installation time. Keeping the current order does not affect the end result and save some time