mindspore.device_context

The device_context encapsulates the interface for querying the number of devices with whether the currently specified backend is available.

Cpu Device Backend Management

mindspore.device_context.cpu.device_count

Returns compute-capable device count of CPU.

mindspore.device_context.cpu.is_available

Return whether cpu backend is available.

mindspore.device_context.cpu.op_tuning.threads_num

Set the threads number of CPU kernel used.

Gpu Device Backend Management

mindspore.device_context.gpu.device_count

Return the number of GPUs available.

mindspore.device_context.gpu.is_available

Return a bool indicating if CUDA is currently available.

mindspore.device_context.gpu.op_precision.conv_allow_tf32

Whether to convert FP32 to TF32 for Conv operators.

mindspore.device_context.gpu.op_precision.matmul_allow_tf32

Whether to convert FP32 to TF32 for Matmul operators.

mindspore.device_context.gpu.op_tuning.conv_dgrad_algo

Specifies convolution data grad algorithm.

mindspore.device_context.gpu.op_tuning.conv_fprop_algo

Specifies convolution forward algorithm.

mindspore.device_context.gpu.op_tuning.conv_wgrad_algo

Specifies convolution filter grad algorithm.

Ascend Device Backend Management

mindspore.device_context.ascend.device_count

Return compute-capable device count of Ascend.

mindspore.device_context.ascend.is_available

Returns whether ascend backend is available.

mindspore.device_context.ascend.op_precision.conv_allow_hf32

Whether to convert FP32 to HF32 for Conv operators.

mindspore.device_context.ascend.op_precision.matmul_allow_hf32

Whether to convert FP32 to HF32 for Matmul operators.

mindspore.device_context.ascend.op_precision.precision_mode

Configure mixed precision mode setting.

mindspore.device_context.ascend.op_precision.op_precision_mode

Path to config file of op precision mode.

mindspore.device_context.ascend.op_debug.execute_timeout

Set the maximum duration of executing an operator in seconds.

mindspore.device_context.ascend.op_debug.debug_option

Enable debugging options for Ascend operators, default not enabled.

mindspore.device_context.ascend.op_tuning.op_compile

Whether to select online compilation.The default settings by the framework are online compilation for static shape, and compiled operator binary files for dynamic shape.

mindspore.device_context.ascend.op_tuning.aoe_tune_mode

AOE tuning mode setting, which is not set by default.

mindspore.device_context.ascend.op_tuning.aoe_job_type

Set the parameters specific to Ascend Optimization Engine.It needs to be used in conjunction with mindspore.device_context.op_tuning.aoe_tune_mode(tune_mode).