6 ms·
And this is where the performance starts converging again, because BLAS is also available from C. So if you can express your computation in terms of BLAS primit
by microtherion 3y ago
And this is where the performance starts converging again, because BLAS is also available from C. So if you can express your computation in terms of BLAS primitives, it does not matter much from what language you're calling them.
- kergonath 3y agoYes, but you retain Fortran’s expressiveness. You can write a matrix product A = x * B, regardless of whether the matrix multiplication is handled by a compiler’s multiplication function, any flavour of BLAS, or ScaLAPACK over MPI. I don’t think Fortran has that much of an edge in performance compared to decently optimised C, but the Fortran code to get there is much more readable and easier to grasp. And with much fewer footguns (think allocatables versus pointer arithmetic).
- lmm 3y agoIf your goal is an expressive, safe, low-footgun language for expressing BLAS computations, you'd probably use NumPy rather than Fortran.
- kergonath 3y agoNumPy is very Fortran-like, it's probably not the best example. Sure, it avoids some Fortran issues, but it also inherits some baggage from Python. Personally, working with both regularly, I don't really find it more expressive or safer than the common Fortran equivalents. And in Fortran there's less mental overhead about whether a variable is a list or a NumPy array, which does not matter until it does. Ditto for row/column-major order. Overall, in terms of ergonomics and ease of use, both are fairly similar.
- physicsguy 3y ago… until you hit sparsity which you almost always have to switch approach. Generally you do not want to construct a dense matrix for a problem where it’s not dense!