diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2024-04-14 23:02:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-14 23:02:03 +0200 |
commit | c449f65b12544725c0eb2b3aeb1e64c11614db13 (patch) | |
tree | 1d9b983222e9155a6f4fd9bafc1d294ca59fc8e9 /candle-core | |
parent | db7dbf3071e2da47314096bb04d8f4d99626d4ca (diff) | |
download | candle-c449f65b12544725c0eb2b3aeb1e64c11614db13.tar.gz candle-c449f65b12544725c0eb2b3aeb1e64c11614db13.tar.bz2 candle-c449f65b12544725c0eb2b3aeb1e64c11614db13.zip |
Expose the synchronize function on the generic device. (#2062)
Diffstat (limited to 'candle-core')
-rw-r--r-- | candle-core/src/device.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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(), + } + } } |