Package ml.dmlc.xgboost4j.java
Class Rabit
- java.lang.Object
-
- ml.dmlc.xgboost4j.java.Rabit
-
public class Rabit extends Object
Rabit global class for synchronization.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Rabit.DataType
static class
Rabit.OpType
-
Constructor Summary
Constructors Constructor Description Rabit()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static float[]
allReduce(float[] elements, Rabit.OpType op)
perform Allreduce on distributed float vectors using operator op.static int
getRank()
get rank of current thread.static int
getWorldSize()
get world size of current job.static void
init(Map<String,String> envs)
Initialize the rabit library on current working thread.static void
shutdown()
Shutdown the rabit engine in current working thread, equals to finalize.static void
trackerPrint(String msg)
Print the message on rabit tracker.static int
versionNumber()
Get version number of current stored model in the thread.
-
-
-
Method Detail
-
init
public static void init(Map<String,String> envs) throws XGBoostError
Initialize the rabit library on current working thread.- Parameters:
envs
- The additional environment variables to pass to rabit.- Throws:
XGBoostError
-
shutdown
public static void shutdown() throws XGBoostError
Shutdown the rabit engine in current working thread, equals to finalize.- Throws:
XGBoostError
-
trackerPrint
public static void trackerPrint(String msg) throws XGBoostError
Print the message on rabit tracker.- Parameters:
msg
-- Throws:
XGBoostError
-
versionNumber
public static int versionNumber() throws XGBoostError
Get version number of current stored model in the thread. which means how many calls to CheckPoint we made so far.- Returns:
- version Number.
- Throws:
XGBoostError
-
getRank
public static int getRank() throws XGBoostError
get rank of current thread.- Returns:
- the rank.
- Throws:
XGBoostError
-
getWorldSize
public static int getWorldSize() throws XGBoostError
get world size of current job.- Returns:
- the worldsize
- Throws:
XGBoostError
-
allReduce
public static float[] allReduce(float[] elements, Rabit.OpType op)
perform Allreduce on distributed float vectors using operator op. This implementation of allReduce does not support customized prepare function callback in the native code, as this function is meant for testing purposes only (to test the Rabit tracker.)- Parameters:
elements
- local elements on distributed workers.op
- operator used for Allreduce.- Returns:
- All-reduced float elements according to the given operator.
-
-