-
Notifications
You must be signed in to change notification settings - Fork 661
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
Temporarily Disable OpenMP support for libsox #1026
Conversation
b728dd5
to
44420fd
Compare
44420fd
to
6808cfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a test to catch this locally. As we discussed, disabling OpenMP temporarily in sox seems like the right temporary workaround.
@@ -76,5 +76,5 @@ ExternalProject_Add(libsox | |||
DOWNLOAD_DIR ${ARCHIVE_DIR} | |||
URL https://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2 | |||
URL_HASH SHA256=81a6956d4330e75b5827316e44ae381e6f1e8928003c6aa45896da9041ea149c | |||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_codec_helper.sh ${CMAKE_CURRENT_SOURCE_DIR}/src/libsox/configure ${COMMON_ARGS} --with-lame --with-flac --with-mad --with-oggvorbis --without-alsa --without-coreaudio --without-png --without-oss --without-sndfile --with-opus | |||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_codec_helper.sh ${CMAKE_CURRENT_SOURCE_DIR}/src/libsox/configure ${COMMON_ARGS} --with-lame --with-flac --with-mad --with-oggvorbis --without-alsa --without-coreaudio --without-png --without-oss --without-sndfile --with-opus --disable-openmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment linking to this issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. added the comment to this issue.
When we're bringing this back we need to figure out how to link against the version of openmp that pytorch is linking against. |
I am not fully aware of how to do this, but there is a similar conversation going in vision, this might be the way. |
Currently `libsox` on Linux is compiled with GPU OpenMP and it interferes with the version PyTorch uses (Intel in case of binary distribution). This PR disables OpenMP support for `libsox`, while we investigate the way to use the same OpenMP as PyTorch's version.
Currently `libsox` on Linux is compiled with GPU OpenMP and it interferes with the version PyTorch uses (Intel in case of binary distribution). This PR disables OpenMP support for `libsox`, while we investigate the way to use the same OpenMP as PyTorch's version.
Sox effect functions and subprocess cause issues like #1021.
In this PR, I added the tests that mimic this issue. This test properly fails in my development env (see the log bellow), however, it somehow does not fail in our CI. Furthermore, all the tests in
test/torchaudio_unittest/sox_effects/dataset_test.py
can fail with segmentation fault on my local env, but it does not happen in our CI. My environment is very similar to the CI settings (Docker/Ubuntu + Anaconda), and I can reproduce the issue on my working env but I have not figured out the key difference between my local env and CI.What are common to these failure cases include;
sox_effects
in subprocess.fork
method.What we know is that;
fork
method, settingOMP_NUM_THREDAS=1
does not resolve the segmentation fault issue.spawn
would circumvent the segmentation fault.mp_context=multiprocessing.get_context("spawn")
in ProcessPoolExecutor will crash lhotse-speech/lhotse#126OMP_NUM_THREADS=1
helps the slowdown prepare.py slow speed k2-fsa/snowfall#18 but this affects all the operations of the application code (including PyTorch)libsox
resolves the issue. (fork
works too)-fopenmp
flag when compilinglibsox
.The above suggests that there is some sort of interference OpenMP of PyTorch (or MKL) and
libsox
.This PR disables OpenMP support of
libsox
so that, at least users won't have an issue using these functionality while we investigate the issue further.error report
This one should go to
0.7.1
release.