4 ms·
One could also "import jax.numpy as jnp". All those libraries have more or less complete implementations of numpy and scipy (i believe CuPy has the most functio
by KeplerBoy 2y ago
One could also "import jax.numpy as jnp". All those libraries have more or less complete implementations of numpy and scipy (i believe CuPy has the most functions, especially when it comes to scipy) functionality.
Also: You can just mix match all those functions and tensors thanks to the __cuda_array_interface__.
- yobbo 2y agoJax variables are immutable. Code written for CuPy looks similar to numpy but very different from Jax.
- bbminner 2y agoAh, well, that's interesting! Does anyone know how cupy manages tensor mutability?
- kmaehashi 2y agoCuPy tensors (or `ndarray`) provide the same semantics as NumPy. In-place operations are permitted.
- KeplerBoy 2y agoAh yes, stumbled over that recently, but the error message is very helpful and it's a quick change.
- kmaehashi 2y agoFor those interested in the NumPy/SciPy API coverage in CuPy, here is the comparison table: https://docs.cupy.dev/en/latest/reference/comparison.html https://docs.cupy.dev/en/latest/reference/comparison.html
- larodi 2y agoIndeed, has anyone so far successfully drop-in replaced numpy in a project with this cupy and achieved massive improvements? Because, you know, when dealing with GPU it is very important to actually understand how data flows back and forth to it, not only the algorithmic nature of the code written. As a sidenote, it is funny how this gets released in 2024, and not in say 2014...
- KeplerBoy 2y agoOh yes, I've personally used CuPy for great speed ups compared to Numpy in radar signal processing. Taking a code that took 30 seconds with NumPy down to 1 second with CuPy. The code basically performed a bunch of math on like 100 MB of data, so the PCIe bottleneck was not a big issue. Also CuPy was first released in 2015, this post is just a reminder for people that such things exist.
- larodi 2y agoThank you. Your post is informative, and well grounds the very inappropriate hype in mine.
- lacker 2y agoYeah, the data managed by cupy generally stays on the GPU and you can control when you get it out pretty straightforwardly. It’s great if most of your work happens in a small number of standard operations. Like matrix operations or Fourier transforms, the sort of thing that cupy will provide for you. You can get custom kernels running through cupy but at some point it’s easier to just write c/c++.
- faangguyindia 2y agoIt's because it was not possible to write tons of brain-dead, repetitive code in 2014. In 2024, with AI you can do these kind of projects very fast.