gmpbench -- how to utilize all CPU cores?

Gabriel Risterucci cleyfaye at
Fri Sep 27 13:42:48 CEST 2013

2013/9/27 Fredrik Johansson <fredrik.johansson at>

> On Fri, Sep 27, 2013 at 12:37 PM, Gabriel Risterucci <cleyfaye at>
> wrote:
> > Unless I'm wrong, the GMP library itself doesn't take advantage of
> > multicores systems, so it don't "perform" better or worse in these cases.
> > The best you can get is multiple independant computations running on
> > different CPU as well as they would have been run sequentially on one
> core,
> > much like launching your code multiple time on different CPU. In this
> case,
> > parallel usages of GMP won't interfere with eachother.
> That's not true -- parallel usages will compete for shared caches and
> main memory bandwidth. In fact, word I've gotten from an expert on the
> matter is that the FFT multiplication code in GMP performs
> comparatively poorly when you run several instances of it in parallel,
> making such a benchmark rather interesting in anticipation of possible
> future improvements...
> Fredrik

​You're completely right, but that would go in the "overhead" part of
parallel programming, and is not really related to anything specific to
GMP, unless you count "using a lot of memory" as GMP-specific.
Making a benchmark on how GMP perform in this case is merely a benchmark on
how well you specific architecture and OS perform in situation where
multiple cores are used.

I'm not saying it's not interesting to evaluate this part of a system, but
the GMP library (as well as any library that don't care about parallelism)
is not really concerned here; you'll only evaluate how well a specific
hardware/system configuration handle parallel workloads.

Cley Faye

More information about the gmp-discuss mailing list