An in-memory communicator, useful for testing.
More...
#include <in_memory_communicator.h>
|
|
| InMemoryCommunicator (int world_size, int rank) |
| |
| bool | IsDistributed () const override |
| | Whether the communicator is running in distributed mode.
|
| |
| bool | IsFederated () const override |
| | Whether the communicator is running in federated mode.
|
| |
| void | AllGather (void *in_out, std::size_t size) override |
| | Gathers data from all processes and distributes it to all processes.
|
| |
| void | AllReduce (void *in_out, std::size_t size, DataType data_type, Operation operation) override |
| | Combines values from all processes and distributes the result back to all processes.
|
| |
| void | Broadcast (void *in_out, std::size_t size, int root) override |
| | Broadcasts a message from the process with rank root to all other processes of the group.
|
| |
| std::string | GetProcessorName () override |
| | Gets the name of the processor.
|
| |
| void | Print (const std::string &message) override |
| | Prints the message.
|
| |
|
int | GetWorldSize () const |
| | Get the total number of processes.
|
| |
|
int | GetRank () const |
| | Get the rank of the current processes.
|
| |
|
| static Communicator * | Create (Json const &config) |
| | Create a new communicator based on JSON configuration.
|
| |
| static void | Init (Json const &config) |
| | Initialize the communicator.
|
| |
|
static void | Finalize () |
| | Finalize the communicator.
|
| |
|
static Communicator * | Get () |
| | Get the communicator instance.
|
| |
| static CommunicatorType | GetTypeFromEnv () |
| | Get the communicator type from environment variables.
|
| |
| static CommunicatorType | GetTypeFromConfig (Json const &config) |
| | Get the communicator type from runtime configuration.
|
| |
|
| void | Shutdown () override |
| | Shuts down the communicator.
|
| |
| | Communicator (int world_size, int rank) |
| | Construct a new communicator.
|
| |
An in-memory communicator, useful for testing.
◆ AllGather()
| void xgboost::collective::InMemoryCommunicator::AllGather |
( |
void * |
send_receive_buffer, |
|
|
std::size_t |
size |
|
) |
| |
|
inlineoverridevirtual |
Gathers data from all processes and distributes it to all processes.
This assumes all ranks have the same size, and input data has been sliced into the corresponding position.
- Parameters
-
| send_receive_buffer | Buffer storing the data. |
| size | Size of the data in bytes. |
Implements xgboost::collective::Communicator.
◆ AllReduce()
| void xgboost::collective::InMemoryCommunicator::AllReduce |
( |
void * |
send_receive_buffer, |
|
|
std::size_t |
count, |
|
|
DataType |
data_type, |
|
|
Operation |
op |
|
) |
| |
|
inlineoverridevirtual |
Combines values from all processes and distributes the result back to all processes.
- Parameters
-
| send_receive_buffer | Buffer storing the data. |
| count | Number of elements in the buffer. |
| data_type | Data type stored in the buffer. |
| op | The operation to perform. |
Implements xgboost::collective::Communicator.
◆ Broadcast()
| void xgboost::collective::InMemoryCommunicator::Broadcast |
( |
void * |
send_receive_buffer, |
|
|
std::size_t |
size, |
|
|
int |
root |
|
) |
| |
|
inlineoverridevirtual |
Broadcasts a message from the process with rank root to all other processes of the group.
- Parameters
-
| send_receive_buffer | Buffer storing the data. |
| size | Size of the data in bytes. |
| root | Rank of broadcast root. |
Implements xgboost::collective::Communicator.
◆ Create()
| static Communicator * xgboost::collective::InMemoryCommunicator::Create |
( |
Json const & |
config | ) |
|
|
inlinestatic |
Create a new communicator based on JSON configuration.
- Parameters
-
| config | JSON configuration. |
- Returns
- Communicator as specified by the JSON configuration.
◆ GetProcessorName()
| std::string xgboost::collective::InMemoryCommunicator::GetProcessorName |
( |
| ) |
|
|
inlineoverridevirtual |
◆ IsDistributed()
| bool xgboost::collective::InMemoryCommunicator::IsDistributed |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ IsFederated()
| bool xgboost::collective::InMemoryCommunicator::IsFederated |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ Print()
| void xgboost::collective::InMemoryCommunicator::Print |
( |
const std::string & |
message | ) |
|
|
inlineoverridevirtual |
◆ Shutdown()
| void xgboost::collective::InMemoryCommunicator::Shutdown |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
The documentation for this class was generated from the following files: