1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#![allow(dead_code)]
use crate::{CpuStorage, DType, Error, Result, Shape};
pub type CudaError = std::io::Error;
#[derive(Debug, Clone)]
pub struct CudaDevice;
macro_rules! fail {
() => {
unimplemented!("cuda support has not been enabled")
};
}
impl CudaDevice {
pub(crate) fn new(_: usize) -> Result<Self> {
Err(Error::NotCompiledWithCudaSupport)
}
pub(crate) fn ordinal(&self) -> usize {
fail!()
}
pub(crate) fn zeros_impl(&self, _shape: &Shape, _dtype: DType) -> Result<CudaStorage> {
Err(Error::NotCompiledWithCudaSupport)
}
pub(crate) fn ones_impl(&self, _shape: &Shape, _dtype: DType) -> Result<CudaStorage> {
Err(Error::NotCompiledWithCudaSupport)
}
pub(crate) fn cuda_from_cpu_storage(&self, _: &CpuStorage) -> Result<CudaStorage> {
Err(Error::NotCompiledWithCudaSupport)
}
}
#[derive(Debug, Clone)]
pub struct CudaStorage;
impl CudaStorage {
pub fn dtype(&self) -> DType {
fail!()
}
pub fn device(&self) -> CudaDevice {
fail!()
}
pub(crate) fn to_cpu_storage(&self) -> Result<CpuStorage> {
Err(Error::NotCompiledWithCudaSupport)
}
pub(crate) fn affine_impl(&self, _: &Shape, _: &[usize], _: f64, _: f64) -> Result<Self> {
Err(Error::NotCompiledWithCudaSupport)
}
}
|