forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Use of parameter in ALLOCATE produces ICE

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2239
Location: Sydney

PostPosted: Mon May 04, 2020 3:40 am    Post subject: Use of parameter in ALLOCATE produces ICE Reply with quote

When allocating a large array, if the array size is an integer parameter, I get an ICE, but an integer variable works ok.
Code:
   PROGRAM monster_1
!
        integer*8, parameter :: four     = 12 ! 4
        integer*8, parameter :: thousand = 1000
        integer*8, parameter :: million  = thousand*thousand
        integer*8, parameter :: billion  = thousand*million
        INTEGER*8, PARAMETER :: fourgb   = four*billion
!
        INTEGER*1, allocatable :: i4gb(:)
        INTEGER*8 :: i8, step, fgb
        integer*4 :: astat, pass
        INTEGER*1 :: b
!
        call wait_for_response ( 'about to start - not allocated')
!
!        fgb = fourgb
!        allocate ( i4gb(fgb), stat=astat )       ! this works
        allocate ( i4gb(fourgb), stat=astat )      ! this produces ICE with Ver 8.62.0
        write (*,*) 'allocate ( i4gb(fourgb), stat=',astat
        call wait_for_response ( 'array allocated')
!
      do pass = 1,2
        if ( pass == 1 ) step = 500*million+3
        if ( pass == 2 ) step = 500*thousand+3
        write (*,fmt='(a,i0,a,i0)') 'Pass =',pass,' : Step = ',step
!
        b = 1
        DO i8 = 1,fourgb,step
           IF (b == 127) THEN
              b = 0
           ELSE
              b = b+1
           END IF
           i4gb(i8) = b
        END DO
        call wait_for_response ( 'initialised loop')
!
        DO i8 = 1,fourgb,step
           WRITE(*,*)i8,i4gb(i8)
        END DO
        call wait_for_response ( 'finished check')
!
      end do
!
   END PROGRAM monster_1

   subroutine wait_for_response (prompt)
      character prompt*(*), a
      write (*,*) prompt,' : Waiting ?'
      read (*,fmt='(a)') a
   end subroutine wait_for_response


Apart from the ICE, this example is interesting as it demonstrates that sparse use of a large array does not demand physical (possibly virtual) memory being allocated.
The above array has a memory "Comit" of 11.7 GB, but
for pass=1 only uses 7Mb of working memory,
for pass=2 only uses 126Mb of working memory and
no working/physical memory is required at ALLOCATE.

This physical memory would be allocated as 4Kb pages so careful use of a large virtual array can work with much less physical memory.
However, get it wrong or use array syntax, then everything will stop !
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6593
Location: Salford, UK

PostPosted: Mon May 04, 2020 9:23 am    Post subject: Reply with quote

This FTN95 failure has now been fixed for the next release.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group