Geoffrey Mainland

Fork me on GitHub

Nikola

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

Nikola: Embedding Compiled GPU Functions in Haskell. Geoffrey Mainland and Greg Morrisett. Proceedings of the 2010 ACM SIGPLAN Symposium on Haskell (Haskell '10), 2010.
[doi] [pdf] [bib]

@inproceedings{mainland10nikola,
 author = {Geoffrey Mainland and Greg Morrisett},
 title = {Nikola: Embedding Compiled {GPU} Functions in {H}askell},
 booktitle = {Proceedings of the third ACM SIGPLAN {S}ymposium on {H}askell},
 series = {Haskell '10},
 year = {2010},
 pages = {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!