collenchyma_blas/
lib.rs

1//! Provides backend-agnostic BLAS operations for [Collenchyma][collenchyma].
2//!
3//! BLAS (Basic Linear Algebra Subprograms) is a specification that prescribes a set of low-level
4//! routines for performing common linear algebra operations such as vector addition, scalar
5//! multiplication, dot products, linear combinations, and matrix multiplication. They are the de
6//! facto standard low-level routines for linear algebra libraries; the routines have bindings for
7//! both C and Fortran. Although the BLAS specification is general, BLAS implementations are often
8//! optimized for speed on a particular machine, so using them can bring substantial performance
9//! benefits. BLAS implementations will take advantage of special floating point hardware such as
10//! vector registers or SIMD instructions.<br/>
11//! [Source][blas-source]
12//!
13//! ## Overview
14//!
15//! A Collenchyma Plugin describes the functionality through three types of traits.
16//!
17//! * __PluginTrait__ -> IBlas<br/>
18//! This trait provides 'provided methods', which already specify the exact, backend-agnostic
19//! behavior of an Operation. These come in two forms `operation()` and `operation_plain()`,
20//! where the first takes care of full memory management and the later one just provides the computation
21//! without any memory management. In some scenarios you would like to use the plain operation for faster
22//! exection.
23//!
24//! * __BinaryTrait__ -> IBlasBinary<br>
25//! The binary trait provides the actual and potentially initialized Functions, which are able to compute
26//! the Operations (as they implement the OperationTrait).
27//!
28//! * __OperationTrait__ -> e.g. IOperationDot<br/>
29//! The PluginTrait can provide 'provided methods', thanks to the OperationTrait. The OperationTrait,
30//! has one required method `compute` which every Framework Function will implement on it's own way.
31//!
32//! Beside these traits a Collenchyma Plugin might also use macros for faster
33//! implementation for various Collenchyma Frameworks such as CUDA, OpenCL or common host CPU.
34//!
35//! Beside these generic functionality through traits, a Plugin also extends the Collenchyma Backend
36//! with implementations of the generic functionality for the Collenchyma Frameworks.
37//!
38//! For more information, give the [Collenchyma docs][collenchyma-docs] a visit.
39//!
40//! [collenchyma]: https://github.com/autumnai/collenchyma
41//! [collenchyma-docs]: http://autumnai.github.io/collenchyma
42//! [blas-source]: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms
43#![cfg_attr(lint, feature(plugin))]
44#![cfg_attr(lint, plugin(clippy))]
45#![allow(dead_code)]
46#![deny(missing_docs,
47        missing_debug_implementations, missing_copy_implementations,
48        trivial_casts, trivial_numeric_casts,
49        unused_import_braces, unused_qualifications)]
50
51#[macro_use]
52extern crate lazy_static;
53
54extern crate collenchyma;
55#[cfg(feature = "native")]
56extern crate rblas;
57#[cfg(feature = "cuda")]
58extern crate cublas;
59
60pub mod plugin;
61pub mod binary;
62pub mod operation;
63pub mod transpose;
64#[macro_use]
65pub mod helper;
66pub mod frameworks;