(
kind: &ResourceDescriptorKind,
)
| 70 | } |
| 71 | |
| 72 | pub fn prune_hyper_threading( |
| 73 | kind: &ResourceDescriptorKind, |
| 74 | ) -> anyhow::Result<ResourceDescriptorKind> { |
| 75 | let groups = kind.as_groups(); |
| 76 | let mut new_desc = Vec::new(); |
| 77 | for group in groups { |
| 78 | let mut new_group = Vec::new(); |
| 79 | for cpu_id in group { |
| 80 | if read_linux_thread_siblings(&cpu_id)? |
| 81 | .iter() |
| 82 | .min() |
| 83 | .ok_or_else(|| anyhow::anyhow!("Thread siblings are empty")) |
| 84 | .map(|v| *v == cpu_id)? |
| 85 | { |
| 86 | new_group.push(cpu_id); |
| 87 | } |
| 88 | } |
| 89 | new_desc.push(new_group); |
| 90 | } |
| 91 | Ok(ResourceDescriptorKind::groups(new_desc).unwrap()) |
| 92 | } |
| 93 | |
| 94 | /// Detects additional resources (apart from CPU) on this worker. |
| 95 | /// Also returns the detected GPU families. |
no test coverage detected