GeneralRoleMaker

class paddle.fluid.incubate.fleet.base.role_maker. GeneralRoleMaker ( **kwargs ) [source]
This role maker is for general use, you can set os.environ to customize:

PADDLE_PSERVERS_IP_PORT_LIST : all pservers’ ip:port, separated by ‘,’ PADDLE_TRAINER_ENDPOINTS : all trainers’ ip:port, separated by ‘,’ TRAINING_ROLE : TRAINER or PSERVER PADDLE_TRAINER_ID : current trainer id (only for trainer),

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/fluid/incubate/fleet/base/role_maker.py:docstring of paddle.fluid.incubate.fleet.base.role_maker.GeneralRoleMaker, line 6)

Unexpected indentation.

it is index in PADDLE_TRAINER_ENDPOINTS

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/incubate/fleet/base/role_maker.py:docstring of paddle.fluid.incubate.fleet.base.role_maker.GeneralRoleMaker, line 7)

Block quote ends without a blank line; unexpected unindent.

PADDLE_PSERVER_ID current pserver id (only for pserver)

it is index in PADDLE_PSERVERS_IP_PORT_LIST

generate_role ( )

generate role for general role maker

all_gather ( input )

all gather between trainers and pservers

Parameters

input (int|float) – input value

Returns

return a list of values

all_reduce_worker ( input, output, mode='sum' )

all reduce between trainers if current role is TRAINER, only support array of one dim.

Parameters
  • input (list/numpy.array) – array of one dim

  • output (list/numpy.array) – array of one dim

  • mode (str) – “sum” or “min” or “max”

barrier_worker ( )

barrier between trainers if current role is TRAINER

barrier_all ( )

barrier between trainers if current role is PSERVER

get_local_endpoint ( )

get local endpoint of current process

get_trainer_endpoints ( )

get endpoint of all trainers

get_pserver_endpoints ( )

get endpoint of all pservers

is_worker ( )

whether current process is worker

is_server ( )

whether current process is server

is_first_worker ( )

whether current process is worker of rank 0

worker_index ( )

get index of current worker

server_index ( )

get index of current server

worker_num ( )

retrun the current number of worker

server_num ( )

return the current number of server