Medial Code Documentation
Loading...
Searching...
No Matches
Static Public Member Functions
LightGBM::Network Class Reference

A static class that contains some collective communication algorithm. More...

#include <network.h>

Static Public Member Functions

static void Init (Config config)
 Initialize.
 
static void Init (int num_machines, int rank, ReduceScatterFunction reduce_scatter_ext_fun, AllgatherFunction allgather_ext_fun)
 Initialize.
 
static void Dispose ()
 Free this static class.
 
static int rank ()
 Get rank of this machine.
 
static int num_machines ()
 Get total number of machines.
 
static void Allreduce (char *input, comm_size_t input_size, int type_size, char *output, const ReduceFunction &reducer)
 Perform all_reduce. if data size is small, will perform AllreduceByAllGather, else with call ReduceScatter followed allgather.
 
static void AllreduceByAllGather (char *input, comm_size_t input_size, int type_size, char *output, const ReduceFunction &reducer)
 Perform all_reduce by using all_gather. it can be use to reduce communication time when data is small.
 
static void Allgather (char *input, comm_size_t send_size, char *output)
 Performing all_gather by using bruck algorithm. Communication times is O(log(n)), and communication cost is O(send_size * number_machine) It can be used when all nodes have same input size.
 
static void Allgather (char *input, const comm_size_t *block_start, const comm_size_t *block_len, char *output, comm_size_t all_size)
 Performing all_gather by using bruck algorithm. Communication times is O(log(n)), and communication cost is O(all_size) It can be used when nodes have different input size.
 
static void ReduceScatter (char *input, comm_size_t input_size, int type_size, const comm_size_t *block_start, const comm_size_t *block_len, char *output, comm_size_t output_size, const ReduceFunction &reducer)
 Perform reduce scatter by using recursive halving algorithm. Communication times is O(log(n)), and communication cost is O(input_size)
 
template<class T >
static T GlobalSyncUpByMin (T &local)
 
template<class T >
static T GlobalSyncUpByMax (T &local)
 
template<class T >
static T GlobalSyncUpByMean (T &local)
 
template<class T >
static void GlobalSum (std::vector< T > &local)
 

Detailed Description

A static class that contains some collective communication algorithm.

Member Function Documentation

◆ Allgather() [1/2]

void LightGBM::Network::Allgather ( char *  input,
comm_size_t  send_size,
char *  output 
)
static

Performing all_gather by using bruck algorithm. Communication times is O(log(n)), and communication cost is O(send_size * number_machine) It can be used when all nodes have same input size.

Parameters
inputInput data
send_sizeThe size of input data
outputOutput result

◆ Allgather() [2/2]

void LightGBM::Network::Allgather ( char *  input,
const comm_size_t *  block_start,
const comm_size_t *  block_len,
char *  output,
comm_size_t  all_size 
)
static

Performing all_gather by using bruck algorithm. Communication times is O(log(n)), and communication cost is O(all_size) It can be used when nodes have different input size.

Parameters
inputInput data
block_startThe block start for different machines
block_lenThe block size for different machines
outputOutput result
all_sizeThe size of output data

◆ Allreduce()

void LightGBM::Network::Allreduce ( char *  input,
comm_size_t  input_size,
int  type_size,
char *  output,
const ReduceFunction &  reducer 
)
static

Perform all_reduce. if data size is small, will perform AllreduceByAllGather, else with call ReduceScatter followed allgather.

Parameters
inputInput data
input_sizeThe size of input data
type_sizeThe size of one object in the reduce function
outputOutput result
reducerReduce function

◆ AllreduceByAllGather()

void LightGBM::Network::AllreduceByAllGather ( char *  input,
comm_size_t  input_size,
int  type_size,
char *  output,
const ReduceFunction &  reducer 
)
static

Perform all_reduce by using all_gather. it can be use to reduce communication time when data is small.

Parameters
inputInput data
input_sizeThe size of input data
type_sizeThe size of one object in the reduce function
outputOutput result
reducerReduce function

◆ Init()

void LightGBM::Network::Init ( Config  config)
static

Initialize.

Parameters
configConfig of network setting

◆ ReduceScatter()

void LightGBM::Network::ReduceScatter ( char *  input,
comm_size_t  input_size,
int  type_size,
const comm_size_t *  block_start,
const comm_size_t *  block_len,
char *  output,
comm_size_t  output_size,
const ReduceFunction &  reducer 
)
static

Perform reduce scatter by using recursive halving algorithm. Communication times is O(log(n)), and communication cost is O(input_size)

Parameters
inputInput data
input_sizeThe size of input data
type_sizeThe size of one object in the reduce function
block_startThe block start for different machines
block_lenThe block size for different machines
outputOutput result
output_sizesize of output data
reducerReduce function

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