-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add get_num_threads This commit adds `get_num_threads`, which returns the number of threads used by the planner, and is the complement to `set_num_threads`. This simply wraps the function `fftw_planner_nthreads`, which was [newly added to fftw in version 3.3.9](https://github.com/FFTW/fftw3/blob/34082eb5d6ed7dc9436915df69f376c06fc39762/NEWS#L3). * Set FFTW_jll compat to 3.3.9 `get_num_threads` requires FFTW_jll v3.3.9+7, but it doesn't seem possible to specify a particular build in the compat section of Project.toml files. However, this should work in most cases, as the most recent build of `FFTW_jll` should be downloaded upon updating. * bump to 1.3 for the new function * Make test for get_num_threads fftw specific No equivalent function for mkl * Typo... * another typo * Add vendor check to `get_num_threads` * Add a method of `set_num_threads` that restores the original nthreads Additionally, separate previous `set_num_threads` method into a base function, `_set_num_threads`, that wraps the `ccalls`, and `set_num_threads`, which will acquire the `fftwlock`. * Provide support for `get_num_threads` with MKL's FFTW While MKL's FFTW does not provide access to the number of threads available to the planner, this can be simulated by caching the value last passed to `set_num_threads` and returning it with `get_num_threads` if `fftw_vendor == :mkl`. * Implement suggestions of @stevengj * Fix typo in set_num_threads * Add test for set_num_threads method that restores original num_threads * Rename `nthreads` variable to `num_threads` to avoid shadowing Threads.nthreads Since FFTW uses `Base.Threads`, and `nthreads` is a function defined in `Base.Threads`, then the function argument `nthreads` shadows a function already in the namespace of every function. While there is no inherent issue with this, it can make debugging this code more confusing. * Make one-line method of `set_num_threads` one line. * First attempt at adding `num_threads` to `plan_...` functions As suggested by @stevengj, I have add a `num_threads` keyword to the `plan_...` functions. My approach here is fairly naive, and adds a bunch of redundant boiler plate code to every `plan_` function. Co-authored-by: Steven G. Johnson <[email protected]> Co-authored-by: Mosè Giordano <[email protected]>
- Loading branch information
1 parent
683a6e8
commit 17bc81a
Showing
5 changed files
with
128 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17bc81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
17bc81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/62829
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: