INNER CODE UNIT · Go
isNvidiaModuleLoaded
NVIDIA/gpu-operator · cmd/nvidia-validator/main.go:924
func isNvidiaModuleLoaded() bool {
// Check if the nvidia module is loaded by checking if nvidiaModuleRefcntPath exists
if _, err := os.Stat(nvidiaModuleRefcntPath); err == nil {
refcntData, err := os.ReadFile(nvidiaModuleRefcntPath)
if err == nil {
refcnt := strings.TrimSpace(string(refcntData))
log.Infof("NVIDIA kernel module already loaded in kernel memory (refcnt=%s)", refcnt)
return true
}
}
return false
}
// createDevCharSymlinks creates symlinks in /host-dev-char that point to all possible NVIDIA devices nodes.
func createDevCharSymlinks(driverInfo driverInfo, disableDevCharSymlinkCreation bool) error {
if disableDevCharSymlinkCreation {
log.WithField("disableDevCharSymlinkCreation", true).
Info("skipping the creation of symlinks under /dev/char that correspond to NVIDIA character devices")