PyWavelets / pywt

PyWavelets - Wavelet Transforms in Python
http://pywavelets.readthedocs.org
MIT License
1.97k stars 460 forks source link

Thread usage of pywt #707

Open stefanratea opened 3 months ago

stefanratea commented 3 months ago

Hi! Sorry to bother you with this question, but i'm very curious why does including your package in an empty script spawn 15 threads on my computer. `import pywt

while(True): print("running")`

Screenshot 2024-03-07 at 13 06 36

Your work is great, and it functions as expected. Thank you very much!

rgommers commented 3 months ago

That looks unrelated to PyWavelets. I'm guessing all it is is import numpy as np, and this is the OpenBLAS thread server. Can you please check if just importing numpy reproduces it? If so, it's known and harmless.

stefanratea commented 3 months ago

Thanks for the quick answer! Replacing pywt with numpy only created 8 threads.

Screenshot 2024-03-07 at 15 00 10

I'm not worried about harmful code getting executed, rather i'm thinking about the reserved threads on a aws server.

rgommers commented 3 months ago

I'm not sure, nothing else beyond numpy and standard library modules should be imported. You can try export OPENBLAS_NUM_THREADS=1 to see if that makes a difference. PyWavelets itself shouldn't be doing anything thread-related.