Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ commands:
our_upload_channel=test
fi
echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
install_build_tools_macos:
description: "installs tools required to build torchaudio"
steps:
- run:
name: Install cmake and pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config
# Disable brew auto update which is very slow

binary_common: &binary_common
parameters:
Expand Down Expand Up @@ -82,28 +89,30 @@ jobs:

download_third_parties_nix:
docker:
- image: "centos:8"
- image: "pytorch/torchaudio_unittest_base:manylinux"
resource_class: small
steps:
- checkout
- generate_cache_key
- restore_cache:

keys:
- tp-nix-{{ checksum ".cachekey" }}-{{ checksum "./build_tools/setup_helpers/build_third_party.sh" }}-{{ checksum "./build_tools/setup_helpers/build_third_party_helper.sh" }}
- tp-nix-v2-{{ checksum ".cachekey" }}

- run:
command: ./build_tools/setup_helpers/build_third_party.sh $PWD --download-only
command: |
mkdir -p third_party/archives/
wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/CMakeLists.txt)
- save_cache:

key: tp-nix-{{ checksum ".cachekey" }}-{{ checksum "./build_tools/setup_helpers/build_third_party.sh" }}-{{ checksum "./build_tools/setup_helpers/build_third_party_helper.sh" }}
key: tp-nix-v2-{{ checksum ".cachekey" }}

paths:
- third_party/tmp
- third_party/archives
- persist_to_workspace:
root: third_party
paths:
- tmp
- archives

binary_linux_wheel:
<<: *binary_common
Expand Down Expand Up @@ -145,6 +154,7 @@ jobs:
xcode: "9.0"
steps:
- checkout
- install_build_tools_macos
- attach_workspace:
at: third_party
- run:
Expand All @@ -169,6 +179,7 @@ jobs:
xcode: "9.0"
steps:
- checkout
- install_build_tools_macos
- attach_workspace:
at: third_party
- run:
Expand Down Expand Up @@ -383,19 +394,21 @@ jobs:
- restore_cache:

keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
- env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}

- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:

key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
key: env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}

paths:
- conda
- env
- third_party/build
- third_party/install
- third_party/src
- run:
name: Install torchaudio
command: .circleci/unittest/linux/scripts/install.sh
Expand Down Expand Up @@ -423,19 +436,21 @@ jobs:
- restore_cache:

keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
- env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}

- run:
name: Setup
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:

key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
key: env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}

paths:
- conda
- env
- third_party/build
- third_party/install
- third_party/src
- run:
name: Install torchaudio
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
Expand Down Expand Up @@ -542,6 +557,8 @@ jobs:
- conda
- env
- third_party/build
- third_party/install
- third_party/src
- run:
name: Run style check
command: .circleci/unittest/linux/scripts/run_style_checks.sh
Expand Down
37 changes: 27 additions & 10 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ commands:
our_upload_channel=test
fi
echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
install_build_tools_macos:
description: "installs tools required to build torchaudio"
steps:
- run:
name: Install cmake and pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config
# Disable brew auto update which is very slow

binary_common: &binary_common
parameters:
Expand Down Expand Up @@ -82,28 +89,30 @@ jobs:

download_third_parties_nix:
docker:
- image: "centos:8"
- image: "pytorch/torchaudio_unittest_base:manylinux"
resource_class: small
steps:
- checkout
- generate_cache_key
- restore_cache:
{% raw %}
keys:
- tp-nix-{{ checksum ".cachekey" }}-{{ checksum "./build_tools/setup_helpers/build_third_party.sh" }}-{{ checksum "./build_tools/setup_helpers/build_third_party_helper.sh" }}
- tp-nix-v2-{{ checksum ".cachekey" }}
{% endraw %}
- run:
command: ./build_tools/setup_helpers/build_third_party.sh $PWD --download-only
command: |
mkdir -p third_party/archives/
wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/CMakeLists.txt)
- save_cache:
{% raw %}
key: tp-nix-{{ checksum ".cachekey" }}-{{ checksum "./build_tools/setup_helpers/build_third_party.sh" }}-{{ checksum "./build_tools/setup_helpers/build_third_party_helper.sh" }}
key: tp-nix-v2-{{ checksum ".cachekey" }}
{% endraw %}
paths:
- third_party/tmp
- third_party/archives
- persist_to_workspace:
root: third_party
paths:
- tmp
- archives

