Researchers at the University of Copenhagen’s Department of Computer Science have officially released their new functional programming language called Futhark. This new programming language—which is free and open source—is designed to run on a GPU for machine learning and other high-performance applications.
The common method for GPU programming involves using frameworks like OpenCL or CUDA, both of which are variations of
C++. Furthark can generate
C code, but it is actually its own language. You can relate this new language to Haskell (Furthark is written in Haskell).
The language developers claim that the more expressive a language is, the easier it is to describe complex operations that use parallelism. This includes the support for nested parallelizations (parallel operations inside other parallel operations).
The Futhark Developers stated:
Futhark can do this despite the complexities of efficiently mapping to the flat parallelism supported by hardware, as a great many programs depend on this feature.
Futhark GPU programs were put to the test. When put against other GPU libraries, they showed mixed but some pretty promising results. For the maximum segment sum test, it matched or was only slightly slower, than the competition. The developers thought that this was attributed to the newness of the language and the unrefined results for memory usage and allocation.
The current toolchain can generate code capable of running on the CPU or GPU, with a good variety of targets. For the former, it will generate
C code compiled by the CGG; for the latter it will compile
C code that uses the OpenCL platform. This will allow the code to run on whichever hardware is available to support it.
For Python developers and coders who want a speed boost, they will be able to generate code with Futhark wrapped in a Python module. This code will run via PyOpenCL, which is a library that interfaces with GPUs. There are examples of this, such as a Futhark-driven GPU implementation of Conway’s Game of Life.
Please remember that at the time of writing this article, Futhark is still currently a research project; it is not as polished or complete as other languages. The current documentation is incomplete, but both the docs and language are open source on GitHub.