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

Too many threads spawed in DANCo().fit() #7

Open
jshleap opened this issue Jun 3, 2021 · 3 comments
Open

Too many threads spawed in DANCo().fit() #7

jshleap opened this issue Jun 3, 2021 · 3 comments

Comments

@jshleap
Copy link

jshleap commented Jun 3, 2021

Hello, I am an HPC technichal consultant and one of our users is using your package. The function skdim.id.DANCo().fit(data) seems to be spawning a significant number of threads with no apparent way to control the number. In an HPC environment, this is an issue. Is this intended?

@j-bac
Copy link
Collaborator

j-bac commented Jun 3, 2021

Hi, thanks for reporting this ! The function does not use any library for multithreading or multiprocessing.
This likely comes from underlying libraries such as numpy which have implicit parallelism (see numpy/numpy#11826)

Maybe adding this line at the beginning of the script would fix this ?
import os os.environ['OMP_NUM_THREADS']= "1")

@jshleap
Copy link
Author

jshleap commented Jun 3, 2021

Hi! The user already has the OMP_NUM_THREADS and MKL_NUM_THREADS to 1. Also, the number of threads created is in the hundreds, which leaves me to believe that is related to the dimensions or the number of timesteps. So there is something underlying this beyond the openblas/mkl threads

@j-bac
Copy link
Collaborator

j-bac commented Jun 3, 2021

I see, then I am a bit confused what can be causing this and how to fix it. I will try to reproduce this

In the meantime maybe one of the solutions here could be a workaround:
https://stackoverflow.com/questions/30791550/limit-number-of-threads-in-numpy

In particular answers by Josh Broomberg and by Amir

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

2 participants