The Futhark team writes about their purely functional array language that compiles to efficient GPU code.
Commenters mention Futhark as an example of high-level functional constructs like map and reduce compiling to CPU or GPU code, with good documentation.
This looks really lovely, I look forward to following the maturation of Ante in the future. I've often thought that the niche of a general purpose low-level FP language was a promising space. The only other langs that fit in there are ATS[1], which is notoriously complex/difficult-to-learn, and Futhark[2], which is more GPGPU/scientific-computing specific.
We've got Rust, which is essentially a C-style lang that steals all kinds of goodies from the ML family; it's nice to see Ante as a kind of inverse to this: i.e. an ML style lang that borrows some of the nice bits from traditional imperative langs (and hopefully maintains their performance characteristics).
Looking through the language tour there already seem to be a plethora of very sensible/ergonomic design decisions here. The 'loop' and 'recur' keywords are a great feature, making a nice little functional nod towards while loops. As a long-time Haskell user the explicit currying initially turned me off, but after seeing a couple examples I can see how it's actually a very reasonable solution, and moreover the ability to curry out of order is really nice instead of having to use 'flip' or similar combinators (as a side note, the explicit currying reminds me a bit of APL's α and ω arguments in dfns, a feature I'd love to see pop up more). The paired tuples also seem like they'd be a pleasure to use; certainly a bit more flexible than tuples in other ML style langs. Making '.' the pipeline operator is also a smart bit of…
Location: US & Europe
Remote: No preference
Willing to relocate: Yes
Technologies: Functional programming, type systems, language design, compilers, parallel programming languages, GPU programming, Haskell.
Résumé/CV: See https://rschenck.com
Email: See https://rschenck.com
I'm a soon-to-be-graduating PhD student at the University of Copenhagen looking for either an industry job or a postdoc. My PhD work has been on the functional array programming language Futhark (https://futhark-lang.org/), including work on the type system (sum types, rank polymorphism) and automatic differentiation. I'm broadly interested in all things type systems/functional programming/compilers/language design. I can work in both the US and the EU without a visa.
There are some attempts, like http://futhark-lang.org/
One problem is that you have to codegen to meager intermediate languages that are fragmented & buggy (OpenCL or GLSL), or go proprietary with just one set of bugs and features (CUDA) but with much limited user base.
Also GPU software stacks are very crashy, have roots in the culture of testing all shaders for driver bugs before shipping in apps ("your game/app is buggy and poorly qa'd if user pc crashes") and only
recently has been slightly exposed to dynamic workloads by WebGL (which is only a OpenGL ES 2 subset, impls invest major engineering effort to work around driver bugs, and still had/has big crash problems).
At this point Python/Numpy is really the array processing language I prefer to use. You can even use libraries like Cupy to switch the backend from BLAS/LAPACK to Nvidia CUDA libraries, which makes it lightning fast, often improving performance by 100x. And the requirement for arcane runes in Numpy is much less than APL or J.
Also the various libraries and functionalities that plug into Numpy is countless and extremely powerful.
There's also https://futhark-lang.org/ which might be an improvement in writing array processing kernels.
The best answer is that you probably don't want to use Futhark for that - it's a specialised, rather restricted language. There are ways to encode irregular arrays, but it's not even remotely as ergonomic as in other languages (it can be plenty fast, however). For a particularly simple example, see https://futhark-lang.org/examples/triangular.html
In the future, or in a future similar language, one might well imagine an ability to "box" arrays, like in APL, which would allow true "arrays of arrays" with no restrictions on sizes.
There's a niche out there where this kind of technology is appreciated. I can even appreciate the technical challenges in making an array language interpreter run fast!
However, unfortunately, the notation is so terse that I can't imagine spending the time to learn this. This looks write-only.
Is there an obvious reason to prefer a k-like language like Klong, over e.g. Futhark[0] or Accelerate[1]?
[0]: https://futhark-lang.org/
[1]: https://hackage.haskell.org/package/accelerate