File: splitmpidebug.sh

package info (click to toggle)
dolfin 2018.1.0.post1-16
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,764 kB
  • sloc: xml: 104,040; cpp: 98,856; python: 22,511; makefile: 204; sh: 182
file content (48 lines) | stat: -rwxr-xr-x 1,404 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# Run from test/unit/python/ as:
#  ./scripts/splitmpidebug.sh <list of test files or modules>
#
# Configure number of repeats and number of mpi processes like this:
#  REPEAT=2 PROCS='3 4' ./scripts/splitmpidebug.sh fem book
#
# This script runs pytest in with mpi such that output from each process
# is visible in separate xterm windows, and on a crash you can abort
# and exit into gdb to inspect the stacktrace in each xterm separately.
#
# You can pass a list of test files or test modules as arguments to this script.
# These tests are executed in separate pytest instances.
# See also mpidebug.sh.
#

# ... FILES = list of test files or modules to try separately (default .)
FILES=${@:-.}

# ... Max number of times to run each test file
REPEAT=${REPEAT:-1}

# ... List of number of mpi processes to try
PROCS=${PROCS:-3}

echo
echo Running $REPEAT times with $PROCS processes each of
echo $FILES
echo

for f in $FILES
do
    for p in $PROCS
    do
        n=1
        # Loop at most $m times until file fails
        while [ $? -eq 0 -a  $n -le $REPEAT ]
        do
            echo === Take $n, $p processes, `date`: $f
            n=$((n+1))
            # Clean before each run to remove error sources from file system
            ./scripts/clean.sh
            # Run!
            mpirun -n $p xterm -e gdb -ex r -ex q -args python -B -m pytest -sv $f
        done
    done
done