Skip to content

Commit

Permalink
try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale-Black committed Jan 17, 2025
1 parent a3c92f4 commit a3c8703
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions benchmarks/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,87 +104,87 @@ function setup_benchmarks(suite::BenchmarkGroup, backend::String, num_cpu_thread
f = Float32.(rand([0, 1], n, n))
bool_f = Bool.(f)
suite["2D"]["Size_$n"]["Maurer"]["CPU"][string(num_cpu_threads, " thread(s)")] =
benchmark_with_memory(() -> distance_transform(feature_transform(bool_f)), backend)
benchmark_with_memory(() -> distance_transform(feature_transform(bool_f)), backend).benchmark

suite["2D"]["Size_$n"]["Felzenszwalb"]["CPU"][string(num_cpu_threads, " thread(s)")] =
benchmark_with_memory(() -> transform(boolean_indicator(f); threaded = false), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f); threaded = false), backend).benchmark

suite["2D"]["Size_$n"]["Felzenszwalb_MT"]["CPU"][string(num_cpu_threads, " thread(s)")] =
benchmark_with_memory(() -> transform(boolean_indicator(f)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f)), backend).benchmark
end

# 3D benchmarks
for n in sizes_3D
f = Float32.(rand([0, 1], n, n, n))
bool_f = Bool.(f)
suite["3D"]["Size_$n"]["Maurer"]["CPU"][string(num_cpu_threads, " thread(s)")] =
benchmark_with_memory(() -> distance_transform(feature_transform(bool_f)), backend)
benchmark_with_memory(() -> distance_transform(feature_transform(bool_f)), backend).benchmark

suite["3D"]["Size_$n"]["Felzenszwalb"]["CPU"][string(num_cpu_threads, " thread(s)")] =
benchmark_with_memory(() -> transform(boolean_indicator(f); threaded = false), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f); threaded = false), backend).benchmark

suite["3D"]["Size_$n"]["Felzenszwalb_MT"]["CPU"][string(num_cpu_threads, " thread(s)")] =
benchmark_with_memory(() -> transform(boolean_indicator(f)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f)), backend).benchmark
end
elseif backend == "Metal"
@info "Running Metal benchmarks"
for n in sizes_2D
f = Float32.(rand([0, 1], n, n))
f_gpu = MtlArray(f)
suite["2D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end

for n in sizes_3D
f = Float32.(rand([0, 1], n, n, n))
f_gpu = MtlArray(f)
suite["3D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end
elseif backend == "CUDA"
@info "Running CUDA benchmarks"
for n in sizes_2D
f = Float32.(rand([0, 1], n, n))
f_gpu = CUDA.CuArray(f)
suite["2D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end

for n in sizes_3D
f = Float32.(rand([0, 1], n, n, n))
f_gpu = CUDA.CuArray(f)
suite["3D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end
elseif backend == "AMDGPU"
@info "Running AMDGPU benchmarks"
for n in sizes_2D
f = Float32.(rand([0, 1], n, n))
f_gpu = ROCArray(f)
suite["2D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end

for n in sizes_3D
f = Float32.(rand([0, 1], n, n, n))
f_gpu = ROCArray(f)
suite["3D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end
elseif backend == "oneAPI"
@info "Running oneAPI benchmarks"
for n in sizes_2D
f = Float32.(rand([0, 1], n, n))
f_gpu = oneArray(f)
suite["2D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end

for n in sizes_3D
f = Float32.(rand([0, 1], n, n, n))
f_gpu = oneArray(f)
suite["3D"]["Size_$n"]["Felzenszwalb"]["GPU"][backend] =
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend)
benchmark_with_memory(() -> transform(boolean_indicator(f_gpu)), backend).benchmark
end
else
@error "Unknown backend: $backend"
Expand Down

0 comments on commit a3c8703

Please sign in to comment.