by kookamamie · 1y ago · 0 comments
I get the idea of added abstraction, but do think it becomes a bit jack-of-all-tradesey.
We do that all the time - there are lots of code that chooses optimal code paths depending on runtime environment or which ISA extensions are available.
Commendable effort, however just like people forget languages are ecosystems, they tend to forget APIs are ecosystems as well.
Everything is an abstraction and choosing the right level of abstraction for your usecase is a tradeoff between your engineering capacities and your performance needs.
During the build, build.rs uses rustc_codegen_nvvm to compile the GPU kernel to PTX.
The resulting PTX is embedded into the CPU binary as static data.
The host code is compiled normally.The fact that different hardware has different features is a good thing.
You get to pull no_std Rust crates and they go to GPU instead of having to convert them to C++
My abstractions though are probably best served by Pytorch and Julia so Rust is just a waste of time, FOR ME.
If your program is written in rust, use an abstraction like Cudarc to send and receive data from the GPU. Write normal CUDA kernels.
I think not.
https://github.com/Rust-GPU/Rust-CUDA/blob/main/guide/src/fe...