LCAV / pyroomacoustics

Pyroomacoustics is a package for audio signal processing for indoor applications. It was developed as a fast prototyping platform for beamforming algorithms in indoor scenarios.
https://pyroomacoustics.readthedocs.io
MIT License
1.35k stars 419 forks source link

Wondering if there's GPU version of pyroomacoustics or any method to accelerate #267

Closed AlanLiudx closed 1 year ago

AlanLiudx commented 1 year ago

Hi @fakufaku. I'm getting more familiar with pra now and using it to generate a set of multi-channel noisy waveform with a number of 40000. Sadly, it might cost about 24 hours or so to generate the data. I wonder if there's any option for simulation acceleration or GPU version available?

fakufaku commented 1 year ago

Hi @AlanLiudx , there is no GPU support at the moment in pyroomacoustics, but you have a couple of options. 1) Parallelize: Use the python multi-processing module to generate RIR in parallel. 2) There is an alternative library gpuRIR that lets you use GPU

AlanLiudx commented 1 year ago

Thanks. I have already known gpuRIR but sadly I cannot manage to handle the environment problem to install gpuRIR on my server. I'll try multiprocessing instead.

fakufaku commented 1 year ago

I see! To get the best performance with multiprocessing it is important to reduce the number of threads used by numpy. On linux you can do it by setting the environment variable OMP_NUM_THREADS=1. If you use conda with MKL, then MKL_NUM_THREADS=1. This avoids each process over-subscribing threads. In my experience, generating 40000 RIR should take a few hours (although it depends on the number of cores available in your machine).

AlanLiudx commented 1 year ago

Yes. Actually I know little about multi-process and thread.(sigh) There will be many problems to face with.

fakufaku commented 1 year ago

This is a pretty involved example, but I have used pyroomacoustics and multiprocessing to create a dataset in this repo: https://github.com/fakufaku/create_wsj1_2345_db

I will close the issue for now, but feel free to open another issue if you have problemes related to pyroomacoustics/multiprocessing.