diff --git a/src/bin/indexer.rs b/src/bin/indexer.rs index 0b1cb5977..5013a0ce9 100644 --- a/src/bin/indexer.rs +++ b/src/bin/indexer.rs @@ -40,6 +40,10 @@ struct Opt { #[structopt(long = "db", parse(from_os_str))] database: PathBuf, + /// Number of parallel jobs, defaults to # of CPUs. + #[structopt(short, long)] + jobs: Option, + /// Files to index in parallel. files_to_index: Vec, } @@ -388,6 +392,10 @@ fn compute_words_attributes_docids(wtxn: &mut heed::RwTxn, index: &Index) -> any fn main() -> anyhow::Result<()> { let opt = Opt::from_args(); + if let Some(jobs) = opt.jobs { + rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global()?; + } + std::fs::create_dir_all(&opt.database)?; let env = EnvOpenOptions::new() .map_size(100 * 1024 * 1024 * 1024) // 100 GB