New functional programming language can generate C, Python code for apps

Ngoc Huynh

The open source Futhark makes it easier to program for GPUs that speed up machine learning and other math-intensive apps.

Researchers at the University of Copenhagen’s Department of Computer Science recently unveiled Futhark, an open source functional programming language designed for creating code that runs on GPUs, for use in machine learning and other high-performance applications.

Futhark is meant to be more convenient to use than standard C/C++ frameworks for programming GPUs. It can automatically generate both C and Python code to be integrated with existing apps.

Most GPU programming involves using frameworks like OpenCL or CUDA, both of which use variations of C or C++ to generate code that runs on the GPU. Futhark can generate C code, but is its own language, more similar to Haskell or Standard ML than C. (Futhark is itself written in Haskell.)

Futhark’s creators claim that the expressiveness of the language makes it easier to describe complex operations that use parallelism. This includes the ability to support nested parallelizations (parallel operations inside other parallel operations). 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,” say the language’s creators.

The current Futhark toolchain can generate code capable of running on either the CPU or GPU, with a variety of targets. For the former, it generates C code compiled by the GCC; for the latter, it generates C code that uses the OpenCL platform. Thus, the same code run on whatever hardware is available to support it, in much the same manner GPU-accelerated apps like the MapD database can fall back to using the CPU if needed.

Python users who want a speed boost can generate code with Futhark wrapped automatically in a Python module. The GPU code runs via PyOpenCL, which is a library for interfacing with GPUs. There are examples of this, such as a Futhark-driven GPU implementation of Conway’s Game of Life.

Because Futhark is still fundamentally a research project, it is not yet as polished or complete as other languages. The documentation is incomplete, but both docs and language are open source on GitHub.

Share the news now

Source : http://www.infoworld.com/