get_world_size¶
返回参与当前任务的进程数。
当前进程数等于环境变量 PADDLE_TRAINERS_NUM
的值,默认值为 1。
返回¶
(int) 参与任务的进程数。
代码示例¶
# Execute this script using distributed launch with one card configs.
import paddle
import paddle.distributed as dist
dist.init_parallel_env()
print("The world_size is %d" % dist.get_world_size())
# The world_size is 1