Bill Allombert on Fri, 23 Feb 2018 11:40:56 +0100


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

Re: Gp2c-run running out of memory


On Thu, Feb 22, 2018 at 09:04:16PM -0500, J. Friedman wrote:
> Pari
> I wrote the gp script below. It runs slowly from within gp, so I tried
> to compile it to a c program with the following steps:
> 
> ./gp2c-run lc.gp
> default(parisize,1G)
> doit(1,100000000000)
> 
> I am running it on a machine with 64 GB of ram, but it keeps on using
> more and more memory and doesn’t seem to do any garbage collection.

Indeed, you need to use the flag -g to activate garbage collection.

See the tutorial:
<https://pari.math.u-bordeaux.fr/pub/pari/manuals/gp2c/gp2c.html#sec5>

However, gp2c will probaby not make your script really faster because
you are mostly calling functions like qfbclassno and quadunit which are
already written in C.

If you want to speed it up , I suggest you try to compute
quadunit only once instead of three times by iteration:

Maybe introduce a parameter u:
QFBclassno(D,u) = qfbclassno(D) * if (D < 0 || norm(u) < 0, 1, 2);
QUADunit(D,u)=u*if(D<0||norm(u)<0,u,1);

and set
u=quadunit(D)
in the mainloop.

Cheers,
Bill.