[libgfortran, configury] BLAS-based implementation of matmul
Tue Apr 4 04:01:00 GMT 2006
On Mon, Apr 03, 2006 at 05:37:28PM -0700, Mike Stump wrote:
> On Apr 1, 2006, at 7:48 AM, FX Coudert wrote:
> >I've been playing this afternoon with a toy patch to have BLAS-
> >based matmul routines in gfortran. What I tested, and which
> >currently works, is the following: the BLAS routines (the ?GEMM
> >routines, precisely) are called from within the libgfortran real
> >matmul routines
> > - could that kind of idea raise any "political" objection?
> It is possible. In general, I like the compiler best, when it has
> all of its runtime libraries bundled with it and suitable for
> commercial development. For example, STL for C++ is part of the
> language standard and C++ is best when bundled with it. This was
> done by bundling the SGI STL with gcc. Likewise implementation
> libraries like libgcc.a, libmudflap.a and libgcov.a and so on.
Mike, I am completely baffled by the above. Are you saying that
the STL provided by GCC is optimized for all architectures supported
by gcc? libgfortran will contain a complete runtime library for
gfortran. What FX is trying to do is map the generic matmul()
routine to optimized BLAS routines. Indeed, FX showed a 425%
increase in speed in computing the matrix multiplication with his
example. There simply isn't a generic BLAS matrix multiplication
algorithm that is optimal for all of the CPUs supported by GCC.
The last time I compiled ATLAS on my system, it took something
like 3 days to complete.
> For libraries that are free enough and have a long open source
> history (X for example, I would claim that it is reasonable to depend
> upon them even though they're external. I don't know enough about
> BLAS to comment if they fall into this category. I suspect it might
> well be reasonable to depend upon it.
Go to netlib and start reading. Netlib's BLAS library is a generic
implementation, and its documentation says to use a vendor supplied
version if it is available. Perhaps, the most important feature of
netlib BLAS is that it established a de facto standard API.
> First step, get the fortran people to agree it would be a good
> direction to go in.
This is a no brainer. People use Fortran to squeeze every last
flop of performance out of the hardware. FX is trying to find
a mechanism to give gfortran users the ability to achieve this goal.
> > - we could have the BLAS selection overridable (is that a real
> >word?) at compile time, like -fblas and -fno-blas
> Yes, if there were some reason why BLAS might be the wrong choice. I
> like the simpler option names.
IMHO, I think the -fblas option is the best choice such that the
flag simply maps matmul to the appropiate BLAS routine and the
user is expected to supply an appropriate BLAS library.
OTOH, FX is doing the hard work and whatever he decides to pursue
is up to him.
More information about the Gcc-patches