# Futhark

- Page: https://shared.btbytes.com/p/futhark
- Date: 2020-01-06
- Tags: programming-language

[Futhark](https://futhark-lang.org/)  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

* [Futhark by Example](https://futhark-lang.org/examples.html)
* [vmchale/phash-fut: Perceptual hash in Futhark](https://github.com/vmchale/phash-fut)
* [vmchale/kullback-liebler: Kullback-Liebler divergence in Futhark](https://github.com/vmchale/kullback-liebler#comparison)
