[Lapack] Question for array size in Lapack subroutine
From: Jason Riedy
Date: Thu, 07 Aug 2008 17:46:28 -0400
And James writes:
My data segment size is exceeding 2GB. That's what is causing
problems. This would require to allocate memory dynamically.
How to fix this problem? How to revise it?
Some compilers start generating garbage if you declare static
arrays over 2GiB, so the link failure may have saved you some
painful debugging. And you're entering the area where
offset computations may be incorrect if the intermediate results
are computed in 32-bit integers.
I would strongly advise using dynamic allocation to handle your
immediate problem. It's not at all difficult in modern Fortran:
real(kind(0.0d0)), allocatable:: bigarray(:), bigarray2(:,:)
integer:: M, N
allocate ( bigarray(N), bigarray2(M,N) )
The allocate() call will abort if it fails to allocate enough
memory for all its arguments. Optional arguments permit
different error handling options. The "final committee drafts"
of the Fortran standards (documents right before final voting)
are available through http://www.j3-fortran.org/ and provide
the full specifications for allocate.
We avoid dynamic allocation within LAPACK proper for historical
reasons and for use in particular applications (validated
systems where "dynamic allocation" is forbidden).