Skip to content

Commit

Permalink
Add OpenVINO GPU support (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
helena-intel authored Mar 31, 2024
1 parent 39ccbf3 commit 92cf80f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Everything else is optional or inferred at runtime, but can be configured to you
- [x] Intel Neural Compressor backend for CPU (`backend=neural-compressor`, `backend.device=cpu`)
- [x] TensorRT-LLM backend for CUDA (`backend=tensorrt-llm`, `backend.device=cuda`)
- [x] OpenVINO backend for CPU (`backend=openvino`, `backend.device=cpu`)
- [x] OpenVINO backend for GPU (`backend=openvino`, `backend.device=gpu`)

### Benchmarking 🏋️

Expand Down
4 changes: 2 additions & 2 deletions optimum_benchmark/backends/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __post_init__(self):
self.device_ids = self.device.split(":")[1]
LOGGER.warning(f"`device` and `device_ids` are now set to `{self.device}` and `{self.device_ids}`.")

if self.device not in ["cuda", "cpu", "mps", "xla"]:
raise ValueError(f"`device` must be either `cuda`, `cpu`, `mps` or `xla`, but got {self.device}")
if self.device not in ["cuda", "cpu", "mps", "xla", "gpu"]:
raise ValueError(f"`device` must be either `cuda`, `cpu`, `mps`, `xla` or `gpu`, but got {self.device}")

if self.device == "cuda":
if self.device_ids is None:
Expand Down
1 change: 1 addition & 0 deletions optimum_benchmark/backends/openvino/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def load_ovmodel_from_pretrained(self) -> None:
self.config.model,
export=self.config.export,
ov_config=self.config.openvino_config,
device=self.config.device,
**self.config.hub_kwargs,
**self.ovmodel_kwargs,
)
Expand Down
3 changes: 2 additions & 1 deletion optimum_benchmark/backends/openvino/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class OVConfig(BackendConfig):
def __post_init__(self):
super().__post_init__()

if self.device != "cpu":
self.device = self.device.lower()
if self.device not in ["cpu", "gpu"]:
raise ValueError(f"OVBackend only supports CPU devices, got {self.device}")

if self.intra_op_num_threads is not None:
Expand Down
2 changes: 2 additions & 0 deletions optimum_benchmark/trackers/latency.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def __init__(self, device: str, backend: str):

if self.backend == "pytorch" and self.device == "cuda":
LOGGER.info("\t+ Tracking Pytorch CUDA latency")
elif self.backend == "openvino":
LOGGER.info(f"\t+ Tracking OpenVINO {self.device.upper()} latency")
else:
LOGGER.info("\t+ Tracking CPU latency")

Expand Down

0 comments on commit 92cf80f

Please sign in to comment.