Debian Codegraph @

python/test/unit/scripts/mpidebug.sh

raw
1 #!/bin/bash
2 #
3 # Run from test/unit/python/ as:
4 # ./scripts/mpidebug.sh <additional pytest args>
5 #
6 # Configure number of repeats and number of mpi processes like this:
7 # REPEAT=2 PROCS='3 4' ./scripts/mpidebug.sh fem book
8 #
9 # This script runs pytest in with mpi such that output from each process
10 # is visible in separate xterm windows, and on a crash you can abort
11 # and exit into gdb to inspect the stacktrace in each xterm separately.
12 #
13 # You can pass a list of test files or test modules as arguments to this script.
14 # These tests are all executed in a single pytest instance.
15 # See also splitmpidebug.sh.
16 #
17
18 # ... PYTESTARGS = arguments passed directly to pytest (default .)
19 PYTESTARGS=${@:-.}
20
21 # ... Max number of times to run each test file
22 REPEAT=${REPEAT:-1}
23
24 # ... List of number of mpi processes to try
25 PROCS=${PROCS:-3}
26
27 echo
28 echo Running $REPEAT times with $PROCS processes with pytest args
29 echo $PYTESTARGS
30 echo
31
32 for p in $PROCS
33 do
34 n=1
35 # Loop at most $m times until file fails
36 while [ $? -eq 0 -a $n -le $REPEAT ]
37 do
38 echo === Take $n, $p processes, `date`: $f
39 n=$((n+1))
40 # Clean before each run to remove error sources from file system
41 ./scripts/clean.sh
42 # Run!
43 mpirun -n $p xterm -e gdb -ex r -ex q -args python -B -m pytest -sv $PYTESTARGS
44 done
45 done