From c449f65b12544725c0eb2b3aeb1e64c11614db13 Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Sun, 14 Apr 2024 23:02:03 +0200 Subject: Expose the synchronize function on the generic device. (#2062) --- candle-core/src/device.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'candle-core') diff --git a/candle-core/src/device.rs b/candle-core/src/device.rs index 846c62ce..d0bec4f7 100644 --- a/candle-core/src/device.rs +++ b/candle-core/src/device.rs @@ -337,4 +337,12 @@ impl Device { } } } + + pub fn synchronize(&self) -> Result<()> { + match self { + Self::Cpu => Ok(()), + Self::Cuda(d) => d.synchronize(), + Self::Metal(d) => d.synchronize(), + } + } } -- cgit v1.2.3