4 ms·
I'll take this opportunity to point out that if you're doing anything numpy related that seems too slow you should run numba on it, in my case we were doing a l
by jack_pp 4y ago
I'll take this opportunity to point out that if you're doing anything numpy related that seems too slow you should run numba on it, in my case we were doing a lot of cosine distance calculations and our inference time sped up 10x by simply running the cosine distance function from numpy through numba and it's as easy as adding a decorator.
- krastanov 4y agoDo jax/tensorflow/pytorch work with numba? I.e. can you pass one of their arrays through a numba function and have it (a) not crash (b) support backprop?
- p1esk 4y agoSeems like pytorch does: https://stackoverflow.com/questions/63169760/how-can-i-use-numba-for-pytorch-tensors https://stackoverflow.com/questions/63169760/how-can-i-use-n...
- krastanov 4y agoIt seems it would not crash if you use some interface function, but it does not seem to support autodiff.
- Siira 4y agoJax already has its own tracing compiler which produces optimized code.
- learndeeply 4y agoThis is mentioned directly in the article: Taichi vs. Numba: As its name indicates, Numba is tailored for Numpy. Numba is recommended if your functions involve vectorization of Numpy arrays. Compared with Numba, Taichi enjoys the following advantages: Taichi supports multiple data types, including struct, dataclass, quant, and sparse, and allows you to adjust memory layout flexibly. This feature is extremely desirable when a program handles massive amounts of data. However, Numba only performs best when dealing with dense NumPy arrays. Taichi can call different GPU backends for computation, making large-scale parallel programming (such as particle simulation or rendering) as easy as winking. But it would be hard even to imagine writing a renderer in Numba.
- jack_pp 4y agoExcept some people don't read the article and already assume numpy is "very" optimized that they might gloss over that line without reading much into it. That line also doesn't say that you might get a 10x speed-up while using numba. I remember when I first came across numba I searched HN for references and didn't find many stories or comments praising it so I skipped over it initially so having HN comments might be useful for future HN'ers.
- gautamdivgi 4y agoThere is Numba and then there is Nutika if you want to compile to a binary. I’m not sure the two work together. But Taichi may work with Nutika for runtime optimization as a binary.
- cycomanic 4y agoThe equivalent of Nutika for numerical code is pythran. Which compiles to highly optimized c++ code. I have been getting the best speedup with the least changes when using it compared to numba or cython (haven't tested taichi yet).
- vram22 4y agos/Nutika/Nuitka https://en.m.wikipedia.org/wiki/Nuitka https://en.m.wikipedia.org/wiki/Nuitka