Skip to content

Commit

Permalink
Merge pull request #64 from archlitchi/master
Browse files Browse the repository at this point in the history
Update vgpu part
  • Loading branch information
volcano-sh-bot committed Apr 12, 2024
2 parents 15b3915 + 221f9ed commit 6a108e0
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
tags:
- v[0-9]+.[0-9]+.[0-9]+
branches: [master]
pull_request:
pull_request_target:
branches: [master]

jobs:
Expand Down
1 change: 0 additions & 1 deletion docker/amd64/Dockerfile.vgpu-ubuntu20.04
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ ENV NVIDIA_DRIVER_CAPABILITIES=utility

COPY --from=build /go/src/volcano.sh/devices/volcano-vgpu-device-plugin /usr/bin/volcano-vgpu-device-plugin
RUN mkdir -p /k8s-vgpu/lib/nvidia
COPY --from=build /go/src/volcano.sh/devices/lib/* /k8s-vgpu/lib/nvidia/

ENTRYPOINT ["volcano-vgpu-device-plugin"]
1 change: 0 additions & 1 deletion lib/ld.so.preload

This file was deleted.

Binary file removed lib/libvgpu.so
Binary file not shown.
26 changes: 1 addition & 25 deletions pkg/plugin/vgpu/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"strings"
"time"

"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/klog/v2"
"volcano.sh/k8s-device-plugin/pkg/lock"
"volcano.sh/k8s-device-plugin/pkg/plugin/vgpu/config"
Expand Down Expand Up @@ -310,7 +309,7 @@ func (m *NvidiaDevicePlugin) Allocate(ctx context.Context, reqs *pluginapi.Alloc
}

for idx := range reqs.ContainerRequests {
currentCtr, devreq, err := util.GetNextDeviceRequest(util.NvidiaGPUDevice, *current)
_, devreq, err := util.GetNextDeviceRequest(util.NvidiaGPUDevice, *current)
klog.Infoln("deviceAllocateFromAnnotation=", devreq)
if err != nil {
klog.Errorln("get device from annotation failed", err.Error())
Expand Down Expand Up @@ -342,29 +341,6 @@ func (m *NvidiaDevicePlugin) Allocate(ctx context.Context, reqs *pluginapi.Alloc
response.Envs["NVIDIA_VISIBLE_DEVICES"] = dev.UUID
}
}
response.Envs["CUDA_DEVICE_MEMORY_SHARED_CACHE"] = fmt.Sprintf("/tmp/vgpu/%v.cache", uuid.NewUUID())

cacheFileHostDirectory := "/tmp/vgpu/containers/" + string(current.UID) + "_" + currentCtr.Name
os.MkdirAll(cacheFileHostDirectory, 0777)
os.Chmod(cacheFileHostDirectory, 0777)
os.MkdirAll("/tmp/vgpulock", 0777)
os.Chmod("/tmp/vgpulock", 0777)
hostHookPath := os.Getenv("HOOK_PATH")
response.Mounts = append(response.Mounts,
&pluginapi.Mount{ContainerPath: "/usr/local/vgpu/libvgpu.so",
HostPath: hostHookPath + "/libvgpu.so",
ReadOnly: true},
&pluginapi.Mount{ContainerPath: "/etc/ld.so.preload",
HostPath: hostHookPath + "/ld.so.preload",
ReadOnly: true},
&pluginapi.Mount{ContainerPath: "/tmp/vgpu",
HostPath: cacheFileHostDirectory,
ReadOnly: false},
&pluginapi.Mount{ContainerPath: "/tmp/vgpulock",
HostPath: "/tmp/vgpulock",
ReadOnly: false},
)
responses.ContainerResponses = append(responses.ContainerResponses, &response)
}
klog.Infoln("Allocate Response", responses.ContainerResponses)
util.PodAllocationTrySuccess(nodename, current)
Expand Down

0 comments on commit 6a108e0

Please sign in to comment.