mindspore.runtime

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

Stream

mindspore.runtime.communication_stream

Return communication stream on this device.

mindspore.runtime.current_stream

Return current stream used on this device.

mindspore.runtime.default_stream

Return default stream on this device.

mindspore.runtime.set_cur_stream

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

mindspore.runtime.synchronize

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

mindspore.runtime.Stream

Wrapper around a device stream.

mindspore.runtime.StreamCtx

Context-manager that selects a given stream.

Event

mindspore.runtime.Event

Wrapper around a device event.

Memory

mindspore.runtime.max_memory_allocated

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

mindspore.runtime.max_memory_reserved

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

mindspore.runtime.memory_allocated

Returns the actual memory size currently occupied by Tensor.

mindspore.runtime.memory_reserved

Returns the total amount of memory currently managed by the memory pool.

mindspore.runtime.memory_stats

Returns status information queried from the memory pool.

mindspore.runtime.memory_summary

Returns readable memory pool status information.

mindspore.runtime.reset_max_memory_reserved

Reset the peak memory size managed by the memory pool.

mindspore.runtime.reset_max_memory_allocated

Reset the peak memory size of the memory pool actually occupied by Tensor.

mindspore.runtime.reset_peak_memory_stats

Reset the "peak" stats tracked by memory manager.

mindspore.runtime.empty_cache

Release all memory fragments in the memory pool, so that memory arrangement will be optimized.

mindspore.runtime.set_memory

Set the memory parameters of runtime device memory management that is implemented using a memory pool.

Executor

mindspore.runtime.set_cpu_affinity

Enable thread-level core binding to assign specific CPU cores to MindSpore's main modules (main thread, pynative, runtime, minddata), to prevent unstable performance caused by MindSpore's threads seizing CPU.

mindspore.runtime.launch_blocking

Whether to enable synchronous execution.

mindspore.runtime.dispatch_threads_num

Set the threads number of runtime used.