6 ms·
Looks like a dead end. Why CUDA? There should be some way to use Rust for GPU programming in general fashion, without being tied to Nvidia.
by shmerl 2y ago
Looks like a dead end. Why CUDA? There should be some way to use Rust for GPU programming in general fashion, without being tied to Nvidia.
- kouteiheika 2y agoThere's no cross-vendor API which exposes the full power of the hardware. For example, you can use Vulkan to do compute on the GPU, but it doesn't expose all of the features that CUDA exposes, and you need to do the legwork yourself reimplementing all of the well optimized libraries (like e.g. cublas or cudnn) that you get for free with CUDA.
- shmerl 2y agoMake a compiler that takes Rust and compiles into some IR, then another compiler that compiles that IR into GPU machine code. Then it can work and that's going to be your API (what you developed in Rust). That's the whole point of what's missing. Not some wrapper around CUDA.
- the__alchemist 2y agoCUDA is the easiest-to-use and most popular GPGPU framework. I agree that it's unfortunate there aren't good alternatives! As kouteiheika pointed out, you can use Vulkan (Or OpenCL), but they are not as pleasant.
- pjmlp 2y agoBecause others so far have failed to deliver anything worthwhile using, with the same tooling ecosystem as CUDA.
- coffeeaddict1 2y agoWhile I agree, that CUDA is the best in class API for GPU programming, OpenCL, Vulkan compute shaders and Sycl are alternatives that are usable. I'm for example, using compute shaders for writing GPGPU algorithms that work on Mac, AMD, Intel and Nvidia. It works ok. The debugging experience and ecosystem sucks compared to CUDA, but being able to run the algorithms across platforms is a huge advantage over CUDA.
- keldaris 2y agoHow are you writing compute shaders that work on all platforms, including Mac? Are you just writing Vulkan and relying on MoltenVK? AFAIK, the only solution that actually works on all major platforms without additional compatibility layers today is OpenCL 1.2 - which also happens to be officially deprecated on MacOS, but still works for now.
- coffeeaddict1 2y agoYes, MoltenVK works fine. Alternatively, you can also use WebGPU (there are C++ and Rust native libs) which is a simpler but more limiting API.
- keldaris 2y agoWebGPU has no support for tensor cores (or their Apple Silicon equivalents). Vulkan has an Nvidia extension for it, is there any way to make MoltenVK use simdgroup_matrix instructions in compute shaders?
- coffeeaddict1 2y agoAFAIK, MoltenVK doesn't. Dawn (Google's C++ WebGPU implementation) does have some experimental support for it [0][1]. [0] https://issues.chromium.org/issues/348702031 https://issues.chromium.org/issues/348702031 [1] https://github.com/gpuweb/gpuweb/issues/4195 https://github.com/gpuweb/gpuweb/issues/4195
- deleted 2y ago[deleted]
- LegNeato 2y agoYou can look to https://github.com/Rust-GPU/rust-gpu/ https://github.com/Rust-GPU/rust-gpu/ for vulkan.
- shmerl 2y agoThat's a good example of of what it should be.