diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-07-15 08:25:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-15 08:25:15 +0100 |
commit | 66750f98271dc852464d55689ca2d29f04f3fa34 (patch) | |
tree | 00fb0c302205dcddd97e58d674c2198f837d3f8b /candle-core/src/utils.rs | |
parent | 2ddda706bde9936cbc8f90142ed4acc43390904e (diff) | |
download | candle-66750f98271dc852464d55689ca2d29f04f3fa34.tar.gz candle-66750f98271dc852464d55689ca2d29f04f3fa34.tar.bz2 candle-66750f98271dc852464d55689ca2d29f04f3fa34.zip |
Add some 'cuda-if-available' helper function. (#172)
Diffstat (limited to 'candle-core/src/utils.rs')
-rw-r--r-- | candle-core/src/utils.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/candle-core/src/utils.rs b/candle-core/src/utils.rs index b5621e56..895c97e1 100644 --- a/candle-core/src/utils.rs +++ b/candle-core/src/utils.rs @@ -17,3 +17,10 @@ pub fn has_mkl() -> bool { #[cfg(not(feature = "mkl"))] return false; } + +pub fn cuda_is_available() -> bool { + #[cfg(feature = "cuda")] + return true; + #[cfg(not(feature = "cuda"))] + return false; +} |