mindspore.hal

Hal encapsulates interfaces for device, stream, and event. MindSpore abstracts the corresponding modules from different backends, allowing users to schedule hardware resources at the Python layer.

Device

API Name

Description

Supported Platforms

mindspore.hal.device_count

Returns device count of specified backend.

Ascend GPU CPU

mindspore.hal.get_arch_list

Get the architecture list this MindSpore was compiled for.

Ascend GPU CPU

mindspore.hal.get_device_capability

Get specified device's capability.

Ascend GPU CPU

mindspore.hal.get_device_name

Get specified device's name.

Ascend GPU CPU

mindspore.hal.get_device_properties

Get specified device's properties.

Ascend GPU CPU

mindspore.hal.is_available

Returns whether specified backend is available.

Ascend GPU CPU

mindspore.hal.is_initialized

Returns whether specified backend is initialized.

Ascend GPU CPU

Stream

API Name

Description

Supported Platforms

mindspore.hal.current_stream

Return current stream used on this device.

Ascend GPU CPU

mindspore.hal.default_stream

Return default stream on this device.

Ascend GPU CPU

mindspore.hal.set_cur_stream

Sets the current stream.This is a wrapper API to set the stream.

Ascend GPU CPU

mindspore.hal.synchronize

Synchronize all streams on current device.(Each MindSpore process only occupies one device)

Ascend GPU CPU

mindspore.hal.Stream

Wrapper around a device stream.

Ascend GPU CPU

mindspore.hal.StreamCtx

Context-manager that selects a given stream.

Ascend GPU CPU

Event

API Name

Description

Supported Platforms

mindspore.hal.Event

Wrapper around a device event.

Ascend GPU CPU