Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Computer hangs during allocating memory

skravoof
Beginner
1,308 Views
Dear all,
I have a weird problem. My project sometimes goes out of memory . When I use fortran powerstation i will endup with out of memory message. For the same code if I use Inter fortran compiler the whole computer hangs during memory allocation. Is there anyway I can stop the code excuction if its out of memory.
PS: I am using visual studio 2008 as well
Regards,
skravoof
0 Kudos
7 Replies
Les_Neilson
Valued Contributor II
1,308 Views
If you are using the Fortran "allocate" statement then use the error status to check for failure/insufficient memory. Then you will know which array "fails".
Some people like to allocate several arrays in one allocate statement which is ok but if you are doing this and your arrays are large then IMHO it is better to allocate one array at a time and check the status.

If you also have large arrays(not sized by allocate) then use /heap-arrays:0
See in VisualStudio Project -> Properties -> Fortran -> Optimization -> Heap Arrays

Les

0 Kudos
mecej4
Honored Contributor III
1,308 Views
I am not yet convinced that the program ran out of memory (well, I have not seen any code yet!).

You wrote "For the same code if I use Inter fortran compiler the whole computer hangs during memory allocation". That is hard to believe. An ALLOCATE statement either succeeds or fails. I have never seen an ALLOCATE statement cause a computer to hang. On the other hand, if the status is not checked following a failed ALLOCATE, and the not-yet-properly-allocated memory is used, that can certainly cause the hang.

You can use the /traceback compiler option to locate the part of your program where a problem occurs. You can use the STAT= option of the ALLOCATE statement and examine the value of the status variable, as well.


0 Kudos
Antonio_R_3
Beginner
1,308 Views

I am new in the use of the coarray ifort facilities, for linux, and I have a problem similar to the one described before. The following is a summary of the code that fails.

.......................... (ifort code)

real(sp), allocatable  :: snr(:)[:]      

........................(ifort code)

allocate (snr(NumberBeams)

  • ,stat=stat)
    write(*,*) "snr ",stat
  • ..................................................

    And the program hangs, and  never executes the last sentence.  

    0 Kudos
    Bernard
    Valued Contributor I
    1,308 Views

    >>>For the same code if I use Inter fortran compiler the whole computer hangs during memory allocation. Is there anyway I can stop the code excuction if its out of memory.>>>

    Can you use process explorer or better VMmap to confirm out-of-memory scenario?

    0 Kudos
    SergeyKostrov
    Valued Contributor II
    1,308 Views
    >>...My project sometimes goes out of memory . When I use fortran powerstation i will endup with out of memory message... Please provide additional technical details of your system: How much physical memory is installed and settings for Virtual Memory ( see System applet in Control Panel ).
    0 Kudos
    Bernard
    Valued Contributor I
    1,308 Views

    @skravoof

    any updates on your problem?

    0 Kudos
    Lorri_M_Intel
    Employee
    1,308 Views

    Antonio R. wrote:

    I am new in the use of the coarray ifort facilities, for linux, and I have a problem similar to the one described before. The following is a summary of the code that fails.

    .......................... (ifort code)

    real(sp), allocatable  :: snr(:)[:]      

    ........................(ifort code)

    allocate (snr(NumberBeams)

  • ,stat=stat)
    write(*,*) "snr ",stat
  • ..................................................

    And the program hangs, and  never executes the last sentence.  

    Popping back to this one for a second ... please look at your code, and make sure that the allocate statement is happening on ALL images.   It is a requirement that all images perform the same allocate on a coarray object.  Also, the language requires that all images wait until everyone has completed the allocation before continuing.

      If you have code that only performs the allocation on some of the images, well, they are waiting patiently for the ones not participating.

                     --Lorri

    0 Kudos
    Reply