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

Sox transforms work on CUDA tensors? #1452

Closed
turian opened this issue Apr 13, 2021 · 8 comments
Closed

Sox transforms work on CUDA tensors? #1452

turian opened this issue Apr 13, 2021 · 8 comments

Comments

@turian
Copy link

turian commented Apr 13, 2021

❓ Questions and Help

Do Sox transforms work on CUDA tensors? Or do they transfer the tensor to CPU and process there?

@mthrok
Copy link
Collaborator

mthrok commented Apr 13, 2021

Hi @turian

If what you mean by "Sox transforms" is the filtering functions implemented in torchaudio.functional, (found under the category of filtering in the official doc), then they work with CUDA. You can pass Tensors transferred to CUDA and filtering functions will perform the operation in CUDA. (however this does not necessarily faster than CPU, because torchaudio does not have efficient CUDA-specific implementation)

If you mean functions under torchaudio.sox_effects, then no. They only support CPU and functions will raise an error.

Either way, functions in torchaudio do not automatically transfer Tensors across devices. It's up to users to move Tensor to an appropriate device.

@turian
Copy link
Author

turian commented Apr 15, 2021

Thanks, my question was about torchaudio.sox_effects. Perhaps this could be added to the docs, just to be clear?

@mthrok
Copy link
Collaborator

mthrok commented Apr 15, 2021

Hi @turian

Thanks for the suggestion. I agree. this can be better explained in the doc.
I filed issue #1456. If no one picks up, I will work on it before the next release.

@turian
Copy link
Author

turian commented Apr 16, 2021

Thank you

@turian turian closed this as completed Apr 16, 2021
@rien333
Copy link

rien333 commented Apr 18, 2021

Any chance if sox effects ever working with CUDA, or is that unrealistic?

@mthrok
Copy link
Collaborator

mthrok commented Apr 19, 2021

Hi @rien333

It's not impossible but it's a huge amount of work, and our engineering resource is very limited at the moment. So, yeah unfortunately it's unrealistic.

Right now, we have some filters re-implemented with PyTorch's generic Tensor operations. They are compatible with CUDA, but when tensors are moved to CUDA, operations become slower than CPU. Efficient filtering in CUDA requires implementations appropriate for CUDA style parallel computation.

@turian
Copy link
Author

turian commented Apr 21, 2021

Thank you @mthrok for your wonderful work. Shinji speaks very highly of your project to me.

@mthrok
Copy link
Collaborator

mthrok commented Apr 21, 2021

@turian

Thanks for the such nice comments. I try to keep the bar high, but libraries cannot exist without users, so let's make something interesting together. :)

mthrok pushed a commit to mthrok/audio that referenced this issue Dec 13, 2022
Co-authored-by: Brian Johnson <brianjo@fb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants