12.07.2015 Views

PGI User's Guide

PGI User's Guide

PGI User's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Medium Memory Model and Large Array in Fortranm = i;}printf("a[0]=%g b[0]=%g c[0]=%g\n", a[0], b[0], c[0]);printf("m=%lld a[%lld]=%g b[%lld]=%gc[%lld]=%g\n",m,m,a[m],m,b[m],m,c[m]);return 0;}% pgcc –mcmodel=medium –o bigadd bigadd.cWhen SIZE is greater than 2G/4, and the arrays are of type float with 4 bytes per element, the size of each arrayis greater than 2GB. With pgcc, using the –mcmodel=medium switch, a static data object can now be > 2GB insize. If you execute with these settings in your environment, you may see the following:% bigaddSegmentation faultExecution fails because the stack size is not large enough. You can most likely correct this error by using thelimit stacksize command to reset the stack size in your environment:% limit stacksize 3000MNoteThe command limit stacksize unlimited probably does not provide as large a stack as we are usingin the Example 13.1.% bigadda[0]=1 b[0]=2 c[0]=3n=599990000 a[599990000]=5.9999e+08 b[599990000]=1.19998e+09c[599990000]=1.79997e+09The size of the bss section of the bigadd executable is now larger than 2GB:% size –-format=sysv bigadd | grep bss.bss 4800000008 5245696% size -–format=sysv bigadd | grep TotalTotal 4800005080Medium Memory Model and Large Array in Fortran172The following example works with the PGFORTRAN, PGF95, and PGF77 compilers included in Release 2011.Both compilers use 64-bit addresses and index arithmetic when the –mcmodel=medium option is used.Consider the following example:Example 13.2. Medium Memory Model and Large Array in Fortran% cat mat.fprogram matinteger i, j, k, size, l, m, n parameter (size=16000) ! >2GBparameter (m=size,n=size)real*8 a(m,n),b(m,n),c(m,n),ddo i = 1, mdo j = 1, na(i,j)=10000.0D0*dble(i)+dble(j)b(i,j)=20000.0D0*dble(i)+dble(j)enddoenddo

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!