1
1
openmpi/ompi/tools/mpisync/ompi_timing_post
Artem Polyakov f2e586980b Fix timing framework:
1. Fixes according to (http://www.open-mpi.org/community/lists/devel/2014/09/15869.php)
2. Force mpisync:rank0 to gather results. Now sync info is written by rank0 to the output file.
3. Improve mpirun_prof: 1) adopt to the environment (SLURM/TORQUE); 2) recognize some noteset-related mpirun options.

This commit was SVN r32772.
2014-09-23 12:59:54 +00:00

55 строки
1.3 KiB
Bash
Исполняемый файл

#!/bin/bash
#
# Copyright (c) 2014 Artem Polyakov <artpol84@gmail.com>
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#####################################################################
# Evaluate a floating point number expression.
function float_eval(){
float_scale=9
local stat=0
local result=0.0
if [[ $# -gt 0 ]]; then
result=$(echo "scale=$float_scale; $*" | bc -q 2>/dev/null)
stat=$?
if [[ $stat -eq 0 && -z "$result" ]]; then
stat=1;
fi
fi
echo $result
return $stat
}
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Need the name of a timing file and the output file"
exit 0
fi
thefile=$1
postfile=$2
sed '/^$/d' $thefile > ${thefile}_tmp
sort ${thefile}_tmp > ${postfile}
read line < ${postfile}
first_ts=`echo $line | awk '{ print $1 }' | sed -e 's/s//'`
prev_ts=$first_ts
echo $first_ts
while read line ; do
cur_ts=`echo $line | awk '{ print $1 }' | sed -e 's/s//'`
dif1=`float_eval "$cur_ts - $first_ts"`
dif2=`float_eval "$cur_ts - $prev_ts"`
newline=`echo $line | sed -e "s/$cur_ts/$dif1:$dif2/"`
prev_ts=$cur_ts
echo $newline
done < ${postfile} > ${thefile}_tmp
cat ${thefile}_tmp > ${postfile}
rm -f ${thefile}_tmp