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

Fortran dynamic space arrays

  1. Sep 5, 2011 #1
    Hi all

    I am trying to run an executable compiled from some Fortran files (not my own), which look like they are written in Fortran 77. One of these includes some dynamic space arrays, where the number of elements depends on an integer value passed to the subroutine, e.g.

    Code (Text):

          subroutine assim (plevels,qlevels,row,number)
          implicit none
         
          integer plevels, qlevels, row, number
         
    C DYNAMIC SPACE ARRAYS:
          integer array1(number)
          integer array2(number)
         
          ...
         
          return
          end
     
    When I try to run the executable, the program gives the error message below, which I have traced back to the dynamic space array declaration. However, when someone from a different department compiles the code it works on their machine.

    I guess this is some sort of memory problem? I've tried using ulimit, but get the same error. Can anyone offer any further help or insight? The error message is:

    Command terminated by signal 11
    0.63user 0.00system 0:00.86elapsed 74%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+2482minor)pagefaults 0swaps

    Many thanks
     
  2. jcsd
  3. Sep 5, 2011 #2
    After doing a bit more work it seems that one of the arrays is defined to have 25 million elements, hence the reason my computer hasn't enough memory! Ah well, problem sorted I guess. :rolleyes:
     
  4. Sep 5, 2011 #3

    uart

    User Avatar
    Science Advisor

    Hi jf22901. What version of Fortran are you using? I'm just trying to figure out when dynamic arrays entered into the language.
     
  5. Sep 5, 2011 #4

    jtbell

    User Avatar

    Staff: Mentor

    Standard Fortran 77 did not have dynamically-allocated arrays. Some F77 compilers may have had them as a non-standard extension, although I don't remember using any such compilers myself.
     
  6. Sep 5, 2011 #5
    It's a model that's been developed over the years, so there is some Fortran 77, and some 90. The code where the dynamic arrays are is definitely written in the syntax of Fortran 77. The compiler is ifort (which seems to allow non-standard extensions), but I know that whenever I've tried to use dynamic arrays with gfortran on my laptop it simply refuses!
     
  7. Sep 5, 2011 #6

    uart

    User Avatar
    Science Advisor

    Ok thanks. I expect that iFort will support whatever the most recent Fortran specifications are and possibly some extensions.

    BTW. I just now checked this with g95 (the gnu fortran 95 compiler) and it also supports arrays defined like this. This is interesting as I didn't expect that.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran dynamic space arrays
  1. Fortran 3D array (Replies: 3)

Loading...