Ramba is a Python project that provides a fast, distributed, NumPy-like array API using compiled Numba functions and a Ray or MPI-based distributed backend. It also provides a way to easily integrate Numba-compiled remote functions and remote Actor methods in Ray.
The main use case for Ramba is as a fast, drop-in replacement for NumPy. Although NumPy typically uses C libraries to implement array functions, it is still largely single threaded, and typically does not make use of multiple cores for most functions, and definitely cannot make use of multiple nodes in a cluster.
Ramba lets NumPy programs make use of multiple cores and multiple nodes with little to no code changes.
Example
Consider this simple example of a large computation in NumPy:
# test-numpy.py
import numpy as np
import time
t0 = time.time()
A = np.arange(1000*1000*1000)/1000.0
B = np.sin(A)
C = np.cos(A)
D = B*B + C**2
t1 = time.time()
print (t1-t0)
Let us try running this code on a dual-socket server with 36 cores/72 threads and 128GB of DRAM:
% python test-numpy.py
47.55583119392395
This takes over 47 seconds, but if we monitor resource usage, we will see that only a single core is used. All others remains idle.
We can very easily modify the code to use Ramba instead of NumPy:
# test-ramba.py
import ramba as np # Use ramba in place of numpy
import time
t0 = time.time()
A = np.arange(1000*1000*1000)/1000.0
B = np.sin(A)
C = np.cos(A)
D = B*B + C**2
np.sync() # Ensure any remote work is complete to get accurate times
t1 = time.time()
print (t1-t0)
Note that the only changes are the import line, and the addition of the np.sync(). The latter is only needed to wait for
all remote work to complete, so we can get an accurate measure of execution time.
Now let us try running the ramba version:
% python test-ramba.py
3.860828161239624
The Ramba version saturates all of the cores, and results in about 12x speedup over the original numpy version. (Why only 12x? Three factors contribute to this: 1) this total includes some of the initialization time; 2) Time for JIT compile (~1 second here); 3) This code is memory-bandwidth bound, so after a point, additional cores will just end up waiting on memory). Importantly, this performance gain is achieved with no significant change to the code.
Metadata
Release files for ramba 0.1.post148
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ramba-0.1.post148-py3-none-any.whl | Python 3 | none | any | Details for ramba-0.1.post148-py3-none-any.whl |
Release files / ramba-0.1.post148-py3-none-any.whl
| Download URL | ramba-0.1.post148-py3-none-any.whl |
|---|---|
| Size | 121.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6fcda76d2b056194a1d72162464c4afc705b025a4ced4836d29381896631f66
|
|
BLAKE2b-256 checksum How to use checksums |
e868661650fce100175cbed12727947fcf4d8a5a9013ee0c5abec315c466a780
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.9.13
|
Security for ramba 0.1.post148
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.