UserDefinedCollectiveRoleMaker¶
-
class
paddle.fluid.incubate.fleet.base.role_maker.
UserDefinedCollectiveRoleMaker
( current_id=0, worker_endpoints=None ) [source] -
UserDefinedCollectiveRoleMaker is designed for worker assignment under manual for collective mode.
-
is_worker
( ) -
return is_worker() 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
-
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_all
( ) -
barrier between trainers if current role is PSERVER
-
barrier_worker
( ) -
barrier between trainers if current role is TRAINER
-
get_pserver_endpoints
( ) -
return pserver endpoints
-
get_trainer_endpoints
( ) -
return trainer endpoints
-
is_server
( ) -
return is_server() of current process
-
server_index
( ) -
Get current server id.
- Returns
-
node id
- Return type
-
int
-
worker_index
( ) -
Get current worker id.
- Returns
-
node id
- Return type
-
int
-
worker_num
( ) -
Get current total worker number.
- Returns
-
worker number
- Return type
-
int
-