Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
a25a25c8
Commit
a25a25c8
authored
8 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Re-enabled individual task timers.
parent
77451de9
No related branches found
No related tags found
Loading
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README
+1
-0
1 addition, 0 deletions
README
examples/main.c
+23
-2
23 additions, 2 deletions
examples/main.c
src/timers.c
+47
-0
47 additions, 0 deletions
src/timers.c
src/timers.h
+9
-1
9 additions, 1 deletion
src/timers.h
with
80 additions
and
3 deletions
README
+
1
−
0
View file @
a25a25c8
...
...
@@ -31,6 +31,7 @@ Valid options are:
-s Run with hydrodynamics.
-S Run with stars.
-t {int} The number of threads to use on each MPI rank. Defaults to 1 if not specified.
-T Print timers every time-step.
-v [12] Increase the level of verbosity
1: MPI-rank 0 writes
2: All MPI-ranks write
...
...
This diff is collapsed.
Click to expand it.
examples/main.c
+
23
−
2
View file @
a25a25c8
...
...
@@ -90,6 +90,7 @@ void print_help_message() {
printf
(
" %2s %8s %s
\n
"
,
"-t"
,
"{int}"
,
"The number of threads to use on each MPI rank. Defaults to 1 if not "
"specified."
);
printf
(
" %2s %8s %s
\n
"
,
"-T"
,
""
,
"Print timers every time-step."
);
printf
(
" %2s %8s %s
\n
"
,
"-v"
,
"[12]"
,
"Increase the level of verbosity."
);
printf
(
" %2s %8s %s
\n
"
,
""
,
""
,
"1: MPI-rank 0 writes "
);
printf
(
" %2s %8s %s
\n
"
,
""
,
""
,
"2: All MPI-ranks write"
);
...
...
@@ -165,12 +166,13 @@ int main(int argc, char *argv[]) {
int
with_drift_all
=
0
;
int
verbose
=
0
;
int
nr_threads
=
1
;
int
with_verbose_timers
=
0
;
char
paramFileName
[
200
]
=
""
;
unsigned
long
long
cpufreq
=
0
;
/* Parse the parameters */
int
c
;
while
((
c
=
getopt
(
argc
,
argv
,
"acCdDef:FgGhn:sSt:v:y:"
))
!=
-
1
)
switch
(
c
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"acCdDef:FgGhn:sSt:
T
v:y:"
))
!=
-
1
)
switch
(
c
)
{
case
'a'
:
with_aff
=
1
;
break
;
...
...
@@ -229,6 +231,9 @@ int main(int argc, char *argv[]) {
return
1
;
}
break
;
case
'T'
:
with_verbose_timers
=
1
;
break
;
case
'v'
:
if
(
sscanf
(
optarg
,
"%d"
,
&
verbose
)
!=
1
)
{
if
(
myrank
==
0
)
printf
(
"Error parsing verbosity level (-v).
\n
"
);
...
...
@@ -596,11 +601,18 @@ int main(int argc, char *argv[]) {
engine_dump_snapshot
(
&
e
);
/* Legend */
if
(
myrank
==
0
)
if
(
myrank
==
0
)
{
printf
(
"# %6s %14s %14s %10s %10s %10s %16s [%s]
\n
"
,
"Step"
,
"Time"
,
"Time-step"
,
"Updates"
,
"g-Updates"
,
"s-Updates"
,
"Wall-clock time"
,
clocks_getunit
());
if
(
with_verbose_timers
)
{
printf
(
"timers: "
);
for
(
int
k
=
0
;
k
<
timer_count
;
k
++
)
printf
(
"%s
\t
"
,
timers_names
[
k
]);
printf
(
"
\n
"
);
}
}
/* Main simulation loop */
for
(
int
j
=
0
;
!
engine_is_done
(
&
e
)
&&
e
.
step
-
1
!=
nsteps
;
j
++
)
{
...
...
@@ -610,6 +622,15 @@ int main(int argc, char *argv[]) {
/* Take a step. */
engine_step
(
&
e
);
/* Print the timers. */
if
(
with_verbose_timers
)
{
printf
(
"timers: "
);
for
(
int
k
=
0
;
k
<
timer_count
;
k
++
)
printf
(
"%.3f
\t
"
,
clocks_from_ticks
(
timers
[
k
]));
printf
(
"
\n
"
);
timers_reset
(
0xFFFFFFFFllu
);
}
#ifdef SWIFT_DEBUG_TASKS
/* Dump the task data using the given frequency. */
if
(
dump_tasks
&&
(
dump_tasks
==
1
||
j
%
dump_tasks
==
1
))
{
...
...
This diff is collapsed.
Click to expand it.
src/timers.c
+
47
−
0
View file @
a25a25c8
...
...
@@ -29,6 +29,53 @@
/* The timers. */
ticks
timers
[
timer_count
];
/* Timer names. */
char
*
timers_names
[
timer_count
]
=
{
"none"
,
"prepare"
,
"init"
,
"drift"
,
"kick1"
,
"kick2"
,
"timestep"
,
"endforce"
,
"dosort"
,
"doself_density"
,
"doself_gradient"
,
"doself_force"
,
"doself_grav_pp"
,
"dopair_density"
,
"dopair_gradient"
,
"dopair_force"
,
"dopair_grav_pm"
,
"dopair_grav_mm"
,
"dopair_grav_pp"
,
"dograv_external"
,
"dograv_down"
,
"dograv_long_range"
,
"dosource"
,
"dosub_self_density"
,
"dosub_self_gradient"
,
"dosub_self_force"
,
"dosub_self_grav"
,
"dosub_pair_density"
,
"dosub_pair_gradient"
,
"dosub_pair_force"
,
"dosub_pair_grav"
,
"dopair_subset"
,
"do_ghost"
,
"do_extra_ghost"
,
"dorecv_part"
,
"dorecv_gpart"
,
"dorecv_spart"
,
"gettask"
,
"qget"
,
"qsteal"
,
"runners"
,
"step"
,
"do_cooling"
,
};
/**
* @brief Re-set the timers.
*
...
...
This diff is collapsed.
Click to expand it.
src/timers.h
+
9
−
1
View file @
a25a25c8
...
...
@@ -27,7 +27,12 @@
#include
"cycle.h"
#include
"inline.h"
/* The timers themselves. */
/**
* @brief The timers themselves.
*
* If you modify this list, be sure to change timers_names in timers.c as
* well!
**/
enum
{
timer_none
=
0
,
timer_prepare
,
...
...
@@ -78,6 +83,9 @@ enum {
/* The timers. */
extern
ticks
timers
[
timer_count
];
/* The timer names. */
extern
char
*
timers_names
[];
/* Mask for all timers. */
#define timers_mask_all ((1ull << timer_count) - 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