Bill Allombert on Mon, 29 May 2023 15:26:27 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: parsum and nbthreads


On Wed, May 24, 2023 at 10:32:47AM +0200, Loïc Grenié wrote:
>    Hi,
> 
>    I've recently used parsum(m2=1,20,<code>) on a 16-threaded
>   machine. parsum parallelizes the sum only up to floor(sqrt(20))
>   threads (hence 4 in my case, for a 16-threaded computer). While
>   this is certainly a good limit if the number of things to sum is
>   >= nbthreads^2, it is less good in the other case.

Use vecsum(parvector(20,m2,<code>))
parsum only makes sense for large sums when storing all the terms would
use too much memory.

vecsum(parvector) has the big advantage of always giving the same result.

Cheers,
Bill