Skip to content
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

Add Windows CI #394

Merged
merged 8 commits into from
Jan 8, 2020
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
22 changes: 22 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ version: 2.1
# - Replace binary_linux_wheel_py3.7 with the name of the job you want to test.
# Job names are 'name:' key.

orbs:
win: circleci/windows@2.0.0

binary_common: &binary_common
parameters:
# Edit these defaults to do a release
Expand Down Expand Up @@ -82,6 +85,22 @@ jobs:
paths:
- "*"

binary_win_conda:
<<: *binary_common
executor:
name: win/default
shell: bash.exe
steps:
- checkout
- run:
command: |
choco install miniconda3
(& "C:\tools\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
conda activate base
conda install -yq conda-build "conda-package-handling!=1.5.0"
bash packaging/build_conda.sh
shell: powershell.exe

binary_macos_wheel:
<<: *binary_common
macos:
Expand Down Expand Up @@ -283,6 +302,9 @@ workflows:
- binary_macos_conda:
name: binary_macos_conda_py3.7
python_version: '3.7'
- binary_win_conda:
name: torchaudio_win_py3.6
python_version: "3.6"

nightly:
jobs:
Expand Down
22 changes: 22 additions & 0 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ version: 2.1
# - Replace binary_linux_wheel_py3.7 with the name of the job you want to test.
# Job names are 'name:' key.

orbs:
win: circleci/windows@2.0.0

binary_common: &binary_common
parameters:
# Edit these defaults to do a release
Expand Down Expand Up @@ -82,6 +85,22 @@ jobs:
paths:
- "*"

binary_win_conda:
<<: *binary_common
executor:
name: win/default
shell: bash.exe
steps:
- checkout
- run:
command: |
choco install miniconda3
(& "C:\tools\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
conda activate base
conda install -yq conda-build "conda-package-handling!=1.5.0"
bash packaging/build_conda.sh
shell: powershell.exe

binary_macos_wheel:
<<: *binary_common
macos:
Expand Down Expand Up @@ -229,6 +248,9 @@ workflows:
jobs:
- circleci_consistency
{{ workflows() }}
- binary_win_conda:
name: torchaudio_win_py3.6
python_version: "3.6"

nightly:
{%- endif %}
Expand Down
5 changes: 5 additions & 0 deletions packaging/torchaudio/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off

set IS_CONDA=1

python setup.py install --single-version-externally-managed --record=record.txt
25 changes: 15 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ def check_env_flag(name, default=''):
if pytorch_package_version is not None:
pytorch_package_dep += "==" + pytorch_package_version

if platform.system() == 'Windows':
ext_modules = None
else:
ext_modules = [
CppExtension(
'_torch_sox',
['torchaudio/torch_sox.cpp'],
libraries=libraries,
include_dirs=include_dirs,
extra_compile_args=eca,
extra_objects=extra_objects,
extra_link_args=ela),
]

setup(
name="torchaudio",
version=version,
Expand All @@ -104,16 +118,7 @@ def check_env_flag(name, default=''):
],
# Exclude the build files.
packages=find_packages(exclude=["build"]),
ext_modules=[
CppExtension(
'_torch_sox',
['torchaudio/torch_sox.cpp'],
libraries=libraries,
include_dirs=include_dirs,
extra_compile_args=eca,
extra_objects=extra_objects,
extra_link_args=ela),
],
ext_modules=ext_modules,
cmdclass={'build_ext': BuildExtension},
install_requires=[pytorch_package_dep]
)
3 changes: 2 additions & 1 deletion torchaudio/_backend.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from functools import wraps

import platform
import torch

from . import _soundfile_backend, _sox_backend


_audio_backend = "sox"
_audio_backend = "soundfile" if platform.system() == "Windows" else "sox"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You recommend making soundfile the default in windows? If that is the case, I'm thinking we may want to make soundfile the default everywhere. Since we are doing the 0.4.0 release now, it may be a good idea to bring this in now so that we have window supported.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You recommend making soundfile the default in windows?

I made the change because I was not able to compile the sox backend on Windows. So actually, soundfile is the only available choice for Windows.

If that is the case, I'm thinking we may want to make soundfile the default everywhere.

The major limitation of soundfile is that it cannot read the file with the MP3 format, which is possible in sox.

Copy link
Contributor Author

@peterjc123 peterjc123 Jan 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another difficulty I met is that there are no available pysoundfile packages hosted on Anaconda Cloud for Windows. Although the current one is marked as noarch, it is depending on a gcc package which is not available on Windows. So for conda users, the installation script will look a bit weird like this.

conda install -c pytorch torchaudio
pip install soundfile

_audio_backends = {"sox": _sox_backend, "soundfile": _soundfile_backend}


Expand Down