3 ms·
From numpy.org: > The core of NumPy is well-optimized C code.
by remram 3y ago
From numpy.org:
> The core of NumPy is well-optimized C code.
- taeric 3y agoAmusingly, "well-optimized C code" includes calling out to fortran libraries. :D https://numpy.org/doc/1.13/user/building.html https://numpy.org/doc/1.13/user/building.html
- cfcf14 3y agoIt's turtles all the way down, except for the final turtle, which is Fortran...
- bee_rider 3y agoThe last turtle is probably assembly, or at least intrinsics, in most good BLAS implementations. Probably called from C, because that’s easier in C. The nice thing about Fortran is that you get something almost as good, but a normal engineer can write it. There are more C programmers than Fortran programmers, but there are more Fortran programmers than there are C programmers who can write really good assembly kernels. And all the C programmers in that last group are already working on vendor BLAS implementations.
- whimsicalism 3y agoThat's a 6 year old documentation page, modern numpy does not use fortran in any way except that maybe you have a particular BLAS reference implementation.
- adastra22 3y agoNumpy is basically a wrapper to BLAS and LAPACK though, so it seems a bit odd to ignore the fact that those system libraries are usually written in Fortran.
- whimsicalism 3y agoThe reference implementation is written in Fortran, but I'm not sure about the implementations actually used. OpenBLAS has fortran components, but I believe cuBLAS and MKL are vast majority C/C++.
- taeric 3y agoThis is a very fair challenge. My understanding was that the main ones in use were fortran and it is very interesting to see that may not be the case. Love to see any benchmark or other comparisons on the options, if you know of any good links.
- adastra22 3y agocuBLAS is not Fortran because it targets NVIDIA GPUs. Despite what the grandparent says, MKL does include some Fortran in its codebase. Most other vendor-provided BLAS and LAPACK libraries are based on the reference Fortran implementation. Even OpenBLAS, the open-source reimplementation, has large parts written in Fortran.
- taeric 3y agoI did link to the old one.... but if you follow the link to the new, it still has that section? I'm confused.
- whimsicalism 3y agoThe old one says you need a fortran compiler to build numpy, the other one explicitly says you don't need a fortran compiler to build numpy.
- taeric 3y agoThe new one says it auto selects. I don't think they got rid of using the fortran if it is there. They just automated a lot of that in the build.
- milancurcic 3y agoThe well-optimized part is C calling Fortran. :)