gmpbench -- how to utilize all CPU cores?

Fredrik Johansson fredrik.johansson at
Fri Sep 27 14:16:20 CEST 2013

On Fri, Sep 27, 2013 at 1:42 PM, Gabriel Risterucci <cleyfaye at> wrote:
> 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.

The parallel overhead certainly depends on things specific to GMP.. A
function that does a lot of out-of-cache memory access might run fast
on a single core while parallel instances slow down since the cores
are competing for memory access. If the function is modified so that
it works on chunks of data that fit in the cache of each core, it will
run about as fast regardless of how many parallel instances there are.
Taking this aspect into account when tuning GMP is clearly of interest
for people who use their multicore systems to run several GMP-based
computations in parallel.


More information about the gmp-discuss mailing list