Created
February 26, 2014 15:47
-
-
Save ArchRobison/9232051 to your computer and use it in GitHub Desktop.
This benchmark requires https://github.com/JuliaLang/julia/pull/5355. Try flog(1000,1000000,30)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function inner( x, y ) | |
s = zero(eltype(x)) | |
@simd for i=1:length(x) | |
@inbounds s += x[i]*y[i] | |
end | |
s | |
end | |
function flog( n, reps, tolerance ) | |
x = rand(Float32,n) | |
y = rand(Float32,n) | |
s = zero(Float64) | |
time = @elapsed for j in 1:reps | |
s+=inner(x,y) | |
end | |
println("GFlop = ",2.0*n*reps/time*1E-9) | |
t = dot(x,y) | |
err = abs(s-t*reps) | |
if err>tolerance | |
println(STDERR,"err = $err") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment