RoleMakerBase¶
-
class
paddle.fluid.incubate.fleet.base.role_maker.
RoleMakerBase
[source] -
RoleMakerBase is a base class for assigning a role to current process in distributed training. A paddle developer can implement RoleMakerBase to design a role maker for worker or pserver assignment.
-
is_worker
( ) -
return is_worker() of current process
-
is_server
( ) -
return is_server() of current process
-
is_first_worker
( ) -
Check whether the node is the first instance of worker. :returns:
- True if this is the first node of worker,
-
False if not.
- Return type
-
bool
-
worker_num
( ) -
Get current total worker number.
- Returns
-
worker number
- Return type
-
int
-
worker_index
( ) -
Get current worker id.
- Returns
-
node id
- Return type
-
int
-
server_index
( ) -
Get current server id.
- Returns
-
node id
- Return type
-
int
-
get_trainer_endpoints
( ) -
return trainer endpoints
-
get_pserver_endpoints
( ) -
return pserver endpoints
-
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
-