private string GetDevicesArgs(IKernelInput kernelInput) { string devicesArgs = string.Empty; if (!string.IsNullOrWhiteSpace(kernelInput.DevicesArg)) { int[] useDevices = this.GpuSet.GetUseDevices(); if ((useDevices.Length != 0 && useDevices.Length != GpuSet.Count) || kernelInput.IsDeviceAllNotEqualsNone) { string separator = kernelInput.DevicesSeparator; // 因为空格在界面上不易被人读取所以以关键字代替空格 if (kernelInput.DevicesSeparator == VirtualRoot.SpaceKeyword) { separator = " "; } List <string> gpuIndexes = new List <string>(); foreach (var index in useDevices) { int i = index; if (kernelInput.DeviceBaseIndex != 0) { i = index + kernelInput.DeviceBaseIndex; } string nText = VirtualRoot.GetIndexChar(i, separator); gpuIndexes.Add(nText); } switch (GpuSet.GpuType) { case GpuType.Empty: break; case GpuType.NVIDIA: devicesArgs = $"{kernelInput.DevicesArg} {string.Join(separator, gpuIndexes.Select(a => $"{kernelInput.NDevicePrefix}{a}{kernelInput.NDevicePostfix}"))}"; break; case GpuType.AMD: devicesArgs = $"{kernelInput.DevicesArg} {string.Join(separator, gpuIndexes.Select(a => $"{kernelInput.ADevicePrefix}{a}{kernelInput.ADevicePostfix}"))}"; break; default: break; } } } return(devicesArgs); }