Skip to content

Commit 9ead68a

Browse files
committed
Add new methods to the dot benchmark
- Update the results - Update the export script - Update the fpm.rsp
1 parent ac66fc4 commit 9ead68a

37 files changed

+734
-550
lines changed

benchmarks/dot/dot.f90

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
program benchmark_dot
22

33
use kinds
4-
use fordot
4+
use fordot, only: fdot_product => dot_product ! to avoid overloading
55
use fast_math, only: fprod, fprod_kahan
66
use forbenchmark
77

@@ -19,7 +19,7 @@ program benchmark_dot
1919
allocate(seed_array(seed_size))
2020
seed_array = 123456789
2121

22-
call bench%init(7,'Benchmark dot_product','benchmarks/dot/results/dot', 10000)
22+
call bench%init(8,'Benchmark dot_product','benchmarks/dot/results/dot', 10000)
2323

2424
num_elements = [1000_ik, 10000_ik, 100000_ik, 1000000_ik]
2525

@@ -48,47 +48,57 @@ program benchmark_dot
4848

4949

5050
!===============================================================================
51-
call bench%start_benchmark(2,'m1', "a = dot_product(u,v,'m1')",[p])
51+
call bench%start_benchmark(2,'blas', "a = dot_product(u,v,'m2')",[p])
5252
do nl = 1,bench%nloops
53-
a = dot_product(u,v,'m1')
53+
a = fdot_product(u,v,'m2')
5454
call prevent_optimization(a,nl) ! loop-invariant
5555
end do
5656
call bench%stop_benchmark(cmp_gflops)
5757
!===============================================================================
5858

5959

6060
!===============================================================================
61-
call bench%start_benchmark(3,'m2', "a = dot_product(u,v,'m2')",[p])
61+
call bench%start_benchmark(3,'m1_b16', "a = f(u,v,'m1',16)",[p])
6262
do nl = 1,bench%nloops
63-
a = dot_product(u,v,'m2')
63+
a = fdot_product(u,v,'m1',16)
6464
call prevent_optimization(a,nl) ! loop-invariant
6565
end do
6666
call bench%stop_benchmark(cmp_gflops)
6767
!===============================================================================
6868

6969

7070
!===============================================================================
71-
call bench%start_benchmark(4,'m3', "a = dot_product(u,v,'m3')",[p])
71+
call bench%start_benchmark(4,'blas_b16', "a = dot_product(u,v,'m2',16)",[p])
7272
do nl = 1,bench%nloops
73-
a = dot_product(u,v,'m3')
73+
a = fdot_product(u,v,'m2',16)
7474
call prevent_optimization(a,nl) ! loop-invariant
7575
end do
7676
call bench%stop_benchmark(cmp_gflops)
7777
!===============================================================================
7878

7979

8080
!===============================================================================
81-
call bench%start_benchmark(5,'m4', "a = dot_product(u,v,'m4')",[p])
81+
call bench%start_benchmark(5,'m3_b16', "a = dot_product(u,v,'m3',16)",[p])
8282
do nl = 1,bench%nloops
83-
a = dot_product(u,v,'m4')
83+
a = fdot_product(u,v,'m3',16)
8484
call prevent_optimization(a,nl) ! loop-invariant
8585
end do
8686
call bench%stop_benchmark(cmp_gflops)
8787
!===============================================================================
8888

8989

9090
!===============================================================================
91-
call bench%start_benchmark(6,'chunks', "a = fprod(u,v)",[p])
91+
call bench%start_benchmark(6,'m4_b16', "a = dot_product(u,v,'m4',16)",[p])
92+
do nl = 1,bench%nloops
93+
a = fdot_product(u,v,'m4',16)
94+
call prevent_optimization(a,nl) ! loop-invariant
95+
end do
96+
call bench%stop_benchmark(cmp_gflops)
97+
!===============================================================================
98+
99+
100+
!===============================================================================
101+
call bench%start_benchmark(7,'chunks', "a = fprod(u,v)",[p])
92102
do nl = 1,bench%nloops
93103
a = fprod(u,v)
94104
call prevent_optimization(a,nl) ! loop-invariant
@@ -98,7 +108,7 @@ program benchmark_dot
98108

99109

100110
!===============================================================================
101-
call bench%start_benchmark(7,'kahan', "a = fprod_kahan(u,v)",[p])
111+
call bench%start_benchmark(8,'kahan', "a = fprod_kahan(u,v)",[p])
102112
do nl = 1,bench%nloops
103113
a = fprod_kahan(u,v)
104114
call prevent_optimization(a,nl) ! loop-invariant
@@ -128,7 +138,7 @@ end function cmp_gflops
128138
subroutine prevent_optimization(a, nl)
129139
real(rk), intent(in) :: a
130140
integer, intent(in) :: nl
131-
if (a == 0.0_rk) print*, nl, 'a = 0.0'
141+
if (abs(a)<tiny(0.0_rk)) print*, nl, 'a = 0.0'
132142
end subroutine prevent_optimization
133143
!===============================================================================
134144

benchmarks/dot/dot_co.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ program benchmark_dot_coarray
33
#if defined(USE_COARRAY)
44

55
use kinds
6-
use fordot
6+
use fordot, only: fdot_product => dot_product ! to avoid overloading
77
use forbenchmark
88

99
implicit none
@@ -21,7 +21,7 @@ program benchmark_dot_coarray
2121
allocate(seed_array(seed_size))
2222
seed_array = 123456789
2323

24-
call bench%init(4, 'Fordot_product','benchmarks/dot/results/dot', 1000)
24+
call bench%init(6, 'Fordot_product','benchmarks/dot/results/dot', 1000)
2525

2626
num_elements = [1000_ik, 10000_ik, 100000_ik, 1000000_ik]
2727

@@ -52,7 +52,7 @@ program benchmark_dot_coarray
5252
!===============================================================================
5353
call bench%start_benchmark(2,'m1_co', "a = dot_product(u,v,'m1',coarray=.true.)",[p])
5454
do nl = 1,bench%nloops
55-
a = dot_product(u,v,'m1',coarray=.true.)
55+
a = fdot_product(u,v,'m1',coarray=.true.)
5656
call prevent_optimization(a,nl) ! loop-invariant
5757
end do
5858
call bench%stop_benchmark(cmp_gflops)
@@ -62,7 +62,7 @@ program benchmark_dot_coarray
6262
!===============================================================================
6363
call bench%start_benchmark(3,'m2_co', "a = dot_product(u,v,'m2',coarray=.true.)",[p])
6464
do nl = 1,bench%nloops
65-
a = dot_product(u,v,'m2',coarray=.true.)
65+
a = fdot_product(u,v,'m2',coarray=.true.)
6666
call prevent_optimization(a,nl) ! loop-invariant
6767
end do
6868
call bench%stop_benchmark(cmp_gflops)
@@ -72,7 +72,7 @@ program benchmark_dot_coarray
7272
!===============================================================================
7373
call bench%start_benchmark(4,'m3_co', "a = dot_product(u,v,'m3',coarray=.true.)",[p])
7474
do nl = 1,bench%nloops
75-
a = dot_product(u,v,'m3',coarray=.true.)
75+
a = fdot_product(u,v,'m3',coarray=.true.)
7676
call prevent_optimization(a,nl) ! loop-invariant
7777
end do
7878
call bench%stop_benchmark(cmp_gflops)

0 commit comments

Comments
 (0)