Troels Henriksen
Troels Henriksen
This should not be a segfault; it should be a proper dynamically checked error. Does it really segfault with cargo-futhark? It would be nice to provide some more information like...
How is that Rust code type correct? The third argument to the entry point must be a one-dimensional array, but you pass it a two-dimensional array.
Wait, no, I misread.
I am still confused, however. What does `rain::Array_U8_2D::new(&ctx, &[0;4], 1, 4)` produce? What is `[0;4]`, and are you trying to create an array of shape `[1][4]` from it?
My guess is that the entry point fails (as it should), meaning the array it returns (at the C level) is uninitialised, which is not handled properly by cargo-futhark.
> Typically C interfaces expect the caller to provide a pre-allocated array. That would only be possible if the C API exposed the size of the various structs, which raises...
A futhark function type ```Futhark [n]i32 -> [n]bool -> ... ``` explicitly expresses that the two arguments must have the same shape. If `n` is a size parameter, that means...
Apart from the paper, maybe some inspiration can be derived from the implementation at https://github.com/morphic-lang/morphic/tree/main/src I think it's in these files: https://github.com/morphic-lang/morphic/blob/main/src/annot_closures.rs https://github.com/morphic-lang/morphic/blob/main/src/closure_specialize.rs
The difference is that ten years from now you don't want to use Ubuntu 20.04, but Nix will still be around. But really, Nix is overkill here. Why not just...
Oh look, there's already [install-mlkit](https://github.com/diku-dk/install-mlkit).