# Fortran 4GB limitation on AIX 5.x - Aix

This is a discussion on Fortran 4GB limitation on AIX 5.x - Aix ; Hi folks, given the following fortran code example: \$ cat a.f90 implicit none INTEGER, PARAMETER :: n1 = 3650 INTEGER, PARAMETER :: n2 = 605 INTEGER, PARAMETER :: ny = 250000 real :: p2(n2,ny) real :: p1(n1,ny) real :: a2(n2), ...

# Thread: Fortran 4GB limitation on AIX 5.x

1. ## Fortran 4GB limitation on AIX 5.x

Hi folks,
given the following fortran code example:

\$ cat a.f90
implicit none
INTEGER, PARAMETER :: n1 = 3650
INTEGER, PARAMETER :: n2 = 605
INTEGER, PARAMETER :: ny = 250000
real :: p2(n2,ny)
real :: p1(n1,ny)
real :: a2(n2), a1(n1)
integer :: iy,i1,i2

DO iy = 1, ny
do i2 = 1, n1
a2(i2) = -8.0*i2
enddo
DO i2 = 1, n2
p2(i2,iy) = a2(i2)
END DO
ENDDO

do iy = 1, ny
DO i1 = 1, n1
p1(i1, iy) = 3.*p2(1,iy) + 4*p2(3,iy)
ENDDO
enddo
do iy = 1, ny
DO i1 = 1, n1
a1(i1) = p1(i1,iy)
ENDDO
ENDDO
write (*,*) 'done'
stop
end

Compile with ( xlf 10 )
\$ xlf90 a.f90 -o2 -q64 -b64 -o a.out

../a.out runs fine using about 4GB of memory ( using nmon ) but as soon
as i increase n1 to 3700 the program crashed with an segmentation
fault right away.

Tested on
- AIX 5.3 (64bit) with 4GB ram & 4GB paging space ( xlf 10 )
- AIX 5.1 (64bit) with 16GB ram & 16 GB paging space. ( xlf 8)

Its looks like that i hit a 4GB limitation but i could not found any
information regarding a 4GB limitation on fortran or aix. BTW: ulimit
is set to unlimited.

Hajo

2. ## Re: Fortran 4GB limitation on AIX 5.x

This program runs without any problem on my server, whith n1=3650 and
n1=3750 and I've also tried n1 = 4750 ;-)

begou@mach4: ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 4194304
memory(kbytes) unlimited
coredump(blocks) 2097151
nofiles(descriptors) unlimited

AIX 5.2 /8GB RAM
xlfcmp 8.1.1.4

xlf -O3 -q64 ess.f
../a.out
done

It is not a fortran limitation.

Patrick

Hajo Ehlers wrote:
> Hi folks,
> given the following fortran code example:
>
> \$ cat a.f90
> implicit none
> INTEGER, PARAMETER :: n1 = 3650
> INTEGER, PARAMETER :: n2 = 605
> INTEGER, PARAMETER :: ny = 250000
> real :: p2(n2,ny)
> real :: p1(n1,ny)
> real :: a2(n2), a1(n1)
> integer :: iy,i1,i2
>
> DO iy = 1, ny
> do i2 = 1, n1
> a2(i2) = -8.0*i2
> enddo
> DO i2 = 1, n2
> p2(i2,iy) = a2(i2)
> END DO
> ENDDO
>
> do iy = 1, ny
> DO i1 = 1, n1
> p1(i1, iy) = 3.*p2(1,iy) + 4*p2(3,iy)
> ENDDO
> enddo
> do iy = 1, ny
> DO i1 = 1, n1
> a1(i1) = p1(i1,iy)
> ENDDO
> ENDDO
> write (*,*) 'done'
> stop
> end
>
>
> Compile with ( xlf 10 )
> \$ xlf90 a.f90 -o2 -q64 -b64 -o a.out
>
> ./a.out runs fine using about 4GB of memory ( using nmon ) but as soon
> as i increase n1 to 3700 the program crashed with an segmentation
> fault right away.
>
> Tested on
> - AIX 5.3 (64bit) with 4GB ram & 4GB paging space ( xlf 10 )
> - AIX 5.1 (64bit) with 16GB ram & 16 GB paging space. ( xlf 8)
>
> Its looks like that i hit a 4GB limitation but i could not found any
> information regarding a 4GB limitation on fortran or aix. BTW: ulimit
> is set to unlimited.
>
> Hajo
>

