~ubuntu-branches/ubuntu/raring/ibutils/raring-proposed

« back to all changes in this revision

Viewing changes to ibmgtsim/tests/FatTree.check.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Benoit Mortier
  • Date: 2010-01-11 22:22:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100111222200-53kum2et5nh13rv3
Tags: upstream-1.2-OFED-1.4.2
ImportĀ upstreamĀ versionĀ 1.2-OFED-1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This is the checker for for a fat-tree routing check
 
2
 
 
3
##############################################################################
 
4
#
 
5
# Start up the test applications
 
6
# This is the default flow that will start OpenSM only in 0x43 verbosity
 
7
# Return a list of process ids it started (to be killed on exit)
 
8
#
 
9
proc runner {simDir osmPath osmPortGuid} {
 
10
   set osmStdOutLog [file join $simDir osm.stdout.log]
 
11
   set osmLog [file join $simDir osm.log]
 
12
   puts "-I- Starting: $osmPath -R ftree -d2 -V -g $osmPortGuid ..."
 
13
   #set osmPid [exec $osmPath -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
 
14
   set osmPid [exec $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
 
15
   #set osmPid [exec valgrind --tool=memcheck -v --log-file-exactly=/tmp/kliteyn/osm.valgrind.log $osmPath -R ftree -f $osmLog -V -g $osmPortGuid  > $osmStdOutLog &]
 
16
 
 
17
   # start a tracker on the log file and process:
 
18
   startOsmLogAnalyzer $osmLog
 
19
 
 
20
   return $osmPid
 
21
}
 
22
 
 
23
##############################################################################
 
24
#
 
25
# Check for the test results
 
26
# 1. Make sure we got a "SUBNET UP"
 
27
# 2. Run ibdiagnet to check routing
 
28
# 3. Check that fat-tree routing has run to completion
 
29
# 4. Run congestion analysis
 
30
# 5. At each step, return the exit code in case of any failure
 
31
#
 
32
proc checker {simDir osmPath osmPortGuid} {
 
33
   global env
 
34
   set osmLog [file join $simDir osm.log]
 
35
 
 
36
   puts "-I- Waiting max time of 100sec...."
 
37
 
 
38
   if {[osmWaitForUpOrDeadWithTimeout $osmLog 1000000]} {
 
39
      return 1
 
40
   }
 
41
 
 
42
   after 5000
 
43
 
 
44
   set ibdiagnetLog [file join $simDir ibdiagnet.log]
 
45
   set cmd "ibdiagnet -o $simDir"
 
46
 
 
47
   puts "-I- Invoking $cmd "
 
48
   if {[catch {set res [eval "exec $cmd > $ibdiagnetLog"]} e]} {
 
49
      puts "-E- ibdiagnet failed with status:$e"
 
50
      return 1
 
51
   }
 
52
 
 
53
   after 5000
 
54
 
 
55
   # Check that the fat-tree routing has run to completion.
 
56
   # If it has, then opensm-ftree-ca-order.dump file should exist
 
57
   # in the simulation directory.
 
58
   set osmFtreeCAOrderDump [file join $simDir opensm-ftree-ca-order.dump]
 
59
   if {[file exists $osmFtreeCAOrderDump]} {
 
60
      puts "-I- Fat-tree CA ordering file exists"
 
61
   } else {
 
62
      puts "-E- Fat-tree CA ordering file doesn't exist"
 
63
      puts "-E- Fat-tree routing hasn't run to normal completion"
 
64
      return 1
 
65
   }
 
66
 
 
67
   set congestionScript "congestion"
 
68
   set ibdiagnetLstFile [file join $simDir ibdiagnet.lst]
 
69
   set ibdiagnetFdbsFile [file join $simDir ibdiagnet.fdbs]
 
70
   set congestionLog [file join $simDir congestion.log]
 
71
   set cmd "$congestionScript -o $ibdiagnetLstFile $ibdiagnetFdbsFile $osmFtreeCAOrderDump"
 
72
 
 
73
   puts "-I- Running congestion analysis"
 
74
   if {[catch {set res [eval "exec $cmd > $congestionLog"]} e]} {
 
75
      puts "-E- Congestion analysis failed with status: $e"
 
76
      return 1
 
77
   }
 
78
 
 
79
   puts "-I- Congestion analysis completed"
 
80
   puts "-I- Parsing congestion log"
 
81
 
 
82
   set maxNumPath 0
 
83
   set maxWorstCong 0
 
84
   set f [open $congestionLog]
 
85
   while {[gets $f sLine] >= 0} {
 
86
 
 
87
      if {[regexp {.*TOTAL CONGESTION HISTOGRAM.*} $sLine match]} {
 
88
         #seek three lines forward in the file
 
89
         if {[gets $f sLine] < 0 || [gets $f sLine] < 0 || [gets $f sLine] < 0} {
 
90
            puts "-E- Failed parsing congestion log: $congestionLog"
 
91
            return -1
 
92
         }
 
93
         puts "-I- Total congestion histogram:"
 
94
         while {[regexp {\s*(\d+)\s*(\d+)} $sLine match numPath numOutPorts]} {
 
95
            puts "-I-  - NumPaths: $numPath, NumOutPorts: $numOutPorts"
 
96
            if { $maxNumPath < $numPath } {
 
97
               set maxNumPath $numPath
 
98
            }
 
99
            # read next line
 
100
            if {[gets $f sLine] < 0} {
 
101
               puts "-E- Failed parsing congestion log: $congestionLog"
 
102
               return -1
 
103
            }
 
104
         }
 
105
      }
 
106
 
 
107
      if {[regexp {.*STAGE CONGESTION HISTOGRAM.*} $sLine match]} {
 
108
         #seek three lines forward in the file
 
109
         if {[gets $f sLine] < 0 || [gets $f sLine] < 0 || [gets $f sLine] < 0} {
 
110
            puts "-E- Failed parsing congestion log: $congestionLog"
 
111
            return -1
 
112
         }
 
113
         puts "-I- Stage congestion histogram:"
 
114
         while {[regexp {\s*(\d+)\s*(\d+)} $sLine match worstCong numStages]} {
 
115
            puts "-I-  - WorstCong: $worstCong, NumStages: $numStages"
 
116
            if { $maxWorstCong < $worstCong } {
 
117
               set maxWorstCong $worstCong
 
118
            }
 
119
            # read next line
 
120
            if {[gets $f sLine] < 0} {
 
121
               puts "-E- Failed parsing congestion log: $congestionLog"
 
122
               return -1
 
123
            }
 
124
         }
 
125
      }
 
126
   }
 
127
   close $f
 
128
 
 
129
   if {$maxNumPath > 1 || $maxWorstCong > 1} {
 
130
      puts "-E- FatTree routing is unbalanced"
 
131
      return 1
 
132
   }
 
133
 
 
134
   puts "-I- FatTree routing is well-balanced"
 
135
   return 0
 
136
}
 
137