Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ag-ohlberger
dune-community
dune-xt
Commits
c9e5cec5
Commit
c9e5cec5
authored
12 years ago
by
René Fritze
Browse files
Options
Downloads
Patches
Plain Diff
[common] new profiler output
parent
8edee7b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/stuff/common/profiler.cc
+29
-3
29 additions, 3 deletions
dune/stuff/common/profiler.cc
dune/stuff/common/profiler.hh
+2
-1
2 additions, 1 deletion
dune/stuff/common/profiler.hh
with
31 additions
and
4 deletions
dune/stuff/common/profiler.cc
+
29
−
3
View file @
c9e5cec5
...
@@ -249,13 +249,39 @@ void Profiler::setOutputdir(const std::string dir)
...
@@ -249,13 +249,39 @@ void Profiler::setOutputdir(const std::string dir)
Dune
::
Stuff
::
Common
::
testCreateDirectory
(
output_dir_
);
Dune
::
Stuff
::
Common
::
testCreateDirectory
(
output_dir_
);
}
}
void
Profiler
::
outputTimings
(
const
std
::
string
/*
csv
*/
)
const
void
Profiler
::
outputTimings
(
const
std
::
string
csv
)
const
{
{
const
auto
&
comm
=
Dune
::
MPIHelper
::
getCollectiveCommunication
();
const
auto
&
comm
=
Dune
::
MPIHelper
::
getCollectiveCommunication
();
boost
::
filesystem
::
path
filename
(
output_dir_
);
boost
::
filesystem
::
path
dir
(
output_dir_
);
filename
/
=
(
boost
::
format
(
"
timing
s_p%08d.csv"
)
%
comm
.
rank
()).
str
();
boost
::
filesystem
::
path
filename
=
dir
/
(
boost
::
format
(
"
%
s_p%08d.csv"
)
%
csv
%
comm
.
rank
()).
str
();
boost
::
filesystem
::
ofstream
out
(
filename
);
boost
::
filesystem
::
ofstream
out
(
filename
);
outputTimings
(
out
);
outputTimings
(
out
);
if
(
comm
.
rank
()
==
0
)
{
boost
::
filesystem
::
path
a_filename
=
dir
/
(
boost
::
format
(
"%s.csv"
)
%
csv
).
str
();
boost
::
filesystem
::
ofstream
a_out
(
a_filename
);
outputTimingsAll
(
a_out
);
}
}
void
Profiler
::
outputTimingsAll
(
std
::
ostream
&
out
)
const
{
if
(
datamaps_
.
size
()
<
1
)
return
;
// csv header:
const
auto
&
comm
=
Dune
::
MPIHelper
::
getCollectiveCommunication
();
out
<<
"run"
;
for
(
const
auto
&
section
:
datamaps_
[
0
])
{
out
<<
csv_sep
<<
section
.
first
<<
"_avg"
<<
csv_sep
<<
section
.
first
<<
"_sum"
;
}
int
i
=
0
;
for
(
const
auto
&
datamap
:
datamaps_
)
{
out
<<
std
::
endl
<<
i
;
for
(
const
auto
&
section
:
datamap
)
{
auto
sum
=
comm
.
sum
(
section
.
second
);
out
<<
csv_sep
<<
sum
/
float
(
comm
.
size
())
<<
csv_sep
<<
sum
;
}
out
<<
std
::
endl
;
}
}
}
void
Profiler
::
outputTimings
(
std
::
ostream
&
out
)
const
void
Profiler
::
outputTimings
(
std
::
ostream
&
out
)
const
...
...
This diff is collapsed.
Click to expand it.
dune/stuff/common/profiler.hh
+
2
−
1
View file @
c9e5cec5
...
@@ -123,8 +123,9 @@ public:
...
@@ -123,8 +123,9 @@ public:
void
outputMap
(
const
InfoContainerMap
&
run_infos_map
,
const
double
scale_factor
=
1.0
)
const
;
void
outputMap
(
const
InfoContainerMap
&
run_infos_map
,
const
double
scale_factor
=
1.0
)
const
;
//! file-output the named sections only
//! file-output the named sections only
void
outputTimings
(
const
std
::
string
filename
)
const
;
void
outputTimings
(
const
std
::
string
filename
=
"timings"
)
const
;
void
outputTimings
(
std
::
ostream
&
out
=
std
::
cout
)
const
;
void
outputTimings
(
std
::
ostream
&
out
=
std
::
cout
)
const
;
void
outputTimingsAll
(
std
::
ostream
&
out
=
std
::
cout
)
const
;
/** call this with correct numRuns <b> before </b> starting any profiling
/** call this with correct numRuns <b> before </b> starting any profiling
* if you're planning on doing more than one iteration of your code
* if you're planning on doing more than one iteration of your code
* called once fromm ctor with numRuns=1
* called once fromm ctor with numRuns=1
...
...
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