Are there any functional programming languages โ€‹โ€‹that run on the GPU?

Using a traditional, consistent approach to reduction, the following graph is reduced as:

(+ (+ 1 2) (+ 3 4)) -> (+ 3 (+ 3 4)) -> (+ 3 7) -> 10 

The chart cuts, however, are essentially parallel. Instead, you can reduce it as:

 (+ (+ 1 2) (+ 3 4)) -> (+ 3 7) -> 10 

As far as I know, every functional programming language uses the first approach. I believe that this is mainly due to the fact that on the processor, thread planning will overcompensate the benefits of parallel reductions. However, recently we started using the GPU more than a processor for parallel applications. If the language is completely on the GPU , these communication costs will disappear.

Are there functional languages โ€‹โ€‹using this idea?

+7
parallel-processing functional-programming haskell gpu ocaml
source share
4 answers

What makes you think about planning a GPU will not exceed the benefits?

In fact, the kind of parallelism used in GPUs is much more difficult to plan: SIMD parallelism, that is, a whole batch of stream processors, do everything essentially the same thing at a time, except each crush another group of numbers. Thus, you will not only need to schedule subtasks, but also synchronize them. Doing this automatically for general calculations is almost impossible.

Doing this for specific tasks works reasonably well and is built into functional languages; check out Speed โ€‹โ€‹up your project .

+10
source share

SPOC provides some GPam access from OCaml.

+5
source share

on the CPU, thread scheduling will overcompensate the benefits of concurrent reduction

Thread scheduling is very effective in modern operating systems. Initialization and termination of the flow may be of concern, but there are many methods to address these costs.

Graph cuts, however, are inherently parallel

As mentioned in another answer, GPUs are very special devices. You canโ€™t just take an arbitrary algorithm and make it 100 times faster by simply rewriting CUDA. Speaking of CUDA, this is not exactly SIMD (Single Instruction on Multiple Data), but SIMT (Single Instruction on Multiple Thread). This is something much more complex, but let it be perceived as a simple vector processing language. As the name implies, vector processors designed to process dense vectors and matrices, i.e. Simple linear data structures. Thus, any branching in warp reduces parallelism's efficiency and performance to zero. Modern architectures (Fermi +) are able to process even some trees, but it is quite difficult, and the performance is not so radiant. Thus, you simply cannot accelerate an arbitrary schedule reduction.

How about functional languages โ€‹โ€‹for GPGPU. I believe that this cannot be serious. Most of the valuable CUDA code exists inside the nearly optimized libraries created by PhD and is aimed at performance. The readability, declarativeness, clarity and even the safety of functional languages โ€‹โ€‹does not matter there.

+4
source share

Obsidian is a domain-specific language built into Haskell that is designed for GPGPU computing. This is rather a lower level than what you are asking for, but I thought I mentioned it.

+2
source share

All Articles