From f11cf4b29a3451716edb49c7787a35803478b0e2 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sat, 30 Sep 2023 12:48:21 +0300 Subject: [PATCH] OpenVINO add Multi GPU option --- modules/intel/openvino/__init__.py | 9 +++++++++ modules/shared.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/modules/intel/openvino/__init__.py b/modules/intel/openvino/__init__.py index 0f2cf44b1..0f2cfa863 100644 --- a/modules/intel/openvino/__init__.py +++ b/modules/intel/openvino/__init__.py @@ -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: diff --git a/modules/shared.py b/modules/shared.py index c8a8b8cda..3606bc6d8 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -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("

Model Compile

", "", gr.HTML),