# Rust and GPUs
---
My task since Q2 2021: make [rust-gpu-tools](https://github.com/filecoin-project/rust-gpu-tools/) framework (OpenCL/CUDA) agnostic.
---
## State Q2 2021
- No established still actively maintained Rust libraries for using GPUs (neither OpenCL, nor CUDA)
- OpenCL options:
- `ocl`: maintaining a fork ourselves
- `opencl3`: brand new library started 2020-12-31
---
## opencl3
- Single person project (it seems)
- Was new to Rust (it seems)
- Was averse to PRs
- Development mode I wasn't used to
- Long discussions (thanks @dignifiedquire and @mxinden for helping me with Rust skills)
- Building trust
- My motivation was fueled by my 2020 Q4 review from @mikeal
---
### State Q3 2021
- OpenCL: :tada: Worked out in the end: `opencl3` is a well maintained Rust library for OpenCL, that has all features we need and is open for improvements.
- CUDA: :disappointed: "passively" maintained library ([RustaCUDA](https://github.com/bheisler/RustaCUDA)), needs some investment in the long run.
---
### rust-gpu-tools
- Now allows for running GPU kernels with the exact same code on both, OpenCL and CUDA
- Devices can be uniquely identified in a more robust way (thanks @neithanmo from Zondax)
- Needed for the GPU scheduler work: in a multi-GPU setup, you can put certain tasks on certain GPUs
---
The end.
{"metaMigratedAt":"2023-06-16T04:01:14.870Z","metaMigratedFrom":"YAML","title":"Rust and GPUs","breaks":true,"description":"Demo Day presentation 2021-07-08","contributors":"[{\"id\":\"03083f6c-6dbb-4064-817b-c45d87e7c765\",\"add\":1594,\"del\":2502}]"}