Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ commands:
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 wget
name: Install pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config wget
# Disable brew auto update which is very slow

binary_common: &binary_common
Expand Down Expand Up @@ -433,7 +433,7 @@ jobs:
resource_class: gpu.small
environment:
<<: *environment
image_name: "pytorch/torchaudio_unittest_base:manylinux-cuda10.1"
image_name: pytorch/torchaudio_unittest_base:manylinux-cuda10.1-cudnn7-20201203
steps:
- checkout
- attach_workspace:
Expand Down
6 changes: 3 additions & 3 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ commands:
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 wget
name: Install pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config wget
# Disable brew auto update which is very slow

binary_common: &binary_common
Expand Down Expand Up @@ -433,7 +433,7 @@ jobs:
resource_class: gpu.small
environment:
<<: *environment
image_name: "pytorch/torchaudio_unittest_base:manylinux-cuda10.1"
image_name: pytorch/torchaudio_unittest_base:manylinux-cuda10.1-cudnn7-20201203
steps:
- checkout
- attach_workspace:
Expand Down
4 changes: 3 additions & 1 deletion .circleci/torchscript_bc_test/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ dependencies:
- pytest
- pytest-cov
- codecov
- librosa
- librosa>=0.8.0
- llvmlite==0.31 # See https://github.com/pytorch/audio/pull/766
- pip
- pip:
- cmake
- ninja
- kaldi-io
- scipy
- parameterized
Expand Down
11 changes: 5 additions & 6 deletions .circleci/unittest/linux/docker/build_and_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ if [ $# -ne 1 ]; then
exit 1
fi

datestr="$(date "+%Y%m%d")"
if [ "$1" = "cpu" ]; then
base_image="ubuntu:18.04"
image="pytorch/torchaudio_unittest_base:manylinux"
elif [[ "$1" =~ ^(9.2|10.1)$ ]]; then
base_image="nvidia/cuda:$1-runtime-ubuntu18.04"
image="pytorch/torchaudio_unittest_base:manylinux-cuda$1"
image="pytorch/torchaudio_unittest_base:manylinux-${datestr}"
else
printf "Unexpected <CUDA_VERSION> string: %s" "$1"
exit 1;
base_image="nvidia/cuda:$1-devel-ubuntu18.04"
docker pull "${base_image}"
image="pytorch/torchaudio_unittest_base:manylinux-cuda$1-${datestr}"
fi

cd "$( dirname "${BASH_SOURCE[0]}" )"
Expand Down
10 changes: 1 addition & 9 deletions .circleci/unittest/linux/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Do not install PyTorch and torchaudio here, otherwise they also get cached.

set -e
set -ex

root_dir="$(git rev-parse --show-toplevel)"
conda_dir="${root_dir}/conda"
Expand Down Expand Up @@ -41,11 +41,3 @@ conda activate "${env_dir}"

# 3. Install minimal build tools
pip --quiet install cmake ninja

# 4. Buld codecs
mkdir -p third_party/build
(
cd third_party/build
cmake -GNinja ..
cmake --build .
)
125 changes: 125 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
cmake_minimum_required(VERSION 3.14)

project(torchaudio)

option(BUILD_SOX "Build SoX and bind statically" OFF)
option(BUILD_LIBTORCHAUDIO "Build C++ Library" ON)
option(BUILD_PYTHON_EXTENSION "Build Python extension" OFF)

set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target.")

find_package(Torch REQUIRED)
# Set -D_GLIBCXX_USE_CXX11_ABI for third party builds
if (DEFINED _GLIBCXX_USE_CXX11_ABI)
set(CXXFLAGS "${CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=${_GLIBCXX_USE_CXX11_ABI}")
endif()

if (APPLE)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
endif()

add_subdirectory(third_party)

IF (APPLE)
EXEC_PROGRAM(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
STRING(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
MESSAGE(STATUS "DARWIN_VERSION=${DARWIN_VERSION}")

#for el capitain have to use rpath

IF (DARWIN_VERSION LESS 15)
set(CMAKE_SKIP_RPATH TRUE)
ENDIF ()

ELSE()
#always skip for linux
set(CMAKE_SKIP_RPATH TRUE)
ENDIF()


################################################################################
# Beginning of torchaudio extension configuration
################################################################################

set(TORCHAUDIO_CSRC "${CMAKE_CURRENT_SOURCE_DIR}/torchaudio/csrc")

set(
LIBTORCHAUDIO_SOURCES
"${TORCHAUDIO_CSRC}/sox_io.cpp"
"${TORCHAUDIO_CSRC}/sox_utils.cpp"
"${TORCHAUDIO_CSRC}/sox_effects.cpp"
"${TORCHAUDIO_CSRC}/sox_effects_chain.cpp"
"${TORCHAUDIO_CSRC}/register.cpp"
)

################################################################################
# libtorchaudio.so
################################################################################
if(BUILD_LIBTORCHAUDIO)
add_library(
libtorchaudio
SHARED
${LIBTORCHAUDIO_SOURCES}
)
set_target_properties(libtorchaudio PROPERTIES PREFIX "")

target_include_directories(
libtorchaudio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

target_link_libraries(
libtorchaudio
"${TORCHAUDIO_THIRD_PARTIES}"
"${TORCH_LIBRARIES}"
)

install(
TARGETS
libtorchaudio
)

set(TORCHAUDIO_LIBRARY -Wl,--no-as-needed libtorchaudio -Wl,--as-needed CACHE INTERNAL "")
endif()

################################################################################
# _torchaudio.so
################################################################################
if (BUILD_PYTHON_EXTENSION)
add_library(
_torchaudio
SHARED
${TORCHAUDIO_CSRC}/sox.cpp
${LIBTORCHAUDIO_SOURCES}
)

set_target_properties(_torchaudio PROPERTIES PREFIX "")

if (APPLE)
# https://github.com/facebookarchive/caffe2/issues/854#issuecomment-364538485
# https://github.com/pytorch/pytorch/commit/73f6715f4725a0723d8171d3131e09ac7abf0666
set_target_properties(_torchaudio PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif()

target_include_directories(
_torchaudio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${Python_INCLUDE_DIR}
)

# See https://github.com/pytorch/pytorch/issues/38122
find_library(TORCH_PYTHON_LIBRARY torch_python PATHS "${TORCH_INSTALL_PREFIX}/lib")

target_link_libraries(
_torchaudio
${TORCHAUDIO_THIRD_PARTIES}
${TORCH_LIBRARIES}
${TORCH_PYTHON_LIBRARY}
)

# We do not define install for _torchaudio.so
# The location of installation is controlled by "CMAKE_LIBRARY_OUTPUT_DIRECTORY" and the
# resulting file is handled by setuptools.
endif()
Loading