Skip to content

Commit 92282a0

Browse files
committed
Suggested changes applied
1 parent 8769a0f commit 92282a0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cmd/gpu_fakedev/gpu_fakedev.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ func generateDriFiles(opts genOptions) {
274274
log.Printf("Generating fake DRI device(s) sysfs, debugfs and devfs content under '%s' & '%s'",
275275
sysfsPath, devfsPath)
276276

277-
makeXelinkSideCar(opts.Capabilities["connection-topology"], opts.DevCount, opts.TilesPerDev, opts.Capabilities["connections"])
278-
279277
opts.dirs, opts.files = 0, 0
280278
for i := 0; i < opts.DevCount; i++ {
281279
if err := addSysfsDriTree(sysfsPath, &opts, i); err != nil {
@@ -295,16 +293,22 @@ func generateDriFiles(opts genOptions) {
295293
}
296294
}
297295
log.Printf("Done, created %d dirs, %d devices and %d files.", opts.dirs, opts.devs, opts.files)
296+
297+
makeXelinkSideCar(opts)
298298
}
299299

300-
func makeXelinkSideCar(topology string, gpus, tiles int, connections string) {
300+
func makeXelinkSideCar(opts genOptions) {
301+
topology := opts.Capabilities["connection-topology"]
302+
gpus := opts.DevCount
303+
tiles := opts.TilesPerDev
304+
connections := opts.Capabilities["connections"]
305+
301306
if topology != fullyConnected {
302-
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d)", gpus, tiles)
303307
saveSideCarFile(connections)
304308
} else {
305-
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d, Topology: %s)", gpus, tiles, topology)
306309
saveSideCarFile(buildConnectionList(gpus, tiles))
307310
}
311+
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d, Topology: %s)", gpus, tiles, topology)
308312
}
309313

310314
func buildConnectionList(gpus, tiles int) string {
@@ -338,7 +342,7 @@ func buildConnectionList(gpus, tiles int) string {
338342
}
339343
}
340344

341-
return fmt.Sprintf("%s", strings.Join(smap, "_"))
345+
return strings.Join(smap, "_")
342346
}
343347

344348
func saveSideCarFile(connections string) {

0 commit comments

Comments
 (0)