src/main.rs

changeset 5
df971c81282e
parent 0
eb3c7813b67a
child 6
bcb508479948
equal deleted inserted replaced
0:eb3c7813b67a 5:df971c81282e
13 #![feature(drain_filter)] 13 #![feature(drain_filter)]
14 14
15 use clap::Parser; 15 use clap::Parser;
16 use itertools::Itertools; 16 use itertools::Itertools;
17 use serde_json; 17 use serde_json;
18 use std::num::NonZeroUsize;
19
18 use alg_tools::iterate::Verbose; 20 use alg_tools::iterate::Verbose;
19 use alg_tools::parallelism::{ 21 use alg_tools::parallelism::{
20 set_num_threads, 22 set_num_threads,
21 set_max_threads, 23 set_max_threads,
22 }; 24 };
23 use std::num::NonZeroUsize;
24 25
25 pub mod types; 26 pub mod types;
26 pub mod measures; 27 pub mod measures;
27 pub mod fourier; 28 pub mod fourier;
28 pub mod kernels; 29 pub mod kernels;
195 } 196 }
196 197
197 /// The entry point for the program. 198 /// The entry point for the program.
198 pub fn main() { 199 pub fn main() {
199 let cli = CommandLineArgs::parse(); 200 let cli = CommandLineArgs::parse();
201
202 #[cfg(debug_assertions)]
203 {
204 use colored::Colorize;
205 println!("{}", format!("\n\
206 ********\n\
207 WARNING: Compiled without optimisations; {}\n\
208 Please recompile with `--release` flag.\n\
209 ********\n\
210 ", "performance will be poor!".blink()
211 ).red());
212 }
200 213
201 if let Some(n_threads) = cli.num_threads { 214 if let Some(n_threads) = cli.num_threads {
202 let n = NonZeroUsize::new(n_threads).expect("Invalid thread count"); 215 let n = NonZeroUsize::new(n_threads).expect("Invalid thread count");
203 set_num_threads(n); 216 set_num_threads(n);
204 } else { 217 } else {

mercurial