Fork me on GitHub

Nikola is a first-order language of array computations embedded in Haskell that compiles to GPUs via CUDA using type-directed techniques that support re-usable computations. Nikola automatically handles a range of low-level details for Haskell programmers, such as marshaling data to/from the GPU, size inference for buffers, memory management, and automatic loop parallelization. Additionally, Nikola supports both compile-time and run-time code generation, making it possible for programmers to choose when and where to specialize embedded programs.

The programmer uses higher-order abstract syntax (HOAS) to write Nikola programs, e.g., Nikola functions are represented by Haskell functions, and Nikola values by Haskell values. Internally, the HOAS representation is converted to a first-order data type representation and then compiled, but the programmer is never exposed to these details. We show how to preserve the implicit sharing present in Haskell let-bindings as explicit sharing in the first-order representation, even for functions that are applied. That is, HOAS function applications are reified as function calls in the first-order representation.

Nikola Publications

  1. Mainland, G. and Morrisett, G. 2010. Nikola: Embedding Compiled GPU Functions in Haskell. Proceedings of the Third ACM Symposium on Haskell (Haskell ’10) (Baltimore, MD, Sep. 2010), 67–78.

Nikola Distribution

The current version of Nikola is available on github. It is compatible with GHC versions 7.4 and 7.6. Please let me know if you use Nikola!