quantrs2_sim/automatic_parallelization/
autoparallelengine_detect_hardware_characteristics_group.rs1use super::types::HardwareCharacteristics;
8
9use super::autoparallelengine_type::AutoParallelEngine;
10
11impl AutoParallelEngine {
12 pub(super) fn detect_hardware_characteristics() -> HardwareCharacteristics {
14 use scirs2_core::parallel_ops::current_num_threads;
15 let num_cores = current_num_threads();
16 let l1_cache_size = 32 * 1024;
17 let l2_cache_size = 256 * 1024;
18 let l3_cache_size = 8 * 1024 * 1024;
19 let memory_bandwidth = 50.0;
20 let num_numa_nodes = if num_cores > 32 { 2 } else { 1 };
21 let has_gpu = false;
22 #[cfg(target_arch = "x86_64")]
23 let simd_width = 256;
24 #[cfg(not(target_arch = "x86_64"))]
25 let simd_width = 128;
26 HardwareCharacteristics {
27 num_cores,
28 l1_cache_size,
29 l2_cache_size,
30 l3_cache_size,
31 memory_bandwidth,
32 num_numa_nodes,
33 has_gpu,
34 simd_width,
35 }
36 }
37}