pub struct CuBlas { /* private fields */ }Expand description
cuBLAS handle wrapper
Implementations§
Source§impl CuBlas
impl CuBlas
Sourcepub fn new() -> CudaResult<Self>
pub fn new() -> CudaResult<Self>
Create new cuBLAS handle
Sourcepub fn set_stream(&self, stream: &CudaStream) -> CudaResult<()>
pub fn set_stream(&self, stream: &CudaStream) -> CudaResult<()>
Set stream for cuBLAS operations
Sourcepub fn sgemm(
&self,
trans_a: bool,
trans_b: bool,
m: i32,
n: i32,
k: i32,
alpha: f32,
a: *const f32,
lda: i32,
b: *const f32,
ldb: i32,
beta: f32,
c: *mut f32,
ldc: i32,
) -> CudaResult<()>
pub fn sgemm( &self, trans_a: bool, trans_b: bool, m: i32, n: i32, k: i32, alpha: f32, a: *const f32, lda: i32, b: *const f32, ldb: i32, beta: f32, c: *mut f32, ldc: i32, ) -> CudaResult<()>
SGEMM: C = alpha * op(A) * op(B) + beta * C
This is the core matrix multiplication operation.
§Arguments
trans_a- Whether to transpose Atrans_b- Whether to transpose Bm- Number of rows of op(A) and Cn- Number of columns of op(B) and Ck- Number of columns of op(A) and rows of op(B)alpha- Scalar multiplier for A*Ba- Matrix Alda- Leading dimension of Ab- Matrix Bldb- Leading dimension of Bbeta- Scalar multiplier for Cc- Matrix C (output)ldc- Leading dimension of C
Sourcepub fn saxpy(
&self,
n: i32,
alpha: f32,
x: *const f32,
incx: i32,
y: *mut f32,
incy: i32,
) -> CudaResult<()>
pub fn saxpy( &self, n: i32, alpha: f32, x: *const f32, incx: i32, y: *mut f32, incy: i32, ) -> CudaResult<()>
SAXPY: y = alpha * x + y
Sourcepub fn sdot(
&self,
n: i32,
x: *const f32,
incx: i32,
y: *const f32,
incy: i32,
) -> CudaResult<f32>
pub fn sdot( &self, n: i32, x: *const f32, incx: i32, y: *const f32, incy: i32, ) -> CudaResult<f32>
SDOT: result = x . y
Sourcepub fn snrm2(&self, n: i32, x: *const f32, incx: i32) -> CudaResult<f32>
pub fn snrm2(&self, n: i32, x: *const f32, incx: i32) -> CudaResult<f32>
SNRM2: result = ||x||_2
Sourcepub fn sscal(
&self,
n: i32,
alpha: f32,
x: *mut f32,
incx: i32,
) -> CudaResult<()>
pub fn sscal( &self, n: i32, alpha: f32, x: *mut f32, incx: i32, ) -> CudaResult<()>
SSCAL: x = alpha * x
Sourcepub fn matmul(&self, a: &CudaTensor, b: &CudaTensor) -> CudaResult<CudaTensor>
pub fn matmul(&self, a: &CudaTensor, b: &CudaTensor) -> CudaResult<CudaTensor>
Matrix multiplication for CudaTensors
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CuBlas
impl RefUnwindSafe for CuBlas
impl Unpin for CuBlas
impl UnwindSafe for CuBlas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more