C****************************************************************************** C TotalView Exercise 1 - Fortran Version C FILE: tvEx1.f C DESCRIPTION: Simple matrix multiply. C Used to demonstrate basic TotalView functions/features C LAST REVISED: 11/28/2001 Blaise Barney C****************************************************************************** program tvEx1 parameter (NRA = 62) parameter (NCA = 15) parameter (NCB = 7) integer i,j,k real*8 a(NRA,NCA), b(NCA,NCB), c(NRA,NCB) common /matarrays/ a, b, c print *, ' ' print*, 'Starting TotalView Exercise 1' C Initialize A and B print *, ' ' print*, 'Initializing matrices...' do 30 i=1, NRA do 30 j=1, NCA a(i,j) = (i-1)+(j-1) 30 continue do 40 i=1, NCA do 40 j=1, NCB b(i,j) = (i-1)*(j-1) 40 continue C Perform matrix multiply print *, ' ' print*, 'Doing matrix multiply...' do 50 k=1, NCB do 50 i=1, NRA c(i,k) = 0.0 do 50 j=1, NCA c(i,k) = c(i,k) + a(i,j) * b(j,k) 50 continue call printmatrix() print *, ' ' print*, 'Exercise 1 code has completed.' end subroutine printmatrix() parameter (NRA = 62) parameter (NCA = 15) parameter (NCB = 7) integer i,j,k real*8 a(NRA,NCA), b(NCA,NCB), c(NRA,NCB) common /matarrays/ a, b, c print *, ' ' print*, 'Here is the result matrix: ' print *, ' ' do 90 i=1, NRA do 80 j = 1, NCB write(*,70)c(i,j) 70 format(2x,f8.2,\$) 80 continue print *, ' ' 90 continue end subroutine