MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / isNvidiaModuleLoaded

Function isNvidiaModuleLoaded

cmd/nvidia-validator/main.go:929–940  ·  view source on GitHub ↗

isNvidiaModuleLoaded checks if NVIDIA kernel module is already loaded in kernel memory.

()

Source from the content-addressed store, hash-verified

927
928// isNvidiaModuleLoaded checks if NVIDIA kernel module is already loaded in kernel memory.
929func isNvidiaModuleLoaded() bool {
930 // Check if the nvidia module is loaded by checking if nvidiaModuleRefcntPath exists
931 if _, err := os.Stat(nvidiaModuleRefcntPath); err == nil {
932 refcntData, err := os.ReadFile(nvidiaModuleRefcntPath)
933 if err == nil {
934 refcnt := strings.TrimSpace(string(refcntData))
935 log.Infof("NVIDIA kernel module already loaded in kernel memory (refcnt=%s)", refcnt)
936 return true
937 }
938 }
939 return false
940}
941
942// createDevCharSymlinks creates symlinks in /host-dev-char that point to all possible NVIDIA devices nodes.
943func createDevCharSymlinks(driverInfo driverInfo, disableDevCharSymlinkCreation bool) error {

Callers 1

createDevCharSymlinksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected