neural_compressor.torch.utils.auto_accelerator
Auto Accelerator Module.
Classes
Accelerator Registry. |
|
Auto Accelerator Base class. |
|
CPU Accelerator. |
|
CUDA Accelerator. |
|
XPU Accelerator. |
|
HPU Accelerator. |
Functions
|
Register new accelerator. |
|
Automatically detects and selects the appropriate accelerator. |
Module Contents
- class neural_compressor.torch.utils.auto_accelerator.AcceleratorRegistry[source]
Accelerator Registry.
- neural_compressor.torch.utils.auto_accelerator.register_accelerator(name: str, priority: float = 0) Callable[Ellipsis, Any] [source]
Register new accelerator.
- Usage example:
@register_accelerator(name=”cuda”, priority=100) class CUDA_Accelerator:
…
- Parameters:
name – the accelerator name.
priority – the priority of the accelerator. A larger number indicates a higher priority,
- class neural_compressor.torch.utils.auto_accelerator.Auto_Accelerator[source]
Auto Accelerator Base class.
- neural_compressor.torch.utils.auto_accelerator.auto_detect_accelerator(device_name='auto') Auto_Accelerator [source]
Automatically detects and selects the appropriate accelerator.
Force use the cpu on node has both cpu and gpu: INC_TARGET_DEVICE=cpu python main.py … The INC_TARGET_DEVICE is case insensitive. The environment variable INC_TARGET_DEVICE has higher priority than the device_name. TODO: refine the docs and logic later