forum.alglib.net
http://forum.alglib.net/

memory allocation limit in ALGLIB?
http://forum.alglib.net/viewtopic.php?f=2&t=21
Page 1 of 1

Author:  franziss [ Sat Jun 05, 2010 4:41 pm ]
Post subject:  memory allocation limit in ALGLIB?

Is there a limit to the memory allocation in ALGLIB? I tried the following code,
Code:
   ap::real_2d_array c,c1,c3;
   c.setlength(9000, 9000);
   c1.setlength(9000, 9000);
   c3.setlength(9000, 9000);

and my program crashes at c3.setlength

I think this limit is set by windows, at most 2gb?

Author:  Sergey.Bochkanov [ Sun Jun 06, 2010 9:41 am ]
Post subject:  Re: memory allocation limit in ALGLIB?

It depends on two factors. First one - OS limitations (2Gb under 32-bit OS, unlimited - under 64-bit OS).

Second factor - even under 64-bit OS ALGLIB supports only 32-bit array indexes. So maximum size of 1-dimensional array is 2^31-1 elements. However, no one objected to this limitation so far :) As for matrices, maximum size of matrix is (2^31-1)x(2^31-1) - which is enough for almost anyone. I think that the this limitation will be dropped in one of the next releases. I just want to make transition as smooth as possible, especially to avoid numerous "32 vs. 64 bit" issues.

As for your problem, you allocate 3*9000*9000*sizeof(double) bytes = 1.8 GB. Take into account that many linear algebra subroutines allocate temporary space, so no wonder that all virtual memory is consumed in this process.

Author:  franziss [ Sun Jun 06, 2010 3:02 pm ]
Post subject:  Re: memory allocation limit in ALGLIB?

I am setting the 2d array to be used for calculating eigenvalues. So the 2d array is symmetrical, and the efficient way is to assign a 1d array to represent a symmetrical 2d array, which the matrix template library(mtl) is doing. But mtl is not as user friendly as ALGLIB, and so far I can't get mtl to work in visual studio 2008

Author:  Sergey.Bochkanov [ Mon Jun 07, 2010 7:44 pm ]
Post subject:  Re: memory allocation limit in ALGLIB?

Yes, I see that 2GB limit on 1D array length will be serious problem for such code. I think that this limitation will be dropped really soon, but as for packed storage for symmetric matrices - it may take as long as 6-12 months. In the near future I want to optimize non-packed linear algebra and FFT (both assembly optimizations and multi-core support). I understand now that packed storage is important for large symmetric problems, but assembly and multithreading are more important, I think. Just can't implement everything at once, so I have to sort thing by priorities :)

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/