-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add a global variable to set number of parallel threads #336
Conversation
The Rust package GSTools-core is now ready for setting the number of parallel threads and I'm quite happy with the implementation. For Cython, I used a bit of an ugly function to set defaults, without having to use Python variables. I think the only thing left would be to update the changelog, if the review gets through ;-) |
See #337 for rtd issue. |
This looks promising. Was also winding my head around the fact, that Is it testable how many cores are used during a function call? This could be cool to check if the setting is actually working. |
I mean, we could get the numbers of cores in Regarding the testing, I think it's difficult to accurately test the number of threads used, if we don's simply want to check for the |
Created an issue in cython for prange: cython/cython#5952 |
As pointed out by pavlovc2 in discussion #333, it would be helpful to set the number of parallel threads in GSTools directly and not only rely on environment variables.
I didn't have a lot of time to put this together, but in this first draft, you can set the number of threads with the global variable
config.NUM_THREADS
. At the moment, this only works with the Cython code and not with the Rust code. And also, for now, the default value of threads is 1.TODO
num_threads=None
in the Cython code