get_world_size¶
- paddle.distributed. get_world_size ( ) [source]
-
Returns the number of trainers (number of processes participating in current job).
Its value is equal to the value of the environment variable
PADDLE_TRAINERS_NUM
. The default value is 1.- Returns
-
(int) The number of trainers.
Examples
import paddle import paddle.distributed as dist # execute this command in terminal: export PADDLE_TRAINERS_NUM=4 print("The world_size is %d" % dist.get_world_size()) # The world_size is 4