Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran error: Big array size, solution?

  1. May 26, 2012 #1
    Hi everybody;
    I'm not programmer or computer expert, but during working with my thesis got serious problem with my program seemingly about big size of matrices. I'm working with meshes and using Fortran to analyze entire of my mesh including nodes and elements. The biggest size of my matrix has around 61,000x61,000 arrays. During debugging of my program, following common message and highlighted ERROR are appearing every time:

    --------------------Configuration: Ali-0 - Win32 Debug--------------------
    Compiling Fortran...
    D:\Thesis\Fortran programming\Copy of shin yokohama fortran\Ali-0.for
    D:\Thesis\Fortran programming\Copy of shin yokohama fortran\Ali-0.for(25) : Error: A common block or variable may not exceed 2147483647 bytes
    & nfix(5000),r1(61000),sk(61000,61000)
    Error executing df.exe.

    Ali-0.exe - 1 error(s), 0 warning(s)

    I know the reason is because size of my matrix in bytes outnumbers maximum allocatable bytes for each matrix. I have no choice to use this matrix. I've searched the web for reasons and solutions. It seems that this error relates to ram and operating system as well.
    I have 2 system: window 32 bit 2GB ram, other windows 64 bit, 6.00 GB.
    Could anybody help me resolving this problem!
  2. jcsd
  3. May 28, 2012 #2

    Well, at least you have realized that the reason why you cannot have this matrix size is simply because your computer does not have that kind of memory. As you can tell, your 61000x61000 matrix puts you up there in 3.7GB, IF the matrix has been declared as a 1-byte short integer...but if it is REAL and possibly double prescision....then it is HUGE.

    I think the only way to get around some of these calculations is to start using sparse techniques.

    Also, regarding the COMMON block just being too big...maybe you should stop using common block and start using MODULES and the USE command...are you in fortran 90 at least? or still f77? You need fortran 90 for modules.
  4. May 28, 2012 #3
    Thanks for commenting, gsal;
    My compiler is Fortran 90 installed on platform 32 bits, 2GB RAM;
    Other one is Microsoft Visual Studio 2008, version 3.5 Sp1 installed on platform 64 bits, 6GB RAM.
    Yeah, you are right, my matrix sk takes about 61000x61000x4 bytes ≈ 15GB memory.
    Even if I want to use sparse techniques, still I need to use another way to overcome memory shortage.
    During these days which I posted my problem, I was reading about my problem from various posts and forums. I came across to heap and stack memory, and allocatable arrays discussions which is exactly related to switching the memories when one is limited.
    As I'm not good with heap arrays ans stack memory concepts, still kind of unfamiliar how exactly utilize these concepts in Fortran language? how much do I have to change the allocation of stack memory in my case ?? :)) still :frown:
  5. May 28, 2012 #4
    Sorry...I don't know much about heaps and stacks; I have certainly never used them instead of matrices in my problems.

    Hopefully somebody else will come along; otherwise, there are other fortran forums you may want to try. This one is pretty active.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook