-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrnetcolumn
More file actions
executable file
·171 lines (137 loc) · 3.84 KB
/
Copy pathrnetcolumn
File metadata and controls
executable file
·171 lines (137 loc) · 3.84 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/usr/bin/tclsh
if {$argc < 9} {
puts "Usage: rnets <nodes file> <inp> <path> <sqrt(no subnet/node)> <no_conn/link> <time> <seed> <decr> <port>"
exit
}
set cont 0
if {$argc > 9} {set cont [lindex $argv 9]}
exec touch start
set name [lindex $argv 0]
set inp [lindex $argv 1]
set path [lindex $argv 2]
set ns [lindex $argv 3]
set ncon [lindex $argv 4]
set tim [lindex $argv 5]
set seed [lindex $argv 6]
set decr [lindex $argv 7]
set port [lindex $argv 8]
set delay 0.3
set f [open $name r]
gets $f nproc
exec cp $name tmp.nodes.tab
for {set i 0} {$i<$nproc} {incr i 1} {
gets $f node
lappend nodelist $node
}
close $f
set f [open "$inp.cfg" r]
gets $f line
close $f
set flags [split $line ,]
set hist [lsearch $flags H]
set out [lsearch $flags O]
set vout [lsearch $flags V]
set link [lsearch $flags L]
set stim [lsearch $flags S]
if {($hist==-1) && ($out==-1) && ($vout==-1)} {
puts { no output generated }
exit
}
set proc [expr sqrt($nproc)]
set filelist1 {par syn neu}
if {$link>-1} {
set filelist1 "$filelist1 lin lout"
}
#exec rm -f tmp.link
if {$stim>-1} {
set filelist1 "$filelist1 stim"
}
set filelist2 "$filelist1 cfg"
if {$cont < 1} {
puts "$filelist2"
puts "mknode $inp tmp $ns $proc $seed"
exec ./mknode $inp tmp $ns $proc $seed >rnet.log
puts "mklink $inp [expr $proc*$ns] $seed"
exec ./mklink $inp [expr $proc*$ns] $seed >>rnet.log
puts "sublink tmp $ncon $delay $seed"
exec ./sublink tmp $ncon $delay $seed >>rnet.log
puts "crl tmp $nproc"
exec ./crl tmp $nproc >>rnet.log
puts copy
for {set i 0} {$i<$nproc} {incr i 1} {
set node [lindex $nodelist $i]
puts $node
exec rsh -n $node rm -rf $path
exec rsh -n $node mkdir $path
exec rcp ./tmp.conn.tab "$node:$path/"
exec rcp ./tmp.nodes.tab "$node:$path/"
exec rcp ./netclustwacnmdadiff "$node:$path/"
foreach ext $filelist2 {
exec rcp "./tmp.$ext.$i" "$node:$path/"
}
foreach ext $filelist1 {
exec rcp "./tmp.$ext.$i" "$node:$path/"
exec rm -f "./tmp.$ext.$i"
}
}
#exec rm -f ./tmp.nodes.tab ./tmp.conn.tab
}
for {set i 0} {$i<$nproc} {incr i 1} {
set node [lindex $nodelist $i]
while { ![catch { exec rsh -n $node netstat -n -A inet | grep $port } ]} {
puts "...waiting for port in $node"
after 1000
}
}
puts run
exec touch run
for {set i 0} {$i<$nproc-1} {incr i 1} {
set node [lindex $nodelist $i]
puts $node
# exec rsh -n $node "$path/netclustwacnmdadiff" tmp $tim $decr &
exec rsh -n $node /bin/nice -n3 "$path/netclustwacnmdadiff" tmp $tim $decr $port &
}
set node [lindex $nodelist $i]
puts $node
exec rsh -n $node /bin/nice -n3 "$path/netclustwacnmdadiff" tmp $tim $decr $port >@stdout
#exec rsh -n $node "$path/netclustwacnmdadiff" tmp $tim $decr >@stdout
exec touch end
puts "computation time: [expr [file mtime end]-[file mtime run]] sec"
for {set i 0} {$i<$nproc} {incr i 1} {
set node [lindex $nodelist $i]
while { ![catch { exec rsh -n $node stat $tmp/done } ]} {
puts "...waiting for $node"
after 5000
}
}
puts copyout
set f [open "nclust.log" w]
for {set i 0} {$i<$nproc} {incr i 1} {
set node [lindex $nodelist $i]
puts $node
exec rcp -r "$node:$path/" .
exec rsh -n $node cat netclust.log >>nclust.log
}
#foreach ext $filelist2 {
# exec rm -f "$path/tmp.$ext.$i"
# }
if {$hist >-1} {
puts "jhist tmp $inp"
exec ./jhist tmp $inp >>rnet.log
}
puts "mkhist histo_$inp tmp.node 1"
exec ./mkhist histo_$inp tmp.node 1 >>rnet.log
#if {$vout >-1} {
#exec ./jvout1 tmp $inp $proc >>rnet.log
#}
#exec ./linknet $inp tmp $proc >>rnet.log
puts clean
#eval exec rm -f [glob "./tmp.*.*"]
if {$hist>-1} {
# eval exec rm -f [ glob "./histo_tmp.*"]
}
#if {$vout>-1} {
# eval exec rm -f [glob "./V_tmp.out.*"]
#}
exec touch end
puts "total time: [expr [file mtime end]-[file mtime start]] sec"