Created: by Pradeep Gowda Updated: Jan 06, 2020 Tagged: programming-language

Futhark is a small programming language designed to be compiled to efficient parallel code. It is a statically typed, data-parallel, and purely functional array language in the ML family, and comes with a heavily optimising ahead-of-time compiler that presently generates GPU code via CUDA and OpenCL, although the language itself is hardware-agnostic and can also run on multicore CPUs. As a simple example, this function computes the average of an array of 64-bit floating-point numbers:

let average (xs: []f64) = reduce (+) 0.0 xs / r64 (length xs)

Futhark is not designed for graphics programming, but instead uses the compute power of the GPU to accelerate data-parallel array computations.

Code in Futhark