March 5 2008 5:48:05.257 PM TIMER_CPU_TIME FORTRAN90 version. Demonstrate the use of the CPU_TIME timer. CPU_TIME is a FORTRAN 95 built in routine. call cpu_time ( reading ) TEST01 Time the FORTRAN90 RANDOM_NUMBER routine: call random_number ( x(1:n) ) 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.000129 0.000083 0.000084 0.000115 0.000084 2048 0.000174 0.000161 0.000162 0.000211 0.000161 4096 0.000344 0.000320 0.000322 0.000321 0.000335 8192 0.000684 0.000638 0.000681 0.000635 0.000637 16384 0.001372 0.001288 0.001280 0.001278 0.001269 32768 0.002833 0.002529 0.002530 0.002540 0.002526 65536 0.005556 0.005079 0.005063 0.005079 0.005065 131072 0.011196 0.010107 0.010137 0.010165 0.010132 262144 0.022171 0.020313 0.020253 0.020292 0.020283 524288 0.044272 0.040569 0.040631 0.040608 0.040580 1048576 0.088726 0.081324 0.081052 0.081634 0.081149 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.000109 0.000041 0.000040 0.000041 0.000041 8192 0.000134 0.000077 0.000078 0.000077 0.000078 16384 0.000261 0.000151 0.000154 0.000153 0.000155 32768 0.000546 0.000308 0.000309 0.000312 0.000308 65536 0.001155 0.000696 0.000707 0.000698 0.000691 131072 0.002262 0.001341 0.001364 0.001354 0.001341 262144 0.004531 0.002644 0.002650 0.002668 0.002681 524288 0.009182 0.006255 0.005489 0.005516 0.005461 1048576 0.018751 0.010939 0.010947 0.010968 0.010967 2097152 0.036234 0.021878 0.021898 0.021914 0.021922 4194304 0.074373 0.043776 0.043683 0.043752 0.044206 Timing Results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000067 0.000061 0.000078 0.000076 0.000077 8192 0.000150 0.000151 0.000151 0.000147 0.000152 16384 0.000272 0.000300 0.000299 0.000291 0.000301 32768 0.000531 0.000592 0.000587 0.000595 0.000579 65536 0.001107 0.001211 0.001109 0.001103 0.001141 131072 0.002291 0.002424 0.002408 0.002352 0.002212 262144 0.004558 0.004607 0.004734 0.004676 0.004513 524288 0.009744 0.009301 0.008701 0.009431 0.009558 1048576 0.018475 0.019236 0.018236 0.018510 0.019227 2097152 0.038368 0.038077 0.038720 0.037317 0.038090 4194304 0.077138 0.078102 0.076840 0.075644 0.075482 Timing Results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000120 0.000104 0.000106 0.000106 0.000102 8192 0.000203 0.000203 0.000203 0.000203 0.000203 16384 0.000519 0.000402 0.000400 0.000399 0.000399 32768 0.000813 0.000813 0.000807 0.000805 0.000812 65536 0.001649 0.001615 0.001635 0.001617 0.001668 131072 0.003227 0.003268 0.003290 0.003333 0.003306 262144 0.006609 0.006632 0.006629 0.006585 0.006589 524288 0.013409 0.013384 0.013422 0.013412 0.013440 1048576 0.026886 0.026892 0.026863 0.026876 0.026880 2097152 0.053705 0.053721 0.053773 0.054131 0.053730 4194304 0.107438 0.107335 0.107416 0.107476 0.107324 Timing Results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000283 0.000264 0.000265 0.000264 0.000264 8192 0.000521 0.000523 0.000522 0.000525 0.000524 16384 0.001039 0.001039 0.001046 0.001038 0.001038 32768 0.002088 0.002088 0.002088 0.002088 0.002094 65536 0.004230 0.004202 0.004199 0.004225 0.004212 131072 0.008428 0.008410 0.008434 0.008420 0.008418 262144 0.016851 0.016826 0.016834 0.016819 0.016820 524288 0.033855 0.033850 0.033853 0.034305 0.033854 1048576 0.067734 0.067764 0.067718 0.067747 0.067735 2097152 0.135406 0.135906 0.135408 0.135434 0.135416 4194304 0.270738 0.270745 0.270852 0.271148 0.271185 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.000120 0.000052 0.000053 0.000052 0.000053 8192 0.000154 0.000102 0.000100 0.000100 0.000098 16384 0.000304 0.000193 0.000199 0.000199 0.000198 32768 0.000641 0.000403 0.000403 0.000405 0.000394 65536 0.001331 0.000827 0.000820 0.000830 0.000830 131072 0.002575 0.001646 0.001659 0.001621 0.001618 262144 0.005200 0.003282 0.003239 0.003306 0.003332 524288 0.010475 0.006984 0.006783 0.006795 0.006829 1048576 0.021320 0.013532 0.013581 0.013650 0.013495 2097152 0.042766 0.027073 0.027198 0.027029 0.027209 4194304 0.085074 0.054360 0.054466 0.054296 0.054339 Timing Results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000057 0.000057 0.000057 0.000057 0.000057 8192 0.000107 0.000107 0.000107 0.000107 0.000121 16384 0.000213 0.000210 0.000211 0.000211 0.000211 32768 0.000434 0.000430 0.000434 0.000432 0.000432 65536 0.000894 0.000890 0.000894 0.000892 0.000907 131072 0.001785 0.001784 0.001785 0.001807 0.001795 262144 0.003591 0.003574 0.003570 0.003581 0.003573 524288 0.007375 0.007381 0.007406 0.007409 0.007384 1048576 0.014798 0.014826 0.014808 0.014825 0.014797 2097152 0.029544 0.029577 0.029578 0.029768 0.029601 4194304 0.059104 0.059137 0.059102 0.059030 0.059190 Timing Results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000129 0.000132 0.000129 0.000129 0.000129 8192 0.000255 0.000243 0.000253 0.000250 0.000251 16384 0.000502 0.000497 0.000501 0.000495 0.000500 32768 0.001002 0.001003 0.000996 0.000997 0.001004 65536 0.002058 0.002041 0.002024 0.002060 0.002023 131072 0.004124 0.004058 0.004092 0.004084 0.004060 262144 0.008242 0.008150 0.008226 0.008118 0.008178 524288 0.016535 0.016535 0.016576 0.016614 0.016678 1048576 0.033123 0.033115 0.033475 0.033180 0.033013 2097152 0.066279 0.066394 0.066404 0.066303 0.066722 4194304 0.132641 0.132591 0.132789 0.132431 0.132641 Timing Results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000289 0.000282 0.000283 0.000282 0.000282 8192 0.000556 0.000558 0.000563 0.000556 0.000576 16384 0.001134 0.001112 0.001110 0.001110 0.001109 32768 0.002231 0.002235 0.002229 0.002233 0.002229 65536 0.004485 0.004500 0.004486 0.004498 0.004508 131072 0.009001 0.008976 0.008994 0.008975 0.008997 262144 0.017970 0.017956 0.017977 0.017950 0.017978 524288 0.036161 0.036152 0.036176 0.036131 0.036168 1048576 0.072267 0.072733 0.072295 0.072283 0.072326 2097152 0.145016 0.144552 0.144547 0.144608 0.145010 4194304 0.289134 0.289066 0.289461 0.289026 0.289047 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.000075 0.000065 0.000064 0.000064 0.000064 2048 0.000120 0.000119 0.000122 0.000118 0.000123 4096 0.000233 0.000232 0.000239 0.000237 0.000232 8192 0.000477 0.000491 0.000458 0.000469 0.000471 16384 0.000964 0.000914 0.000936 0.000937 0.000916 32768 0.001931 0.001835 0.001821 0.001830 0.001881 65536 0.003785 0.003721 0.003727 0.003690 0.003712 131072 0.007663 0.007438 0.007404 0.007538 0.007510 262144 0.014853 0.015197 0.015120 0.015029 0.014702 524288 0.030039 0.030066 0.029877 0.029986 0.029643 1048576 0.060817 0.061283 0.060023 0.060553 0.059476 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.000008 0.000011 0.000009 0.000010 0.000009 16 0.000138 0.000129 0.000130 0.000128 0.000129 64 0.007779 0.007757 0.007734 0.007756 0.007765 256 0.700376 0.699715 0.700545 0.700104 0.701062 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.000063 0.000016 0.000017 0.000042 0.000017 16 0.000011 0.000011 0.000011 0.000011 0.000011 64 0.000435 0.000424 0.000427 0.000424 0.000422 256 0.025780 0.025788 0.025705 0.025779 0.025715 1024 4.511519 4.510469 4.508258 4.509994 4.507885 TIMER_CPU_TIME Normal end of execution. March 5 2008 5:49:10.767 PM