public class Communicator extends Object
| 修饰符和类型 | 类和描述 | 
|---|---|
| 静态类  | Communicator.DataType | 
| 静态类  | Communicator.OpType | 
| 构造器和说明 | 
|---|
| Communicator() | 
| 修饰符和类型 | 方法和说明 | 
|---|---|
| static float[] | allReduce(float[] elements, Communicator.OpType op)使用运算符 op 对分布式浮点向量执行 Allreduce。 | 
| static void | communicatorPrint(String msg)通过通信器打印消息。 | 
| static int | getRank()获取当前线程的排名。 | 
| static int | getWorldSize()获取当前作业的世界大小。 | 
| static void | init(Map<String,Object> envs)初始化当前工作线程上的集体通信器。 | 
| static void | shutdown()关闭当前工作线程中的通信器,等同于 finalize。 | 
public static void init(Map<String,Object> envs) throws XGBoostError
envs - 要传递给通信器的额外环境变量。XGBoostErrorpublic static void shutdown()
                     throws XGBoostError
XGBoostErrorpublic static void communicatorPrint(String msg) throws XGBoostError
msg - XGBoostErrorpublic static int getRank()
                   throws XGBoostError
XGBoostErrorpublic static int getWorldSize()
                        throws XGBoostError
XGBoostErrorpublic static float[] allReduce(float[] elements,
                                Communicator.OpType op)
elements - 分布式工作器上的本地元素。op - 用于 Allreduce 的运算符。版权所有 © 2025. 保留所有权利。