Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format #458

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
indent = 2
indent = 2
margin = 80
remove_extra_newlines = true
long_to_short_function_def = true
format_docstrings = true
trailing_comma = false
separate_kwargs_with_semicolon = true
7 changes: 2 additions & 5 deletions benchmark/benchmarkflops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function Base.vcat(br1::BenchmarkResult, br2::BenchmarkResult)
br1.tests,
SizedResults(
hcat(br1.sizedresults.results, br2.sizedresults.results),
vcat(br1.sizedresults.sizes, br2.sizedresults.sizes),
),
vcat(br1.sizedresults.sizes, br2.sizedresults.sizes)
)
)
end

Expand Down Expand Up @@ -119,7 +119,6 @@ function At_mul_Bt_bench!(br, s, i)
matmul_bench!(br, C, A, B, i)
end


function dot_bench!(br, s, i)
a = rand(s)
b = rand(s)
Expand Down Expand Up @@ -440,7 +439,6 @@ function logdettriangle_bench!(br, s, i)
br[5+2INTEL_BENCH, i] = n_gflop / @belapsed logdet($U)
end


function filter2d_bench_run!(br, s, i, K)
A = rand(s + 2, s + 2)
B = OffsetArray(similar(A, (s, s)), 1, 1)
Expand All @@ -463,7 +461,6 @@ function filter2d_bench_run!(br, s, i, K)
end
end


function filter2dunrolled_bench_run!(br, s, i, K)
A = rand(s + 2, s + 2)
B = OffsetArray(similar(A, (s, s)), 1, 1)
Expand Down
3 changes: 2 additions & 1 deletion benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ for n ∈ 1:64
B = rand(n, n)
C = Matrix{Float64}(undef, n, n)
SUITE["linalg"]["matmul"]["AmulB", n] = @benchmarkable gemmavx!($C, $A, $B)
SUITE["linalg"]["matmul"]["A′mulB", n] = @benchmarkable jAtmulBavx!($C, $A′, $B)
SUITE["linalg"]["matmul"]["A′mulB", n] =
@benchmarkable jAtmulBavx!($C, $A′, $B)
x = rand(n)
y = rand(n)
SUITE["linalg"]["dot"]["dot", n] = @benchmarkable jdotavx($x, $y)
Expand Down
38 changes: 25 additions & 13 deletions benchmark/driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ const LOOPVECBENCHDIR = joinpath(pkgdir(LoopVectorization), "benchmark")
include(joinpath(LOOPVECBENCHDIR, "benchmarkflops.jl"))
include(joinpath(LOOPVECBENCHDIR, "plotbenchmarks.jl"))


nprocs_to_add() = ((Sys.CPU_THREADS)::Int >> 1)
# nprocs_to_add() = ((Sys.CPU_THREADS)::Int >> 1) - 1
start_worker(wid) = remotecall(include, wid, joinpath(LOOPVECBENCHDIR, "setup_worker.jl"))
start_worker(wid) =
remotecall(include, wid, joinpath(LOOPVECBENCHDIR, "setup_worker.jl"))
function start_workers(nprocs = nprocs_to_add())
addprocs(nprocs, exeflags = "--project=$(Base.active_project())")
addprocs(nprocs; exeflags = "--project=$(Base.active_project())")
foreach(wait, map(start_worker, workers()))
end
stop_workers() = rmprocs(workers())


function blastests()
tests = ["LoopVectorization", "Julia", "Clang", "GFortran"]
INTEL_BENCH && push!(tests, "icc", "ifort")
push!(tests, "g++ & Eigen-3", "clang++ & Eigen-3", "GFortran-builtin", "OpenBLAS")
push!(
tests,
"g++ & Eigen-3",
"clang++ & Eigen-3",
"GFortran-builtin",
"OpenBLAS"
)
INTEL_BENCH && push!(tests, "ifort-builtin")
MKL_BENCH && push!(tests, "MKL")
tests
Expand Down Expand Up @@ -166,7 +171,10 @@ function benchmark_random_access(sizes)
INTEL_BENCH && push!(tests, "icc", "ifort")
start_workers()
sm = SharedMatrix(Matrix{Float64}(undef, length(tests), length(sizes)))
@showprogress pmap(is -> randomaccess_bench!(sm, is[2], is[1]), enumerate(sizes))
@showprogress pmap(
is -> randomaccess_bench!(sm, is[2], is[1]),
enumerate(sizes)
)
br = BenchmarkResult(Matrix(sm), tests, sizes)
stop_workers()
br
Expand All @@ -178,7 +186,10 @@ function benchmark_logdettriangle(sizes)
push!(tests, "LinearAlgebra")
start_workers()
sm = SharedMatrix(Matrix{Float64}(undef, length(tests), length(sizes)))
@showprogress pmap(is -> logdettriangle_bench!(sm, is[2], is[1]), enumerate(sizes))
@showprogress pmap(
is -> logdettriangle_bench!(sm, is[2], is[1]),
enumerate(sizes)
)
br = BenchmarkResult(Matrix(sm), tests, sizes)
stop_workers()
br
Expand All @@ -188,7 +199,10 @@ function benchmark_filter2d(sizes, K)
INTEL_BENCH && push!(tests, "icc", "ifort")
start_workers()
sm = SharedMatrix(Matrix{Float64}(undef, length(tests), length(sizes)))
@showprogress pmap(is -> filter2d_bench_run!(sm, is[2], is[1], K), enumerate(sizes))
@showprogress pmap(
is -> filter2d_bench_run!(sm, is[2], is[1], K),
enumerate(sizes)
)
br = BenchmarkResult(Matrix(sm), tests, sizes)
stop_workers()
br
Expand All @@ -209,15 +223,13 @@ function benchmark_filter2dunrolled(sizes)
K = SizedOffsetMatrix{Float64,-1,1,-1,1}(rand(3, 3))
@showprogress pmap(
is -> filter2dunrolled_bench_run!(sm, is[2], is[1], K),
enumerate(sizes),
enumerate(sizes)
)
br = BenchmarkResult(Matrix(sm), tests, sizes)
stop_workers()
br
end



# sizes = 23:23
sizes = 256:-1:2
longsizes = 1024:-1:2
Expand Down Expand Up @@ -287,7 +299,8 @@ const v = 2
# using Cairo, Fontconfig
const PICTURES = joinpath(pkgdir(LoopVectorization), "docs", "src", "assets")
# saveplot(f, br) = draw(PNG(joinpath(PICTURES, f * "$v.png"), 12inch, 8inch), plot(br))
saveplot(f, br) = draw(SVG(joinpath(PICTURES, f * "$v.svg"), 12inch, 8inch), plot(br))
saveplot(f, br) =
draw(SVG(joinpath(PICTURES, f * "$v.svg"), 12inch, 8inch), plot(br))

# If only rerunning a few, remove them from load.
# @load "benchmarkresults.jld2" logdettriangle_bench filter2d_dynamic_bench filter2d_3x3_bench filter2d_unrolled_bench dot_bench selfdot_bench dot3_bench sse_bench aplusBc_bench AplusAt_bench vexp_bench randomaccess_bench AmulB_bench AmulBt_bench AtmulB_bench AtmulBt_bench Amulvb_bench Atmulvb_bench
Expand All @@ -305,7 +318,6 @@ saveplot("bench_AtmulBt_v", AtmulBt_bench);
saveplot("bench_Amulvb_v", Amulvb_bench);
saveplot("bench_Atmulvb_v", Atmulvb_bench);


saveplot("bench_logdettriangle_v", logdettriangle_bench);
saveplot("bench_filter2d_dynamic_v", filter2d_dynamic_bench);
saveplot("bench_filter2d_3x3_v", filter2d_3x3_bench);
Expand Down
Loading