Embedding OpenCL in GHC Haskell

Benedict R. Gaster and J. Garrett Morris

In Proceedings of MULTIPROG’13. 2013.


OpenCL defines a computation model for data-parallel code, supporting compilation to a variety of platforms, including both conventional x86 CPUs and commodity graphics hardware. OpenCL consists of both a programming language for writing data parallel code, called ker- nels, and an API, written in C, for interacting with the OpenCL platform and invoking OpenCL kernels. We describe a library to enable Haskell programmers to access the OpenCL APIs in an idiomatic fashion, elimi- nating much of the complexity of interacting with the OpenCL platform and providing stronger static guarantees than are possible in existing APIs.