-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from QuState/options
Options WIP
- Loading branch information
Showing
2 changed files
with
39 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// Options to tune to improve performance depending on the hardware and input size. | ||
/// | ||
/// Calling FFT routines without specifying options will automatically select reasonable defaults | ||
/// depending on the input size and other factors. | ||
/// | ||
/// You only need to tune these options if you are trying to squeeze maximum performance | ||
/// out of a known hardware platform that you can bechmark at varying input sizes. | ||
#[non_exhaustive] | ||
#[derive(Debug, Clone, Default)] | ||
pub struct Options { | ||
/// Whether to run bit reversal step in 2 threads instead of one. | ||
/// This is beneficial only at large input sizes (i.e. gigabytes of data). | ||
/// The exact threshold where it starts being beneficial varies depending on the hardware. | ||
pub multithreaded_bit_reversal: bool, | ||
} | ||
|
||
impl Options { | ||
pub(crate) fn guess_options(input_size: usize) -> Options { | ||
let mut options = Options::default(); | ||
let n: usize = input_size.ilog2() as usize; | ||
options.multithreaded_bit_reversal = n >= 22; | ||
options | ||
} | ||
} |