File: ompi_timing_post

package info (click to toggle)
openmpi 3.1.3-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,572 kB
  • sloc: ansic: 628,972; f90: 17,993; makefile: 13,761; sh: 7,051; java: 6,360; perl: 3,215; cpp: 2,225; python: 1,350; lex: 988; fortran: 52; tcl: 12
file content (58 lines) | stat: -rwxr-xr-x 1,122 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
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#
# Copyright (c) 2014      Artem Polyakov <artpol84@gmail.com>
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$

#####################################################################
# Evaluate a floating point number expression.

if [ -z "$1" ] || [ -z "$2" ]; then
    echo "Need the name of a timing file and the output file"
    exit 0
fi

initfile=$1
postfile=$2

# 1. Filter OPAL_TRACE entrieas only
#    and put the timestamp to the first place
#.2. Sort considering that we dealing with
#    floating point numbers
# 3. Return to initial field order and count relative fields
cat $initfile | \
awk 'BEGIN { FPAT = "([^ ]+)|(\"[^\"]+\")" }
{
    if( $0 ~ /\[OPAL_TRACE\]/ ){
        x = $NF
        $NF = $1
        $1 = x
        print $0
    }
}' | sort --general-numeric-sort | \
awk 'BEGIN {
    FPAT = "([^ ]+)|(\"[^\"]+\")"
    first = 0
    prev = 0
}
{
    if( first == 0 ){
	first = $1
	prev = $1
    }
    x = $1
    $1 = $NF
    $NF = x
    rel_to_first = x - first
    rel_to_prev = x - prev
    prev = x
    print $0, " ", rel_to_prev, " ", rel_to_first
}' > $postfile