Download PGI User's Guide
Transcript
Chapter 12. Programming Considerations for 64-Bit Environments enddo !$omp do do i=1,m do j = 1, n d = 30000.0D0*dble(i)+dble(j)+dble(j) if(d .ne. c(i,j)) then print *,"err i=",i,"j=",j print *,"c(i,j)=",c(i,j) print *,"d=",d stop endif enddo enddo !$omp end parallel print *, "M =",M,", N =",N print *, "c(M,N) = ", c(m,n) end When compiled with the PGF95 compiler using –mcmodel=medium: % pgf95 –mp –o mat mat.f –i8 –mcmodel=medium % setenv OMP_NUM_THREADS 2 % mat M = 16000 , N = 16000 c(M,N) = 480032000.0000000 Large Array and Small Memory Model in Fortran The following example uses large, dynamically-allocated arrays. The code is divided into a main and subroutine so you could put the subroutine into a shared library. Dynamic allocation of large arrays saves space in the size of executable and saves time initializing data. Further, the routines can be compiled with 32bit compilers, by just decreasing the parameter size. Example 12.3. Large Array and Small Memory Model in Fortran % cat mat_allo.f90 program mat_allo integer i, j integer size, m, n parameter (size=16000) parameter (m=size,n=size) double precision, allocatable::a(:,:),b(:,:),c(:,:) allocate(a(m,n), b(m,n), c(m,n)) do i = 100, m, 1 do j = 100, n, 1 a(i,j) = 10000.0D0 * dble(i) + dble(j) b(i,j) = 20000.0D0 * dble(i) + dble(j) enddo enddo call mat_add(a,b,c,m,n) print *, "M =",m,",N =",n print *, "c(M,N) = ", c(m,n) end subroutine mat_add(a,b,c,m,n) integer m, n, i, j double precision a(m,n),b(m,n),c(m,n) !$omp do 145
Related documents
PGI User's Guide - The University of Sheffield High Performance and
PGI User's Guide
PGI User's Guide Release 9.0 - Faculty of Science HPC Site
PGI User's Guide
PGI 6.1 User`s Guide - University of Alberta
PGI 5 User's Guide - The Portland Group
PGI User's Guide
PGI Compiler User`s Guide
PGI Compiler Reference Manual
PVF Reference Guide
PGI 5 User's Guide
Intel(R) C++ Compiler for Linux* Systems User's Guide