This is a Summer Internship project from 2023. Numskull is a NumPy-like library for Haskell, featuring NdArrays which can be created and manipulated to store many different types (of the DType class).
Numskull was designed for purposes of integration into an Onnx backend, but it can be used anywhere you need to operate on arrays of unspecified type and shape.
For more information, have a look at my talk: slides.
To run the demo you need
- jupyter
- iHaskell (https://github.com/IHaskell/IHaskell) to put Numskull code into a jupyter notebook.
- nix-shell
- cd demo/notebook/
- ./start.sh
Note that the work in main is Numskull 1.0. Numskull 2.0 can be found in the so-called branch! The second version is less well tested and complete, but should be more efficient since it makes use of strides. I didn't have time to integrate that into the Onnx backend, but it shouldn't be at all difficult to do so. There is an open pull request so it's easy to find.
This builds like any Cabal project with cabal build
, cabal repl
, etc.
Run the benchmark with
$ cabal run bench
The benchmark depends on the hmatrix
library, which depends on the blas and
lapack non-Haskell libraries, so you may need to install these to your system
first (they may be called e.g. libblas-dev
or liblapack-dev
in your package
manager).
There is a default.nix
so the project can be built with nix-build
, and a
shell.nix
for a development shell with nix-shell
.
Dependencies are maintained using niv
in nix/sources.json
.
If any source repositories are specified in cabal.project
, they should be
kept up to date with the sources specified in nix/sources.json
.
numskull.nix
should be updated with
$ cabal2nix . > numskull.nix
whenever the Cabal file is updated with e.g. new dependencies.
Within a Nix shell, ideally you build the project with
cabal build --project-file=cabal-nix.project
to avoid fetching and building
dependencies specifid in cabal.project
which are only intended for the
non-Nix build.