Class Communicator

java.lang.Object
ml.dmlc.xgboost4j.java.Communicator

public class Communicator extends Object
Collective communicator global class for synchronization. Currently the communicator API is experimental, function signatures may change in the future without notice.
  • Constructor Details

    • Communicator

      public Communicator()
  • Method Details

    • init

      public static void init(Map<String,Object> envs) throws XGBoostError
      Initialize the collective communicator on current working thread.
      Parameters:
      envs - The additional environment variables to pass to the communicator.
      Throws:
      XGBoostError
    • shutdown

      public static void shutdown() throws XGBoostError
      Shutdown the communicator in current working thread, equals to finalize.
      Throws:
      XGBoostError
    • communicatorPrint

      public static void communicatorPrint(String msg) throws XGBoostError
      Print the message via the communicator.
      Parameters:
      msg -
      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, Communicator.OpType op)
      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.