summaryrefslogtreecommitdiff
path: root/candle-core/src/utils.rs
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-07-15 08:25:15 +0100
committerGitHub <noreply@github.com>2023-07-15 08:25:15 +0100
commit66750f98271dc852464d55689ca2d29f04f3fa34 (patch)
tree00fb0c302205dcddd97e58d674c2198f837d3f8b /candle-core/src/utils.rs
parent2ddda706bde9936cbc8f90142ed4acc43390904e (diff)
downloadcandle-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.rs7
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;
+}