summaryrefslogtreecommitdiff
path: root/candle-core/src/cuda_backend.rs
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-07-23 12:31:17 +0200
committerGitHub <noreply@github.com>2023-07-23 11:31:17 +0100
commite449ce53a2f3c85f23ca0f2e7d557a0d0003e0ca (patch)
treeb908de30c669bbbf20edb1604caec3450f76a01d /candle-core/src/cuda_backend.rs
parentb8a10425ad550b04ccf3b5ff2493714615d7df4b (diff)
downloadcandle-e449ce53a2f3c85f23ca0f2e7d557a0d0003e0ca.tar.gz
candle-e449ce53a2f3c85f23ca0f2e7d557a0d0003e0ca.tar.bz2
candle-e449ce53a2f3c85f23ca0f2e7d557a0d0003e0ca.zip
Wrapping code to call the custom op. (#225)
* Wrapping code to call the custom op. * Get the rms example to work. * Get around rustfmt failing in the CI. * Fix the rms computation.
Diffstat (limited to 'candle-core/src/cuda_backend.rs')
-rw-r--r--candle-core/src/cuda_backend.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/candle-core/src/cuda_backend.rs b/candle-core/src/cuda_backend.rs
index d2cc3e41..5e362041 100644
--- a/candle-core/src/cuda_backend.rs
+++ b/candle-core/src/cuda_backend.rs
@@ -2,6 +2,7 @@ use crate::backend::{BackendDevice, BackendStorage};
use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT};
use crate::{CpuStorage, DType, Layout, Result, Shape, WithDType};
use candle_kernels as kernels;
+pub use cudarc;
use cudarc::cublas::{Gemm, GemmConfig, StridedBatchedConfig};
use cudarc::driver::{
CudaFunction, CudaSlice, DeviceRepr, DeviceSlice, LaunchAsync, LaunchConfig, ValidAsZeroBits,
@@ -101,7 +102,7 @@ impl std::ops::Deref for CudaDevice {
}
}
-trait WrapErr<O> {
+pub trait WrapErr<O> {
fn w(self) -> std::result::Result<O, crate::Error>;
}
@@ -171,7 +172,7 @@ impl CudaDevice {
})
}
- fn get_or_load_func(&self, module_name: &str, ptx: &'static str) -> Result<CudaFunction> {
+ pub fn get_or_load_func(&self, module_name: &str, ptx: &'static str) -> Result<CudaFunction> {
if !self.has_func(module_name, module_name) {
// Leaking the string here is a bit sad but we need a &'static str and this is only
// done once per kernel name.