释放分布式资源,例如 HCCL 或 NCCL 或 MCCL 服务。
说明
release 方法应该在 init 方法之后使用。如果不使用,则在程序结束时资源才会自动释放。
RuntimeError - 在释放分布式资源失败时抛出。
Ascend GPU CPU
Ascend
GPU
CPU
样例:
运行以下样例之前,需要配置好通信环境变量。
针对Ascend/GPU/CPU设备,推荐使用msrun启动方式,无第三方以及配置文件依赖。详见 msrun启动 。
>>> from mindspore.communication import init, release >>> init() >>> release()