Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions
xgboost::collective::InMemoryCommunicator Class Reference

An in-memory communicator, useful for testing. More...

#include <in_memory_communicator.h>

Inheritance diagram for xgboost::collective::InMemoryCommunicator:
xgboost::collective::Communicator

Public Member Functions

 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.
 
- Public Member Functions inherited from xgboost::collective::Communicator
int GetWorldSize () const
 Get the total number of processes.
 
int GetRank () const
 Get the rank of the current processes.
 

Static Public Member Functions

static CommunicatorCreate (Json const &config)
 Create a new communicator based on JSON configuration.
 
- Static Public Member Functions inherited from xgboost::collective::Communicator
static void Init (Json const &config)
 Initialize the communicator.
 
static void Finalize ()
 Finalize the communicator.
 
static CommunicatorGet ()
 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.
 

Protected Member Functions

void Shutdown () override
 Shuts down the communicator.
 
- Protected Member Functions inherited from xgboost::collective::Communicator
 Communicator (int world_size, int rank)
 Construct a new communicator.
 

Detailed Description

An in-memory communicator, useful for testing.

Member Function Documentation

◆ 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_bufferBuffer storing the data.
sizeSize 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_bufferBuffer storing the data.
countNumber of elements in the buffer.
data_typeData type stored in the buffer.
opThe 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_bufferBuffer storing the data.
sizeSize of the data in bytes.
rootRank 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
configJSON configuration.
Returns
Communicator as specified by the JSON configuration.

◆ GetProcessorName()

std::string xgboost::collective::InMemoryCommunicator::GetProcessorName ( )
inlineoverridevirtual

Gets the name of the processor.

Implements xgboost::collective::Communicator.

◆ IsDistributed()

bool xgboost::collective::InMemoryCommunicator::IsDistributed ( ) const
inlineoverridevirtual

Whether the communicator is running in distributed mode.

Implements xgboost::collective::Communicator.

◆ IsFederated()

bool xgboost::collective::InMemoryCommunicator::IsFederated ( ) const
inlineoverridevirtual

Whether the communicator is running in federated mode.

Implements xgboost::collective::Communicator.

◆ Print()

void xgboost::collective::InMemoryCommunicator::Print ( const std::string &  message)
inlineoverridevirtual

Prints the message.

Implements xgboost::collective::Communicator.

◆ Shutdown()

void xgboost::collective::InMemoryCommunicator::Shutdown ( )
inlineoverrideprotectedvirtual

Shuts down the communicator.

Implements xgboost::collective::Communicator.


The documentation for this class was generated from the following files: