January 14 2011 11:29:51.005 AM TIMER_ETIME FORTRAN90 version. Demonstrate the use of the ETIME timer. ETIME is a routine built into most UNIX compilers, in particular, the Gnu GFORTRAN compiler, used as follows: real etime real tarray(2) cpu = etime ( tarray ) returning elapsed CPU time in seconds. ETIME reports: The current CPU time is 0.137300E-02 TARRAY(1) = 0.338000E-03 TARRAY(2) = 0.103500E-02 TEST01 Time the FORTRAN90 RANDOM_NUMBER routine: call random_number ( x(1:n) ) Data vectors will be of minimum size 1 Data vectors will be of maximum size 1048576 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 Min Ave Max 1 0.000008 0.000000 0.000000 0.000002 0.000000 0.000000 0.000002 0.000008 2 0.000001 0.000000 0.000000 0.000000 0.000001 0.000000 0.000000 0.000001 4 0.000001 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000001 8 0.000001 0.000000 0.000001 0.000000 0.000001 0.000000 0.000001 0.000001 16 0.000001 0.000001 0.000001 0.000001 0.000000 0.000000 0.000001 0.000001 32 0.000001 0.000001 0.000002 0.000001 0.000001 0.000001 0.000001 0.000002 64 0.000001 0.000001 0.000003 0.000001 0.000001 0.000001 0.000001 0.000003 128 0.000002 0.000002 0.000004 0.000002 0.000002 0.000002 0.000002 0.000004 256 0.000005 0.000004 0.000005 0.000004 0.000006 0.000004 0.000005 0.000006 512 0.000011 0.000009 0.000009 0.000010 0.000009 0.000009 0.000010 0.000011 1024 0.000020 0.000017 0.000017 0.000023 0.000016 0.000016 0.000019 0.000023 2048 0.000037 0.000034 0.000034 0.000035 0.000035 0.000034 0.000035 0.000037 4096 0.000076 0.000068 0.000068 0.000069 0.000068 0.000068 0.000070 0.000076 8192 0.000150 0.000138 0.000137 0.000136 0.000137 0.000136 0.000140 0.000150 16384 0.000297 0.000272 0.000274 0.000274 0.000273 0.000272 0.000278 0.000297 32768 0.000584 0.000530 0.000545 0.000549 0.000547 0.000530 0.000551 0.000584 65536 0.001155 0.001093 0.001044 0.001043 0.001078 0.001043 0.001083 0.001155 131072 0.002297 0.002085 0.002087 0.002084 0.002110 0.002084 0.002133 0.002297 262144 0.004594 0.004184 0.004192 0.004201 0.004191 0.004184 0.004272 0.004594 524288 0.009288 0.008363 0.008376 0.008432 0.008462 0.008363 0.008584 0.009288 1048576 0.018550 0.016793 0.016784 0.016780 0.016770 0.016770 0.017135 0.018550 TEST02 Time vectorized operations: y(1:n) = x(1:n) y(1:n) = PI * x(1:n) y(1:n) = sqrt ( x(1:n) ) y(1:n) = exp ( x(1:n) ) Data vectors will be of minimum size 4096 Data vectors will be of maximum size 4194304 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000026 0.000006 0.000007 0.000007 0.000007 8192 0.000027 0.000013 0.000013 0.000015 0.000014 16384 0.000056 0.000029 0.000027 0.000028 0.000027 32768 0.000109 0.000055 0.000055 0.000055 0.000058 65536 0.000218 0.000109 0.000108 0.000109 0.000108 131072 0.000425 0.000218 0.000218 0.000218 0.000218 262144 0.000861 0.000448 0.000440 0.000436 0.000437 524288 0.001760 0.000892 0.000889 0.000912 0.000894 1048576 0.004317 0.002251 0.002218 0.002187 0.002204 2097152 0.007727 0.004436 0.004415 0.004406 0.004405 4194304 0.015263 0.008699 0.008698 0.008684 0.008710 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000007 0.000007 0.000008 0.000008 0.000007 8192 0.000013 0.000015 0.000016 0.000013 0.000014 16384 0.000029 0.000029 0.000029 0.000028 0.000029 32768 0.000057 0.000056 0.000057 0.000057 0.000056 65536 0.000112 0.000112 0.000112 0.000112 0.000112 131072 0.000223 0.000228 0.000223 0.000222 0.000222 262144 0.000447 0.000446 0.000449 0.000445 0.000447 524288 0.000915 0.000934 0.000913 0.000913 0.000911 1048576 0.002269 0.002267 0.002238 0.002250 0.002244 2097152 0.004470 0.004453 0.004477 0.004450 0.004472 4194304 0.008830 0.008840 0.008886 0.008925 0.008897 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000044 0.000045 0.000043 0.000045 0.000044 8192 0.000086 0.000087 0.000086 0.000087 0.000086 16384 0.000173 0.000173 0.000173 0.000173 0.000174 32768 0.000346 0.000349 0.000346 0.000346 0.000347 65536 0.000692 0.000692 0.000691 0.000691 0.000691 131072 0.001401 0.001400 0.001398 0.001390 0.001404 262144 0.002783 0.002767 0.002774 0.002794 0.002785 524288 0.005566 0.005557 0.005568 0.005563 0.005575 1048576 0.011146 0.011176 0.011193 0.011152 0.011148 2097152 0.022205 0.022158 0.022171 0.022264 0.022191 4194304 0.044312 0.044329 0.044339 0.044326 0.044393 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000065 0.000060 0.000061 0.000062 0.000062 8192 0.000120 0.000120 0.000120 0.000120 0.000120 16384 0.000241 0.000240 0.000240 0.000240 0.000240 32768 0.000479 0.000481 0.000483 0.000481 0.000480 65536 0.000960 0.000965 0.000960 0.000961 0.000976 131072 0.001921 0.001920 0.001920 0.001936 0.001938 262144 0.003877 0.003859 0.003865 0.003879 0.003859 524288 0.007720 0.007743 0.007701 0.007710 0.007718 1048576 0.015538 0.015529 0.015554 0.015557 0.015565 2097152 0.031146 0.031164 0.031151 0.031192 0.031159 4194304 0.062380 0.062303 0.062239 0.062365 0.062406 TEST03 Time the unvectorized loops: do i = 1, n y(i) = x(i) y(i) = PI * x(i) y(i) = sqrt ( x(i) ) y(i) = exp ( x(i) ) end do Data vectors will be of minimum size 4096 Data vectors will be of maximum size 4194304 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000028 0.000012 0.000013 0.000012 0.000012 8192 0.000037 0.000022 0.000024 0.000023 0.000023 16384 0.000074 0.000045 0.000047 0.000044 0.000044 32768 0.000171 0.000089 0.000089 0.000089 0.000089 65536 0.000299 0.000178 0.000178 0.000178 0.000179 131072 0.000584 0.000355 0.000354 0.000355 0.000355 262144 0.001149 0.000711 0.000710 0.000710 0.000711 524288 0.002309 0.001462 0.001454 0.001431 0.001433 1048576 0.004843 0.003092 0.003022 0.003054 0.003043 2097152 0.009628 0.006174 0.006098 0.006084 0.006861 4194304 0.019266 0.012245 0.012225 0.012241 0.012196 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000014 0.000014 0.000014 0.000014 0.000014 8192 0.000027 0.000027 0.000027 0.000028 0.000028 16384 0.000054 0.000054 0.000055 0.000054 0.000054 32768 0.000108 0.000107 0.000108 0.000108 0.000109 65536 0.000216 0.000216 0.000215 0.000215 0.000216 131072 0.000432 0.000430 0.000430 0.000430 0.000430 262144 0.000864 0.000866 0.000864 0.000865 0.000864 524288 0.001744 0.001762 0.001754 0.001755 0.001744 1048576 0.003614 0.003597 0.003596 0.003583 0.003663 2097152 0.007263 0.007296 0.007218 0.007201 0.007236 4194304 0.014664 0.014489 0.014597 0.014425 0.014452 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000043 0.000044 0.000043 0.000043 0.000043 8192 0.000085 0.000086 0.000091 0.000086 0.000086 16384 0.000172 0.000174 0.000172 0.000173 0.000171 32768 0.000344 0.000353 0.000343 0.000344 0.000343 65536 0.000687 0.000688 0.000686 0.000687 0.000686 131072 0.001374 0.001390 0.001388 0.001373 0.001379 262144 0.002744 0.002744 0.002762 0.002750 0.002761 524288 0.005503 0.005519 0.005511 0.005512 0.005579 1048576 0.011103 0.011095 0.011098 0.011117 0.011101 2097152 0.022626 0.022320 0.022195 0.022226 0.022209 4194304 0.044436 0.044440 0.044446 0.044479 0.044469 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000059 0.000059 0.000058 0.000059 0.000057 8192 0.000122 0.000115 0.000114 0.000114 0.000114 16384 0.000228 0.000229 0.000229 0.000228 0.000229 32768 0.000458 0.000457 0.000467 0.000473 0.000457 65536 0.000913 0.000912 0.000912 0.000915 0.000930 131072 0.001824 0.001824 0.001827 0.001825 0.001860 262144 0.003684 0.003672 0.003664 0.003651 0.003650 524288 0.007316 0.007328 0.007385 0.007331 0.007333 1048576 0.014794 0.014807 0.014836 0.014791 0.014819 2097152 0.029634 0.029639 0.029623 0.029645 0.029683 4194304 0.059364 0.059291 0.059285 0.059327 0.059281 TEST04 Time the 2D nearest neighbor problem. Given X(2,N) and Y(2), find X(2,*) closest to Y(2). do i = 1, n if distance ( x(2,i), y ) < minimum so far x_min = x(2,i) end do Data vectors will be of minimum size 1024 Data vectors will be of maximum size 1048576 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 1024 0.000013 0.000009 0.000007 0.000009 0.000007 2048 0.000014 0.000014 0.000015 0.000014 0.000015 4096 0.000028 0.000028 0.000029 0.000028 0.000028 8192 0.000055 0.000054 0.000055 0.000054 0.000059 16384 0.000105 0.000104 0.000104 0.000105 0.000116 32768 0.000225 0.000209 0.000210 0.000209 0.000215 65536 0.000430 0.000420 0.000418 0.000420 0.000420 131072 0.000836 0.000838 0.000854 0.000838 0.000839 262144 0.001677 0.001678 0.001682 0.001696 0.001675 524288 0.003367 0.003373 0.003381 0.003366 0.003370 1048576 0.006870 0.006876 0.006825 0.006862 0.006838 TEST05 Time the matrix multiplication problem. Compute C = A * B where A is an L by M matrix, B is an M by N matrix, and so C is an L by N matrix. Minimum value of L = M = N = 4 Maximum value of L = M = N = 1024 Number of repetitions of the operation: 5 Use nested DO loops for matrix multiplication. Timing results using nested DO loops: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4 0.000002 0.000000 0.000001 0.000000 0.000000 16 0.000034 0.000035 0.000036 0.000036 0.000034 64 0.002268 0.002234 0.002235 0.002270 0.002234 256 0.203341 0.203174 0.203164 0.203709 0.203391 Use the MATMUL routine for matrix multiplication. Timing results using MATMUL: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4 0.000010 0.000001 0.000001 0.000002 0.000003 16 0.000005 0.000004 0.000004 0.000004 0.000005 64 0.000165 0.000168 0.000168 0.000176 0.000167 256 0.010179 0.010208 0.010223 0.010304 0.010204 1024 0.810998 0.812658 0.812593 0.826429 0.812897 TIMER_ETIME Normal end of execution. January 14 2011 11:30:04.628 AM