Brereton, Ashley on Sat, 25 Jun 2022 21:10:43 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: FORTRAN memory issues and use of the sum function 'somme' |
Dear all,
Many thanks for your quick replies.
The glngamma
function is exactly what I needed and the gerepilecopy function will be useful for different problems, so this has saved me a massive amount of time!
Thanks again and have a great weekend,
Ash
From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Sent: 25 June 2022 18:15 To: pari-users@pari.math.u-bordeaux.fr <pari-users@pari.math.u-bordeaux.fr> Subject: Re: FORTRAN memory issues and use of the sum function 'somme' On Sat, Jun 25, 2022 at 04:12:56PM +0000, Brereton, Ashley wrote:
> Hi there, > > I was hoping somebody could help with an issue with memory usage. > > My code is written in Fortran. In my code, I have a (simplified) loop (see below). The code fails because the pari stack size isn't big enough. > > It seems like 'u' is stored at a new memory address for each loop iteration, and so the memory fills up - though I may be wrong! Yes, this is correct, you should read the chapter 'Garbage collection' of the documentation. Let say you want to do the sum DO I=1_8,100000_8 u = gadd(u, stor(I,prec)) ENDDO you should do av = avma DO I=1_8,100000_8 u = gadd(u, stor(I,prec)) u = gerepilecopy(av, u); ENDDO or better, only do 'u = gerepilecopy(av, u);' every 1000 iterations or so. (avma is a global variable from libpari) Cheers, Bill. |