Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
sensei
sensei
Commits
d88d2377
Commit
d88d2377
authored
Aug 29, 2018
by
David Thompson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'log-timing-to-files' into 'master'
The batch system ate my homework. See merge request
!103
parents
612f2188
ab7afe6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
56 deletions
+36
-56
sensei/CDFReducer.cxx
sensei/CDFReducer.cxx
+2
-1
sensei/ConfigurableAnalysis.cxx
sensei/ConfigurableAnalysis.cxx
+34
-55
No files found.
sensei/CDFReducer.cxx
View file @
d88d2377
#include <algorithm>
#include <limits>
#include <vtkCommunicator.h>
...
...
@@ -206,4 +207,4 @@ double* CDFReducer::Compute(double* localSortedValues,
}
return
this
->
ReducedCDF
;
}
\ No newline at end of file
}
sensei/ConfigurableAnalysis.cxx
View file @
d88d2377
...
...
@@ -43,6 +43,7 @@
#include <vector>
#include <pugixml.hpp>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <errno.h>
...
...
@@ -131,7 +132,7 @@ static int parse(MPI_Comm comm, int rank,
struct
ConfigurableAnalysis
::
InternalsType
{
InternalsType
()
:
Comm
(
MPI_COMM_NULL
)
,
RecordTimings
(
false
),
RankLogModulus
(
1
)
:
Comm
(
MPI_COMM_NULL
)
{
}
...
...
@@ -181,29 +182,31 @@ public:
// and superfluous Comm_dup's are avoided.
MPI_Comm
Comm
;
// whether to record timings for each configured analysis:
bool
RecordTimings
;
// how many ranks should print timing info:
int
RankLogModulus
;
std
::
vector
<
std
::
string
>
LogEventNames
;
};
// --------------------------------------------------------------------------
int
ConfigurableAnalysis
::
InternalsType
::
TimeInitialization
(
AnalysisAdaptorPtr
adaptor
,
std
::
function
<
int
()
>
initializer
)
{
std
::
string
analysisName
;
if
(
t
his
->
RecordTim
ing
s
)
const
char
*
analysisName
=
nullptr
;
if
(
t
imer
::
GetLogg
ing
()
)
{
std
::
ostringstream
name
;
name
<<
adaptor
->
GetClassName
()
<<
"::"
<<
this
->
Analyses
.
size
()
<<
"::initialize"
;
analysisName
=
name
.
str
();
timer
::
MarkStartEvent
(
analysisName
.
c_str
());
std
::
ostringstream
initName
;
std
::
ostringstream
execName
;
std
::
ostringstream
finiName
;
auto
analysisNumber
=
this
->
Analyses
.
size
();
initName
<<
adaptor
->
GetClassName
()
<<
"::"
<<
analysisNumber
<<
"::initialize"
;
execName
<<
adaptor
->
GetClassName
()
<<
"::"
<<
analysisNumber
<<
"::execute"
;
finiName
<<
adaptor
->
GetClassName
()
<<
"::"
<<
analysisNumber
<<
"::finalize"
;
this
->
LogEventNames
.
push_back
(
initName
.
str
());
this
->
LogEventNames
.
push_back
(
execName
.
str
());
this
->
LogEventNames
.
push_back
(
finiName
.
str
());
analysisName
=
this
->
LogEventNames
[
3
*
analysisNumber
].
c_str
();
}
timer
::
MarkStartEvent
(
analysisName
);
int
result
=
initializer
();
if
(
this
->
RecordTimings
)
{
timer
::
MarkEndEvent
(
analysisName
.
c_str
());
}
timer
::
MarkEndEvent
(
analysisName
);
return
result
;
}
...
...
@@ -915,17 +918,6 @@ int ConfigurableAnalysis::Initialize(const std::string& filename)
int
rv
=
0
;
pugi
::
xml_node
root
=
doc
.
child
(
"sensei"
);
// This must come before analysis initialization in order for us to time them.
this
->
Internals
->
RecordTimings
=
root
.
attribute
(
"timing"
).
as_bool
(
false
);
if
(
this
->
Internals
->
RecordTimings
)
{
timer
::
SetTrackSummariesOverTime
(
root
.
attribute
(
"summarize-timing"
).
as_bool
(
true
));
this
->
Internals
->
RankLogModulus
=
root
.
attribute
(
"timing-rank-modulus"
).
as_int
(
1
);
}
for
(
pugi
::
xml_node
node
=
root
.
child
(
"analysis"
);
node
;
node
=
node
.
next_sibling
(
"analysis"
))
{
...
...
@@ -962,29 +954,23 @@ bool ConfigurableAnalysis::Execute(DataAdaptor* data)
int
rv
=
0
;
int
ai
=
0
;
bool
recordTimings
=
this
->
Internals
->
RecordTimings
;
std
::
string
analysisName
;
const
char
*
analysisName
=
nullptr
;
AnalysisAdaptorVector
::
iterator
iter
=
this
->
Internals
->
Analyses
.
begin
();
AnalysisAdaptorVector
::
iterator
end
=
this
->
Internals
->
Analyses
.
end
();
for
(;
iter
!=
end
;
++
iter
,
++
ai
)
{
if
(
recordTimings
)
{
std
::
ostringstream
name
;
name
<<
(
*
iter
)
->
GetClassName
()
<<
"::"
<<
ai
<<
"::execute"
;
analysisName
=
name
.
str
();
timer
::
MarkStartEvent
(
analysisName
.
c_str
());
}
if
(
timer
::
GetLogging
())
{
analysisName
=
this
->
Internals
->
LogEventNames
[
3
*
ai
+
1
].
c_str
();
}
timer
::
MarkStartEvent
(
analysisName
);
if
(
!
(
*
iter
)
->
Execute
(
data
))
{
if
(
rank
==
0
)
SENSEI_ERROR
(
"Failed to execute "
<<
(
*
iter
)
->
GetClassName
())
rv
-=
1
;
}
if
(
recordTimings
)
{
timer
::
MarkEndEvent
(
analysisName
.
c_str
());
}
timer
::
MarkEndEvent
(
analysisName
);
}
return
rv
<
0
?
false
:
true
;
...
...
@@ -998,34 +984,27 @@ int ConfigurableAnalysis::Finalize()
int
rv
=
0
;
int
ai
=
0
;
bool
recordTimings
=
this
->
Internals
->
RecordTimings
;
std
::
string
analysisName
;
const
char
*
analysisName
=
nullptr
;
AnalysisAdaptorVector
::
iterator
iter
=
this
->
Internals
->
Analyses
.
begin
();
AnalysisAdaptorVector
::
iterator
end
=
this
->
Internals
->
Analyses
.
end
();
for
(;
iter
!=
end
;
++
iter
,
++
ai
)
{
if
(
recordTimings
)
{
std
::
ostringstream
name
;
name
<<
(
*
iter
)
->
GetClassName
()
<<
"::"
<<
ai
<<
"::finalize"
;
analysisName
=
name
.
str
();
timer
::
MarkStartEvent
(
analysisName
.
c_str
());
}
if
(
timer
::
GetLogging
())
{
analysisName
=
this
->
Internals
->
LogEventNames
[
3
*
ai
+
2
].
c_str
();
}
timer
::
MarkStartEvent
(
analysisName
);
if
((
*
iter
)
->
Finalize
())
{
SENSEI_ERROR
(
"Failed to finalize "
<<
(
*
iter
)
->
GetClassName
())
rv
-=
1
;
}
if
(
recordTimings
)
{
timer
::
MarkEndEvent
(
analysisName
.
c_str
());
}
timer
::
MarkEndEvent
(
analysisName
);
}
if
(
recordTim
ing
s
)
if
(
timer
::
GetLogg
ing
()
)
{
timer
::
PrintLog
(
std
::
cout
,
this
->
GetCommunicator
(),
this
->
Internals
->
RankLogModulus
);
timer
::
PrintLog
(
std
::
cout
,
this
->
GetCommunicator
());
}
return
rv
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment