On Thu, May 2, 2013 at 10:23 PM, Michael Torrie <[email protected]> wrote:
> And it turns out that it's pretty easy to generate fast math algorithms > by emitting C code (Blast I think it is called) that can be used in a > language like Python to great effect. In fact an awful lot of > high-performance computing is done using Python and these fast libraries > written (or generated) in C. End result? A superior and faster > programming environment that C itself never could fulfill, at least in a > timely manner. There's BLAS, which is the Fortran library that's the standard set of linear algebra routines used for scientific computing and benchmarking. LAPACK is based on it, which you may recognize as one of the benchmarks used to compare the top supercomputers. There's also FFTW (Fastest Fourier Transform in the West) which uses an OCaml program to analyze your FFT operation, perform all kinds of crazy optimizations on it, and then emit C code tuned for your specific FFT task. The C code is not just straightforward C, it makes sure to inform the compiler of non-aliasing memory and can also take advantage of some CPU-specific instruction sets if you let it. Basically, it does all the high and mid-level optimizations and lets the C compiler take care of the micro-optimizations that C compilers are incredibly good at, while providing the low-level optimization (like extended instruction sets) that C is not good at. Oh, and it also has a Fortran interface, because quite a few people writing serious number crunching code still write it in Fortran. It's not an amazing language, but at least it's not as brain-dead about arrays and math as C is. Really, the primary virtue of C is its ubiquity. Beyond that, it's pretty mediocre as far as languages go. But now that most everyone uses gcc as the basis of the standard compiler for their platform (aside from perhaps the major desktop/server players that provide expensive but highly-tuned C and Fortran compilers) C shares most of its ubiquity with a whole set of languages that people really ought to consider instead of C. Aside from being a bit verbose, Ada is a pretty nice language for systems programming, especially if security and safety are important, and a good implementation of it comes with gcc now. /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
