sblas - Scala Native BLAS
This library implements BLAS (Basic Linear Algebra Subprograms) in the form of CBLAS for the Scala Native platform. Scala Native is a unique platform that marries the high level language of Scala but compiles to native code with a lightweight managed runtime which includes a state of the art garbage collector. The combination allows for great programming and the ability to use high performance C language libraries like CBLAS.
Scala Native uses the Scala compiler to produce NIR (Native Intermediate Representation) that is optimized and then converted to LLVM IR. Finally LLVM code is optimized and compiled by Clang to produce a native executable.
If you are already familiar with Scala Native you can jump right in by adding the following dependency in your
sbt build file.
libraryDependencies += "org.ekrich" %%% "sblas" % "x.y.z"
To use in
x.y.z with the version from Maven Central badge above. All available versions can be seen at the Maven Repository.
Otherwise follow the Getting Started instructions for Scala Native if you are not already setup.
Additional libraries that need to be installed on you system are as follows:
- Linux/Ubuntu you need to install ATLAS for CBLAS support.
$ sudo apt-get install libatlas-base-dev
macOS has CBLAS pre-installed as part of the Accelerate Framework.
Other OSes need to have
libcblasavailable on the system.
Usage and Help
Reference the link above for Scaladoc. The documentation is a little sparse but hopefully will improve with time.
sbt is installed and any other Scala Native prerequisites are met you can use the following Gitter G8 template instructions to get a fully functional Scala Native application with a couple of BLAS examples in the body of the main program.
$ sbt new ekrich/sblas.g8 $ cd <directory entered after the prompt> $ sbt run
In addition, look at the sblas unit tests for other examples of usage.
BLAS References and External Documentation
Some useful links are as follows which are also in the LICENSE.md file as some of the Scaladoc was sourced from these references: