Skip to content

Instantly share code, notes, and snippets.

@carlobaldassi
Created May 4, 2012 13:08
Show Gist options
  • Save carlobaldassi/2594711 to your computer and use it in GitHub Desktop.
Save carlobaldassi/2594711 to your computer and use it in GitHub Desktop.
julia syrk tests
100x100 matrices, averages over 250000 tests:
A'*A gemm : 0.00022529661750793456 ± 1.3165374929527648e-6
A'*A syrk : 0.0004116961793899536 ± 2.2544687273938097e-6
A*A' gemm : 0.00020168535614013673 ± 9.12395962546235e-7
A*A' syrk : 0.0004128545732498169 ± 2.236023626830784e-6
200x200 matrices, averages over 31250 tests:
A'*A gemm : 0.0016472916564941407 ± 1.1819936441612635e-5
A'*A syrk : 0.0019588019256591795 ± 1.173932771520073e-5
A*A' gemm : 0.0012420702819824219 ± 2.3948308461046164e-6
A*A' syrk : 0.0020064849548339842 ± 1.1782910390385928e-5
300x300 matrices, averages over 9259 tests:
A'*A gemm : 0.004209100022044575 ± 1.1443629541125378e-5
A'*A syrk : 0.00493905309699166 ± 2.642037383553854e-5
A*A' gemm : 0.0048035201301249225 ± 2.7032614458515995e-5
A*A' syrk : 0.004935173303909211 ± 2.5530462089949676e-5
400x400 matrices, averages over 3906 tests:
A'*A gemm : 0.009954503238109582 ± 3.3772147454008674e-5
A'*A syrk : 0.010654515568195582 ± 5.756081604300627e-5
A*A' gemm : 0.010769411715494323 ± 6.052318156548842e-5
A*A' syrk : 0.010765373981493409 ± 5.880383310147551e-5
500x500 matrices, averages over 2000 tests:
A'*A gemm : 0.020299663066864013 ± 0.00011519095174060427
A'*A syrk : 0.019195371747016906 ± 0.00010359926633560927
A*A' gemm : 0.01851184105873108 ± 5.426529917091691e-5
A*A' syrk : 0.01930423629283905 ± 0.00010203773212890967
600x600 matrices, averages over 1157 tests:
A'*A gemm : 0.031800814713500346 ± 0.00015873136544554956
A'*A syrk : 0.031131482474641134 ± 0.00019196990801390734
A*A' gemm : 0.031820516289568404 ± 0.00015370719289218093
A*A' syrk : 0.03125427504912882 ± 0.0001855467052980594
700x700 matrices, averages over 729 tests:
A'*A gemm : 0.056105114304970324 ± 0.00041621806285096065
A'*A syrk : 0.048390302147884916 ± 0.0003094000542381335
A*A' gemm : 0.051199696191544394 ± 0.0002887484706178267
A*A' syrk : 0.04817583531509211 ± 0.00028085196726708797
800x800 matrices, averages over 488 tests:
A'*A gemm : 0.07600630502231785 ± 0.0005305810959733221
A'*A syrk : 0.06518704089962069 ± 0.0004738245322760668
A*A' gemm : 0.07856891096615401 ± 0.0005621345799153399
A*A' syrk : 0.06650807964997213 ± 0.00047014200564167284
900x900 matrices, averages over 343 tests:
A'*A gemm : 0.13171221146430637 ± 0.0010763558810964054
A'*A syrk : 0.08632556898600853 ± 0.0006640003102003667
A*A' gemm : 0.1165344763775261 ± 0.0009403136131830547
A*A' syrk : 0.10026601591193642 ± 0.00069463891369644
1000x1000 matrices, averages over 250 tests:
A'*A gemm : 0.1613630771636963 ± 0.0010219976787457302
A'*A syrk : 0.12506118774414063 ± 0.0008009328280355326
A*A' gemm : 0.1619360246658325 ± 0.0010823179071896604
A*A' syrk : 0.12960903930664064 ± 0.0008041600405606759
function syrktst(n)
a = randn(n,n)
at = a'
t1a = @elapsed b1a = at * a;
t1b = @elapsed b1b = a * at;
t2a = @elapsed b2a = a' * a;
t2b = @elapsed b2b = a * a';
return t1a, t1b, t2a, t2b
end
function syrktst(n, T)
t1a = Array(Float64, T)
t1b = Array(Float64, T)
t2a = Array(Float64, T)
t2b = Array(Float64, T)
for i = 1 : T
t1a[i], t1b[i], t2a[i], t2b[i] = syrktst(n)
end
m1a, s1a = mean(t1a), std(t1a)/sqrt(T)
m1b, s1b = mean(t1b), std(t1b)/sqrt(T)
m2a, s2a = mean(t2a), std(t2a)/sqrt(T)
m2b, s2b = mean(t2b), std(t2b)/sqrt(T)
println("$(n)x$(n) matrices, averages over $(T) tests:")
println(" A'*A gemm : $m1a ± $s1a")
println(" A'*A syrk : $m2a ± $s2a")
println(" A*A' gemm : $m1b ± $s1b")
println(" A*A' syrk : $m2b ± $s2b")
println()
end
function dosyrktst()
T = 250000
for i = 1:10
n = 100 * i
T = iround(250000 / i^3)
syrktst(n, T)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment