[gambit-list] Computing pi with parallel gambit

Marc Feeley feeley at iro.umontreal.ca
Mon Dec 12 16:39:56 EST 2016


> On Dec 11, 2016, at 9:53 PM, Bradley Lucier <lucier at math.purdue.edu> wrote:
> 
> Is there a way for me to try to run it in parallel?
> 
> Brad
> 
> <chud-parallel.scm>

I tried your program on my working copy of Gambit (rather brittle, but good enough to run simple tests like this).  I computed 1 million digits of pi.  On 1 processor it takes 15 seconds real-time, and on 7 processors it takes 9 seconds.  Not a great improvement.

When I look at the activity log (attached below) I see that the program is not very parallel.  It seems threads are only generated in the main part of the computation, between 2000 ms and 5000 ms into the execution.  When I review the source code, I think the first 2000 ms are used to compute sequentially the square root of a 2 million digit bignum, and after the 5000 ms mark, the program computes sequentially (quotient (* p ch-C sqrt-C) (* ch-D (+ q (* p ch-A)))) with large bignums.

So to improve the performance, it would be necessary to improve the parallelism in those two parts.  The square root could probably be done concurrently with the main computation (for a small number of processors, otherwise a parallel square root algorithm needs to be devised).  The tail part of the computation might be improved by parallel algorithms for multiplication and division.

Marc




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161212/7cb06d20/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 38655 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161212/7cb06d20/attachment.png>


More information about the Gambit-list mailing list