-
Notifications
You must be signed in to change notification settings - Fork 98
/
run_cube.ps1
91 lines (77 loc) · 2.05 KB
/
run_cube.ps1
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
$HCPU = "x86_64"
$HABI = "WIN64"
$HOS = "Windows"
$dir = Get-Location
. "$dir\funcs.ps1"
$use_em = $FALSE;
$ncpu = 4;
$bcpu = 0;
$showhelp = $FALSE;
$front = $FALSE;
for ($count = 0 ; $count -lt $args.count ; $count ++ ){
$marg = $args[$count]
if ( $marg -eq '-e'){
$use_em = $TRUE;
}
elseif ( $marg -eq '-n'){
$ncpu = $args[$count+1];
$count ++;
}
elseif ( $marg -eq '-b'){
$bcpu = $args[$count+1];
$count ++;
}
elseif ( $marg -eq '-f'){
$front = $TRUE;
}
else {
$showhelp = $TRUE;
}
}
if ( $use_em -eq $TRUE ){
$HCPU = "vp64";
$HABI = "VP64";
$HOS = "Windows";
}
if ( $bcpu -eq 0 ){
. "$dir\stop.ps1"
}
if ( $ncpu -gt 4){
$ncpu = 4;
}
if ( $showhelp -eq $TRUE ){
Write-Output "[-n cnt] number of nodes";
Write-Output "[-b base] base offset";
Write-Output "[-e] emulator mode";
Write-Output "[-h] help";
}
else {
$num_cpu = $ncpu;
for ($cpu_z=$num_cpu-1; $cpu_z -ge 0; $cpu_z--){
for ($cpu_y=$num_cpu-1; $cpu_y -ge 0; $cpu_y--){
for ($cpu_x=$num_cpu-1; $cpu_x -ge 0; $cpu_x--){
$cpu=$(($cpu_z*$num_cpu*$num_cpu + $cpu_y*$num_cpu + $cpu_x))
$links=""
for ($lcpu_z=$cpu_z-1; $lcpu_z -le $cpu_z+1; $lcpu_z++){
$wp = wrap $lcpu_z $num_cpu
$c1 = $cpu
$c2 = $(($wp*$num_cpu*$num_cpu + $cpu_y*$num_cpu + $cpu_x))
$links += add_link $c1 $c2 $links
}
for ($lcpu_y=$cpu_y-1; $lcpu_y -le $cpu_y+1; $lcpu_y++){
$wp = wrap $lcpu_y $num_cpu
$c1 = $cpu
$c2 = $(($cpu_z*$num_cpu*$num_cpu + $wp*$num_cpu + $cpu_x))
$links += add_link $c1 $c2 $links
}
for ($lcpu_x=$cpu_x-1; $lcpu_x -le $cpu_x+1; $lcpu_x++){
$wp = wrap $lcpu_x $num_cpu
$c1 = $cpu
$c2 = $(($cpu_z*$num_cpu*$num_cpu + $cpu_y*$num_cpu + $wp))
$links += add_link $c1 $c2 $links
}
boot_cpu_gui $front $cpu "$links"
}
}
}
}