Skip to content

torch.mps

译者:片刻小哥哥

项目地址:https://pytorch.apachecn.org/2.0/docs/mps

原始地址:https://pytorch.org/docs/stable/mps.html

该软件包支持在 Python 中访问 MPS(Metal Performance Shaders)后端的接口。Metal 是 Apple 用于对 Metal GPU(图形处理器单元)进行编程的 API。使用 MPS 意味着可以通过在金属 GPU 上运行工作来提高性能。有关更多详细信息,请参阅 https://developer.apple.com/documentation/metalperformanceshaders

synchronize 等待 MPS 设备上所有流中的所有内核完成。
get_rng_state 以 ByteTensor 形式返回随机数生成器状态。
set_rng_state 设置随机数生成器状态。
手册_seed 设置用于生成随机数的种子。
seed 将生成随机数的种子设置为随机数。
empty_cache 释放缓存分配器当前持有的所有未占用的缓存内存,以便这些内存可以在其他 GPU 应用程序中使用。
set_per_process_memory_fraction 设置内存分数以限制 MPS 设备上进程的内存分配。
当前_分配_内存 返回tensor当前占用的 GPU 内存(以字节为单位)。
驱动_分配_内存 返回 Metal 驱动程序为进程分配的 GPU 内存总量(以字节为单位)。

MPS Profiler

profiler.start Start OS Signpost tracing from MPS backend.
profiler.stop Stops generating OS Signpost tracing from MPS backend.
profiler.profile Context Manager to enabling generating OS Signpost tracing from MPS backend.

MPS 事件

event.Event Wrapper around an MPS event.

我们一直在努力

apachecn/AiLearning

【布客】中文翻译组