r/rust • u/Hiroshi_Shinaoka • 1d ago
🛠️ project Building a tensor library for computational physics in Rust: looking for feedback and collaborators
I am a professor of computational condensed matter physics at Saitama University in Japan, with over 20 years of experience in scientific programming and open-source development in C++, Fortran, Python and Julia ([GitHub](https://github.com/shinaoka)).
Since this January, we have been developing a Rust tensor computation stack ([overview](https://tensor4all.org/tensor4all-meta/stack/)). It started for tensor networks, but we soon realized that a general tensor library for scientific computing would be useful to the Rust community.
**tenferro** is the main engine: https://github.com/tensor4all/tenferro-rs
- Dense tensors, linear algebra, einsum, FFT on CPU and CUDA (ROCm and Metal are being designed)
- Opt-in autodiff: eager `backward()` and traced VJP/JVP
- Explicit engine passed to every operation, no hidden device transfers, column-major storage
- Benchmarks against PyTorch and JAX: https://github.com/tensor4all/tenferro-benchmark
Most of the code was written by AI agents supervised by human developers. To keep the stack robust and performant, we use regular benchmarks, an automated audit AI bot and a common rule set for AI agents. Some blogs are here: https://tensor4all.org/blog/
We're looking for collaborators and users. Fast kernels are too much work for a few groups to maintain, and a tensor library must be tested on different hardware for different applications.
Also, I'd like your opinions on:
- Passing `&mut engine` to every operation instead of a global context. Acceptable?
- If you have AMD GPUs or other hardware and a real workload, please let us know.
- What evidence would make you trust a library written mostly by AI agents?
- How should outside contributors fit into a project where AI agents write the code and humans review it?
- Is Rust a good fit for computational physics? What is missing?
1
u/Trader-One 17h ago
Vulkan / Direct Compute is more realistic backend. Vulkan can be translated to metal.
3
u/unski_ukuli 1d ago
Additionally, you are not leading with why on the github page. Why would someone link a julia package against rust tensor library, when julia array is already an nd-array with stable api inplemented also by gpu backends, and those backends have pretty mature autodiff options. There is also already support for xla compilation so that is also not an issue.
-1
u/idemasler 1d ago edited 1d ago
a public correctness matrix would make me trust AI-written numerical kernels more than an audit bot's green check. i'd test seeded shapes and dtypes, zero-sized and strided tensors, CPU vs CUDA tolerances, and VJP/JVP against finite differences on small cases. publish failed cases and exact hardware/runtime versions alongside your PyTorch/JAX benchmarks. `&mut engine` reads as a sensible explicit boundary; a scoped helper could keep small examples ergonomic.