Skip to content

Commit

Permalink
Suggested added
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyrja committed Oct 30, 2023
1 parent 19630d6 commit 71207b0
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions cmd/gpu_fakedev/gpu_fakedev.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const (
devfsPath = "dev"
mib = 1024.0 * 1024.0
// null device major, minor on linux.
devNullMajor = 1
devNullMinor = 3
devNullType = unix.S_IFCHR
devNullMajor = 1
devNullMinor = 3
devNullType = unix.S_IFCHR
// GPU connectivity
maxK8sLabelSize = 63
fullyConnected = "FULL"
)
Expand Down Expand Up @@ -299,29 +300,20 @@ func generateDriFiles(opts genOptions) {
func makeXelinkSideCar(topology string, gpus, tiles int, connections string) {
if topology != fullyConnected {
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d)", gpus, tiles)
saveSideCarFile(connections)
} else {
log.Printf("XELINK: generate xelink sidecar label file, using (GPUs: %d, Tiles: %d, Topology: %s)", gpus, tiles, topology)
}

if topology == fullyConnected {
saveSideCarFile(buildConnectionList(gpus, tiles))
} else {
saveSideCarFile(connections)
}
}

func buildConnectionList(gpus, tiles int) string {
mm := 0

var nodes = make([]string, 0)

for mm < gpus {
nn := 0
for nn < tiles {
for mm := 0; mm < gpus; mm++ {
for nn := 0; nn < tiles; nn++ {
nodes = append(nodes, fmt.Sprintf("%d.%d", mm, nn))
nn++
}
mm++
}

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

0 comments on commit 71207b0

Please sign in to comment.