On Fri, Jan 10, 2020 at 04:55:54PM +0100, Julien Puydt wrote:
> Le jeudi 09 janvier 2020 à 12:17 +0100, Bill Allombert a écrit :
> > Maybe the problem is just that the number of cores has increased.
> > 
> > PARI require that parisizemax + threadsizemax * nbthreads fit in the
> > virtual memory.
> > 
> > On 32bit system, there is about 3G of virtual memory,
> > so if you want to set a large threadsizemax, you need to limit the
> > number of threads.
> > 
> 
> Yes, but my point is that if there's a memory problem, there should be
> a proper crash, not an infinite wait.

What you should do is disable parallelism on 32bit plateforms or
compute a suitable value for threadsizemax instead of relying on
PARI recovery code.

The PARI/GP virtual memory allocator manages to allocate nearly all the
available virtual memory.
At this point the pthread library start to misbehave and wait for
some virtual memory to be freed, which will never happen.

If you do in GP

default(threadsizemax, "100M")
isprime(293911884200387681576093)
default(threadsizemax, "1G")
isprime(293911884200387681576093)

Then it works, because the pthread library gets a chance to allocate
some vm memory for itself before PARI grabs the rest.

Since PARI allocates virtual memory to threads in order,
If the system has a bit less than 2GB of free vm and threadsizemax
is set to 1GB, then  
- thread 1 get 1GB
- thread 2 get only 512MB
- thread 3 get only 256MB
- thread 4 get only 128MB
etc.
which converge rather quickly to 2GB of use.

Cheers,
Bill

Reply via email to