Re: I need help for parallel optimization

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <Z9sFdp-KuQJoxOS-@seventeen>
On Wed, Mar 19, 2025 at 06:34:51PM +0100, Jean-Luc Arnaud wrote:
> Hi all,
> 
> I've coded a GP Script calculating Pi digits based en Chudnovski algorithm.
> 
> It works very well and fast (≈ 1 min 43 s for 1 000 000 digits) but I'd like
> to optimize it with parallel calculation.

It is not really possible. There is few part of the algorithm that can run at
the same time.

Also it is not needed, PARI uses the same formula and need less than 1s without
parallelism.

The trick is to use a technique known as binary splitting to compute the sum.

To start with something easier, what you can try to speed it up a bit (without
paralelism) is to keep track of the numerators and denominators of ak, a_sum
and bsum separately.

That is 
num_a_k = num_a_k*(-(6*i-5)*(2*i-1)*(6*i-1)) 
den_a_k = den_a_k* (i^3* C3);

etc.

Cheers,
Bill.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.