Calling Futhark from C and Haskell
futhark-lang.org
futhark-lang.org
I have eagerly been awaiting this development! This is great!
I write much of my code in Rust these days and being able to generate plain C entrypoints to my Futhark functions will allow me to bridge both worlds :)
For example, we probably should not handle "catastrophic" errors like GPU/compiler bugs the same way we handle "incidental" errors like bounds check failures. The former might well poison the entire context, while the latter should permit subsequent entry points to work.
I'd like to be able to fall back to CPU execution when OpenCL is not available on a platform. I realize this means I will need to reduce the problem set significantly, but it would be nice to be able to run a small demo on unsupported platforms as well.
There's also a sorting-contest [2], perhaps it can bring some more inspiration.
[0]: https://github.com/diku-dk/futhark/blob/master/futlib/radix_...
[1]: https://github.com/diku-dk/futhark/blob/master/futlib/merge_...
I'm not aware of sorting algorithms that use "clever" tricks; the challenge with sorting seems to be in the low-level optimization (e.g. making sure that no unnecessary data-copying takes place).
If you are looking for a challenge, then you could try sorting arbitrary length strings (more difficult since the comparison operator is of non-constant time). Or do something like the Burrows-Wheeler transform [1], where you sort all rotations of a very large string. This is actually a very useful operation for building a large search index [2]. Many people in e.g. bioinformatics would be very interested in a fast solution.
[1] https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transf...