CPU dispatching in GMP is flawed

Jonathan Blanchard BlanchardJ at ieee.org
Mon Aug 9 14:33:33 CEST 2010

If I may jump into this discussion. The subject of optimized binary is
a complex one and runtime cpu detection is one of the possible
solution. From my experience, writing portable cpu detection code is
far from simple and hardly portable. Like most open source projects my
interest in GMP are in getting a working, portable and correct
library, speed is just 'nice to have' but never at the price of
portability. (Now with a grain of salt here but still.) Also this
discussion appears to be mostly related to the way x86 cpu handles the
mess they created by having half a million instruction sets.

Let's not forget the difference between a distribution and an
optimized version of GMP. OS or software distribution will provide
baseline binaries that should work with acceptable results on all
supported architecture. One of the advantages of free software to the
area of numerical computing is the ability to build optimized binaries
for their computing platform. This kind of negate the need for runtime
detection since it would be disabled in that case where performance
matter the most.

Finally I would just like to add that there is other ways to select
optimized binary at runtime, whether it's a functionality of the
dynamic linker or the application.

On Mon, Aug 9, 2010 at 7:07 AM, Agner Fog <agner at agner.org> wrote:
 Any processor you are
> optimizing for now is likely to be obsolete at the time the software is
> running on the end user's PC.

Clearly this statement is false in the world we are living. If
mathematica cannot update their code as often as they should it's
certainly not the authors problem. Also many software packages and OS
distribution ships with extremely up to date code, most linux
distribution do or for example the Scilab numerical computing

Jonathan Blanchard

More information about the gmp-discuss mailing list