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