PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Allocation greater than 4GB failed for derived types

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
T.D.



Joined: 04 Feb 2005
Posts: 1

PostPosted: Fri Feb 04, 2005 1:48 am    Post subject: Allocation greater than 4GB failed for derived types Reply with quote

Hi,

The following program causes a segmentation fault using the PGI fortran compiler 5.2-4 in AMD64 opteron (16GB memory) on line:
Code:
allocate(grandTableau(0:grandeTaille - 1))


It does not depend on compilation options (-i8 or -tp k8-64 or -tp amd64).

Code:
program kkraboum

  type ensemble
     integer, dimension(:), pointer :: petitTableau => null()
  end type ensemble

  type(ensemble), dimension(:), allocatable :: grandTableau
  real, dimension(:), allocatable :: tabReel
  integer :: i
  integer, parameter :: tailleTabReel = 2000000000
  integer, parameter :: grandeTaille = 64000000
  integer, parameter :: petiteTaille = 5
  type(ensemble) :: donnee
  integer :: longueur

  write(*,*) "Test ..."
  write(*,*) "Test tableau simple", tailleTabReel
  allocate(tabReel(0:tailleTabReel - 1))
  write(*,*) " -> allocation OK"
  do i = 0, tailleTabReel - 1, 100
     tabReel(i) = real(i)
  end do
  write(*,*) "suivant ... (appuyez sur entre)"
  read(*,*)
  deallocate(tabReel)
  write(*,*) "Allocation grand tableau"
  allocate(grandTableau(0:grandeTaille - 1))
  write(*,*) "Allocation OK"

  write(*,*) "Allocation petits tableaux"
  do i = 0, grandeTaille - 1, 1
     allocate(grandTableau(i)%petitTableau(0:petiteTaille - 1))
  end do
  write(*,*) "Allocation OK"
  do i = 0, grandeTaille - 1, 1
     deallocate(grandTableau(i)%petitTableau)
  end do
  deallocate(grandTableau)
end program kkraboum
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6215
Location: The Portland Group Inc.

PostPosted: Fri Feb 04, 2005 10:08 am    Post subject: Reply with quote

Hello,

You need to compile with "-i8 -Mlarge_arrays" in order to use arrays that are larger than 2Gb. (See page 31 of the 5.2-4 release notes http://www.pgroup.com/doc/pgiwsrn.pdf). For large static arrays and common blocks, you'll also need to add "-mcmodel=medium". Note that I was able to compile and run the program on our 16Gb system without problem when the program was compiled with "-i8 -Mlarge_arrays".

Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
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 © phpBB Group