// GPU AMD public ComputeDevice(AmdGpuDevice amdDevice, int GPUCount) { _amdDevice = amdDevice; ID = amdDevice.DeviceID; DeviceGroupType = DeviceGroupType.AMD_OpenCL; Group = GroupNames.GetName(DeviceGroupType.AMD_OpenCL); DeviceGroupString = GroupNames.GetNameGeneral(DeviceGroupType); Name = amdDevice.DeviceName; _nameNoNums = amdDevice.DeviceName; Enabled = true; IsEtherumCapale = amdDevice.IsEtherumCapable(); DeviceType = DeviceType.AMD; NameCount = String.Format(International.GetText("ComputeDevice_Short_Name_AMD_GPU"), GPUCount); UUID = amdDevice.UUID; // sgminer extra IsOptimizedVersion = amdDevice.UseOptimizedVersion; Codename = amdDevice.Codename; }
private void QueryCudaDevices() { Process CudaDevicesDetection = new Process(); CudaDevicesDetection.StartInfo.FileName = "CudaDeviceDetection.exe"; CudaDevicesDetection.StartInfo.UseShellExecute = false; CudaDevicesDetection.StartInfo.RedirectStandardError = true; CudaDevicesDetection.StartInfo.RedirectStandardOutput = true; CudaDevicesDetection.StartInfo.CreateNoWindow = true; CudaDevicesDetection.OutputDataReceived += QueryCudaDevicesOutputErrorDataReceived; CudaDevicesDetection.ErrorDataReceived += QueryCudaDevicesOutputErrorDataReceived; const int waitTime = 5 * 1000; // 5seconds try { if (!CudaDevicesDetection.Start()) { Helpers.ConsolePrint(TAG, "CudaDevicesDetection process could not start"); } else { CudaDevicesDetection.BeginErrorReadLine(); CudaDevicesDetection.BeginOutputReadLine(); if (CudaDevicesDetection.WaitForExit(waitTime)) { CudaDevicesDetection.Close(); } } } catch (Exception ex) { // TODO Helpers.ConsolePrint(TAG, "CudaDevicesDetection threw Exception: " + ex.Message); } finally { if (QueryCudaDevicesString != "") { try { CudaDevices = JsonConvert.DeserializeObject <List <CudaDevice> >(QueryCudaDevicesString, Globals.JsonSettings); } catch { } } } if (CudaDevices != null && CudaDevices.Count != 0) { HasNVIDIA = true; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(""); stringBuilder.AppendLine("CudaDevicesDetection:"); foreach (var cudaDev in CudaDevices) { // check sm vesrions bool isUnderSM21; { bool isUnderSM2_major = cudaDev.SM_major < 2; bool isUnderSM1_minor = cudaDev.SM_minor < 1; isUnderSM21 = isUnderSM2_major && isUnderSM1_minor; } //bool isOverSM6 = cudaDev.SM_major > 6; bool isDisabledGroup = IsSMGroupSkip(cudaDev.SM_major); bool skip = isUnderSM21 || isDisabledGroup; string skipOrAdd = skip ? "SKIPED" : "ADDED"; string isDisabledGroupStr = isDisabledGroup ? " (SM group disabled)" : ""; string etherumCapableStr = cudaDev.IsEtherumCapable() ? "YES" : "NO"; stringBuilder.AppendLine(String.Format("\t{0} device{1}:", skipOrAdd, isDisabledGroupStr)); stringBuilder.AppendLine(String.Format("\t\tID: {0}", cudaDev.DeviceID.ToString())); stringBuilder.AppendLine(String.Format("\t\tNAME: {0}", cudaDev.GetName())); stringBuilder.AppendLine(String.Format("\t\tVENDOR: {0}", cudaDev.VendorName)); stringBuilder.AppendLine(String.Format("\t\tUUID: {0}", cudaDev.UUID)); stringBuilder.AppendLine(String.Format("\t\tSM: {0}", cudaDev.SMVersionString)); stringBuilder.AppendLine(String.Format("\t\tMEMORY: {0}", cudaDev.DeviceGlobalMemory.ToString())); stringBuilder.AppendLine(String.Format("\t\tETHEREUM: {0}", etherumCapableStr)); if (!skip) { string group; switch (cudaDev.SM_major) { case 2: group = GroupNames.GetName(DeviceGroupType.NVIDIA_2_1); break; case 3: group = GroupNames.GetName(DeviceGroupType.NVIDIA_3_x); break; case 5: group = GroupNames.GetName(DeviceGroupType.NVIDIA_5_x); break; case 6: group = GroupNames.GetName(DeviceGroupType.NVIDIA_6_x); break; default: group = GroupNames.GetName(DeviceGroupType.NVIDIA_6_x); break; } new ComputeDevice(cudaDev, group, true); } } Helpers.ConsolePrint(TAG, stringBuilder.ToString()); } else { Helpers.ConsolePrint(TAG, "CudaDevicesDetection found no devices. CudaDevicesDetection returned: " + QueryCudaDevicesString); } }