Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions
xgboost::collective::InMemoryHandler Class Reference

Handles collective communication primitives in memory. More...

#include <in_memory_handler.h>

Public Member Functions

 InMemoryHandler ()=default
 Default constructor.
 
 InMemoryHandler (int worldSize)
 Construct a handler with the given world size.
 
void Init (int world_size, int rank)
 Initialize the handler with the world size and rank.
 
void Shutdown (uint64_t sequence_number, int rank)
 Shut down the handler.
 
void Allgather (char const *input, std::size_t bytes, std::string *output, std::size_t sequence_number, int rank)
 Perform allgather.
 
void Allreduce (char const *input, std::size_t bytes, std::string *output, std::size_t sequence_number, int rank, DataType data_type, Operation op)
 Perform allreduce.
 
void Broadcast (char const *input, std::size_t bytes, std::string *output, std::size_t sequence_number, int rank, int root)
 Perform broadcast.
 

Detailed Description

Handles collective communication primitives in memory.

This class is thread safe.

Constructor & Destructor Documentation

◆ InMemoryHandler() [1/2]

xgboost::collective::InMemoryHandler::InMemoryHandler ( )
default

Default constructor.

This is used when multiple objects/threads are accessing the same handler and need to initialize it collectively.

◆ InMemoryHandler() [2/2]

xgboost::collective::InMemoryHandler::InMemoryHandler ( int  worldSize)
inlineexplicit

Construct a handler with the given world size.

Parameters
world_sizeNumber of workers.

This is used when the handler only needs to be initialized once with a known world size.

Member Function Documentation

◆ Allgather()

void xgboost::collective::InMemoryHandler::Allgather ( char const *  input,
std::size_t  bytes,
std::string *  output,
std::size_t  sequence_number,
int  rank 
)

Perform allgather.

Parameters
inputThe input buffer.
bytesNumber of bytes in the input buffer.
outputThe output buffer.
sequence_numberCall sequence number.
rankIndex of the worker.

◆ Allreduce()

void xgboost::collective::InMemoryHandler::Allreduce ( char const *  input,
std::size_t  bytes,
std::string *  output,
std::size_t  sequence_number,
int  rank,
DataType  data_type,
Operation  op 
)

Perform allreduce.

Parameters
inputThe input buffer.
bytesNumber of bytes in the input buffer.
outputThe output buffer.
sequence_numberCall sequence number.
rankIndex of the worker.
data_typeType of the data.
opThe reduce operation.

◆ Broadcast()

void xgboost::collective::InMemoryHandler::Broadcast ( char const *  input,
std::size_t  bytes,
std::string *  output,
std::size_t  sequence_number,
int  rank,
int  root 
)

Perform broadcast.

Parameters
inputThe input buffer.
bytesNumber of bytes in the input buffer.
outputThe output buffer.
sequence_numberCall sequence number.
rankIndex of the worker.
rootIndex of the worker to broadcast from.

◆ Init()

void xgboost::collective::InMemoryHandler::Init ( int  world_size,
int  rank 
)

Initialize the handler with the world size and rank.

Parameters
world_sizeNumber of workers.
rankIndex of the worker.

This is used when multiple objects/threads are accessing the same handler and need to initialize it collectively.

◆ Shutdown()

void xgboost::collective::InMemoryHandler::Shutdown ( uint64_t  sequence_number,
int  rank 
)

Shut down the handler.

Parameters
sequence_numberCall sequence number.
rankIndex of the worker.

This is used when multiple objects/threads are accessing the same handler and need to shut it down collectively.


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