OpenVINO add Multi GPU option

This commit is contained in:
Disty0
2023-09-30 12:48:21 +03:00
parent 62977137d6
commit f11cf4b29a
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -70,6 +70,15 @@ def get_device():
core = Core()
if os.getenv("OPENVINO_TORCH_BACKEND_DEVICE") is not None:
device = os.getenv("OPENVINO_TORCH_BACKEND_DEVICE")
elif shared.opts.openvino_multi_gpu:
device = ""
available_devices = core.available_devices
available_devices.remove("CPU")
if shared.opts.openvino_remove_igpu_from_multi and "GPU.0" in available_devices:
available_devices.remove("GPU.0")
for gpu in available_devices:
device = f"{device},{gpu}"
device = f"MULTI:{device[1:]}"
elif any(openvino_cpu in cpu_module.lower() for cpu_module in shared.cmd_opts.use_cpu for openvino_cpu in ["openvino", "all"]):
device = "CPU"
elif shared.cmd_opts.device_id is not None:
+2
View File
@@ -426,6 +426,8 @@ options_templates.update(options_section(('cuda', "Compute Settings"), {
"opt_channelslast": OptionInfo(False, "Use channels last as torch memory format "),
"cudnn_benchmark": OptionInfo(False, "Enable full-depth cuDNN benchmark feature"),
"ipex_optimize": OptionInfo(True if devices.backend == "ipex" else False, "Enable IPEX Optimize for Intel GPUs"),
"openvino_multi_gpu": OptionInfo(False, "OpenVINO use Multi GPU"),
"openvino_remove_igpu_from_multi": OptionInfo(False, "OpenVINO remove iGPU from Multi GPU"),
"directml_memory_provider": OptionInfo(default_memory_provider, 'DirectML memory stats provider', gr.Radio, lambda: {"choices": memory_providers}),
"torch_gc_threshold": OptionInfo(90, "VRAM usage threshold before running Torch GC to clear up VRAM", gr.Slider, {"minimum": 0, "maximum": 100, "step": 1}),
"cuda_compile_sep": OptionInfo("<h2>Model Compile</h2>", "", gr.HTML),