3. ## Re: Fortran 4GB limitation on AIX 5.x

On 6 Feb., 18:05, Patrick Begou wrote:
> This program runs without any problem on my server, whith n1=3650 and
> n1=3750 and I've also tried n1 = 4750 ;-)
>

....
>
> xlf -O3 -q64 ess.f
> ./a.out
> done

Hi Patrik,
if i use your command line i get errors because the xlf can not
compile f90 code. So its looks like that your xlf is somehow linked to
xlf90. Could you verify this.

tia
Hajo

4. ## Re: Fortran 4GB limitation on AIX 5.x

Hajo Ehlers wrote:
> On 6 Feb., 18:05, Patrick Begou wrote:
>
>>This program runs without any problem on my server, whith n1=3650 and
>>n1=3750 and I've also tried n1 = 4750 ;-)
>>

>
> ...
>
>>xlf -O3 -q64 ess.f
>>./a.out
>> done

>
>
> Hi Patrik,
> if i use your command line i get errors because the xlf can not
> compile f90 code. So its looks like that your xlf is somehow linked to
> xlf90. Could you verify this.
>
> tia
> Hajo
>

I alway use xlf for fortran90 codes on my AIXs boxes because most of our
files are in fixed format but embeds fortran90 statments (big codes
moving slowly from Fortran77 to Fortran90).

begou@mach4: whence xlf
/usr/bin/xlf
begou@mach4: ls -l /usr/bin/xlf
-rwxr-xr-x 11 bin bin 203232 Jan 29 2004 /usr/bin/xlf
But, yes it seems to use xlf90 befavior. In /etc/xlf.cfg I have:

xlf: use = DEFLT
libraries = -lxlf90,-lxlopt,-lxlf,-lxlomp_ser,-lm,-lc
proflibs = -L/lib/profiled,-L/usr/lib/profiled
options =

Did you check your system limits with ulimit -a ?

5. ## Re: Fortran 4GB limitation on AIX 5.x

On Feb 7, 10:29 am, Patrick Begou wrote:
> Hajo Ehlers wrote:

....
> xlf: use = DEFLT
> libraries = -lxlf90,-lxlopt,-lxlf,-lxlomp_ser,-lm,-lc
> proflibs = -L/lib/profiled,-L/usr/lib/profiled
> options =
>
> Did you check your system limits with ulimit -a ?

\$ ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 4194304
memory(kbytes) unlimited
coredump(blocks) 2097151
nofiles(descriptors) unlimited

xlf options.
\$ grep -wp xlf: /etc/xlf.cfg
* Original Fortran compiler
xlf: use = DEFLT
libraries = -lxlf90,-lxlopt,-lxlf,-lxlomp_ser,-lm,-lc
proflibs = -L/lib/profiled,-L/usr/lib/profiled
options = -qnozerosize,-qsave,-qalias=intptr,-
qposition=appendold,-qxlf90=noautodealloc:nosignedzero,-

Still i can not use the xlf for f90 code. Do you have an alias set ?
Searching the net i found something about the stacksize which is by
default limited to 4GB. But setting the stack to a larger size like:

export XLSMPOPTS="stack=83888608"

and using the

xlf90_r -qsmp ...

does not work either. Maybe it is different on AIX 5.2 and 5.3 .

Hajo

6. ## Re: Fortran 4GB limitation on AIX 5.x

....
> Did you check your system limits with ulimit -a ?

Its looks like that the array is put onto the stack. The stack is
limited to 4GB thus the segmentation fault. Why it not happen on your
AIX 5.2 machine i do not know. At least increasing the stack to 8GB
solved the problem.

thanks again
Hajo