Unverified Commit dc1d7a43 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by GitHub
Browse files

Add CircleCI pipeline for Linux binary builds. (#214)


Signed-off-by: default avatarEdward Z. Yang <ezyang@fb.com>
parent 77a69ee3
version: 2.1
# How to test:
# - 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_linux_wheel
# - Replace binary_linux_wheel with the name of the job you want to test
param_target_commit: &param_target_commit
target_commit:
description: "what hash or branch to build binaries for; by default, same as trigger"
type: string
default: HEAD
jobs:
binary_linux_wheel:
parameters:
<<: *param_target_commit
docker:
- image: "soumith/manylinux-cuda100"
resource_class: 2xlarge+
steps:
- checkout
- run: TARGET_COMMIT=<< parameters.target_commit >> build_tools/packaging/wheel/linux_manywheel.sh
- store_artifacts:
path: /remote/cpu
binary_linux_conda:
parameters:
<<: *param_target_commit
docker:
- image: "soumith/conda-cuda"
resource_class: 2xlarge+
steps:
- checkout
- run: TARGET_COMMIT=<< parameters.target_commit >> build_tools/packaging/conda/build_audio.sh
- store_artifacts:
path: /opt/conda/conda-bld/linux-64
workflows:
build:
jobs:
- binary_linux_wheel
- binary_linux_conda
...@@ -109,3 +109,4 @@ ENV/ ...@@ -109,3 +109,4 @@ ENV/
# Generated Files # Generated Files
test/assets/sinewave.wav test/assets/sinewave.wav
torchaudio/version.py torchaudio/version.py
gen.yml
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
nvidia-docker run -it --ipc=host --rm -v $(pwd):/remote soumith/conda-cuda bash nvidia-docker run -it --ipc=host --rm -v $(pwd):/remote soumith/conda-cuda bash
pushd remote/conda pushd remote/conda
conda config --add channels pytorch conda config --add channels pytorch
conda config --add channels conda-forge
./build_audio.sh ./build_audio.sh
``` ```
......
...@@ -10,31 +10,38 @@ retry () { ...@@ -10,31 +10,38 @@ retry () {
$* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*) $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)
} }
export TORCHAUDIO_BUILD_VERSION="0.4.0.dev$(date "+%Y%m%d")" if [[ -z "$TORCHAUDIO_BUILD_VERSION" ]]; then
export TORCHAUDIO_BUILD_NUMBER=1 export TORCHAUDIO_BUILD_VERSION="0.4.0.dev$(date "+%Y%m%d")"
fi
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" if [[ -z "$TORCHAUDIO_BUILD_NUMBER" ]]; then
export TORCHAUDIO_BUILD_NUMBER=1
audio_rootdir="$(pwd)/torchaudio-src"
if [[ "$BRANCH" == "" ]]; then
BRANCH=master
fi fi
if [[ ! -d "$audio_rootdir" ]]; then script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
rm -rf "$audio_rootdir"
git clone "https://github.com/pytorch/audio" "$audio_rootdir" -b "$BRANCH" if [[ "$TARGET_COMMIT" == HEAD ]]; then
# Assume that this script was called from a valid checkout
WORKDIR="$(realpath "$script_dir/../../..")"
else
WORKDIR="/tmp/audio"
cd /tmp
rm -rf audio
git clone https://github.com/pytorch/audio
cd audio
git checkout "$TARGET_COMMIT"
git submodule update --init --recursive
mkdir audio/third_party
fi fi
export TORCHAUDIO_GITHUB_ROOT_DIR="$audio_rootdir" export TORCHAUDIO_GITHUB_ROOT_DIR="$WORKDIR"
cd "$SOURCE_DIR" cd "$script_dir"
ANACONDA_USER=pytorch ANACONDA_USER=pytorch-nightly
conda config --set anaconda_upload no conda config --set anaconda_upload no
LATEST_PYTORCH_NIGHTLY_VERSION=$(conda search --json 'pytorch-nightly[channel=pytorch]' | python "$SOURCE_DIR/get-latest.py") LATEST_PYTORCH_NIGHTLY_VERSION=$(conda search --json 'pytorch[channel=pytorch-nightly]' | python "$script_dir/get-latest.py")
export CONDA_PYTORCH_CONSTRAINT=" - pytorch-nightly ==${LATEST_PYTORCH_NIGHTLY_VERSION}" export CONDA_PYTORCH_CONSTRAINT=" - pytorch ==${LATEST_PYTORCH_NIGHTLY_VERSION}"
export CONDA_CUDATOOLKIT_CONSTRAINT="" export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CUDA_VERSION="None" export CUDA_VERSION="None"
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
...@@ -42,9 +49,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then ...@@ -42,9 +49,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi fi
time conda build -c $ANACONDA_USER --no-anaconda-upload --python 2.7 torchaudio time conda build -c $ANACONDA_USER --no-anaconda-upload --python 2.7 torchaudio
# Currently disabled, see https://github.com/pytorch/pytorch/issues/23738 time conda build -c $ANACONDA_USER --no-anaconda-upload --python 3.5 torchaudio
# time conda build -c $ANACONDA_USER --no-anaconda-upload --python 3.5 torchaudio
time conda build -c $ANACONDA_USER --no-anaconda-upload --python 3.6 torchaudio time conda build -c $ANACONDA_USER --no-anaconda-upload --python 3.6 torchaudio
time conda build -c $ANACONDA_USER --no-anaconda-upload --python 3.7 torchaudio time conda build -c $ANACONDA_USER --no-anaconda-upload --python 3.7 torchaudio
set +e
# Functionally equivalent to: # Functionally equivalent to:
# jq -r '.["pytorch-nightly"][-1].version' | sed 's/+.*$//' # jq -r '.["pytorch"][-1].version' | sed 's/+.*$//'
import sys import sys
import json import json
import re import re
print(re.sub(r'\+.*$', '', json.load(sys.stdin)["pytorch-nightly"][-1]["version"])) print(re.sub(r'\+.*$', '', json.load(sys.stdin)["pytorch"][-1]["version"]))
...@@ -2,44 +2,58 @@ ...@@ -2,44 +2,58 @@
set -ex set -ex
export TORCHAUDIO_PACKAGE_NAME="torchaudio_nightly" if [[ -z "$TORCHAUDIO_BUILD_VERSION" ]]; then
export TORCHAUDIO_BUILD_VERSION="0.4.0.dev$(date "+%Y%m%d")" export TORCHAUDIO_BUILD_VERSION="0.4.0.dev$(date "+%Y%m%d")"
export TORCHAUDIO_BUILD_NUMBER="1" fi
if [[ -z "$TORCHAUDIO_BUILD_NUMBER" ]]; then
export TORCHAUDIO_BUILD_NUMBER="1"
fi
export OUT_DIR="/remote/cpu" export OUT_DIR="/remote/cpu"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd /opt/python cd /opt/python
DESIRED_PYTHON=(*/) DESIRED_PYTHON=(*/)
for desired_py in "${DESIRED_PYTHON[@]}"; do for desired_py in "${DESIRED_PYTHON[@]}"; do
python_installations+=("/opt/python/$desired_py") python_installations+=("/opt/python/$desired_py")
done done
OLD_PATH=$PATH if [[ "$TARGET_COMMIT" == HEAD ]]; then
cd /tmp # Assume that this script was called from a valid checkout
rm -rf audio WORKDIR="$(realpath "$script_dir/../../..")"
git clone https://github.com/pytorch/audio else
mkdir audio/third_party WORKDIR="/tmp/audio"
cd /tmp
rm -rf audio
git clone https://github.com/pytorch/audio
cd audio
git checkout "$TARGET_COMMIT"
git submodule update --init --recursive
fi
mkdir "$WORKDIR/third_party"
export PREFIX="/tmp/audio" export PREFIX="$WORKDIR"
. /remote/wheel/build_from_source.sh . "$script_dir/build_from_source.sh"
cd /tmp/audio cd "$WORKDIR"
ORIG_TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION="$TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION"
OLD_PATH=$PATH
for PYDIR in "${python_installations[@]}"; do for PYDIR in "${python_installations[@]}"; do
export PATH=$PYDIR/bin:$OLD_PATH export PATH="$PYDIR/bin:$OLD_PATH"
pip install --upgrade pip pip install --upgrade pip
# For true hermetic builds, you ought to be constructing the docker if [[ -z "$ORIG_TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION" ]]; then
# from scratch each time. But this makes things marginally safer if pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# you aren't doing this. # CPU/CUDA variants of PyTorch have ABI compatible PyTorch. Therefore, we
pip uninstall -y torch || true # strip off the local package qualifier. Also, we choose to build against
pip uninstall -y torch_nightly || true # the CPU build, because it takes less time to download.
export TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION="$(pip show torch | grep ^Version: | sed 's/Version: \+//' | sed 's/+.\+//')"
export TORCHAUDIO_PYTORCH_DEPENDENCY_NAME=torch_nightly else
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html pip install "torch==$TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION" -f https://download.pytorch.org/whl/torch_stable.html
# CPU/CUDA variants of PyTorch have ABI compatible PyTorch. Therefore, we fi
# strip off the local package qualifier. Also, we choose to build against
# the CPU build, because it takes less time to download.
export TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION="$(pip show torch_nightly | grep ^Version: | sed 's/Version: \+//' | sed 's/+.\+//')"
echo "Building against ${TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION}" echo "Building against ${TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION}"
# NB: do not actually install requirements.txt; that is only needed for # NB: do not actually install requirements.txt; that is only needed for
......
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