RSTSR OpenBLAS device
This crate enables OpenBLAS device.
For more information of OpenBLAS and its usage, we refer to document of rstsr-openblas-ffi.
Usage
use *;
use DeviceOpenBLAS;
// specify the number of threads of 16
let device = new;
// if you want to use the default number of threads, use the following line
// let device = DeviceOpenBLAS::default();
let a = linspace.into_shape;
let b = linspace.into_shape;
// by optimized BLAS, the following operation is very fast
let c = &a % &b;
// mean of all elements is also performed in parallel
let c_mean = c.mean_all;
println!;
assert!;
Important Notes
-
We do not provide automatic linkage:
- Please add
-l openblasinRUSTFLAGS, orcargo:rustc-link-lib=openblasin build.rs, or something similar, to your project. We do not use external FFI cratesblasorblas-sys, and do not automatically search OpenBLAS library for linking. - If feature
openmpactivated, please add-l gompor-l ompinRUSTFLAGS, orcargo:rustc-link-lib=gomporcargo:rustc-link-lib=ompin build.rs, or something similar, to your project. We do not use external FFI crateopenmp-sys, and do not automatically search for OpenMP library for linking.
- Please add
-
If your OpenBLAS is compiled with OpenMP, please add
openmpfeature to either this crate orrstsr-openblas-ffi.- In our testing, OpenBLAS with OpenMP is probably more efficient than pthreads. However, we currently decided not make
openmpas default feature.
- In our testing, OpenBLAS with OpenMP is probably more efficient than pthreads. However, we currently decided not make