Struct rcublas::API

source ·
pub struct API;
Expand description

Defines the cuBLAS API.

Implementations§

source§

impl API

source

pub fn asum( context: &Context, x: *mut f32, result: *mut f32, n: i32, stride: Option<i32> ) -> Result<(), Error>

Compute the sum of magnitudes of the provided vector elements.

x: pointer to input vector. result: pointer to output scalar. n: number of elements to compute sum over (should not be greater than x). stride: offset from one input element to the next. Defaults to 1.

source

pub fn axpy( context: &Context, alpha: *mut f32, x: *mut f32, y: *mut f32, n: i32, stride_x: Option<i32>, stride_y: Option<i32> ) -> Result<(), Error>

Computes a vector-scalar product and adds the result to a vector.

alpha: pointer to input scalar. x: pointer to input vector. y: pointer to output vector. n: number of elements to use for operation (should not be greater than number of elements in x or y). stride_x: offset from one element in x to the next. Defaults to 1. stride_y: offset from one element in y to the next. Defaults to 1.

source

pub fn copy( context: &Context, x: *mut f32, y: *mut f32, n: i32, stride_x: Option<i32>, stride_y: Option<i32> ) -> Result<(), Error>

Copies a vector into another vector.

x: pointer to input vector. y: pointer to output vector. n: number of elements to use for operation (should not be greater than number of elements in x or y). stride_x: offset from one element in x to the next. Defaults to 1. stride_y: offset from one element in y to the next. Defaults to 1.

source

pub fn dot( context: &Context, x: *mut f32, y: *mut f32, result: *mut f32, n: i32, stride_x: Option<i32>, stride_y: Option<i32> ) -> Result<(), Error>

TODO: DOC

source

pub fn nrm2( context: &Context, x: *mut f32, result: *mut f32, n: i32, stride_x: Option<i32> ) -> Result<(), Error>

TODO: DOC

source

pub fn scal( context: &Context, alpha: *mut f32, x: *mut f32, n: i32, stride_x: Option<i32> ) -> Result<(), Error>

TODO: DOC

source

pub fn swap( context: &Context, x: *mut f32, y: *mut f32, n: i32, stride_x: Option<i32>, stride_y: Option<i32> ) -> Result<(), Error>

TODO: DOC

source§

impl API

source

pub fn gemm( context: &Context, transa: Operation, transb: Operation, m: i32, n: i32, k: i32, alpha: *mut f32, a: *mut f32, lda: i32, b: *mut f32, ldb: i32, beta: *mut f32, c: *mut f32, ldc: i32 ) -> Result<(), Error>

Performs a general matrix-matrix multiplication.

Note: the matrices are expected to be ordered column-major (FORTRAN-style).

source§

impl API

source

pub fn create() -> Result<Context, Error>

Create a new cuBLAS context, allocating resources on the host and the GPU.

The returned Context must be provided to future cuBLAS calls. Creating contexts all the time can lead to performance problems. Generally one Context per GPU device and configuration is recommended.

source

pub unsafe fn destroy(context: &mut Context) -> Result<(), Error>

Destroys the cuBLAS context, freeing its resources.

Should generally not be called directly. Automatically called when dropping a Context.

§Safety

Instructs CUDA to remove the cuBLAS handle, causing any further instructions to fail. This should be called at the end of using cuBLAS and should ideally be handled by drop exclusively, and never called by the user.

source

pub fn get_version(context: &Context) -> Result<i32, Error>

Get CUBLAS Version

source

pub fn get_pointer_mode(context: &Context) -> Result<PointerMode, Error>

Retrieve the pointer mode for a given cuBLAS context.

source

pub fn set_pointer_mode( context: &mut Context, pointer_mode: PointerMode ) -> Result<(), Error>

Set the pointer mode for a given cuBLAS context.

Trait Implementations§

source§

impl Clone for API

source§

fn clone(&self) -> API

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for API

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for API

Auto Trait Implementations§

§

impl RefUnwindSafe for API

§

impl Send for API

§

impl Sync for API

§

impl Unpin for API

§

impl UnwindSafe for API

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.