Skip to content

Commit 5bbbb6d

Browse files
authored
adapt to JetReconstruction changes making algorithm argument mandatory (#8)
1 parent 61c746b commit 5bbbb6d

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/benchmark.jl

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,14 @@ function julia_jet_process_avg_time(events::Vector{Vector{T}};
7979
repeats::Int = 1) where {T <: JetReconstruction.FourMomentum}
8080
@info "Will process $(size(events)[1]) events, repeating $(repeats) time(s)"
8181

82-
# Set consistent algorithm and power
83-
(p, algorithm) = JetReconstruction.get_algorithm_power_consistency(p = p,
84-
algorithm = algorithm)
85-
8682
n_events = length(events)
8783

8884
# Warmup code if we are doing a multi-sample timing run
8985
if nsamples > 1
9086
@info "Doing initial warm-up run"
9187
for event in events
92-
_ = inclusive_jets(jet_reconstruct(event, R = radius, p = p,
93-
strategy = strategy); ptmin = ptmin)
88+
_ = inclusive_jets(jet_reconstruct(event, R = radius,
89+
algorithm = algorithm, p = p, strategy = strategy); ptmin = ptmin)
9490
end
9591
end
9692

@@ -112,8 +108,8 @@ function julia_jet_process_avg_time(events::Vector{Vector{T}};
112108
Threads.@threads for event_counter 1:n_events * repeats
113109
event_idx = mod1(event_counter, n_events)
114110
my_t = Threads.threadid()
115-
inclusive_jets(jet_reconstruct(events[event_idx], R = radius, p = p,
116-
strategy = strategy), ptmin = ptmin)
111+
inclusive_jets(jet_reconstruct(events[event_idx], R = radius,
112+
algorithm = algorithm, p = p, strategy = strategy), ptmin = ptmin)
117113
end
118114
t_stop = time_ns()
119115
dt_μs = convert(Float64, t_stop - t_start) * 1.e-3
@@ -158,9 +154,8 @@ function fastjet_jet_process_avg_time(input_file::AbstractString;
158154
input_file = hepmc3gunzip(input_file)
159155
end
160156

161-
# Set consistent algorithm and power
162-
(p, algorithm) = JetReconstruction.get_algorithm_power_consistency(p = p,
163-
algorithm = algorithm)
157+
# Get consistent algorithm power
158+
p = JetReconstruction.get_algorithm_power(p = p, algorithm = algorithm)
164159

165160
# @warn "FastJet timing not implemented yet"
166161
fj_bin = joinpath(@__DIR__, "..", "fastjet", "build", "fastjet-finder")
@@ -194,10 +189,6 @@ function python_jet_process_avg_time(backend::Backends.Code,
194189
if endswith(input_file, ".gz")
195190
input_file = hepmc3gunzip(input_file)
196191
end
197-
198-
# Set consistent algorithm and power
199-
(p, algorithm) = JetReconstruction.get_algorithm_power_consistency(p = p,
200-
algorithm = algorithm)
201192

202193
# There are some limitations in the Python code - only AntiKt is supported,
203194
# and the strategy has to be manually set
@@ -351,8 +342,8 @@ function main()
351342
hepmc3_files_df[:, :mean_particles] .= -1
352343
end
353344

354-
# Get consistent algorithm and power here, so that missing values are filled
355-
(power, algorithm) = JetReconstruction.get_algorithm_power_consistency(p = args[:power], algorithm = args[:algorithm])
345+
# Get consistent algorithm power
346+
power = JetReconstruction.get_algorithm_power(p = args[:power], algorithm = args[:algorithm])
356347

357348
event_timing = Float64[]
358349
n_samples = Int[]
@@ -404,7 +395,7 @@ function main()
404395
# Decorate the DataFrame with the metadata of the runs
405396
hepmc3_files_df[:, :code] .= args[:code]
406397
hepmc3_files_df[:, :code_version] .= args[:code_version]
407-
hepmc3_files_df[:, :algorithm] .= algorithm
398+
hepmc3_files_df[:, :algorithm] .= args[:algorithm]
408399
hepmc3_files_df[:, :strategy] .= args[:strategy]
409400
hepmc3_files_df[:, :radius] .= args[:radius]
410401
hepmc3_files_df[:, :power] .= power

0 commit comments

Comments
 (0)