public static void AfterDeviceQueryInitialization() { // extra check (probably will never happen but just in case) { var invalidDevices = new List <ComputeDevice>(); foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { if (cDev.IsAlgorithmSettingsInitialized() == false) { Helpers.ConsolePrint(Tag, "CRITICAL ISSUE!!! Device has AlgorithmSettings == null. Will remove"); invalidDevices.Add(cDev); } } // remove invalids foreach (var invalid in invalidDevices) { ComputeDeviceManager.Avaliable.AllAvaliableDevices.Remove(invalid); } } // set enabled/disabled devs foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { foreach (var devConf in GeneralConfig.LastDevicesSettup) { cDev.SetFromComputeDeviceConfig(devConf); } } // create/init device benchmark configs files and configs foreach (var cDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) { var keyUuid = cDev.Uuid; BenchmarkConfigFiles[keyUuid] = new DeviceBenchmarkConfigFile(keyUuid); // init { DeviceBenchmarkConfig currentConfig = null; if (BenchmarkConfigFiles[keyUuid].IsFileExists()) { currentConfig = BenchmarkConfigFiles[keyUuid].ReadFile(); } // config exists and file load success set from file if (currentConfig != null) { cDev.SetAlgorithmDeviceConfig(currentConfig); // if new version create backup if (_isNewVersion) { BenchmarkConfigFiles[keyUuid].CreateBackup(); } } else { // no config file or not loaded, create new BenchmarkConfigFiles[keyUuid].Commit(cDev.GetAlgorithmDeviceConfig()); } } } // save settings GeneralConfigFileCommit(); }
private DeviceBenchmarkConfig GetConfig(string deviceUUID) { DeviceBenchmarkConfig retConfig = null; if (_benchmarkConfigs.TryGetValue(deviceUUID, out retConfig) == false) { retConfig = null; } return(retConfig); }
public DeviceBenchmarkConfig GetConfig(DeviceGroupType deviceGroupType, string deviceUUID, string deviceName) { DeviceBenchmarkConfig retConfig = GetConfig(deviceUUID); if (retConfig == null) { retConfig = new DeviceBenchmarkConfig(deviceGroupType, deviceUUID, deviceName); _benchmarkConfigs.Add(deviceUUID, retConfig); } return(retConfig); }
public static void AfterDeviceQueryInitialization() { // extra check (probably will never happen but just in case) AvailableDevices.RemoveInvalidDevs(); // set enabled/disabled devs foreach (var cDev in AvailableDevices.Devices) { foreach (var devConf in GeneralConfig.LastDevicesSettup) { cDev.SetFromComputeDeviceConfig(devConf); } } // create/init device benchmark configs files and configs foreach (var cDev in AvailableDevices.Devices) { var keyUuid = cDev.Uuid; BenchmarkConfigFiles[keyUuid] = new DeviceBenchmarkConfigFile(keyUuid); // init { DeviceBenchmarkConfig currentConfig = null; if (BenchmarkConfigFiles[keyUuid].IsFileExists()) { currentConfig = BenchmarkConfigFiles[keyUuid].ReadFile(); } // config exists and file load success set from file if (currentConfig != null) { cDev.SetAlgorithmDeviceConfig(currentConfig); // if new version create backup if (_isNewVersion) { BenchmarkConfigFiles[keyUuid].CreateBackup(); } } else { // no config file or not loaded, create new BenchmarkConfigFiles[keyUuid].Commit(cDev.GetAlgorithmDeviceConfig()); } } } // save settings GeneralConfigFileCommit(); }