J. Friedman on Fri, 23 Feb 2018 03:04:25 +0100


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

Gp2c-run running out of memory


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.


On the other hand, when I run the script within GP, without using gp2c, it uses very little memory. Is there something I can do to so it releases unused memory and convert it to a c program?



##################
IsProp(D)=if ( (D%4==1 || (D)%4==0) && !issquare(D), 0, 1);
QFBclassno(D) = qfbclassno(D) * if (D < 0 || norm(quadunit(D)) < 0, 1, 2);
QUADunit(D)=quadunit(D)*if(D<0||norm(quadunit(D))<0,quadunit(D),1);
Li(x) = -eint1(log(1/x));

doit(MinD,MaxD) = {
for (D=MinD,MaxD, if (IsProp(D)==0,
n=QUADunit(D)^2;
if (n < MaxD, 
m=QFBclassno(D); 
write(MinD"to"MaxD"prime.csv", n "," m "," D "," real(n) "," imag(n) ) ) ) ); 
}
################