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

use threadpoolctl to manage openblas/mkl threading #532

Open
jmuhlich opened this issue Jan 13, 2021 · 0 comments
Open

use threadpoolctl to manage openblas/mkl threading #532

jmuhlich opened this issue Jan 13, 2021 · 0 comments

Comments

@jmuhlich
Copy link
Member

In ScipyOdeSimulator, numpy and scipy's integration with openblas and mkl causes counterproductive parallelization of linear algebra operations that doesn't speed anything up for the matrix sizes we generally deal with, and actually slows things down when our simulator tries to do its own parallelization. The threadpoolctl package is a nice generalized way to control these libraries' thread pool usage at runtime (the only other way would be to ask the user to set one of about five different environment variables depending on their platform). We should use it and default to only allowing 1 thread. Perhaps we should allow the
user to override this if they have a truly enormous model where it can make a difference, but I'm dubious.

Example:

import threadpoolctl
with threadpoolctl.threadpool_limits(1): 
    <simulate...>
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

1 participant