megengine.set_default_device¶
- set_default_device(device='xpux')[source]¶
Sets default computing node.
- Parameters
device (
str
) – 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 GPU devices.
The default value is ‘xpux’ to specify any device available.
The priority of using GPU is higher when both GPU and CPU are available.
‘multithread’ device type is avaliable when inference, which implements multi-threading parallelism at the operator level. For example, ‘multithread4’ will compute with 4 threads.
It can also be set by environment variable
MGE_DEFAULT_DEVICE
.