Karim BELABAS on Tue, 3 Aug 1999 11:35:12 +0200 (MET DST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Two bugs (2.0.16 on Linux/Alpha) |
>> [Matias:] >> ? allocatemem(256000000) >> ? matrix(1000,5000,i,j,cos(0.5*i*j)) >> *** the PARI stack overflows !!! >> >> *** Warning: doubling stack size; new stack = 512000000. >> >> I repeated this with a stack of 800Mb and it gave me the same problem. >[Igor:] >> It has improved since, for example, version 2.0.9, but still it's >> far away from where it could eventually be. It's not on the immediate >> TODO list, but Karim will tell you whether it's planned for remote future. [Matias:] > > I would feel satisfied with this answer if I were actually DOING matrix > operations, but I'm not. I use the matrix() command just to create a 2 > dimensinoal array with special entries, but after that I don't do anything > other than extracting entries from it. Indeed. > So, in my opinion this problem would not mean that PARI does linear algebra > poorly, but that it does memory management poorly. No need for memory management in matrix(): The stack is clean after each matrix entry is computed (i.e the stack only grows by the amount necessary to fit the entry). I don't understand why 800MB overflows, but 256MB definitely should. Your machine is 64bit; using default precision (4 words), real numbers (2 codewords) need 6 words each. Multiplied by 5.10^6, it's about 230MB, and you need a bit more to actually hold the entries. It fits, but barely. Now it turns out that because of the way the computations were done, one extra word of precision becomes available, hence most of the entries actually need 7 words and not 6. That's enough to overflow. 1) experiment with sizebyte and check how much room this kind of matrices needs on your architecture. Again it shouldn't overflow at 800MB, check whether the size of your matrices is roughly equal to (number of entries) * (realprecision + 2 (or 3)) bytes 2) cut down the precision (\p19 for instance). Entries will now fit in 4 words at most. Karim. __ Karim Belabas email: Karim.Belabas@math.u-psud.fr Dep. de Mathematiques, Bat. 425 Universite Paris-Sud Tel: (00 33) 1 69 15 57 48 F-91405 Orsay (France) Fax: (00 33) 1 69 15 60 19 -- PARI/GP Home Page: http://hasse.mathematik.tu-muenchen.de/ntsw/pari/