multi-threaded multiplication speed-up

Michael comtech.usa at
Sat Jan 13 19:46:44 CET 2007

Hi Jason,

I am also interested in this issue.

My project involves MPFR which is built on top of GMP. I recently started
optimizing the performance of MPFR and GMP using the Intel architecture. The
learning curve of the whole set of Intel tools is quite steep so I don't
have much progress yet.

What I know is that Intel has reimplemented GMP in their MKL library. So I
guess I will try compiling MPFR on top of the Intel version of GMP and see
how it goes. The next step might be to parallelize the MPFR routines as what
you've suggested...

Could you please give some pointers on how to do these types of



On 1/11/07, Jason Martin <jason.worth.martin at> wrote:
> Hi All,
> Out of curiosity, I recently tried a naive multi-threaded
> multiplication scheme (using pthreads) and got a speed-up of about 25%
> for extremely large operands (over 2000 limbs).  I was just using
> simple "textbook" style multiplication (break the larger operand in
> half, do two multiplies using mpn_mul, then shift/add back together).
> I got similar results on a Woodcrest running OS X and a dual core
> Opteron running Linux.
> I suspect that a quad-core CPU in which all the cores share the L2
> cache could really benifit from a Karatsuba-style multi-threaded
> multiply since the three multiplies could run in parallel without
> having to go off-chip for memory accesses.
> Is anyone working on this already?  Does anyone care?
> --jason
> --
> -----------------------------------------------------------
> Jason Worth Martin
> Asst. Prof. of Mathematics
> James Madison University
> phone: (+1) 540-568-5101
> fax: (+1) 540-568-6857
> "Ever my heart rises as we draw near the mountains.
> There is good rock here." -- Gimli, son of Gloin
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the gmp-discuss mailing list