use super::common::*;
#[cfg(feature = "rocm")]
pub mod rocm_impl {
use super::*;
pub struct RocmBackend {
#[allow(dead_code)]
devices: Vec<String>,
}
impl RocmBackend {
pub fn new() -> LinalgResult<Self> {
Ok(Self {
devices: Vec::new(),
})
}
}
impl GpuBackend for RocmBackend {
fn name(&self) -> &str {
"ROCm"
}
fn is_available(&self) -> bool {
false
}
fn list_devices(&self) -> LinalgResult<Vec<GpuDeviceInfo>> {
Ok(vec![])
}
fn create_context(&self, _device_id: usize) -> LinalgResult<Box<dyn GpuContext>> {
Err(LinalgError::ComputationError(
"ROCm backend not fully implemented".to_string(),
))
}
}
}
#[cfg(feature = "rocm")]
pub use rocm_impl::*;
#[cfg(not(feature = "rocm"))]
pub struct RocmBackend;
#[cfg(not(feature = "rocm"))]
impl RocmBackend {
pub fn new() -> LinalgResult<Self> {
Err(LinalgError::ComputationError(
"ROCm support not compiled in".to_string(),
))
}
}
#[cfg(not(feature = "rocm"))]
impl GpuBackend for RocmBackend {
fn name(&self) -> &str {
"ROCm (not available)"
}
fn is_available(&self) -> bool {
false
}
fn list_devices(&self) -> LinalgResult<Vec<GpuDeviceInfo>> {
Ok(vec![])
}
fn create_context(&self, _device_id: usize) -> LinalgResult<Box<dyn GpuContext>> {
Err(LinalgError::ComputationError(
"ROCm support not compiled in".to_string(),
))
}
}