Skip to content

Commit

Permalink
Rename and copy cmds / helm charts to split GPU and IMEX drivers
Browse files Browse the repository at this point in the history
For now they are 100% clones of each other, but subsequent commits will
fine tune them to either the GPU driver or the IMEX driver.

Signed-off-by: Kevin Klues <[email protected]>
  • Loading branch information
klueska committed Jan 18, 2025
1 parent 228b913 commit 3d9ce1c
Show file tree
Hide file tree
Showing 75 changed files with 4,078 additions and 21 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ This should show two pods running in the `nvidia` namespace:
kubectl get pods -n nvidia
```
```
NAME READY STATUS RESTARTS AGE
nvidia-dra-driver-k8s-dra-driver-controller-844fcb94b-ktbkc 1/1 Running 0 69s
nvidia-dra-driver-k8s-dra-driver-kubelet-plugin-5vfp9 1/1 Running 0 69s
NAME READY STATUS RESTARTS AGE
nvidia-dra-driver-k8s-dra-driver-gpu-kubelet-plugin-5vfp9 1/1 Running 0 69s
```

### Run the examples by following the steps in the demo script
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ func newApp() *cli.App {
cliFlags = append(cliFlags, flags.loggingConfig.Flags()...)

app := &cli.App{
Name: "nvidia-dra-plugin",
Usage: "nvidia-dra-plugin implements a DRA driver plugin for NVIDIA GPUs.",
Name: "nvidia-dra-gpu-plugin",
Usage: "nvidia-dra-gpu-plugin implements a DRA driver plugin for NVIDIA GPUs.",
ArgsUsage: " ",
HideHelpCommand: true,
Flags: cliFlags,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func newApp() *cli.App {
cliFlags = append(cliFlags, flags.loggingConfig.Flags()...)

app := &cli.App{
Name: "nvidia-dra-controller",
Usage: "nvidia-dra-controller implements a DRA driver controller for NVIDIA GPUs.",
Name: "nvidia-dra-imex-controller",
Usage: "nvidia-dra-imex-controller implements a DRA driver controller for NVIDIA IMEX domains.",
ArgsUsage: " ",
HideHelpCommand: true,
Flags: cliFlags,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
108 changes: 108 additions & 0 deletions cmd/nvidia-dra-imex-plugin/allocatable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package main

import (
"slices"

resourceapi "k8s.io/api/resource/v1beta1"
)

type AllocatableDevices map[string]*AllocatableDevice

type AllocatableDevice struct {
Gpu *GpuInfo
Mig *MigDeviceInfo
ImexChannel *ImexChannelInfo
}

func (d AllocatableDevice) Type() string {
if d.Gpu != nil {
return GpuDeviceType
}
if d.Mig != nil {
return MigDeviceType
}
if d.ImexChannel != nil {
return ImexChannelType
}
return UnknownDeviceType
}

func (d *AllocatableDevice) CanonicalName() string {
switch d.Type() {
case GpuDeviceType:
return d.Gpu.CanonicalName()
case MigDeviceType:
return d.Mig.CanonicalName()
case ImexChannelType:
return d.ImexChannel.CanonicalName()
}
panic("unexpected type for AllocatableDevice")
}

func (d *AllocatableDevice) CanonicalIndex() string {
switch d.Type() {
case GpuDeviceType:
return d.Gpu.CanonicalIndex()
case MigDeviceType:
return d.Mig.CanonicalIndex()
case ImexChannelType:
return d.ImexChannel.CanonicalIndex()
}
panic("unexpected type for AllocatableDevice")
}

func (d *AllocatableDevice) GetDevice() resourceapi.Device {
switch d.Type() {
case GpuDeviceType:
return d.Gpu.GetDevice()
case MigDeviceType:
return d.Mig.GetDevice()
case ImexChannelType:
return d.ImexChannel.GetDevice()
}
panic("unexpected type for AllocatableDevice")
}

func (d AllocatableDevices) GpuUUIDs() []string {
var uuids []string
for _, device := range d {
if device.Type() == GpuDeviceType {
uuids = append(uuids, device.Gpu.UUID)
}
}
slices.Sort(uuids)
return uuids
}

func (d AllocatableDevices) MigDeviceUUIDs() []string {
var uuids []string
for _, device := range d {
if device.Type() == MigDeviceType {
uuids = append(uuids, device.Mig.UUID)
}
}
slices.Sort(uuids)
return uuids
}

func (d AllocatableDevices) UUIDs() []string {
uuids := append(d.GpuUUIDs(), d.MigDeviceUUIDs()...)
slices.Sort(uuids)
return uuids
}
Loading

0 comments on commit 3d9ce1c

Please sign in to comment.