Unverified Commit 4125d3a0 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

kill CircleCI (#7611)

parent 285500d6
#!/usr/bin/env bash
set -ex
if [ "$2" == "" ]; then
echo call as "$0" "<src>" "<target branch>"
echo where src is the root of the built documentation git checkout and
echo branch should be "main" or "1.7" or so
exit 1
fi
src=$1
target=$2
echo "committing docs from ${src} to ${target}"
pushd "${src}"
git checkout gh-pages
mkdir -p ./"${target}"
rm -rf ./"${target}"/*
cp -r "${src}/docs/build/html/"* ./"$target"
if [ "${target}" == "main" ]; then
mkdir -p ./_static
rm -rf ./_static/*
cp -r "${src}/docs/build/html/_static/"* ./_static
git add --all ./_static || true
fi
git add --all ./"${target}" || true
git config user.email "soumith+bot@pytorch.org"
git config user.name "pytorchbot"
# If there aren't changes, don't make a commit; push is no-op
git commit -m "auto-generating sphinx docs" || true
git remote add https https://github.com/pytorch/vision.git
git push -u https gh-pages
version: 2.1
# How to test the Linux jobs:
# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/
# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_win_wheel_py3.8
# - Replace binary_win_wheel_py3.8 with the name of the job you want to test.
# Job names are 'name:' key.
executors:
windows-cpu:
machine:
resource_class: windows.xlarge
image: windows-server-2019-vs2019:stable
shell: bash.exe
windows-gpu:
machine:
resource_class: windows.gpu.nvidia.medium
image: windows-server-2019-nvidia:stable
shell: bash.exe
commands:
checkout_merge:
description: "checkout merge branch"
steps:
- checkout
# - run:
# name: Checkout merge branch
# command: |
# set -ex
# BRANCH=$(git rev-parse --abbrev-ref HEAD)
# if [[ "$BRANCH" != "main" ]]; then
# git fetch --force origin ${CIRCLE_BRANCH}/merge:merged/${CIRCLE_BRANCH}
# git checkout "merged/$CIRCLE_BRANCH"
# fi
designate_upload_channel:
description: "inserts the correct upload channel into ${BASH_ENV}"
steps:
- run:
name: adding UPLOAD_CHANNEL to BASH_ENV
command: |
our_upload_channel=nightly
# On tags upload to test instead
if [[ -n "${CIRCLE_TAG}" ]]; then
our_upload_channel=test
fi
echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
pip_install:
parameters:
args:
type: string
descr:
type: string
default: ""
user:
type: boolean
default: true
steps:
- run:
name: >
<<^ parameters.descr >> pip install << parameters.args >> <</ parameters.descr >>
<<# parameters.descr >> << parameters.descr >> <</ parameters.descr >>
command: >
pip install
<<# parameters.user >> --user <</ parameters.user >>
--progress-bar=off
<< parameters.args >>
binary_common: &binary_common
parameters:
# Edit these defaults to do a release
build_version:
description: "version number of release binary; by default, build a nightly"
type: string
default: ""
pytorch_version:
description: "PyTorch version to build against; by default, use a nightly"
type: string
default: ""
# Don't edit these
python_version:
description: "Python version to build against (e.g., 3.8)"
type: string
cu_version:
description: "CUDA version to build against, in CU format (e.g., cpu or cu100)"
type: string
default: "cpu"
unicode_abi:
description: "Python 2.7 wheel only: whether or not we are cp27mu (default: no)"
type: string
default: ""
wheel_docker_image:
description: "Wheel only: what docker image to use"
type: string
default: ""
conda_docker_image:
description: "Conda only: what docker image to use"
type: string
default: "pytorch/conda-builder:cpu"
environment:
PYTHON_VERSION: << parameters.python_version >>
PYTORCH_VERSION: << parameters.pytorch_version >>
UNICODE_ABI: << parameters.unicode_abi >>
CU_VERSION: << parameters.cu_version >>
MACOSX_DEPLOYMENT_TARGET: 10.9
smoke_test_common: &smoke_test_common
<<: *binary_common
docker:
- image: torchvision/smoke_test:latest
jobs:
circleci_consistency:
docker:
- image: cimg/python:3.8
steps:
- checkout
- pip_install:
args: jinja2 pyyaml
- run:
name: Check CircleCI config consistency
command: |
python .circleci/regenerate.py
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
smoke_test_docker_image_build:
machine:
image: ubuntu-2004:202104-01
resource_class: large
environment:
image_name: torchvision/smoke_test
steps:
- checkout
- designate_upload_channel
- run:
name: Build and push Docker image
no_output_timeout: "1h"
command: |
set +x
echo "${DOCKER_HUB_TOKEN}" | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin
set -x
cd .circleci/smoke_test/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID}
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} ${image_name}:latest
docker push ${image_name}:${CIRCLE_WORKFLOW_ID}
docker push ${image_name}:latest
cmake_linux_cpu:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cpu"
resource_class: 2xlarge+
steps:
- checkout_merge
- designate_upload_channel
- run:
name: Setup conda
command: .circleci/unittest/linux/scripts/setup_env.sh
- run: packaging/build_cmake.sh
cmake_linux_gpu:
<<: *binary_common
machine:
image: ubuntu-2004-cuda-11.4:202110-01
resource_class: gpu.nvidia.small
steps:
- checkout_merge
- designate_upload_channel
- run:
name: Setup conda
command: docker run -e CU_VERSION -e PYTHON_VERSION -e UNICODE_ABI -e PYTORCH_VERSION -t --gpus all -v $PWD:$PWD -w $PWD << parameters.wheel_docker_image >> .circleci/unittest/linux/scripts/setup_env.sh
- run:
name: Build torchvision C++ distribution and test
no_output_timeout: 30m
command: docker run -e CU_VERSION -e PYTHON_VERSION -e UNICODE_ABI -e PYTORCH_VERSION -e UPLOAD_CHANNEL -t --gpus all -v $PWD:$PWD -w $PWD << parameters.wheel_docker_image >> packaging/build_cmake.sh
cmake_macos_cpu:
<<: *binary_common
macos:
xcode: "14.0"
steps:
- checkout_merge
- designate_upload_channel
- run:
command: |
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
sh conda.sh -b
source $HOME/miniconda3/bin/activate
conda install -yq conda-build cmake python=<< parameters.python_version >>
packaging/build_cmake.sh
cmake_windows_cpu:
<<: *binary_common
executor:
name: windows-cpu
steps:
- checkout_merge
- designate_upload_channel
- run:
command: |
set -ex
source packaging/windows/internal/vc_install_helper.sh
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate base
conda create -yn python39 python=3.9
conda activate python39
packaging/build_cmake.sh
cmake_windows_gpu:
<<: *binary_common
executor:
name: windows-gpu
steps:
- checkout_merge
- designate_upload_channel
- run:
name: Update CUDA driver
command: packaging/windows/internal/driver_update.bat
- run:
command: |
set -ex
source packaging/windows/internal/vc_install_helper.sh
packaging/windows/internal/cuda_install.bat
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate
conda update -y conda
conda create -yn python39 python=3.9
conda activate python39
packaging/build_cmake.sh
workflows:
lint:
jobs:
- circleci_consistency
cmake:
jobs:
- cmake_linux_cpu:
cu_version: cpu
name: cmake_linux_cpu
python_version: '3.8'
- cmake_linux_gpu:
cu_version: cu117
name: cmake_linux_gpu
python_version: '3.8'
wheel_docker_image: pytorch/manylinux-cuda117
- cmake_windows_cpu:
cu_version: cpu
name: cmake_windows_cpu
python_version: '3.8'
- cmake_windows_gpu:
cu_version: cu117
name: cmake_windows_gpu
python_version: '3.8'
- cmake_macos_cpu:
cu_version: cpu
name: cmake_macos_cpu
python_version: '3.8'
docker_build:
triggers:
- schedule:
cron: "0 10 * * 0"
filters:
branches:
only:
- main
jobs:
- smoke_test_docker_image_build:
context: org-member
version: 2.1
# How to test the Linux jobs:
# - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/
# - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_win_wheel_py3.8
# - Replace binary_win_wheel_py3.8 with the name of the job you want to test.
# Job names are 'name:' key.
executors:
windows-cpu:
machine:
resource_class: windows.xlarge
image: windows-server-2019-vs2019:stable
shell: bash.exe
windows-gpu:
machine:
resource_class: windows.gpu.nvidia.medium
image: windows-server-2019-nvidia:stable
shell: bash.exe
commands:
checkout_merge:
description: "checkout merge branch"
steps:
- checkout
# - run:
# name: Checkout merge branch
# command: |
# set -ex
# BRANCH=$(git rev-parse --abbrev-ref HEAD)
# if [[ "$BRANCH" != "main" ]]; then
# git fetch --force origin ${CIRCLE_BRANCH}/merge:merged/${CIRCLE_BRANCH}
# git checkout "merged/$CIRCLE_BRANCH"
# fi
designate_upload_channel:
description: "inserts the correct upload channel into ${BASH_ENV}"
steps:
- run:
name: adding UPLOAD_CHANNEL to BASH_ENV
command: |
our_upload_channel=nightly
# On tags upload to test instead
if [[ -n "${CIRCLE_TAG}" ]]; then
our_upload_channel=test
fi
echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
pip_install:
parameters:
args:
type: string
descr:
type: string
default: ""
user:
type: boolean
default: true
steps:
- run:
name: >
<<^ parameters.descr >> pip install << parameters.args >> <</ parameters.descr >>
<<# parameters.descr >> << parameters.descr >> <</ parameters.descr >>
command: >
pip install
<<# parameters.user >> --user <</ parameters.user >>
--progress-bar=off
<< parameters.args >>
binary_common: &binary_common
parameters:
# Edit these defaults to do a release
build_version:
description: "version number of release binary; by default, build a nightly"
type: string
default: ""
pytorch_version:
description: "PyTorch version to build against; by default, use a nightly"
type: string
default: ""
# Don't edit these
python_version:
description: "Python version to build against (e.g., 3.8)"
type: string
cu_version:
description: "CUDA version to build against, in CU format (e.g., cpu or cu100)"
type: string
default: "cpu"
unicode_abi:
description: "Python 2.7 wheel only: whether or not we are cp27mu (default: no)"
type: string
default: ""
wheel_docker_image:
description: "Wheel only: what docker image to use"
type: string
default: ""
conda_docker_image:
description: "Conda only: what docker image to use"
type: string
default: "pytorch/conda-builder:cpu"
environment:
PYTHON_VERSION: << parameters.python_version >>
PYTORCH_VERSION: << parameters.pytorch_version >>
UNICODE_ABI: << parameters.unicode_abi >>
CU_VERSION: << parameters.cu_version >>
MACOSX_DEPLOYMENT_TARGET: 10.9
smoke_test_common: &smoke_test_common
<<: *binary_common
docker:
- image: torchvision/smoke_test:latest
jobs:
circleci_consistency:
docker:
- image: cimg/python:3.8
steps:
- checkout
- pip_install:
args: jinja2 pyyaml
- run:
name: Check CircleCI config consistency
command: |
python .circleci/regenerate.py
git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)
smoke_test_docker_image_build:
machine:
image: ubuntu-2004:202104-01
resource_class: large
environment:
image_name: torchvision/smoke_test
steps:
- checkout
- designate_upload_channel
- run:
name: Build and push Docker image
no_output_timeout: "1h"
command: |
set +x
echo "${DOCKER_HUB_TOKEN}" | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin
set -x
cd .circleci/smoke_test/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID}
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} ${image_name}:latest
docker push ${image_name}:${CIRCLE_WORKFLOW_ID}
docker push ${image_name}:latest
cmake_linux_cpu:
<<: *binary_common
docker:
- image: "pytorch/manylinux-cpu"
resource_class: 2xlarge+
steps:
- checkout_merge
- designate_upload_channel
- run:
name: Setup conda
command: .circleci/unittest/linux/scripts/setup_env.sh
- run: packaging/build_cmake.sh
cmake_linux_gpu:
<<: *binary_common
machine:
image: ubuntu-2004-cuda-11.4:202110-01
resource_class: gpu.nvidia.small
steps:
- checkout_merge
- designate_upload_channel
- run:
name: Setup conda
command: docker run -e CU_VERSION -e PYTHON_VERSION -e UNICODE_ABI -e PYTORCH_VERSION -t --gpus all -v $PWD:$PWD -w $PWD << parameters.wheel_docker_image >> .circleci/unittest/linux/scripts/setup_env.sh
- run:
name: Build torchvision C++ distribution and test
no_output_timeout: 30m
command: docker run -e CU_VERSION -e PYTHON_VERSION -e UNICODE_ABI -e PYTORCH_VERSION -e UPLOAD_CHANNEL -t --gpus all -v $PWD:$PWD -w $PWD << parameters.wheel_docker_image >> packaging/build_cmake.sh
cmake_macos_cpu:
<<: *binary_common
macos:
xcode: "14.0"
steps:
- checkout_merge
- designate_upload_channel
- run:
command: |
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
sh conda.sh -b
source $HOME/miniconda3/bin/activate
conda install -yq conda-build cmake python=<< parameters.python_version >>
packaging/build_cmake.sh
cmake_windows_cpu:
<<: *binary_common
executor:
name: windows-cpu
steps:
- checkout_merge
- designate_upload_channel
- run:
command: |
set -ex
source packaging/windows/internal/vc_install_helper.sh
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate base
conda create -yn python39 python=3.9
conda activate python39
packaging/build_cmake.sh
cmake_windows_gpu:
<<: *binary_common
executor:
name: windows-gpu
steps:
- checkout_merge
- designate_upload_channel
- run:
name: Update CUDA driver
command: packaging/windows/internal/driver_update.bat
- run:
command: |
set -ex
source packaging/windows/internal/vc_install_helper.sh
packaging/windows/internal/cuda_install.bat
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate
conda update -y conda
conda create -yn python39 python=3.9
conda activate python39
packaging/build_cmake.sh
workflows:
lint:
jobs:
- circleci_consistency
cmake:
jobs:
{{ cmake_workflows() }}
docker_build:
triggers:
- schedule:
cron: "0 10 * * 0"
filters:
branches:
only:
- main
jobs:
- smoke_test_docker_image_build:
context: org-member
#!/usr/bin/env python3
"""
This script should use a very simple, functional programming style.
Avoid Jinja macros in favor of native Python functions.
Don't go overboard on code generation; use Python only to generate
content that can't be easily declared statically using CircleCI's YAML API.
Data declarations (e.g. the nested loops for defining the configuration matrix)
should be at the top of the file for easy updating.
See this comment for design rationale:
https://github.com/pytorch/vision/pull/1321#issuecomment-531033978
"""
import os.path
import jinja2
import yaml
from jinja2 import select_autoescape
def indent(indentation, data_list):
return ("\n" + " " * indentation).join(yaml.dump(data_list, default_flow_style=False).splitlines())
def cmake_workflows(indentation=6):
jobs = []
python_version = "3.8"
for os_type in ["linux", "windows", "macos"]:
# Skip OSX CUDA
device_types = ["cpu", "gpu"] if os_type != "macos" else ["cpu"]
for device in device_types:
job = {"name": f"cmake_{os_type}_{device}", "python_version": python_version}
job["cu_version"] = "cu117" if device == "gpu" else "cpu"
if device == "gpu" and os_type == "linux":
job["wheel_docker_image"] = "pytorch/manylinux-cuda117"
jobs.append({f"cmake_{os_type}_{device}": job})
return indent(indentation, jobs)
if __name__ == "__main__":
d = os.path.dirname(__file__)
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(d),
lstrip_blocks=True,
autoescape=select_autoescape(enabled_extensions=("html", "xml")),
keep_trailing_newline=True,
)
with open(os.path.join(d, "config.yml"), "w") as f:
f.write(
env.get_template("config.yml.in").render(
cmake_workflows=cmake_workflows,
)
)
# this Dockerfile is for torchvision smoke test, it will be created periodically via CI system
# if you need to do it locally, follow below steps once you have Docker installed
# assuming you're within the directory where this Dockerfile located
# $ docker build . -t torchvision/smoketest
# if you want to push to aws ecr, make sure you have the rights to write to ECR, then run
# $ eval $(aws ecr get-login --region us-east-1 --no-include-email)
# $ export MYTAG=localbuild ## you can choose whatever tag you like
# $ docker tag torchvision/smoketest 308535385114.dkr.ecr.us-east-1.amazonaws.com/torchvision/smoke_test:${MYTAG}
# $ docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/torchvision/smoke_test:${MYTAG}
FROM ubuntu:latest
RUN apt-get -qq update && apt-get -qq -y install curl bzip2 libsox-fmt-all \
&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
&& bash /tmp/miniconda.sh -bfp /usr/local \
&& rm -rf /tmp/miniconda.sh \
&& conda install -y python=3 \
&& conda update conda \
&& apt-get -qq -y remove curl bzip2 \
&& apt-get -qq -y autoremove \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
&& conda clean --all --yes
ENV PATH /opt/conda/bin:$PATH
RUN conda create -y --name python3.7 python=3.7
RUN conda create -y --name python3.8 python=3.8
RUN conda create -y --name python3.9 python=3.9
RUN conda create -y --name python3.10 python=3.10
SHELL [ "/bin/bash", "-c" ]
RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc
CMD [ "/bin/bash"]
#!/bin/bash
set -ex -o pipefail
echo "DIR: $(pwd)"
echo "ANDROID_HOME=${ANDROID_HOME}"
echo "ANDROID_NDK_HOME=${ANDROID_NDK_HOME}"
echo "JAVA_HOME=${JAVA_HOME}"
WORKSPACE=/home/circleci/workspace
VISION_ANDROID=/home/circleci/project/android
. /home/circleci/project/.circleci/unittest/android/scripts/install_gradle.sh
GRADLE_LOCAL_PROPERTIES=${VISION_ANDROID}/local.properties
rm -f $GRADLE_LOCAL_PROPERTIES
echo "sdk.dir=${ANDROID_HOME}" >> $GRADLE_LOCAL_PROPERTIES
echo "ndk.dir=${ANDROID_NDK_HOME}" >> $GRADLE_LOCAL_PROPERTIES
echo "GRADLE_PATH $GRADLE_PATH"
echo "GRADLE_HOME $GRADLE_HOME"
${GRADLE_PATH} --scan --stacktrace --debug --no-daemon -p ${VISION_ANDROID} assemble || true
mkdir -p ~/workspace/artifacts
find . -type f -name *aar -print | xargs tar cfvz ~/workspace/artifacts/artifacts-aars.tgz
find . -type f -name *apk -print | xargs tar cfvz ~/workspace/artifacts/artifacts-apks.tgz
#!/bin/bash
set -ex -o pipefail
echo "DIR: $(pwd)"
echo "ANDROID_HOME=${ANDROID_HOME}"
echo "ANDROID_NDK_HOME=${ANDROID_NDK_HOME}"
echo "JAVA_HOME=${JAVA_HOME}"
WORKSPACE=/home/circleci/workspace
VISION_ANDROID=/home/circleci/project/android
. /home/circleci/project/.circleci/unittest/android/scripts/install_gradle.sh
GRADLE_LOCAL_PROPERTIES=${VISION_ANDROID}/local.properties
rm -f $GRADLE_LOCAL_PROPERTIES
GRADLE_PROPERTIES=/home/circleci/project/android/gradle.properties
echo "sdk.dir=${ANDROID_HOME}" >> $GRADLE_LOCAL_PROPERTIES
echo "ndk.dir=${ANDROID_NDK_HOME}" >> $GRADLE_LOCAL_PROPERTIES
echo "SONATYPE_NEXUS_USERNAME=${SONATYPE_NEXUS_USERNAME}" >> $GRADLE_PROPERTIES
echo "mavenCentralRepositoryUsername=${SONATYPE_NEXUS_USERNAME}" >> $GRADLE_PROPERTIES
echo "SONATYPE_NEXUS_PASSWORD=${SONATYPE_NEXUS_PASSWORD}" >> $GRADLE_PROPERTIES
echo "mavenCentralRepositoryPassword=${SONATYPE_NEXUS_PASSWORD}" >> $GRADLE_PROPERTIES
echo "signing.keyId=${ANDROID_SIGN_KEY}" >> $GRADLE_PROPERTIES
echo "signing.password=${ANDROID_SIGN_PASS}" >> $GRADLE_PROPERTIES
cat /home/circleci/project/android/gradle.properties | grep VERSION
${GRADLE_PATH} --scan --stacktrace --debug --no-daemon -p ${VISION_ANDROID} ops:uploadArchives
mkdir -p ~/workspace/artifacts
find . -type f -name *aar -print | xargs tar cfvz ~/workspace/artifacts/artifacts-aars.tgz
#!/bin/bash
set -ex
_https_amazon_aws=https://downloads.gradle-dn.com/distributions
GRADLE_VERSION=6.8.3
_gradle_home=/opt/gradle
sudo rm -rf $gradle_home
sudo mkdir -p $_gradle_home
curl --silent --output /tmp/gradle.zip --retry 3 $_https_amazon_aws/gradle-${GRADLE_VERSION}-bin.zip
sudo unzip -q /tmp/gradle.zip -d $_gradle_home
rm /tmp/gradle.zip
sudo chmod -R 777 $_gradle_home
export GRADLE_HOME=$_gradle_home/gradle-$GRADLE_VERSION
export GRADLE_PATH=${GRADLE_HOME}/bin/gradle
#!/bin/bash
set -ex -o pipefail
echo ""
echo "DIR: $(pwd)"
WORKSPACE=/Users/distiller/workspace
PROJ_ROOT_IOS=/Users/distiller/project/ios
PYTORCH_IOS_NIGHTLY_NAME=libtorch_ios_nightly_build.zip
export TCLLIBPATH="/usr/local/lib"
# install conda
curl --retry 3 -o ~/conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x ~/conda.sh
/bin/bash ~/conda.sh -b -p ~/anaconda
export PATH="~/anaconda/bin:${PATH}"
source ~/anaconda/bin/activate
# install dependencies
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests wget --yes
conda install -c conda-forge valgrind --yes
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
# sync submodules
cd ${PROJ_ROOT_IOS}
git submodule sync
git submodule update --init --recursive
# download pytorch-iOS nightly build and unzip it
mkdir -p ${PROJ_ROOT_IOS}/lib
mkdir -p ${PROJ_ROOT_IOS}/build
mkdir -p ${PROJ_ROOT_IOS}/pytorch
TORCH_ROOT="${PROJ_ROOT_IOS}/pytorch"
cd ${TORCH_ROOT}
wget https://ossci-ios-build.s3.amazonaws.com/${PYTORCH_IOS_NIGHTLY_NAME}
mkdir -p ./build_ios
unzip -d ./build_ios ./${PYTORCH_IOS_NIGHTLY_NAME}
LIBTORCH_HEADER_ROOT="${TORCH_ROOT}/build_ios/install/include"
cd ${PROJ_ROOT_IOS}
IOS_ARCH=${IOS_ARCH} LIBTORCH_HEADER_ROOT=${LIBTORCH_HEADER_ROOT} ./build_ios.sh
rm -rf ${TORCH_ROOT}
# store the binary
DEST_DIR=${WORKSPACE}/ios/${IOS_ARCH}
mkdir -p ${DEST_DIR}
cp ${PROJ_ROOT_IOS}/lib/*.a ${DEST_DIR}
#!/bin/bash
set -ex -o pipefail
echo ""
echo "DIR: $(pwd)"
WORKSPACE=/Users/distiller/workspace
PROJ_ROOT=/Users/distiller/project
ARTIFACTS_DIR=${WORKSPACE}/ios
ls ${ARTIFACTS_DIR}
ZIP_DIR=${WORKSPACE}/zip
mkdir -p ${ZIP_DIR}/install/lib
# build a FAT bianry
cd ${ZIP_DIR}/install/lib
libs=("${ARTIFACTS_DIR}/x86_64/libtorchvision_ops.a" "${ARTIFACTS_DIR}/arm64/libtorchvision_ops.a")
lipo -create "${libs[@]}" -o ${ZIP_DIR}/install/lib/libtorchvision_ops.a
lipo -i ${ZIP_DIR}/install/lib/*.a
# copy the license
cp ${PROJ_ROOT}/LICENSE ${ZIP_DIR}/
# zip the library
ZIPFILE=libtorchvision_ops_ios_nightly_build.zip
cd ${ZIP_DIR}
#for testing
touch version.txt
echo $(date +%s) > version.txt
zip -r ${ZIPFILE} install version.txt LICENSE
# upload to aws
# Install conda then 'conda install' awscli
curl --retry 3 -o ~/conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x ~/conda.sh
/bin/bash ~/conda.sh -b -p ~/anaconda
export PATH="~/anaconda/bin:${PATH}"
source ~/anaconda/bin/activate
conda install -c conda-forge awscli --yes
set +x
export AWS_ACCESS_KEY_ID=${AWS_S3_ACCESS_KEY_FOR_PYTORCH_BINARY_UPLOAD}
export AWS_SECRET_ACCESS_KEY=${AWS_S3_ACCESS_SECRET_FOR_PYTORCH_BINARY_UPLOAD}
set -x
aws s3 cp ${ZIPFILE} s3://ossci-ios-build/ --acl public-read
channels:
- pytorch
- defaults
dependencies:
- pytest
- pytest-cov
- pytest-mock
- pip
- libpng
- jpeg
- ca-certificates
- h5py
- pip:
- future
- scipy
- av < 10
#!/usr/bin/env bash
unset PYTORCH_VERSION
# For unittest, nightly PyTorch is used as the following section,
# so no need to set PYTORCH_VERSION.
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.
set -ex
eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
if [ "${CU_VERSION:-}" == cpu ] ; then
cudatoolkit="cpuonly"
version="cpu"
else
if [[ ${#CU_VERSION} -eq 4 ]]; then
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
elif [[ ${#CU_VERSION} -eq 5 ]]; then
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
fi
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION: ${CU_VERSION} "
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="pytorch-cuda=${version}"
# make sure local cuda is set to required cuda version and not CUDA version by default
rm -f /usr/local/cuda
ln -s /usr/local/cuda-${version} /usr/local/cuda
fi
case "$(uname -s)" in
Darwin*) os=MacOSX;;
*) os=Linux
esac
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
if [ "${os}" == "MacOSX" ]; then
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}"
else
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c nvidia "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}"
fi
printf "* Installing torchvision\n"
python setup.py develop
#!/usr/bin/env bash
set -e
eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
#!/usr/bin/env bash
set -e
eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
python -m torch.utils.collect_env
case "$(uname -s)" in
Darwin*)
# The largest macOS runner is not able to handle the regular test suite plus the transforms v2 tests at the same
# time due to insufficient resources. Thus, we ignore the transforms v2 tests at first and run them in a separate
# step afterwards.
GLOB='test/test_transforms_v2*'
pytest --junitxml=test-results/junit.xml -v --durations 20 --ignore-glob="${GLOB}"
eval "pytest --junitxml=test-results/junit-transforms-v2.xml -v --durations 20 ${GLOB}"
;;
*)
pytest --junitxml=test-results/junit.xml -v --durations 20
;;
esac
#!/usr/bin/env bash
# This script is for setting up environment in which unit test is ran.
# To speed up the CI time, the resulting environment is cached.
#
# Do not install PyTorch and torchvision here, otherwise they also get cached.
set -ex
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Avoid error: "fatal: unsafe repository"
git config --global --add safe.directory '*'
root_dir="$(git rev-parse --show-toplevel)"
conda_dir="${root_dir}/conda"
env_dir="${root_dir}/env"
cd "${root_dir}"
case "$(uname -s)" in
Darwin*) os=MacOSX;;
*) os=Linux
esac
# 1. Install conda at ./conda
if [ ! -d "${conda_dir}" ]; then
printf "* Installing conda\n"
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
bash ./miniconda.sh -b -f -p "${conda_dir}"
fi
eval "$(${conda_dir}/bin/conda shell.bash hook)"
# 2. Create test environment at ./env
if [ ! -d "${env_dir}" ]; then
printf "* Creating a test environment\n"
conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION"
fi
conda activate "${env_dir}"
# 3. Install Conda dependencies
printf "* Installing dependencies (except PyTorch)\n"
FFMPEG_PIN="=4.2"
if [[ "${PYTHON_VERSION}" == "3.9" ]]; then
FFMPEG_PIN=">=4.2"
fi
conda install -y -c pytorch "ffmpeg${FFMPEG_PIN}"
conda env update --file "${this_dir}/environment.yml" --prune
channels:
- pytorch
- defaults
dependencies:
- pytest
- pytest-cov
- pytest-mock
- pip
- libpng
- jpeg
- ca-certificates
- hdf5
- setuptools
- pip:
- future
- scipy
- av !=9.1.1, <10
- dataclasses
- h5py
#!/usr/bin/env bash
unset PYTORCH_VERSION
# For unittest, nightly PyTorch is used as the following section,
# so no need to set PYTORCH_VERSION.
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.
set -ex
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
conda activate ./env
# TODO, refactor the below logic to make it easy to understand how to get correct cuda_version.
if [ "${CU_VERSION:-}" == cpu ] ; then
cudatoolkit="cpuonly"
version="cpu"
else
if [[ ${#CU_VERSION} -eq 4 ]]; then
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
elif [[ ${#CU_VERSION} -eq 5 ]]; then
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
fi
cuda_toolkit_pckg="cudatoolkit"
if [[ $CUDA_VERSION == 11.6 || $CUDA_VERSION == 11.7 || $CUDA_VERSION == 11.8 || $CUDA_VERSION == 12.1 ]]; then
cuda_toolkit_pckg="pytorch-cuda"
fi
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION"
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="${cuda_toolkit_pckg}=${version}"
fi
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c nvidia "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}"
torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())")
echo torch.cuda.is_available is $torch_cuda
if [ ! -z "${CUDA_VERSION:-}" ] ; then
if [ "$torch_cuda" == "False" ]; then
echo "torch with cuda installed but torch.cuda.is_available() is False"
exit 1
fi
fi
source "$this_dir/set_cuda_envs.sh"
printf "* Installing torchvision\n"
"$this_dir/vc_env_helper.bat" python setup.py develop
start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda%
#!/usr/bin/env bash
set -e
eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
conda activate ./env
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment