summaryrefslogtreecommitdiff
path: root/src/device.rs
diff options
context:
space:
mode:
authorlaurent <laurent.mazare@gmail.com>2023-06-21 09:13:57 +0100
committerlaurent <laurent.mazare@gmail.com>2023-06-21 09:13:57 +0100
commit8cde0c54788d7ae7c676e4f2fad5fcbc16f6980c (patch)
tree265aa584ac6cb9024716e08e38b61fe454431823 /src/device.rs
parentf319583530745dfab125bd2d16c2dfa4aa75646d (diff)
downloadcandle-8cde0c54788d7ae7c676e4f2fad5fcbc16f6980c.tar.gz
candle-8cde0c54788d7ae7c676e4f2fad5fcbc16f6980c.tar.bz2
candle-8cde0c54788d7ae7c676e4f2fad5fcbc16f6980c.zip
Add some skeleton code for GPU support.
Diffstat (limited to 'src/device.rs')
-rw-r--r--src/device.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/device.rs b/src/device.rs
index d7b724d1..c092a347 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -6,6 +6,7 @@ use crate::{
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Device {
Cpu,
+ Cuda { gpu_id: usize },
}
// TODO: Should we back the cpu implementation using the NdArray crate or similar?
@@ -72,6 +73,9 @@ impl Device {
};
Storage::Cpu(storage)
}
+ Device::Cuda { gpu_id: _ } => {
+ todo!()
+ }
}
}
@@ -91,12 +95,18 @@ impl Device {
};
Storage::Cpu(storage)
}
+ Device::Cuda { gpu_id: _ } => {
+ todo!()
+ }
}
}
pub(crate) fn tensor<A: NdArray>(&self, array: A) -> Storage {
match self {
Device::Cpu => Storage::Cpu(array.to_cpu_storage()),
+ Device::Cuda { gpu_id: _ } => {
+ todo!()
+ }
}
}
}