1 Star 0 Fork 0

小应子/k8s-device-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
Renaud Gaubert 提交于 2018-05-09 16:45 . Update to new device plugin API
// Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
package main
import (
"log"
"syscall"
"github.com/NVIDIA/nvidia-docker/src/nvml"
)
func main() {
log.Println("Loading NVML")
if err := nvml.Init(); err != nil {
log.Printf("Failed to start nvml with error: %s.", err)
log.Printf("If this is a GPU node, did you set the docker default runtime to `nvidia`?")
log.Printf("You can check the prerequisites at: https://github.com/NVIDIA/k8s-device-plugin#prerequisites")
log.Printf("You can learn how to set the runtime at: https://github.com/NVIDIA/k8s-device-plugin#quick-start")
select {}
}
defer func() { log.Println("Shutdown of NVML returned:", nvml.Shutdown()) }()
log.Println("Fetching devices.")
if len(getDevices()) == 0 {
log.Println("No devices found. Waiting indefinitely.")
select {}
}
log.Println("Starting OS watcher.")
sigs := newOSWatcher(syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
var devicePlugin *NvidiaDevicePlugin
devicePlugin = NewNvidiaDevicePlugin()
if err := devicePlugin.Start(); err != nil {
log.Println("Failed to start Device Plugin with error %+v.", err)
select {}
}
// TODO kill if socket gets removed
s := <-sigs
log.Printf("Received signal \"%v\", shutting down.", s)
devicePlugin.Stop()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wukaiying01/k8s-device-plugin.git
git@gitee.com:wukaiying01/k8s-device-plugin.git
wukaiying01
k8s-device-plugin
k8s-device-plugin
nvidiak8s/v1.9

搜索帮助