r"""Sets default computing node. Args: device: default device type. Note: * The type can be 'cpu0', 'cpu1', etc., or 'gpu0', 'gpu1', etc., to specify the particular CPU or GPU to use. * 'cpux' and 'gpux' can also be used to specify any number of CPU or GP
(device: str = "xpux")
| 124 | |
| 125 | |
| 126 | def set_default_device(device: str = "xpux"): |
| 127 | r"""Sets default computing node. |
| 128 | |
| 129 | Args: |
| 130 | device: default device type. |
| 131 | |
| 132 | Note: |
| 133 | * The type can be 'cpu0', 'cpu1', etc., or 'gpu0', 'gpu1', etc., |
| 134 | to specify the particular CPU or GPU to use. |
| 135 | * 'cpux' and 'gpux' can also be used to specify any number of CPU or GPU devices. |
| 136 | * The default value is 'xpux' to specify any device available. |
| 137 | * The priority of using GPU is higher when both GPU and CPU are available. |
| 138 | * 'multithread' device type is avaliable when inference, |
| 139 | which implements multi-threading parallelism at the operator level. |
| 140 | For example, 'multithread4' will compute with 4 threads. |
| 141 | * It can also be set by environment variable ``MGE_DEFAULT_DEVICE``. |
| 142 | """ |
| 143 | assert _valid_device(device), "Invalid device name {}".format(device) |
| 144 | CompNode._set_default_device(device) |
| 145 | |
| 146 | |
| 147 | def get_default_device() -> str: |
no test coverage detected