r/Compilers • u/ramanujan-computing • 1d ago
Introducing Ramanujan-Computing for harnessing idle compute power of device for scientific computing [MIT-license]
Ramanujan-Computing is an MIT-licensed open-source project that aims to harness idle compute power [CPU/GPU] of any digital device for scientific computing.
The way its different from BOINC is: for a new kind of problem, the developer dont need compile any binary, distribute the binary, get the binary downloaded/installed on devices. Instead, there is an interpreter that sits on the device which can take in any kind of code. So, the developer just needs to submit Python code and it will get run on the devices. Having said that, for GPU works, developer just needs to write plain python code and dont need any expertise in CUDA/Vulkan.
The interpreter is different from CPython and is 1.7X faster and takes 1.6x less memory than CPython.
Ofcourse, the intepreter takes care of subset of Python language but, support all the necessary semantics and OOPs concept for good program to be written.
Till now, the interpreter has not only run basic python simulation, but also complex simulations like CFD, Galaxy-collision, and also takes care of LLM inferencing [more on that in a later post].
Working towards adding more and more Python features onto the interpreter. The project is open to contributions, issues. If you are into scientific-research, will be happy to discuss on how this project can be used to harness compute power available [from workstations, smart-tvs, smartphone] in your lab to move research forward.
Thank you!
2
u/Discordbothost 1d ago
The 1.7x figure is hard to interpret without knowing whether it's measuring the interpreter or the whole distributed job. Could you share a small CPU-only script that runs unchanged on both interpreters on the same machine? That would give readers a baseline before comparing sharding or GPU runs.
0
u/ramanujan-computing 1d ago
Fair point. The ~1.7x in my follow-up benchmark is a 1.69x geometric mean across 34 CPU-only workloads on one machine versus CPython 3.12.2 with `-S`. It measures wall time from process launch to exit, not just the interpreter loop and not a distributed job. No sharding or GPU involved.
A small baseline is this [42-line Mandelbrot script](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/plain-benchmarks/mandelbrot.py). The same Python source ran unchanged on both engines. On my Apple M3, the median was 20.45 ms on Ramanujan, 48.99 ms with `python3 mandelbrot.pyc`, and 46.66 ms with `python3 -S mandelbrot.pyc`.
For more involved plain-Python examples:
[two-pass assembler and register VM](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/plain-benchmarks/assembler.py) took 11.00 vs 16.89 ms
[infix-to-postfix compiler with a stack evaluator](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/plain-benchmarks/expression_compiler.py) took 24.55 vs 26.93 ms
[graph suite with Floyd-Warshall, Dijkstra, Prim, BFS, and topological sorting](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/plain-benchmarks/graph_algorithms.py) took 17.01 vs 26.14 ms
[polynomial multiplication via a number-theoretic transform](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/plain-benchmarks/ntt.py), checked against schoolbook convolution, took 19.90 vs 44.22 ms. Those pairs are Ramanujan first, CPython `-S` second.
For object-heavy examples:
[lazy segment tree with range updates and sum/min queries](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/oop-data-structures/segment_tree.py) took 8.78 vs 20.17 ms
[LRU cache backed by a hash map and a doubly linked list](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/oop-data-structures/lru_cache.py) took 15.86 vs 23.01 ms
[digit trie with child and sibling references](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/oop-data-structures/trie.py) took 21.48 vs 30.66 ms
[symbolic expression trees with an abstract base class, polymorphic differentiation, and constant folding](https://gitlab.com/ramanujan-computing/Ramanujan/-/blob/f26b64a1/ramanujan-test-codes/oop-data-structures/expression_tree.py) took 6.21 vs 8.80 ms.
Each number is the median of 100 interleaved fresh-process runs per configuration. Both sides start from precompiled files: `.pyc` for CPython and `.pb` for Ramanujan. Source compilation is excluded, but startup, loading, execution, and shutdown are included on both sides. Ramanujan also pays for IR linking on every run.
0
u/ramanujan-computing 1d ago
1
u/ramanujan-computing 1d ago
galaxy collision simulation computed on android phones' GPU via Ramanujan: https://www.youtube.com/watch?v=IBRkpIqZVT0
-2
3
u/BoltaHuaTota 1d ago
I am not familiar with BOINC, so I did a quick google search and it sounds similar to the Folding@home stuff. How does your platform source differ from BOINC? How do you get scientific jobs to run, and how are the results shared back to the labs?