Skip to main content

collenchyma_blas/frameworks/cuda/
mod.rs

1//! Provides BLAS for a CUDA backend.
2#![allow(missing_docs)]
3use ::plugin::*;
4use collenchyma::backend::Backend;
5use collenchyma::tensor::ITensorDesc;
6use collenchyma::plugin::Error as PluginError;
7use collenchyma::frameworks::cuda::Cuda;
8use cublas;
9
10#[macro_use]
11pub mod helper;
12
13lazy_static! {
14    static ref CONTEXT: cublas::Context = {
15        let mut context = cublas::Context::new().unwrap();
16        context.set_pointer_mode(cublas::api::PointerMode::Device).unwrap();
17        context
18    };
19}
20
21impl Asum<f32> for Backend<Cuda> {
22    iblas_asum_for_cuda!(f32);
23}
24
25impl Axpy<f32> for Backend<Cuda> {
26    iblas_axpy_for_cuda!(f32);
27}
28
29impl Copy<f32> for Backend<Cuda> {
30    iblas_copy_for_cuda!(f32);
31}
32
33impl Dot<f32> for Backend<Cuda> {
34    iblas_dot_for_cuda!(f32);
35}
36
37impl Nrm2<f32> for Backend<Cuda> {
38    iblas_nrm2_for_cuda!(f32);
39}
40
41impl Scal<f32> for Backend<Cuda> {
42    iblas_scal_for_cuda!(f32);
43}
44
45impl Swap<f32> for Backend<Cuda> {
46    iblas_swap_for_cuda!(f32);
47}
48
49impl Gemm<f32> for Backend<Cuda> {
50    iblas_gemm_for_cuda!(f32);
51}