GPU programming in rust

Hey everybody

I'm looking into gpu programming with rust. Does anybody have any experience with it?

No personal experience, but I always thought the following looks interesting: GitHub - EmbarkStudios/rust-gpu: ๐Ÿ‰ Making Rust a first-class language and ecosystem for GPU shaders ๐Ÿšง

1 Like

I've only played around with it a little, but wgpu seems like it has a pretty Rust-ic API

https://wgpu.rs/

2 Likes

Thereโ€™s a multi-language multi-platform library written in Rust and called WGPU

1 Like

I wrote a safe Vulkan library in Rust, called yarvk, and a rust game renderer (in progress), and have some knowledge about the famous Ash, Vulkano and WGPU, please make yourself clear what you want, maybe I can help.

1 Like

Thank you all for your input. :blush:

I might wanna use it for HPC. I.e.stuff like fft and matrix and/or tensor multiplications. I just started my master thesis in computational science and don't know a lot about the topic yet.

I know this is a Rust forum, but you might want to look into Futhark.

From their website:

Futhark is a small programming language designed to be compiled to efficient parallel code. It is a statically typed, data-parallel, and purely functional array language in the ML family, and comes with a heavily optimising ahead-of-time compiler that presently generates either GPU code via CUDA and OpenCL, or multi-threaded CPU code. As a simple example, this function computes the average of an array of 64-bit floating-point numbers:

def average (xs: []f64) = reduce (+) 0 xs / f64.i64 (length xs)

[...]

Futhark is not intended to replace existing general-purpose languages. The intended use case is that Futhark is only used for relatively small but compute-intensive parts of an application. The Futhark compiler generates code that can be easily integrated with non-Futhark code. For example, you can compile a Futhark program to a Python module that internally uses PyOpenCL to execute code on the GPU, yet looks like any other Python module from the outside (more on this here). The Futhark compiler will also generate more conventional C code, which can be accessed from any language with a basic FFI (an example here).

2 Likes

Deep learning is not my area, but I know there's a Rust CUDA project.

I think that there might be a misunderstanding. HPC isn't deep learning. It's high performance computing.

1 Like