T.D.
Joined: 04 Feb 2005 Posts: 1
|
Posted: Fri Feb 04, 2005 1:48 am Post subject: Allocation greater than 4GB failed for derived types |
|
|
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
|
|
|
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Fri Feb 04, 2005 10:08 am Post subject: |
|
|
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 |
|