Medial Code Documentation
|
Experimental support for exposing internal communicator in XGBoost. More...
Functions | |
XGB_DLL int | XGCommunicatorInit (char const *config) |
Initialize the collective communicator. | |
XGB_DLL int | XGCommunicatorFinalize (void) |
Finalize the collective communicator. | |
XGB_DLL int | XGCommunicatorGetRank (void) |
Get rank of current process. | |
XGB_DLL int | XGCommunicatorGetWorldSize (void) |
Get total number of processes. | |
XGB_DLL int | XGCommunicatorIsDistributed (void) |
Get if the communicator is distributed. | |
XGB_DLL int | XGCommunicatorPrint (char const *message) |
Print the message to the communicator. | |
XGB_DLL int | XGCommunicatorGetProcessorName (const char **name_str) |
Get the name of the processor. | |
XGB_DLL int | XGCommunicatorBroadcast (void *send_receive_buffer, size_t size, int root) |
Broadcast a memory region to all others from root. This function is NOT thread-safe. | |
XGB_DLL int | XGCommunicatorAllreduce (void *send_receive_buffer, size_t count, int data_type, int op) |
Perform in-place allreduce. This function is NOT thread-safe. | |
Experimental support for exposing internal communicator in XGBoost.
XGB_DLL int XGCommunicatorAllreduce | ( | void * | send_receive_buffer, |
size_t | count, | ||
int | data_type, | ||
int | op | ||
) |
Perform in-place allreduce. This function is NOT thread-safe.
Example Usage: the following code gives sum of the result
send_receive_buffer | Buffer for both sending and receiving data. |
count | Number of elements to be reduced. |
data_type | Enumeration of data type, see xgboost::collective::DataType in communicator.h. |
op | Enumeration of operation type, see xgboost::collective::Operation in communicator.h. |
XGB_DLL int XGCommunicatorBroadcast | ( | void * | send_receive_buffer, |
size_t | size, | ||
int | root | ||
) |
Broadcast a memory region to all others from root. This function is NOT thread-safe.
Example:
send_receive_buffer | Pointer to the send or receive buffer. |
size | Size of the data. |
root | The process rank to broadcast from. |
XGB_DLL int XGCommunicatorFinalize | ( | void | ) |
Finalize the collective communicator.
Call this function after you finished all jobs.
XGB_DLL int XGCommunicatorGetProcessorName | ( | const char ** | name_str | ) |
Get the name of the processor.
name_str | Pointer to received returned processor name. |
XGB_DLL int XGCommunicatorGetRank | ( | void | ) |
Get rank of current process.
XGB_DLL int XGCommunicatorGetWorldSize | ( | void | ) |
Get total number of processes.
XGB_DLL int XGCommunicatorInit | ( | char const * | config | ) |
Initialize the collective communicator.
Currently the communicator API is experimental, function signatures may change in the future without notice.
Call this once before using anything.
The additional configuration is not required. Usually the communicator will detect settings from environment variables.
config | JSON encoded configuration. Accepted JSON keys are:
|
XGB_DLL int XGCommunicatorIsDistributed | ( | void | ) |
Get if the communicator is distributed.
XGB_DLL int XGCommunicatorPrint | ( | char const * | message | ) |
Print the message to the communicator.
This function can be used to communicate the information of the progress to the user who monitors the communicator.
message | The message to be printed. |