3 ms·
And if you are using for example Numpy, you aren’t using Python for anything performance sensitive of course, because Numpy is almost certainly calling the syst
by bee_rider 4y ago
And if you are using for example Numpy, you aren’t using Python for anything performance sensitive of course, because Numpy is almost certainly calling the system’s tuned BLAS implementation. Which should handle the parallelism I guess. If anything I’d expect parallel Python calls to Numpy to result in oversubscription…
- fest 4y agoI don't think numpy functions are neccessarily multithreaded and probably many are inherently sequential by their nature, so there are definitely case where multiprocessing can speed up the overall program.
- bb88 4y agoSomeone once said that python + numpy is probably going to be faster than writing it using basic C++, since numpy is using highly tuned libraries underneath. I don't know for certain this is the case, but I'd like to see some benchmarks about it.
- kelipso 4y agoYou would almost never use raw C++ when working with linear algebra stuff. You use a library like Eigen that interfaces with BLAS, LAPACK, etc., so you definitely get all the advantages of those highly tuned libraries, plus the speed of C++ and potential flexibility of not having to make multiple array copies and so on.
- cozzyd 4y agoRight, but you can use those highly tuned libraries yourself. I do kind of wish numpy had a stable C API that didn't require a Python interpreter though.
- bee_rider 4y agoThey aren’t necessarily threaded, but if you care about Numpy performance on an Intel chip at least you are already using MKL for Numpy’s BLAS, and MKL’s gemm is threaded.
- anonkogudhyfhhf 4y agoParallelism using CPU instructions and vectorization most likely. Threading would still improve performance
- bee_rider 4y agoMultiplying a large enough matrix in Python using MKL for Numpy, I can watch the cpu usage go to 400% in top. You may need to run it in a loop or make the matrices quite large, a surprisingly large amount of computation has to happen before it’ll show up in top.