コード例 #1
0
 public static void AfterDeviceQueryInitialization()
 {
     // extra check (probably will never happen but just in case)
     {
         List<ComputeDevice> invalidDevices = new List<ComputeDevice>();
         foreach (var CDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) {
             if (CDev.AlgorithmSettings == null) {
                 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) {
         string 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();
 }
コード例 #2
0
 public static void CommitBenchmarks()
 {
     foreach (var CDev in ComputeDeviceManager.Avaliable.AllAvaliableDevices) {
         string devUUID = CDev.UUID;
         if (BenchmarkConfigFiles.ContainsKey(devUUID)) {
             BenchmarkConfigFiles[devUUID].Commit(CDev.GetAlgorithmDeviceConfig());
         } else {
             BenchmarkConfigFiles[devUUID] = new DeviceBenchmarkConfigFile(devUUID);
             BenchmarkConfigFiles[devUUID].Commit(CDev.GetAlgorithmDeviceConfig());
         }
     }
 }