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

A Federated Learning communicator class that handles collective communication. More...

#include <federated_communicator.h>

Inheritance diagram for xgboost::collective::FederatedCommunicator:
xgboost::collective::Communicator

Public Member Functions

 FederatedCommunicator (int world_size, int rank, std::string const &server_address, std::string const &server_cert_path, std::string const &client_key_path, std::string const &client_cert_path)
 Construct a new federated communicator.
 
 FederatedCommunicator (int world_size, int rank, std::string const &server_address)
 Construct an insecure federated communicator without using SSL.
 
bool IsDistributed () const override
 Get if the communicator is distributed.
 
bool IsFederated () const override
 Get if the communicator is federated.
 
void AllGather (void *send_receive_buffer, std::size_t size) override
 Perform in-place allgather.
 
void AllReduce (void *send_receive_buffer, std::size_t count, DataType data_type, Operation op) override
 Perform in-place allreduce.
 
void Broadcast (void *send_receive_buffer, std::size_t size, int root) override
 Broadcast a memory region to all others from root.
 
std::string GetProcessorName () override
 Get the name of the processor.
 
void Print (const std::string &message) override
 Print the message to the communicator.
 
- 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

A Federated Learning communicator class that handles collective communication.

Constructor & Destructor Documentation

◆ FederatedCommunicator() [1/2]

xgboost::collective::FederatedCommunicator::FederatedCommunicator ( int  world_size,
int  rank,
std::string const &  server_address,
std::string const &  server_cert_path,
std::string const &  client_key_path,
std::string const &  client_cert_path 
)
inline

Construct a new federated communicator.

Parameters
world_sizeTotal number of processes.
rankRank of the current process.
server_addressAddress of the federated server (host:port).
server_cert_pathPath to the server cert file.
client_key_pathPath to the client key file.
client_cert_pathPath to the client cert file.

◆ FederatedCommunicator() [2/2]

xgboost::collective::FederatedCommunicator::FederatedCommunicator ( int  world_size,
int  rank,
std::string const &  server_address 
)
inline

Construct an insecure federated communicator without using SSL.

Parameters
world_sizeTotal number of processes.
rankRank of the current process.
server_addressAddress of the federated server (host:port).

Member Function Documentation

◆ AllGather()

void xgboost::collective::FederatedCommunicator::AllGather ( void *  send_receive_buffer,
std::size_t  size 
)
inlineoverridevirtual

Perform in-place allgather.

Parameters
send_receive_bufferBuffer for both sending and receiving data.
sizeNumber of bytes to be gathered.

Implements xgboost::collective::Communicator.

◆ AllReduce()

void xgboost::collective::FederatedCommunicator::AllReduce ( void *  send_receive_buffer,
std::size_t  count,
DataType  data_type,
Operation  op 
)
inlineoverridevirtual

Perform in-place allreduce.

Parameters
send_receive_bufferBuffer for both sending and receiving data.
countNumber of elements to be reduced.
data_typeEnumeration of data type.
opEnumeration of operation type.

Implements xgboost::collective::Communicator.

◆ Broadcast()

void xgboost::collective::FederatedCommunicator::Broadcast ( void *  send_receive_buffer,
std::size_t  size,
int  root 
)
inlineoverridevirtual

Broadcast a memory region to all others from root.

Parameters
send_receive_bufferPointer to the send or receive buffer.
sizeSize of the data.
rootThe process rank to broadcast from.

Implements xgboost::collective::Communicator.

◆ Create()

static Communicator * xgboost::collective::FederatedCommunicator::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::FederatedCommunicator::GetProcessorName ( )
inlineoverridevirtual

Get the name of the processor.

Returns
Name of the processor.

Implements xgboost::collective::Communicator.

◆ IsDistributed()

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

Get if the communicator is distributed.

Returns
True.

Implements xgboost::collective::Communicator.

◆ IsFederated()

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

Get if the communicator is federated.

Returns
True.

Implements xgboost::collective::Communicator.

◆ Print()

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

Print the message to the communicator.

Parameters
messageThe message to be printed.

Implements xgboost::collective::Communicator.

◆ Shutdown()

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

Shuts down the communicator.

Implements xgboost::collective::Communicator.


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