Debian Codegraph @

python/test/unit/scripts/splitmpidebug.sh

raw
1 #!/bin/bash
2 #
3 # Run from test/unit/python/ as:
4 # ./scripts/splitmpidebug.sh <list of test files or modules>
5 #
6 # Configure number of repeats and number of mpi processes like this:
7 # REPEAT=2 PROCS='3 4' ./scripts/splitmpidebug.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 executed in separate pytest instances.
15 # See also mpidebug.sh.
16 #
17
18 # ... FILES = list of test files or modules to try separately (default .)
19 FILES=${@:-.}
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 each of
29 echo $FILES
30 echo
31
32 for f in $FILES
33 do
34 for p in $PROCS
35 do
36 n=1
37 # Loop at most $m times until file fails
38 while [ $? -eq 0 -a $n -le $REPEAT ]
39 do
40 echo === Take $n, $p processes, `date`: $f
41 n=$((n+1))
42 # Clean before each run to remove error sources from file system
43 ./scripts/clean.sh
44 # Run!
45 mpirun -n $p xterm -e gdb -ex r -ex q -args python -B -m pytest -sv $f
46 done
47 done
48 done