TotalView Fortran Serial Exercise 3 - Assignment

Assignment

Use TotalView to locate an error in the following program. The program should print a sum of matrix components. The correct sum is 5.001E+7.

 PROGRAM WRONG
      COMMON /BLOCK/ VECA,VECB,VECA2
      DOUBLE PRECISION VECA(100,100), VECB(500), VECA2(100,100)
      INTEGER I
      DO 10 I=1,100
      DO 15 J=1,100
        VECA(I,J) =   (I-50.D0)**2+(J-50.D0)**2
        VECA2(I,J) =  2.D0*((I-50.D0)**2+(J-50.D0)**2)
15    CONTINUE
        VECB(10000-I*J) = 42.D0
10    CONTINUE
      SUM = 0
      DO 20 I=1,100
      DO 20 J=1,100
        SUM=SUM+VECA(I,J)+VECA2(I,J)
20    CONTINUE
      PRINT *, 'SUM should be 5.001E+07. SUM: ',SUM
      PRINT *, 'All Done'
      STOP
      END