Package ml.dmlc.xgboost4j.java
Class Communicator
java.lang.Object
ml.dmlc.xgboost4j.java.Communicator
Collective communicator global class for synchronization.
Currently the communicator API is experimental, function signatures may change in the future
without notice.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic float[]allReduce(float[] elements, Communicator.OpType op) perform Allreduce on distributed float vectors using operator op.static voidcommunicatorPrint(String msg) Print the message via the communicator.static intgetRank()get rank of current thread.static intget world size of current job.static voidInitialize the collective communicator on current working thread.static voidshutdown()Shutdown the communicator in current working thread, equals to finalize.
-
Constructor Details
-
Communicator
public Communicator()
-
-
Method Details
-
init
Initialize the collective communicator on current working thread.- Parameters:
envs- The additional environment variables to pass to the communicator.- Throws:
XGBoostError
-
shutdown
Shutdown the communicator in current working thread, equals to finalize.- Throws:
XGBoostError
-
communicatorPrint
Print the message via the communicator.- Parameters:
msg-- Throws:
XGBoostError
-
getRank
get rank of current thread.- Returns:
- the rank.
- Throws:
XGBoostError
-
getWorldSize
get world size of current job.- Returns:
- the worldsize
- Throws:
XGBoostError
-
allReduce
perform Allreduce on distributed float vectors using operator op.- Parameters:
elements- local elements on distributed workers.op- operator used for Allreduce.- Returns:
- All-reduced float elements according to the given operator.
-