use crate::host::PinnedBuf;
pub enum HostBuf<T> {
Owned(Vec<T>),
Pinned(PinnedBuf<T>),
}
impl<T> HostBuf<T> {
pub fn len(&self) -> usize {
match self {
HostBuf::Owned(v) => v.len(),
HostBuf::Pinned(p) => p.len(),
}
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for HostBuf<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
HostBuf::Owned(v) => f.debug_tuple("HostBuf::Owned").field(&v.len()).finish(),
HostBuf::Pinned(p) => f.debug_tuple("HostBuf::Pinned").field(&p.len()).finish(),
}
}
}
#[derive(Debug, Clone, Copy)]
pub struct DeviceLoad {
pub free_bytes: usize,
pub total_bytes: usize,
pub active_streams: u32,
pub queue_depth: u32,
pub compute_cap: (i32, i32),
}