Skip to content

Commit

Permalink
Added a MPI rank filter to reduce the number of traced processes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cniethammer committed Oct 26, 2018
1 parent 7b46500 commit ec45ff4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ The LOGDIR variable may be used to specify another directory for the log files:
```
LOGDIR=my_log_dir mpirun [MPI OPTIONS] ./strace-wrapper.sh ./my_app [APP OPTIONS]
```
#### Filtering MPI ranks
For MPI programs running with large number of processes the number of traced
processes may have to be narrowed down. The RANK_FILTER variable allows to
specify a regex pattern which is matched agains the MPI rank number. Only
processes with ranks matching this regex will be traced.
```
RANK_FILTER='[0-4]' mpirun [MPI OPTIONS] ./strace-wrapper.sh ./my_app [APP OPTIONS]
```


#### Analyzing Traces
Expand Down
9 changes: 8 additions & 1 deletion strace-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ if ! test -d $LOGDIR ; then
mkdir -p $LOGDIR
fi
LOGFILE="$LOGDIR/${MPI_RANK:+r${MPI_RANK}-}$(hostname).$$.strace"
strace -f -r -T -o "$LOGFILE" "$@"


if ! test -z $MPI_RANK && ! test -z $RANK_FILTER && ! [[ $MPI_RANK =~ $RANK_FILTER ]] ; then
echo "# Rank $MPI_RANK not traced" > $LOGFILE
"$@"
else
strace -f -r -T -o "$LOGFILE" "$@"
fi

0 comments on commit ec45ff4

Please sign in to comment.