mindspore.hal

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

Device

mindspore.hal.device_count

Return device count of specified device, this api will be deprecated and removed in future versions, please use the api mindspore.device_context.cpu.device_count() , mindspore.device_context.gpu.device_count(), mindspore.device_context.ascend.device_count() instead.

mindspore.hal.get_arch_list

Get the architecture list this MindSpore was compiled for, this api will be deprecated and removed in future versions.

mindspore.hal.get_device_capability

Get specified device's capability, this api will be deprecated and removed in future versions.

mindspore.hal.get_device_name

Get specified device's name, this api will be deprecated and removed in future versions.

mindspore.hal.get_device_properties

Get specified device's properties, this api will be deprecated and removed in future versions.

mindspore.hal.is_available

Return whether specified device is available, this api will be deprecated and removed in future versions, please use the api mindspore.device_context.cpu.is_available() , mindspore.device_context.gpu.is_available(), mindspore.device_context.ascend.is_available() instead.

mindspore.hal.is_initialized

Return whether specified device is initialized, this api will be deprecated and removed in future versions.

Stream

mindspore.hal.communication_stream

Return communication stream on this device, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.communication_stream() instead.

mindspore.hal.current_stream

Return current stream used on this device, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.current_stream() instead.

mindspore.hal.default_stream

Return default stream on this device, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.default_stream() instead.

mindspore.hal.set_cur_stream

Set the current stream, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.set_cur_stream() instead.

mindspore.hal.synchronize

Synchronize all streams on current device, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.synchronize() instead.

mindspore.hal.Stream

Wrapper around a device stream, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.Stream instead.

mindspore.hal.StreamCtx

Context-manager that selects a given stream, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.StreamCtx instead.

Event

mindspore.hal.Event

Wrapper around a device event, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.Event() instead.

Memory

mindspore.hal.contiguous_tensors_handle.combine_tensor_list_contiguous

Return a contiguous memory handle where contiguous memory has been requested and slicing functionality is provided.

mindspore.hal.contiguous_tensors_handle.ContiguousTensorsHandle

ContiguousTensorsHandle is a handle manage continuous memory.

mindspore.hal.max_memory_allocated

Return the peak memory size of the memory pool actually occupied by Tensor since the process was started.

mindspore.hal.max_memory_reserved

Returns the peak value of the total memory managed by the memory pool since the process was started.

mindspore.hal.memory_allocated

Returns the actual memory size currently occupied by Tensor, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.memory_allocated() instead.

mindspore.hal.memory_reserved

Returns the total amount of memory currently managed by the memory pool, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.memory_reserved() instead.

mindspore.hal.memory_stats

Returns status information queried from the memory pool, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.memory_stats() instead.

mindspore.hal.memory_summary

Returns readable memory pool status information, this api will be deprecated and removed in future versions.

mindspore.hal.reset_max_memory_reserved

Reset the peak memory size managed by the memory pool, this api will be deprecated and removed in future versions.

mindspore.hal.reset_max_memory_allocated

Reset the peak memory size of the memory pool actually occupied by Tensor, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.reset_max_memory_allocated() instead.

mindspore.hal.reset_peak_memory_stats

Reset the "peak" stats tracked by memory manager, this api will be deprecated and removed in future versions.

mindspore.hal.empty_cache

Release all memory fragments in the memory pool, so that memory arrangement will be optimized, this api will be deprecated and removed in future versions, please use the api mindspore.runtime.empty_cache() instead.