sklears_compose/resource_management/
gpu_manager.rs1use super::resource_types::GpuAllocation;
4use sklears_core::error::Result as SklResult;
5use std::collections::HashMap;
6
7#[derive(Debug)]
9pub struct GpuResourceManager {
10 devices: Vec<GpuDevice>,
12 allocations: HashMap<String, GpuAllocation>,
14}
15
16#[derive(Debug, Clone)]
18pub struct GpuDevice {
19 pub device_id: String,
21 pub name: String,
23 pub memory_size: u64,
25 pub available_memory: u64,
27}
28
29impl Default for GpuResourceManager {
30 fn default() -> Self {
31 Self::new()
32 }
33}
34
35impl GpuResourceManager {
36 #[must_use]
38 pub fn new() -> Self {
39 Self {
40 devices: Vec::new(),
41 allocations: HashMap::new(),
42 }
43 }
44
45 pub fn allocate_gpu(&mut self, device_count: usize) -> SklResult<GpuAllocation> {
47 Ok(GpuAllocation {
48 devices: Vec::new(),
49 memory_pools: Vec::new(),
50 compute_streams: Vec::new(),
51 context: None,
52 })
53 }
54
55 pub fn release_gpu(&mut self, allocation: &GpuAllocation) -> SklResult<()> {
57 Ok(())
58 }
59}