C****************************************************************************** C FILE: arit05.f C DESCRIPTION: C Demonstrates type considerations between double and complex C*****************************************************************************/ PROGRAM arit05 IMPLICIT NONE INTEGER ARRAY_SIZE PARAMETER(ARRAY_SIZE = 100000) INTEGER I INTEGER(8) T1, T2, IRTC REAL*16 X, A(ARRAY_SIZE), B(ARRAY_SIZE), C(ARRAY_SIZE) REAL*8 Y, D(ARRAY_SIZE), E(ARRAY_SIZE), F(ARRAY_SIZE) C Initialization DO I=1, ARRAY_SIZE A(I) = I*1.0 B(I) = I*2.0 C(I) = I*3.0 D(I) = I*1.0 E(I) = I*2.0 F(I) = I*3.0 ENDDO C***************************************************************************** C* Untuned Loop * C***************************************************************************** T1 = IRTC() X = 0 DO I=1,ARRAY_SIZE X = X + A(I)*B(I)+C(I) ENDDO T2 = IRTC() WRITE(*,*)'Untuned loop took', (T2-T1)/1000000, 'msec' C***************************************************************************** C* Tuned Loop * C***************************************************************************** T1 = IRTC() Y = 0 DO I=1,ARRAY_SIZE Y = Y + D(I)*E(I)+F(I) ENDDO T2 = IRTC() WRITE(*,*)'Tuned loop took', (T2-T1)/1000000, 'msec' C Need to actually use the results of the calculations or else the C optimizing compiler may just skip doing them...so we'll just C print them. This will force the optimizer to actually do the work. PRINT *, X, Y 999 end