[ANN] jlrs v0.7: write functions in Rust and call them from Julia, execute multiple tasks in parallel, use Julia arrays with ndarray

Last Saturday I released jlrs v0.7 which has two major new features.

First of all, you can now use functionality from jlrs when writing Rust code that is called from Julia using its ccall interface. This function can call arbitrary functions defined in dynamic libraries that use the C ABI (ie functions marked with extern "C", and possibly #[no_mangle] in Rust). While this can be achieved without using jlrs, it’s now possible to use features from jlrs such as borrowing array data.

The second major feature is the introduction of an (experimental) async runtime. This feature is highly experimental and only works on Linux. With the async runtime you can use Value::call_async to offload a function call to another thread (using Base.Threads.@spawn) and wait for the result; while the computation is running the runtime is free to work on other tasks. This feature is experimental because it’s the first async code I’ve ever written and depends on some unstable features.

Additionally, some small features have been added. The biggest one of these is that there’s a new arrya type, TypedArray, which is highly similar to Array except that the type of the elements is explicitly known. The crate jlrs-ndarray is now available to easily borrow array data from Julia as an ArrayView(Mut) from ndarray.

The repository now contains several examples, so if you’re curious how to use these new features you can take a look here.

Github

Docs.rs

Crates.io

11 Likes