ekrich / sblas   0.5.0

GitHub

Scala Native BLAS (Basic Linear Algebra Subprograms) supporting Linux and macOS

Scala versions: 3.x 2.13 2.12 2.11
Scala Native versions: 0.4 0.3

sblas - Scala Native BLAS

CI

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.

Getting started

Maven Central

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 sbt, replace 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 libcblas available on the system.

Scala Build Versions

Scala Version Native (0.4.0) Native (0.4.3+) Native (0.4.10+)
2.11.x
2.12.x
2.13.x
3.x.x

Use version sblas 0.3.0 for Scala Native 0.4.0. Use version sblas 0.4.0 for Scala Native 0.4.3+ with Scala 3 support. Use version sblas 0.5.0 for Scala Native 0.4.10+.

Usage and Help

scaladoc Join chat https://gitter.im/ekrich/sblas

Reference the link above for Scaladoc. The documentation is a little sparse but hopefully will improve with time.

After 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:

Wikipedia Website:

Netlib Website:

Apple Website:

Intel Website:

IBM Website:

Versions

Release 0.5.0 - (2023-01-29)
Release 0.4.0 - (2022-02-01)
Release 0.3.0 - (2021-03-20)
Release 0.2.0 - (2019-12-05)
Release 0.1.1 - (2019-05-01)