agent/gpu/nvidia_gpu_manager_unix.go
func (n *NvidiaGPUManager) Initialize() error {
	if GPUInfoFileExists() {
		// GPU info file found
		gpuJSON, err := GetGPUInfoJSON()
		if err != nil {
			return errors.Wrapf(err, "could not read GPU file content")
		}
		var nvidiaGPUInfo NvidiaGPUManager
		err = json.Unmarshal(gpuJSON, &nvidiaGPUInfo)
		if err != nil {
			return errors.Wrapf(err, "could not unmarshal GPU file content")
		}
		n.SetDriverVersion(nvidiaGPUInfo.GetDriverVersion())
		nvidiaGPUInfo.lock.RLock()
		gpuIDs := nvidiaGPUInfo.GetGPUIDsUnsafe()
		nvidiaGPUInfo.lock.RUnlock()
		n.SetGPUIDs(gpuIDs)
		n.SetDevices()
	} else {
		seelog.Error("Config for GPU support is enabled, but GPU information is not found; continuing without it")
	}
	return nil
}
func (n *NvidiaGPUManager) Initialize() error {
	if GPUInfoFileExists() {
		// GPU info file found
		gpuJSON, err := GetGPUInfoJSON()
		if err != nil {
			return errors.Wrapf(err, "could not read GPU file content")
		}
		var nvidiaGPUInfo NvidiaGPUManager
		err = json.Unmarshal(gpuJSON, &nvidiaGPUInfo)
		if err != nil {
			return errors.Wrapf(err, "could not unmarshal GPU file content")
		}
		n.SetDriverVersion(nvidiaGPUInfo.GetDriverVersion())
		nvidiaGPUInfo.lock.RLock()
		gpuIDs := nvidiaGPUInfo.GetGPUIDsUnsafe()
		nvidiaGPUInfo.lock.RUnlock()
		n.SetGPUIDs(gpuIDs)
		n.SetDevices()
	} else {
		seelog.Error("Config for GPU support is enabled, but GPU information is not found; continuing without it")
	}
	return nil
}
func ( n * NvidiaGPUManager ) Initialize ( ) error { if GPUInfoFileExists ( ) { // GPU info file found gpuJSON , err := GetGPUInfoJSON ( ) if err != nil { return errors . Wrapf ( err , " " ) } var nvidiaGPUInfo NvidiaGPUManager err = json . Unmarshal ( gpuJSON , & nvidiaGPUInfo ) if err != nil { return errors . Wrapf ( err , " " ) } n . SetDriverVersion ( nvidiaGPUInfo . GetDriverVersion ( ) ) nvidiaGPUInfo . lock . RLock ( ) gpuIDs := nvidiaGPUInfo . GetGPUIDsUnsafe ( ) nvidiaGPUInfo . lock . RUnlock ( ) n . SetGPUIDs ( gpuIDs ) n . SetDevices ( ) } else { seelog . Error ( " " ) } return nil }
// Initialize sets the fields of Nvidia GPU Manager struct
Initialize sets the fields of Nvidia GPU Manager struct