Parallelizing GMP

Kentaro Yamamoto taku2ro at
Sun Oct 30 10:39:49 CET 2011

On Sat, 29 Oct 2011 10:03:41 +0200 (CEST)
Marc Glisse <marc.glisse at> wrote:

> do you only compute the exponentiation of a single number? When you 
> parallelize, the higher the level, the greater the gains, and computing 
> the exponentiation of several numbers in parallel sounds like it would 
> work best.

I compute the exponentiation of several number.  But in my case
depending on the exponentiation of a number, that of other numbers
become unnecessary.  Since computing the exponentiation takes very
long, so I thought concentrating all the cores into on the
exponentiation of a single number would be better.

> Some algorithms parallelize better than others, and the one currently in 
> gmp wasn't written for that purpose. If I understand correctly, the FFT 
> multiplication first computes the transform of each operand (you could try 
> doing those 2 in parallel), then multiplies the 2 transforms componentwise 
> (what you already parallelized) and eventually retransforms to get the 
> result. If you are close to the FFT threshold, you could also try 
> parallelizing the toom multiplications. 

Parallelizing the transformation itself or Toom, I believe, causes
nested #omp parallel directives.  Doesn't it have a bad effect on the

Kentaro Yamamoto <call at>

More information about the gmp-discuss mailing list