Skip to content

Commit 6fe76f2

Browse files
committed
A few benchmark bug fixes.
1 parent 06d9294 commit 6fe76f2

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

benchmarks/driver.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function sse!(Xβ, y, X, β)
129129
dot(Xβ, Xβ)
130130
end
131131
function benchmark_sse(sizes)
132-
tests = [BLAS.vendor() === :mkl ? "IntelMKL" : "OpenBLAS", "Julia", "Clang-Polly", "GFort-loops", "GFort-intrinsic", "LoopVectorization"]
132+
tests = [BLAS.vendor() === :mkl ? "IntelMKL" : "OpenBLAS", "Julia", "Clang-Polly", "GFort-loops", "LoopVectorization"]
133133
br = BenchmarkResult(tests, sizes)
134134
for (i,s) enumerate(sizes)
135135
N, P = totwotuple(s)
@@ -156,7 +156,7 @@ function benchmark_exp(sizes)
156156
br = BenchmarkResult(tests, sizes)
157157
for (i,s) enumerate(sizes)
158158
a = rand(s); b = similar(a)
159-
n_gflop = s # not really gflops
159+
n_gflop = 1e-9*s # not really gflops
160160
br[1,i] = n_gflop / @belapsed @. $b = exp($a)
161161
baseb = copy(b)
162162
br[2,i] = n_gflop / @belapsed fvexp!($b, $a)

benchmarks/loadsharedlibs.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ function caplusBc!(D, a, B, c)
113113
M, K = size(B)
114114
ccall(
115115
(:aplusBc, LIBCTEST), Cvoid,
116-
(Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Clong, Clong),
117-
y, A, x, M, K
116+
(Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Clong, Clong),
117+
D, a, B, c, M, K
118118
)
119119
end
120120
function faplusBc!(D, a, B, c)
121121
M, K = size(B)
122122
ccall(
123123
(:aplusBc, LIBFTEST), Cvoid,
124-
(Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{Clong}, Ref{Clong}),
125-
y, A, x, Ref(M), Ref(K)
124+
(Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{Clong}, Ref{Clong}),
125+
D, a, B, c, Ref(M), Ref(K)
126126
)
127127
end
128128
function cOLSlp(y, X, β)

benchmarks/looptests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void unscaledvar(double* restrict s, double* restrict A, double* restrict xb, lo
118118
return;
119119
}
120120

121-
void aplucBc(double* restrict D, double* restrict a, double* restrict B, double* restrict c, long M, long N){
121+
void aplusBc(double* restrict D, double* restrict a, double* restrict B, double* restrict c, long M, long N){
122122
for (long n = 0; n < N; n++){
123123
for (long m = 0; m < M; m++){
124124
D[m + n*M] = a[m] + B[m + n*M] * c[n];

benchmarks/looptests.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ subroutine unscaledvar(s, A, x, M, N) BIND(C, name="unscaledvar")
176176
end do
177177
end do
178178
end subroutine unscaledvar
179-
subroutine aplusBc(D, a, B, c, M, N) BIND(C, name="aplucBc")
179+
subroutine aplusBc(D, a, B, c, M, N) BIND(C, name="aplusBc")
180180
integer(C_long), intent(in) :: M, N
181181
real(C_double), intent(in) :: a(M), B(M,N), c(N)
182182
real(C_double), dimension(M,N), intent(out) :: D

benchmarks/looptests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ japlucBcavx!(d, a, B, c) = @avx @. d = a + B * c';
113113

114114
function jOLSlp(y, X, β)
115115
lp = 0.0
116-
@inbounds for i eachindex(y)
116+
@inbounds @fastmath for i eachindex(y)
117117
δ = y[i]
118-
@simd for j eachindex(x)
118+
@simd for j eachindex(β)
119119
δ -= X[i,j] * β[j]
120120
end
121121
lp += δ * δ

0 commit comments

Comments
 (0)