Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reconstruction_benchmarks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
reconstruction_benchmarks
Commits
0bde8a2e
Commit
0bde8a2e
authored
1 year ago
by
Christopher Dilks
Browse files
Options
Downloads
Patches
Plain Diff
feat: more step control
parent
173bf614
Branches
Branches containing commit
No related tags found
2 merge requests
!309
Irt algo
,
!293
feat: dRICH benchmarks
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/rich/run_benchmark.rb
+56
-30
56 additions, 30 deletions
benchmarks/rich/run_benchmark.rb
with
56 additions
and
30 deletions
benchmarks/rich/run_benchmark.rb
+
56
−
30
View file @
0bde8a2e
...
@@ -18,13 +18,14 @@ IdealParticle = 'pi+'
...
@@ -18,13 +18,14 @@ IdealParticle = 'pi+'
# default opt
# default opt
opt
=
OpenStruct
.
new
opt
=
OpenStruct
.
new
opt
.
evgen
=
''
opt
.
evgen
=
''
opt
.
ana_only
=
false
opt
.
sim_file
=
'out/sim.edm4hep.root'
opt
.
sim_file
=
'sim.edm4hep.root'
opt
.
rec_file
=
'out/rec.edm4hep.root'
opt
.
rec_file
=
'rec.edm4hep.root'
opt
.
ana_file
=
'out/ana.edm4hep.root'
opt
.
ana_file
=
'ana.edm4hep.root'
opt
.
run_sim
=
true
opt
.
run_sim
=
true
opt
.
run_rec
=
true
opt
.
run_rec
=
true
opt
.
run_ana
=
true
opt
.
run_ana
=
true
opt
.
run_rec_down
=
false
opt
.
run_ana_down
=
false
opt
.
num_events
=
10
opt
.
num_events
=
10
opt
.
benchmark_exe
=
'benchmark_rich_reconstruction'
opt
.
benchmark_exe
=
'benchmark_rich_reconstruction'
opt
.
algos
=
Array
.
new
opt
.
algos
=
Array
.
new
...
@@ -40,19 +41,30 @@ avail_evgens = [
...
@@ -40,19 +41,30 @@ avail_evgens = [
]
]
# parse options
# parse options
required_set
=
false
OptionParser
.
new
do
|
o
|
OptionParser
.
new
do
|
o
|
o
.
banner
=
"USAGE:
#{
$0
}
[OPTIONS]..."
o
.
banner
=
"USAGE:
#{
$0
}
[OPTIONS]..."
o
.
separator
''
o
.
separator
''
o
.
separator
'required options, one of either:'
.
upcase
o
.
separator
'required options, one of either:'
.
upcase
o
.
separator
''
o
.
separator
''
o
.
on
(
"-b"
,
"--benchmark-only"
,
"Run only the analysis benchmark"
)
{
|
a
|
opt
.
ana_only
=
true
}
o
.
on
(
"-r"
,
"--rec-only"
,
"Run only the reconstruction, then the analysis benchmark"
)
do
|
a
|
opt
.
run_rec_down
=
true
required_set
=
true
end
o
.
separator
''
o
.
on
(
"-b"
,
"--ana-only"
,
"Run only the analysis benchmark"
)
do
|
a
|
opt
.
run_ana_down
=
true
required_set
=
true
end
o
.
separator
''
o
.
separator
''
o
.
on
(
"-e"
,
"--evgen [EVGEN_MODE]"
,
"Event generation mode, one of:"
)
do
|
a
|
o
.
on
(
"-e"
,
"--evgen [EVGEN_MODE]"
,
"Run the event generation, reconstruction, and analysis"
,
"[EVGEN_MODE] must be one of:"
)
do
|
a
|
unless
avail_evgens
.
include?
a
unless
avail_evgens
.
include?
a
$stderr
.
puts
"ERROR: unknown event generation mode '
#{
a
}
'"
$stderr
.
puts
"ERROR: unknown event generation mode '
#{
a
}
'"
exit
1
exit
1
end
end
opt
.
evgen
=
a
opt
.
evgen
=
a
required_set
=
true
end
end
avail_evgens
.
each
{
|
it
|
o
.
separator
' '
*
40
+
it
}
avail_evgens
.
each
{
|
it
|
o
.
separator
' '
*
40
+
it
}
o
.
separator
''
o
.
separator
''
...
@@ -91,12 +103,26 @@ opt.each_pair { |k,v| puts "#{k.to_s.rjust(20)} => #{v}" }
...
@@ -91,12 +103,26 @@ opt.each_pair { |k,v| puts "#{k.to_s.rjust(20)} => #{v}" }
puts
'}'
puts
'}'
# check for required options
# check for required options
if
opt
.
evgen
==
''
and
opt
.
ana_only
==
fal
se
unless
required_
se
t
$stderr
.
puts
"ERROR: required options have not been set"
$stderr
.
puts
"ERROR: required options have not been set"
$stderr
.
puts
"run '
#{
$0
}
--help' for guidance"
$stderr
.
puts
"run '
#{
$0
}
--help' for guidance"
exit
1
exit
1
end
end
# figure out which steps to run
run_step
=
{
:sim
=>
false
,
:rec
=>
false
,
:ana
=>
false
,
}
if
opt
.
run_ana_down
run_step
[
:ana
]
=
true
elsif
opt
.
run_rec_down
run_step
[
:rec
]
=
true
run_step
[
:ana
]
=
true
else
run_step
[
:sim
]
=
opt
.
run_sim
run_step
[
:rec
]
=
opt
.
run_rec
run_step
[
:ana
]
=
opt
.
run_ana
end
puts
"steps to run:
#{
run_step
}
"
# get compact file
# get compact file
if
ENV
[
'DETECTOR_PATH'
].
nil?
or
ENV
[
'DETECTOR_CONFIG'
].
nil?
if
ENV
[
'DETECTOR_PATH'
].
nil?
or
ENV
[
'DETECTOR_CONFIG'
].
nil?
$stderr
.
puts
"ERROR: unknown DETECTOR_PATH or DETECTOR_CONFIG"
$stderr
.
puts
"ERROR: unknown DETECTOR_PATH or DETECTOR_CONFIG"
...
@@ -105,7 +131,7 @@ end
...
@@ -105,7 +131,7 @@ end
compact_file
=
"
#{
ENV
[
'DETECTOR_PATH'
]
}
/
#{
ENV
[
'DETECTOR_CONFIG'
]
}
.xml"
compact_file
=
"
#{
ENV
[
'DETECTOR_PATH'
]
}
/
#{
ENV
[
'DETECTOR_CONFIG'
]
}
.xml"
#
helper function
s
#
event generator command generator
s
# ---------------------------------------------------
# ---------------------------------------------------
def
theta2xyz
(
theta
)
def
theta2xyz
(
theta
)
rad
=
theta
*
Math
::
PI
/
180
rad
=
theta
*
Math
::
PI
/
180
...
@@ -136,7 +162,7 @@ case opt.evgen
...
@@ -136,7 +162,7 @@ case opt.evgen
when
'idealAngle'
when
'idealAngle'
evgen_cmd
=
evgen_fixed_angle
.
call
IdealTheta
,
IdealEnergy
,
IdealParticle
evgen_cmd
=
evgen_fixed_angle
.
call
IdealTheta
,
IdealEnergy
,
IdealParticle
else
else
exit
1
unless
opt
.
ana_only
exit
1
if
run_step
[
:sim
]
end
end
...
@@ -177,28 +203,28 @@ analysis_cmd.append '-' + 'v'*opt.verbosity if opt.verbosity > 0
...
@@ -177,28 +203,28 @@ analysis_cmd.append '-' + 'v'*opt.verbosity if opt.verbosity > 0
# execute commands
# execute commands
# ---------------------------------------------------
# ---------------------------------------------------
exe
=
Proc
.
new
do
|
cmd_args
,
name
|
# proc: execute a command; raise runtime exception if failure (exit nonzero)
cmd
=
cmd_args
.
join
' '
exe
=
Proc
.
new
do
|
cmd_args
,
name
,
step
|
puts
"
#{
name
}
command:"
.
upcase
if
run_step
[
step
]
cmd_args
.
each_with_index
do
|
arg
,
i
|
cmd
=
cmd_args
.
join
' '
line
=
i
==
0
?
''
:
' '
puts
"benchmark
#{
name
}
command:"
.
upcase
line
+=
arg
cmd_args
.
each_with_index
do
|
arg
,
i
|
line
+=
' \\'
unless
i
+
1
==
cmd_args
.
size
line
=
i
==
0
?
''
:
' '
puts
line
line
+=
arg
end
line
+=
' \\'
unless
i
+
1
==
cmd_args
.
size
unless
opt
.
dry_run
puts
line
end
unless
opt
.
dry_run
puts
'-'
*
50
puts
"
#{
name
}
execution:"
.
upcase
system
cmd
or
raise
"benchmark
#{
name
}
failed!"
.
upcase
end
puts
'-'
*
50
puts
'-'
*
50
puts
"
#{
name
}
execution:"
.
upcase
system
cmd
or
raise
"
#{
name
}
failed!"
end
end
puts
'-'
*
50
end
end
puts
'-'
*
50
puts
'-'
*
50
unless
opt
.
ana_only
exe
.
call
evgen_cmd
,
'event generator'
if
opt
.
run_sim
# execute the commands
exe
.
call
recon_cmd
,
'reconstruction'
if
opt
.
run_rec
exe
.
call
evgen_cmd
,
'event generation'
,
:sim
end
exe
.
call
recon_cmd
,
'reconstruction'
,
:rec
if
opt
.
ana_only
or
opt
.
run_ana
exe
.
call
analysis_cmd
,
'analysis'
,
:ana
exe
.
call
analysis_cmd
,
'benchmark analysis'
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment