timer.f

来自「网络带宽测试工具」· F 代码 · 共 755 行 · 第 1/2 页

F
755
字号
            t0 = wclock()            Do j = 1, nrep! --- Prevent smart compilers from being too smart ...               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n4, 4                  y(i,jsw) = x1(i) * x2(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 17 ) Then	 If ( n > 0 ) Then	    n3 = 3 * n            t0 = wclock()            Do j = 1, nrep! --- Prevent smart compilers from being too smart ...               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n3, 3                  y(i,jsw) = x1(i) / x2(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 18 ) Then	 If ( n > 0 ) Then            n4 = n * 4            t0 = wclock()            Do j = 1, nrep! - Prevent smart compilers from being too smart ...               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n4, 4                  y(i,jsw) = x1(i) / x2(i)               End Do            End Do            t1 = wclock() - t0! - Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 19 ) Then	 If ( n > 0 ) Then	    n3 = 3 * n            s(1) = zero            s(2) = zero            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )               ssw = s(jsw)!$omp parallel do reduction(+:ssw)               Do i = 1, n3, 3                  ssw = ssw + x1(i)*x2(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 20 ) Then	 If ( n > 0 ) Then            n4 = n * 4            s(1) = zero            s(2) = zero            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )               ssw = s(jsw)!$omp parallel do reduction(+:ssw)               Do i = 1, n4, 4                  ssw = ssw + x1(i)*x2(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 21 ) Then	 If ( n > 0 ) Then   	    n3 = 3 * n            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n3, 3                  y(i,jsw) = y(i,jsw) + c0*x1(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 22 ) Then	 If ( n > 0 ) Then            n4 = n * 4            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n4, 4                  y(i,jsw) = y(i,jsw) + c0*x1(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 23 ) Then	 If ( n > 0 ) Then	    n3 = 3 * n            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n3, 3                  y(i,jsw) = x1(i) + c0*x2(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 24 ) Then	 If ( n > 0 ) Then            n4 = n * 4            t0 = wclock()! ---  Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n4, 4                  y(i,jsw) = x1(i) + c0*x2(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 25 ) Then	 If ( n > 0 ) Then            Call permut( n, ind, -1990 )            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n                  y(ind(i),jsw) = x1(i)               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 26 ) Then	 If ( n > 0 ) Then            Call permut( n, ind, -1990 )            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n                  y(i,jsw) = x1(ind(i))               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 27 ) Then	 If ( n > 0 ) Then            Call permut( n, ind, -1990 )            t0 = wclock()! --- Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n                  y(i,jsw) = x1(ind(i)) * x2(ind(i))               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 28 ) Then	 If ( n > 0 ) Then            Call permut( n, ind, -1990 )            t0 = wclock()! ---  Prevent smart compilers from being too smart ...            Do j = 1, nrep               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n                  y(i,jsw) = x1(ind(i)) / x2(ind(i))               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 29 ) Then	 If ( n > 0 ) Then            Call permut( n, ind, -1990 )            s(1) = zero            s(2) = zero            t0 = wclock()            Do j = 1, nrep! --- Prevent smart compilers from being too smart ...               jsw = jswitch( krit, indj, j )               ssw = s(jsw)!$omp parallel do reduction(+:ssw)               Do i = 1, n                  ssw = ssw + x1(ind(i)) * x2(ind(i))               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 30 ) Then         If ( n > 0 ) Then             Call permut( n, ind, -1990 )            t0 = wclock()            Do j = 1, nrep! --- Prevent smart compilers from being too smart ...               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n                  y(i,jsw) = y(i,jsw) + c0 * x1(ind(i))               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      Else If ( kern == 31 ) Then	 If ( n > 0 ) Then            Call permut( n, ind, -1990 )            t0 = wclock()            Do j = 1, nrep! --- Prevent smart compilers from being too smart ...               jsw = jswitch( krit, indj, j )!$omp parallel do               Do i = 1, n                  y(i,jsw) = x1(ind(i)) + c0 * x2(ind(i))               End Do            End Do            t1 = wclock() - t0! --- Correct for repetition loop.            corr = wclock()            Do j = 1, nrep               jsw = jswitch( krit, indj, j )            End Do            time = (  t1 - wclock() + corr  ) /  nrep         End If! ----------------------------------------------------------------------      End If! ----------------------------------------------------------------------      End Subroutine timer

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?