Why Futhark?

tosh1 pts0 comments

Why Futhark?

The Futhark Programming Language

High-performance purely functional data-parallel array programming

Overview<br>Examples<br>Docs<br>Publications<br>Gotta Go Fast!<br>Get Involved<br>Blog

Fork me on GitHub

Why Futhark?

Because it's nicer than writing CUDA or OpenCL by hand!

Futhark is a small programming language designed to be compiled to<br>efficient parallel code. It is a statically typed, data-parallel, and<br>purely functional array language in the ML family, and comes with a<br>heavily optimising ahead-of-time compiler that presently generates<br>either GPU code via CUDA and<br>OpenCL, or multi-threaded CPU<br>code. As a simple example, this function computes the average of an<br>array of 64-bit floating-point numbers:

def average (xs: []f64) = reduce (+) 0 xs / f64.i64 (length xs)

Quick links

Playground

REPL

Installation

Tutorial

User's guide

Language<br>reference

Prelude

More packages

Futhark is not designed for graphics programming, but can instead use<br>the compute power of the GPU to accelerate data-parallel array<br>computations. The language supports regular nested<br>data-parallelism and automatic differentiation , as well as a<br>form of imperative-style in-place modification of arrays, while still<br>preserving the purity of the language via the use of a uniqueness<br>type system .

While the Futhark language and compiler is an ongoing research<br>project , it is quite usable for real programming, and can compile<br>nontrivial programs which then run on real machines at high speed.

Futhark is a simple language and is designed to be easy to learn,<br>although it omits some common features in order to generate<br>high-performance parallel code. Nevertheless, Futhark can already be<br>used for nontrivial programs . We are actively looking for more<br>potential applications as well as people who are interested in<br>contributing to the language design.

Futhark is not intended to replace existing general-purpose<br>languages . The intended use case is that Futhark is only used for<br>relatively small but compute-intensive parts of an application. The<br>Futhark compiler generates code that can be easily integrated with<br>non-Futhark code . For example, you can compile a Futhark program to a<br>Python module that internally uses<br>PyOpenCL to execute code<br>on the GPU, yet looks like any other Python module from the outside<br>(more on this here). The<br>Futhark compiler will also generate more conventional C code, which can<br>be accessed from any language with a basic FFI (an example<br>here).

For more information, you can look at code examples,<br>details on performance, our devblog,<br>or maybe the docs, which also contains a list of our<br>publications. You can of course also visit our<br>main repository on Github, or our<br>repository of<br>benchmarks.

Developed<br>at DIKU<br>(copyright, acknowledgements, hedgehogs)

futhark language code programming parallel data

Related Articles