1#[derive(Debug, Clone, PartialEq)]
5pub struct CpuAffinity {
6 pub cores: Vec<usize>,
8}
9
10#[derive(Debug, Clone, PartialEq)]
12pub enum ExecutionContext {
13 Cpu {
15 affinity: Option<CpuAffinity>,
16 numa_node: Option<usize>,
17 },
18 Gpu { device_id: u32, stream: Option<u32> },
20 Heterogeneous { contexts: Vec<ExecutionContext> },
22}
23
24impl Default for ExecutionContext {
25 fn default() -> Self {
26 ExecutionContext::Cpu {
27 affinity: None,
28 numa_node: None,
29 }
30 }
31}
32
33impl ExecutionContext {
34 pub fn cpu() -> Self {
36 ExecutionContext::Cpu {
37 affinity: None,
38 numa_node: None,
39 }
40 }
41
42 pub fn gpu(device_id: u32) -> Self {
44 ExecutionContext::Gpu {
45 device_id,
46 stream: None,
47 }
48 }
49}