Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
a25a25c8
Commit
a25a25c8
authored
Apr 17, 2017
by
Matthieu Schaller
Browse files
Re-enabled individual task timers.
parent
77451de9
Changes
4
Hide whitespace changes
Inline
Side-by-side
README
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
...
...
examples/main.c
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
))
{
...
...
src/timers.c
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.
*
...
...
src/timers.h
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)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment