Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
perfs.h
Go to the documentation of this file.
1
/** @file perfs.h
2
*/
3
/**
4
# Performance monitoring (for the Navier--Stokes solvers)
5
6
This logs simple statistics available for the various [Navier--Stokes
7
solvers](/src/README#navierstokes). */
8
9
/** @brief Event: perfs (i += 1) */
10
void
event_perfs
(
void
) {
11
static
FILE
*
fp
=
fopen
(
"perfs"
,
"w"
);
12
if
(
i
== 0)
13
fprintf
(
fp
,
14
"t dt mgp.i mgp.nrelax mgpf.i mgpf.nrelax mgu.i mgu.nrelax "
15
"grid->tn perf.t perf.speed npe perf.ispeed\n"
);
16
static
double
start = 0.;
17
if
(
i
> 10 &&
perf
.t - start < 1.)
return
0;
18
fprintf
(
fp
,
"%g %g %d %d %d %d %d %d %ld %g %g %d %g\n"
,
19
t
,
dt
,
mgp
.
i
,
mgp
.
nrelax
,
mgpf
.
i
,
mgpf
.
nrelax
,
mgu
.
i
,
mgu
.
nrelax
,
20
grid
->
tn
,
perf
.t,
perf
.speed,
npe
(),
perf
.ispeed);
21
fflush
(
fp
);
22
start =
perf
.t;
23
}
24
25
/**
26
If we have a display (and gnuplot works), a graph of the statistics is
27
displayed and updated at regular intervals (10 seconds as defined in
28
[perfs.plot]()). */
29
30
/** @brief Event: perf_plot (i = 10) */
31
void
event_perf_plot
(
void
) {
32
if
(
getenv
(
"DISPLAY"
))
33
popen
(
"gnuplot -e 'set term x11 noraise title perfs' "
34
"\f$BASILISK/navier-stokes/perfs.plot 2> /dev/null "
35
"& read dummy; kill \f$! 2> /dev/null"
,
"w"
);
36
}
37
38
/**
39
The graph looks like this:
40
41
![Graph displayed by [perfs.h]()](perfs.png)
42
43
## Monitoring a distant run
44
45
This can also be useful to monitor what is happening to a simulation
46
running on a remote system. The [perfs.sh]() script provides a
47
convenient way to do this.
48
49
Imagine you started a simulation including the [perfs.h]() file on the
50
"mesu" system at UPMC (typically using the queueing system) and that
51
the simulation is running in the `wave/level-10/` directory on
52
mesu. You can then get a regularly-updated graph of what is happening
53
using:
54
55
~~~bash
56
bash $BASILISK/navier-stokes/perfs.sh mesu.dsi.upmc.fr:wave/level-10/perfs
57
~~~
58
59
## See also
60
61
* [Continuous profiling monitoring](/src/profiling.h).
62
*/
mgu
mgstats mgu
Definition
all-mach.h:66
mgp
mgstats mgp
Definition
all-mach.h:66
npe
int npe
Definition
balance.h:195
mgpf
mgstats mgpf
Definition
centered.h:74
x
int x
Definition
common.h:76
grid
Grid * grid
Definition
common.h:32
popen
#define popen
Definition
config.h:666
dt
double dt
Definition
predictor-corrector.h:18
i
scalar int i
Definition
embed.h:74
t
double t
Definition
events.h:24
event_perf_plot
void event_perf_plot(void)
If we have a display (and gnuplot works), a graph of the statistics is displayed and updated at regul...
Definition
perfs.h:37
fp
FILE * fp
Definition
mtrace.h:7
event_perfs
void event_perfs(void)
Event: perfs (i += 1)
Definition
perfs.h:10
Grid::tn
long tn
Definition
common.h:28
mgstats::nrelax
int nrelax
Definition
poisson.h:116
mgstats::i
int i
Definition
poisson.h:113
perf
struct @16 perf
Performance statistics are stored in this structure.
fflush
src vof fflush(ferr)
navier-stokes
perfs.h
Generated by
1.9.8