Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Computing
cbmroot
Commits
81202236
Commit
81202236
authored
1 year ago
by
Felix Weiglhofer
Browse files
Options
Downloads
Patches
Plain Diff
Options.cxx: Add flag for output-file.
parent
932d9bc7
No related branches found
No related tags found
1 merge request
!1192
cbmreco: Add support to store results to file
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
algo/base/Options.cxx
+4
-0
4 additions, 0 deletions
algo/base/Options.cxx
algo/base/Options.h
+4
-0
4 additions, 0 deletions
algo/base/Options.h
reco/app/cbmreco/main.cxx
+10
-2
10 additions, 2 deletions
reco/app/cbmreco/main.cxx
with
18 additions
and
2 deletions
algo/base/Options.cxx
+
4
−
0
View file @
81202236
...
...
@@ -59,6 +59,10 @@ Options::Options(int argc, char** argv)
po
::
options_description
generic
(
"Other options"
);
// clang-format off
generic
.
add_options
()
(
"output,o"
,
po
::
value
(
&
fOutputFile
)
->
default_value
(
""
)
->
value_name
(
"<file>"
),
"write results to file"
)
(
"write-per-ts,W"
,
po
::
bool_switch
(
&
fWritePerTimeslice
)
->
default_value
(
false
),
"Write results to file per timeslice (resulting files are named <file>_<tsnr>). Requires -o."
)
(
"device,d"
,
po
::
value
(
&
fDevice
)
->
default_value
(
"cpu"
)
->
value_name
(
"<device>"
),
"select device (cpu, cuda0, cuda1, hip0, ...)"
)
(
"log-level,l"
,
po
::
value
(
&
fLogLevel
)
->
default_value
(
info
)
->
value_name
(
"<level>"
),
...
...
This diff is collapsed.
Click to expand it.
algo/base/Options.h
+
4
−
0
View file @
81202236
...
...
@@ -23,6 +23,8 @@ namespace cbm::algo
fs
::
path
ParamsDir
()
const
{
return
fParamsDir
;
}
const
std
::
string
&
InputLocator
()
const
{
return
fInputLocator
;
}
fs
::
path
OutputFile
()
const
{
return
fOutputFile
;
}
bool
WritePerTimeslice
()
const
{
return
fWritePerTimeslice
;
}
severity_level
LogLevel
()
const
{
return
fLogLevel
;
}
fs
::
path
LogFile
()
const
{
return
fLogFile
;
}
const
std
::
string
&
Device
()
const
{
return
fDevice
;
}
...
...
@@ -49,6 +51,8 @@ namespace cbm::algo
private
:
std
::
string
fParamsDir
;
// TODO: can we make this a std::path?
std
::
string
fInputLocator
;
std
::
string
fOutputFile
;
bool
fWritePerTimeslice
=
false
;
severity_level
fLogLevel
;
std
::
string
fLogFile
;
std
::
string
fDevice
;
...
...
This diff is collapsed.
Click to expand it.
reco/app/cbmreco/main.cxx
+
10
−
2
View file @
81202236
...
...
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
reco
.
Init
(
opts
);
Archive
archive
(
opts
.
Detector
s
()
);
Archive
archive
(
{
fles
::
SubsystemIdentifier
::
STS
});
// TODO: use
opts.Detector()
once detector flag is merged
fles
::
TimesliceAutoSource
source
{
opts
.
InputLocator
()};
int
tsIdx
=
0
;
int
num_ts
=
opts
.
NumTimeslices
();
...
...
@@ -57,12 +57,20 @@ int main(int argc, char** argv)
continue
;
}
auto
result
=
reco
.
Run
(
*
ts
);
archive
.
TimesliceResults
().
push_back
(
result
);
if
(
opts
.
WritePerTimeslice
()
&&
!
opts
.
OutputFile
().
empty
())
{
Archive
tsResults
({
fles
::
SubsystemIdentifier
::
STS
});
// TODO: use opts.Detector() once detector flag is merged
tsResults
.
TimesliceResults
().
push_back
(
result
);
// TODO: handle file endings
tsResults
.
Store
(
fmt
::
format
(
"{}_{}"
,
opts
.
OutputFile
().
string
(),
ts
->
index
()));
}
archive
.
TimesliceResults
().
push_back
(
result
);
// TODO: result should be moved not copied
tsIdx
++
;
if
(
num_ts
>
0
&&
tsIdx
>=
num_ts
)
{
break
;
}
}
if
(
!
opts
.
WritePerTimeslice
()
&&
!
opts
.
OutputFile
().
empty
())
archive
.
Store
(
opts
.
OutputFile
());
reco
.
Finalize
();
return
0
;
...
...
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