Skip to content

Commit 71207b0

Browse files
committed
Suggested added
1 parent 19630d6 commit 71207b0

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

cmd/gpu_fakedev/gpu_fakedev.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ const (
5959
devfsPath = "dev"
6060
mib = 1024.0 * 1024.0
6161
// null device major, minor on linux.
62-
devNullMajor = 1
63-
devNullMinor = 3
64-
devNullType = unix.S_IFCHR
62+
devNullMajor = 1
63+
devNullMinor = 3
64+
devNullType = unix.S_IFCHR
65+
// GPU connectivity
6566
maxK8sLabelSize = 63
6667
fullyConnected = "FULL"
6768
)
@@ -299,29 +300,20 @@ func generateDriFiles(opts genOptions) {
299300
func makeXelinkSideCar(topology string, gpus, tiles int, connections string) {
300301
if topology != fullyConnected {
301302
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d)", gpus, tiles)
303+
saveSideCarFile(connections)
302304
} else {
303305
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d, Topology: %s)", gpus, tiles, topology)
304-
}
305-
306-
if topology == fullyConnected {
307306
saveSideCarFile(buildConnectionList(gpus, tiles))
308-
} else {
309-
saveSideCarFile(connections)
310307
}
311308
}
312309

313310
func buildConnectionList(gpus, tiles int) string {
314-
mm := 0
315-
316311
var nodes = make([]string, 0)
317312

318-
for mm < gpus {
319-
nn := 0
320-
for nn < tiles {
313+
for mm := 0; mm < gpus; mm++ {
314+
for nn := 0; nn < tiles; nn++ {
321315
nodes = append(nodes, fmt.Sprintf("%d.%d", mm, nn))
322-
nn++
323316
}
324-
mm++
325317
}
326318

327319
var links = make(map[string]struct{}, 0)

0 commit comments

Comments
 (0)