Created
April 27, 2016 09:58
-
-
Save pkofod/901639371f4c05925e171dd279147f16 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using Benchmarks | |
mydot{T<:BLAS.BlasReal, TI<:Integer}(x::Vector{T}, rx::Union{UnitRange{TI},Range{TI}}, y::Vector{T}, ry::Union{UnitRange{TI},Range{TI}}) = BLAS.dot(sub(x, rx), sub(y, ry)) | |
mydot{T<:BLAS.BlasComplex, TI<:Integer}(x::Vector{T}, rx::Union{UnitRange{TI},Range{TI}}, y::Vector{T}, ry::Union{UnitRange{TI},Range{TI}}) = BLAS.dotc(sub(x, rx), sub(y, ry)) | |
n = 1000 | |
m = 20 | |
step_size = 5 | |
x = rand(n) | |
y = rand(n) | |
xc = rand(Complex128, n) | |
yc = rand(Complex128, n) | |
dot(x,1:m, y, 1:m) == mydot(x,1:m, y, 1:m) && dot(xc,1:m, yc, 1:m) == mydot(xc,1:m, yc, 1:m) | |
# Unit stride | |
@benchmark dot(x,1:m, y, 1:m) | |
@benchmark mydot(x,1:m, y, 1:m) | |
@benchmark dot(xc,1:m, yc, 1:m) | |
@benchmark mydot(xc,1:m, yc, 1:m) | |
# step_size stride | |
@benchmark dot(x,1:step_size:m, y, 1:step_size:m) | |
@benchmark mydot(x,1:step_size:m, y, 1:step_size:m) | |
@benchmark dot(xc,1:step_size:m, yc, 1:step_size:m) | |
@benchmark mydot(xc,1:step_size:m, yc, 1:step_size:m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment