Skip to content
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
12 changes: 7 additions & 5 deletions perf/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
# Benchmark names are `category/backend/mode/group/...`, with the categories of
# perf/benchmark-config.json. On the CPU backend, `serial` benchmarks run with one PoCL
# worker and `parallel` ones with a worker per physical core that this process may use (or
# `KA_BENCHMARK_THREADS`). Every group of benchmarks runs in a fresh process with one Julia
# thread, as the number of workers can't change once the backend has been used.
# `KA_BENCHMARK_THREADS`), with as many Julia threads, which the backend may run
# work-groups on. Every group of benchmarks runs in a fresh process, as the number of
# workers can't change once the backend has been used.
#
# Results that don't pass the checks below aren't written, so that they don't get published.

Expand All @@ -17,7 +18,7 @@ using KernelAbstractions

const PERF = @__DIR__
const OUTPUT = length(ARGS) >= 1 ? ARGS[1] : "benchmarks.json"
const JULIA = `$(Base.julia_cmd()) --project=$(dirname(Base.active_project())) --startup-file=no --threads=1`
const JULIA = `$(Base.julia_cmd()) --project=$(dirname(Base.active_project())) --startup-file=no`

# The number of physical cores, but no more than the CPUs this process may run on
function physical_cores()
Expand All @@ -42,11 +43,12 @@ end

const PARALLEL_THREADS = parse(Int, get(ENV, "KA_BENCHMARK_THREADS", string(physical_cores())))

# The environment of a benchmark process: `threads` PoCL workers, and a PoCL kernel cache
# of its own, so that no kernel compiled by an earlier run is reused
# The environment of a benchmark process: `threads` workers and Julia threads, and a PoCL
# kernel cache of its own, so that no kernel compiled by an earlier run is reused
function child_env(threads; cache = mktempdir())
env = filter(((k, _),) -> !startswith(k, "POCL_") && k != "JULIA_KA_CPU_THREADS", ENV)
env["JULIA_KA_CPU_THREADS"] = string(threads)
env["JULIA_NUM_THREADS"] = "$threads,0"
env["POCL_CACHE_DIR"] = cache
env["OPENBLAS_NUM_THREADS"] = "1"
return env
Expand Down
7 changes: 4 additions & 3 deletions perf/suite.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Runs the benchmarks of one execution mode in this process, and saves their results:
#
# julia --project=perf -t1 perf/suite.jl MODE GROUP OUTPUT
# julia --project=perf perf/suite.jl MODE GROUP OUTPUT
#
# with MODE `serial` or `parallel`, and GROUP `launch` (the launch-overhead benchmarks) or
# `main` (all others). `runbenchmarks.jl` starts this with `JULIA_KA_CPU_THREADS` set to the
# number of PoCL workers of the mode: it has to be set before the backend is first used.
# `main` (all others). `runbenchmarks.jl` starts this with as many Julia threads as the mode
# has workers, and `JULIA_KA_CPU_THREADS` set to that number: it has to be set before the
# backend is first used.

using KernelAbstractions
using BenchmarkTools
Expand Down
Loading