July 10 2008 4:53:17.253 PM TIMER_OMP_GET_WTIME FORTRAN90 version. Demonstrate the OMP_GET_WTIME timer. omp_get_wtime ( ) is an OpenMP function. It returns elapsed wall clock time in seconds. Number of processors is 2 Number of threads requested = 2 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 524288 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 1024 0.000124 0.000079 0.000080 0.000079 0.000079 2048 0.000172 0.000158 0.000157 0.000157 0.000158 4096 0.000395 0.000314 0.000314 0.000314 0.000317 8192 0.000683 0.000631 0.000632 0.000631 0.000628 16384 0.001460 0.001261 0.001258 0.001262 0.001257 32768 0.002836 0.002543 0.002520 0.002531 0.002520 65536 0.005591 0.005235 0.005097 0.005112 0.005129 131072 0.011246 0.010181 0.010243 0.010218 0.010826 262144 0.022850 0.020288 0.020375 0.020307 0.020428 524288 0.044683 0.041054 0.040956 0.040859 0.040881 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 262144 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000086 0.000084 0.000084 0.000086 0.000068 8192 0.000164 0.000172 0.000168 0.000172 0.000142 16384 0.000338 0.000337 0.000335 0.000338 0.000337 32768 0.000770 0.000640 0.000660 0.000678 0.000680 65536 0.001370 0.001256 0.001370 0.001381 0.001347 131072 0.002741 0.002691 0.002759 0.002817 0.002808 262144 0.005050 0.005665 0.005549 0.005628 0.004642 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000055 0.000053 0.000055 0.000055 0.000056 8192 0.000105 0.000104 0.000106 0.000107 0.000106 16384 0.000235 0.000209 0.000218 0.000217 0.000211 32768 0.000439 0.000441 0.000424 0.000417 0.000421 65536 0.000890 0.000879 0.000879 0.000872 0.000885 131072 0.001769 0.001765 0.001783 0.001790 0.001876 262144 0.003643 0.003696 0.003596 0.003750 0.003666 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000120 0.000120 0.000093 0.000095 0.000093 8192 0.000209 0.000210 0.000186 0.000207 0.000192 16384 0.000382 0.000384 0.000400 0.000372 0.000382 32768 0.000774 0.000802 0.000796 0.000885 0.000836 65536 0.001759 0.001999 0.001843 0.001807 0.001874 131072 0.003789 0.003606 0.003667 0.003396 0.003474 262144 0.006962 0.007278 0.007411 0.007392 0.007662 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000283 0.000263 0.000264 0.000264 0.000263 8192 0.000534 0.000524 0.000523 0.000525 0.000525 16384 0.001054 0.001062 0.001058 0.001050 0.001146 32768 0.002103 0.002822 0.002106 0.002187 0.002107 65536 0.004240 0.004276 0.004297 0.004244 0.004309 131072 0.008618 0.008589 0.008539 0.008708 0.008577 262144 0.017338 0.017245 0.017230 0.017052 0.017414 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 262144 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000058 0.000054 0.000052 0.000054 0.000052 8192 0.000109 0.000112 0.000104 0.000105 0.000103 16384 0.000214 0.000209 0.000215 0.000208 0.000210 32768 0.000434 0.000426 0.000418 0.000436 0.000433 65536 0.000923 0.000879 0.000887 0.000887 0.000911 131072 0.001803 0.001788 0.001781 0.001799 0.001964 262144 0.003657 0.003604 0.003702 0.003553 0.003610 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000059 0.000058 0.000058 0.000061 0.000059 8192 0.000117 0.000113 0.000113 0.000119 0.000114 16384 0.000220 0.000232 0.000229 0.000225 0.000227 32768 0.000464 0.000462 0.000461 0.000464 0.000458 65536 0.000949 0.000985 0.001035 0.000921 0.000950 131072 0.001893 0.001887 0.001981 0.001894 0.001890 262144 0.003830 0.004022 0.003947 0.003965 0.003851 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000129 0.000136 0.000130 0.000135 0.000136 8192 0.000253 0.000260 0.000269 0.000265 0.000269 16384 0.000533 0.000512 0.000501 0.000515 0.000517 32768 0.001139 0.001133 0.001087 0.001084 0.001179 65536 0.002181 0.002208 0.002197 0.002179 0.002200 131072 0.004476 0.004249 0.004428 0.004433 0.004217 262144 0.008985 0.009032 0.008918 0.009025 0.008904 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 4096 0.000285 0.000278 0.000279 0.000282 0.000281 8192 0.000555 0.000554 0.000554 0.000556 0.000554 16384 0.001124 0.001125 0.001111 0.001113 0.001110 32768 0.002226 0.002233 0.002219 0.002330 0.002284 65536 0.004606 0.004476 0.004489 0.004493 0.004467 131072 0.009056 0.009183 0.009073 0.009215 0.009146 262144 0.018160 0.018148 0.018258 0.018058 0.018171 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 262144 Number of repetitions of the operation: 5 Timing results: Vector Size Rep #1 Rep #2 Rep #3 Rep #4 Rep #5 1024 0.000131 0.000079 0.000067 0.000076 0.000068 2048 0.000171 0.000139 0.000172 0.000159 0.000133 4096 0.000267 0.000266 0.000348 0.000325 0.000265 8192 0.000567 0.000548 0.000650 0.000662 0.000534 16384 0.001071 0.001071 0.001413 0.001310 0.001095 32768 0.002753 0.002182 0.002640 0.002761 0.002162 65536 0.004872 0.005199 0.004345 0.005115 0.005401 131072 0.008770 0.010573 0.009072 0.010301 0.010888 262144 0.019362 0.017816 0.019139 0.018821 0.020041 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.000004 0.000003 0.000003 0.000003 0.000006 16 0.000133 0.000126 0.000126 0.000154 0.000129 64 0.007973 0.008075 0.007980 0.007875 0.008005 256 0.777241 1.214181 0.763978 0.771196 0.763523 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.000055 0.000003 0.000003 0.000003 0.000003 16 0.000008 0.000007 0.000007 0.000007 0.000007 64 0.000421 0.000421 0.000566 0.000425 0.000420 256 0.028057 0.026618 0.034261 0.032402 0.037096 1024 4.521269 4.572364 4.620301 4.566723 4.612701 TIMER_OMP_GET_WTIME Normal end of execution. July 10 2008 4:53:48.804 PM