Skip to content

Ask HN: C++ still dominates on GPUs, why not Rust?

11 pointsAmbix2 comments
On HN

From what I know, modern GPUs are still programmed with C++ exclusively. See CUDA [0] for Nvidia and ROCm [1] for AMD.

Why is this? Why Rust is not loved there?

[0] https://docs.nvidia.com/cuda/

[1] https://github.com/ROCm-Developer-Tools/HIP

Comments

> Why is this? Why Rust is not loved there?

History and demand.

CUDA is about 15 years old. MPI and similar parallel computing APIs are even older.

C, C++, and Fortran have been the "goto" programming languages for parallel and scientific computing for decades.

Rust is a relative newcomer that does not have enough demand yet to mandate CUDA APIs. It probably will some day.

Another concern is the number of decades-mature libraries that are used in parallel computing domains. It seems much more likely that any Rust support will initially be Rust wrappers around C or C++ APIs rather than native Rust implementations.

Some projects for Rust on CUDA are in progress:

https://github.com/Rust-GPU/Rust-CUDA

https://github.com/bheisler/RustaCUDA

GPU programming =/= CPU programming. GPUs don't have complex execution paths with branching, and the programs that run are "memory safe" in the sense of what Rust aims to improve.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.