* * Program mem1d - Determine the performance of various loop sizes * IMPLICIT NONE * REAL WTIME, CTIME REAL*8 MOPS INTEGER*4 OPERATIONS, BASIS, MAX PARAMETER (BASIS=16, MAX= 19, OPERATIONS = (2**max) * BASIS) INTEGER*4 LoopSize, LoopIterations DIMENSION ARRAY(OPERATIONS) INTEGER*4 ARRAY, Iterations, Length, x MOPS = OPERATIONS / 1000000.0 PRINT 110,'Len, Wall, MOPS, CPU, CPU/Wall' * Fill the array with zeros Do 5 X = 1, OPERATIONS ARRAY(X) = 0 5 Continue CALL HPCTIM(WTIME, CTIME) * Loop lengths are powers of two Do 10 Length = 0, max CALL HPCTIM(WTIME, CTIME) LoopSize = BASIS * (2**Length) LoopIterations = 2**(max - Length) Do 20 Iterations = 1, LoopIterations DO 30 X = 1, LoopSize ARRAY(X) = ARRAY(X) + 3 30 CONTINUE CALL NOOPT(ARRAY) 20 CONTINUE CALL HPCTIM(WTIME, CTIME) print 100,LoopSize*4,WTIME,MOPS/WTIME,CTIME,CTIME/WTIME 10 CONTINUE 100 FORMAT(I10, ',', 7(F10.5, ',')) 110 FORMAT(A) END