public AMDGpuSet(INTMinerRoot root) { _root = root; this.Properties = new List <GpuSetProperty>(); if (Design.IsInDesignMode) { return; } adlHelper.Init(); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { _gpus.Add(i, new Gpu { Index = i, Name = adlHelper.GetGpuName(i) }); } Global.Access <Per5SecondEvent>( Guid.Parse("7C379223-D494-4213-9659-A086FFDE36DF"), "周期刷新显卡状态", LogEnum.None, action: message => { Task.Factory.StartNew(() => { LoadGpuState(); }); }); }
public AMDGpuSet(INTMinerRoot root) { _root = root; this.Properties = new List <GpuSetProperty>(); if (NTMinerRoot.IsInDesignMode) { return; } adlHelper.Init(); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { _gpus.Add(i, new Gpu { Index = i, Name = adlHelper.GetGpuName(i) }); } string driverVersion = adlHelper.GetDriverVersion(); this.Properties.Add(new GpuSetProperty("DriverVersion", "驱动版本", driverVersion)); Global.Access <Per5SecondEvent>(Guid.Parse("7C379223-D494-4213-9659-A086FFDE36DF"), "周期刷新显卡状态", LogEnum.None, action: message => { LoadGpuState(); }); }
public AMDGpuSet(INTMinerRoot root) : this() { #if DEBUG VirtualRoot.Stopwatch.Restart(); #endif _root = root; adlHelper.Init(); this.OverClock = new AMDOverClock(adlHelper); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { var atiGpu = adlHelper.GetGpuName(i); string name = atiGpu.AdapterName; // short gpu name if (!string.IsNullOrEmpty(name)) { name = name.Replace("Radeon (TM) RX ", string.Empty); name = name.Replace("Radeon RX ", string.Empty); } var gpu = Gpu.Create(i, atiGpu.BusNumber.ToString(), name); gpu.TotalMemory = adlHelper.GetTotalMemoryByIndex(i); _gpus.Add(i, gpu); } if (deviceCount > 0) { this.DriverVersion = adlHelper.GetDriverVersion(); this.Properties.Add(new GpuSetProperty(GpuSetProperty.DRIVER_VERSION, "驱动版本", DriverVersion)); const ulong minG = (ulong)5 * 1024 * 1024 * 1024; if (_gpus.Any(a => a.Key != NTMinerRoot.GpuAllId && a.Value.TotalMemory < minG)) { Dictionary <string, string> kvs = new Dictionary <string, string> { { "GPU_FORCE_64BIT_PTR", "0" }, { "GPU_MAX_ALLOC_PERCENT", "100" }, { "GPU_MAX_HEAP_SIZE", "100" }, { "GPU_SINGLE_ALLOC_PERCENT", "100" }, { "GPU_USE_SYNC_OBJECTS", "1" } }; foreach (var kv in kvs) { var property = new GpuSetProperty(kv.Key, kv.Key, kv.Value); this.Properties.Add(property); } Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerRoot.GpuAllId); foreach (var kv in kvs) { Environment.SetEnvironmentVariable(kv.Key, kv.Value); } }); } } #if DEBUG Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor"); #endif }
public AMDGpuSet(INTMinerRoot root) : this() { #if DEBUG VirtualRoot.Stopwatch.Restart(); #endif _root = root; if (Design.IsInDesignMode) { return; } adlHelper.Init(); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { string name = adlHelper.GetGpuName(i); // short gpu name if (!string.IsNullOrEmpty(name)) { name = name.Replace("Radeon (TM) RX ", string.Empty); name = name.Replace("Radeon RX ", string.Empty); } var gpu = Gpu.Create(i, name); gpu.TotalMemory = adlHelper.GetTotalMemory(i); _gpus.Add(i, gpu); } if (deviceCount > 0) { this.Properties.Add(new GpuSetProperty(GpuSetProperty.DRIVER_VERSION, "驱动版本", DriverVersion)); Dictionary <string, string> kvs = new Dictionary <string, string> { { "GPU_FORCE_64BIT_PTR", "0" }, { "GPU_MAX_ALLOC_PERCENT", "100" }, { "GPU_MAX_HEAP_SIZE", "100" }, { "GPU_SINGLE_ALLOC_PERCENT", "100" }, { "GPU_USE_SYNC_OBJECTS", "1" } }; foreach (var kv in kvs) { var property = new GpuSetProperty(kv.Key, kv.Key, kv.Value); this.Properties.Add(property); } Task.Factory.StartNew(() => { foreach (var kv in kvs) { Environment.SetEnvironmentVariable(kv.Key, kv.Value); } }); } #if DEBUG Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor"); #endif }
public AMDGpuSet(INTMinerRoot root) : this() { _root = root; if (Design.IsInDesignMode) { return; } adlHelper.Init(); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { _gpus.Add(i, new Gpu { Index = i, Name = adlHelper.GetGpuName(i), Temperature = 0, PowerUsage = 0, FanSpeed = 0, OverClock = new AMDOverClock() }); } if (deviceCount > 0) { this.Properties.Add(new GpuSetProperty("DriverVersion", "driver version", GetDriverVersion())); Dictionary <string, string> kvs = new Dictionary <string, string> { { "GPU_FORCE_64BIT_PTR", "0" }, { "GPU_MAX_ALLOC_PERCENT", "100" }, { "GPU_MAX_HEAP_SIZE", "100" }, { "GPU_SINGLE_ALLOC_PERCENT", "100" }, { "GPU_USE_SYNC_OBJECTS", "1" } }; foreach (var kv in kvs) { var property = new GpuSetProperty(kv.Key, kv.Key, kv.Value); this.Properties.Add(property); } Task.Factory.StartNew(() => { foreach (var kv in kvs) { Environment.SetEnvironmentVariable(kv.Key, kv.Value); } }); } }
public AMDGpuSet() { #if DEBUG NTStopwatch.Start(); #endif adlHelper.Init(); this.Properties = new List <GpuSetProperty>(); this.OverClock = new GpuOverClock(adlHelper); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { var atiGpu = adlHelper.GetGpuName(i); string name = atiGpu.AdapterName; // short gpu name if (!string.IsNullOrEmpty(name)) { name = name.Replace("Radeon (TM) RX ", string.Empty); name = name.Replace("Radeon RX ", string.Empty); } var gpu = Gpu.Create(i, atiGpu.BusNumber.ToString(), name); gpu.TotalMemory = adlHelper.GetTotalMemory(i); _gpus.Add(i, gpu); } if (deviceCount > 0) { this.DriverVersion = adlHelper.GetDriverVersion(); this.Properties.Add(new GpuSetProperty(GpuSetProperty.DRIVER_VERSION, "驱动版本", DriverVersion)); const ulong minG = (ulong)5 * 1024 * 1024 * 1024; bool has470 = _gpus.Any(a => a.Key != NTMinerRoot.GpuAllId && a.Value.TotalMemory < minG); if (has470) { Dictionary <string, string> kvs = new Dictionary <string, string> { { "GPU_MAX_ALLOC_PERCENT", "100" }, { "GPU_MAX_HEAP_SIZE", "100" }, { "GPU_SINGLE_ALLOC_PERCENT", "100" } }; foreach (var kv in kvs) { var property = new GpuSetProperty(kv.Key, kv.Key, kv.Value); this.Properties.Add(property); } Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerRoot.GpuAllId); foreach (var kv in kvs) { Environment.SetEnvironmentVariable(kv.Key, kv.Value); } }); } else { Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerRoot.GpuAllId); }); } } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }