Re: Size of Largest Array?

From: Herman D. Knoble (SkipKnobleLESS_at_SPAMpsu.edu)
Date: 01/30/04


Date: Fri, 30 Jan 2004 13:56:27 -0500

T: For arrays this large to be part of the object code is not reasonable. To
use such large arrays use Allocate(able) arrays. For example:
see Metcalf's example at: http://ftp.cac.psu.edu/pub/ger/fortran/hdk/dyng.f90
or a somewhat cruder example:

        integer ierror, MB, na, nb
        double precision a
        allocatable a
        dimension a(:,:)
        print*, "How many MB to Allocate?"
        read(unit=*,fmt=*) na
        MB=1024**2
!---DOUBLE PRECISION array assumed to have 8-byte elements.
        nb=MB/8
        allocate( a(na,nb), stat=ierror)
        if (ierror.ne.0) then
          print *, "?? Cannot allocate',na,'MB of virtual storage."
          print *, "At least this much free disk space for swap file", &
                        " is needed."
          stop
        endif
!---Initialize all elements of that array (for example's sake here).
        call anysub(a, na,nb)
!---Deallocate the array and quit.
        deallocate( a)
        print *, "Double Presion Array of dimension (",na,",",nb,")"
        print *, "was succesfully allocated, used, and deallocated."
        end
   subroutine anysub(a, n1,n2)
        integer i,j,n1,n2
        double precision a(n1,n2)
!---Access the array in row major order - by columns - (least paging).
        do j=1,n2
          do i=1,n1
           a(i,j)=i+j
          end do
       end do
        end

Skip Knoble, Penn State

On 30 Jan 2004 10:06:30 -0800, rcl7820@owl.forestry.uga.edu (TLowe) wrote:

-|Hey Folks,
-|
-|Can anybody tell me the size of the largest array I can dimension?
-|I am using Lahey FORTRAN 90. I was able to dimension and populate
-|4 arrays, each with 100,000,000 elements. When I added another, I
-|received an error stating that the compiled executable was not a
-|legal Win32 application.
-|
-|I get the idea that I can only use 2 gigs of memory. I have a machine
-|with 6 gigs of memory (running Win 2000 Advanced Server). I want to
-|use as much as possible. Can somebody fill me in if there is a switch
-|I can use when compiling to let the program use more memory?
-|
-|Thanks,
-|
-|TLowe
-|WSFR, UGA

   Herman D. (Skip) Knoble, Research Associate
   (a computing professional for 38 years)
   Email: SkipKnobleLESS@SPAMpsu.edu
   Web: http://www.personal.psu.edu/hdk
   Penn State Information Technology Services
    Academic Services and Emerging Technologies
     Graduate Education and Research Services
   Penn State University
     214C Computer Building
     University Park, PA 16802-21013
   Phone:+1 814 865-0818 Fax:+1 814 863-7049



Relevant Pages

  • Re: How to allocate variable in f90 subroutine and pass it to c program?
    ... -|I understand how it is possible to send arrays from c to F90, ... -|into the c-prog from the F90 subroutine I would like to allocate it in the ... Penn State Information Technology Services ...
    (comp.lang.fortran)
  • Re: How do you visualise arrays?
    ... Interactive Visualization of Higher Dimensional Data in a Multiview Environment: ... -|Needless to say this only works up to 3D and I can't work with arrays ... Penn State Information Technology Services ...
    (comp.lang.fortran)
  • memory leak in (?)... (redux)
    ... the mem leaks in our long-running tcl daemons. ... when actively exercised the app grows continuously. ... the mystery is that while our audit code does show us a couple of arrays ... and memory are checked and meanwhile externally, ...
    (comp.lang.tcl)
  • Re: StackOverflowException.
    ... The Status object monitors the ... so I'm really at a total loss as to where I'm leaking stack memory. ... private static extern bool EscapeCommFunction(IntPtr hFile, ... Good to know about arrays. ...
    (microsoft.public.dotnet.framework)
  • Re: Strategy for caches & GC
    ... I end up writing manual allocators for byte arrays. ... memory to insure it sits in the LOH and suballocate from there (ala ... ArraySlicehandle to work with buffers. ... and manual management for memory and GC generation 0 for efficient ...
    (microsoft.public.dotnet.framework.clr)