binary_linux_wheel:
<<: *binary_common
Expand Down Expand Up @@ -145,6 +154,7 @@ jobs:
xcode: "9.0"
steps:
- checkout
- install_build_tools_macos
- attach_workspace:
at: third_party
- run:
Expand All @@ -169,6 +179,7 @@ jobs:
xcode: "9.0"
steps:
- checkout
- install_build_tools_macos
- attach_workspace:
at: third_party
- run:
Expand Down Expand Up @@ -383,19 +394,21 @@ jobs:
- restore_cache:
{% raw %}
keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
- env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
{% endraw %}
- run:
name: Setup
command: .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:
{% raw %}
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
key: env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
{% endraw %}
paths:
- conda
- env
- third_party/build
- third_party/install
- third_party/src
- run:
name: Install torchaudio
command: .circleci/unittest/linux/scripts/install.sh
Expand Down Expand Up @@ -423,19 +436,21 @@ jobs:
- restore_cache:
{% raw %}
keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
- env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
{% endraw %}
- run:
name: Setup
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/setup_env.sh
- save_cache:
{% raw %}
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".cachekey" }}
key: env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
{% endraw %}
paths:
- conda
- env
- third_party/build
- third_party/install
- third_party/src
- run:
name: Install torchaudio
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
Expand Down Expand Up @@ -542,6 +557,8 @@ jobs:
- conda
- env
- third_party/build
- third_party/install
- third_party/src
- run:
name: Run style check
command: .circleci/unittest/linux/scripts/run_style_checks.sh
Expand Down
2 changes: 2 additions & 0 deletions .circleci/unittest/linux/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ RUN apt update && apt install -y \
sox \
libsox-dev \
libsox-fmt-all \
cmake \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /kaldi /kaldi
COPY --from=builder /third_party /third_party
Expand Down
2 changes: 1 addition & 1 deletion .circleci/unittest/linux/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env

python -m torch.utils.collect_env
export PATH="${PWD}/third_party/build/bin/:${PATH}"
export PATH="${PWD}/third_party/install/bin/:${PATH}"
pytest --cov=torchaudio --junitxml=test-results/junit.xml -v --durations 20 test
9 changes: 7 additions & 2 deletions .circleci/unittest/linux/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ conda activate "${env_dir}"
printf "* Installing dependencies (except PyTorch)\n"
conda env update --file "${this_dir}/environment.yml" --prune

# 4. Build codecs
build_tools/setup_helpers/build_third_party.sh
# 4. Buld codecs
mkdir -p third_party/build
(
cd third_party/build
cmake ..
cmake --build .
)
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ gen.yml
examples/interactive_asr/data/*.txt
examples/interactive_asr/data/*.model
examples/interactive_asr/data/*.pt

# third parties
third_party/archives/
third_party/install/
third_party/src/
third_party/tmp/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ python setup.py install
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
```

Alternatively, the build process can build SoX (and codecs such as libmad, lame and flac) statically and torchaudio can link them, by setting environment variable `BUILD_SOX=1`.
The build process will fetch and build SoX, liblame, libmad, flac before building extension.
Alternatively, the build process can build libsox and some optional codecs statically and torchaudio can link them, by setting environment variable `BUILD_SOX=1`.
The build process will fetch and build libmad, lame, flac, vorbis, opus, and libsox before building extension. This process requires `cmake` and `pkg-config`.

```bash
# Linux
Expand Down
64 changes: 0 additions & 64 deletions build_tools/setup_helpers/build_third_party.sh

This file was deleted.

Loading