xgboost
|
Experimental support for exposing internal communicator in XGBoost. More...
Typedefs | |
typedef void * | TrackerHandle |
Handle to tracker. More... | |
Functions | |
int | XGTrackerCreate (char const *config, TrackerHandle *handle) |
Create a new tracker. More... | |
int | XGTrackerWorkerArgs (TrackerHandle handle, char const **args) |
Get the arguments needed for running workers. This should be called after XGTrackerRun(). More... | |
int | XGTrackerRun (TrackerHandle handle, char const *config) |
Start the tracker. The tracker runs in the background and this function returns once the tracker is started. More... | |
int | XGTrackerWaitFor (TrackerHandle handle, char const *config) |
Wait for the tracker to finish, should be called after XGTrackerRun(). This function will block until the tracker task is finished or timeout is reached. More... | |
int | XGTrackerFree (TrackerHandle handle) |
Free a tracker instance. This should be called after XGTrackerWaitFor(). If the tracker is not properly waited, this function will shutdown all connections with the tracker, potentially leading to undefined behavior. More... | |
int | XGCommunicatorInit (char const *config) |
Initialize the collective communicator. More... | |
int | XGCommunicatorFinalize (void) |
Finalize the collective communicator. More... | |
int | XGCommunicatorGetRank (void) |
Get rank of current process. More... | |
int | XGCommunicatorGetWorldSize (void) |
Get total number of processes. More... | |
int | XGCommunicatorIsDistributed (void) |
Get if the communicator is distributed. More... | |
int | XGCommunicatorPrint (char const *message) |
Print the message to the communicator. More... | |
int | XGCommunicatorGetProcessorName (const char **name_str) |
Get the name of the processor. More... | |
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. More... | |
int | XGCommunicatorAllreduce (void *send_receive_buffer, size_t count, int data_type, int op) |
Perform in-place allreduce. This function is NOT thread-safe. More... | |
Experimental support for exposing internal communicator in XGBoost.
typedef void* TrackerHandle |
Handle to tracker.
There are currently two types of tracker in XGBoost, first one is rabit
, while the other one is federated
.
This is still under development.
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. |
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. |
int XGCommunicatorFinalize | ( | void | ) |
Finalize the collective communicator.
Call this function after you finished all jobs.
int XGCommunicatorGetProcessorName | ( | const char ** | name_str | ) |
Get the name of the processor.
name_str | Pointer to received returned processor name. |
int XGCommunicatorGetRank | ( | void | ) |
Get rank of current process.
int XGCommunicatorGetWorldSize | ( | void | ) |
Get total number of processes.
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:
|
int XGCommunicatorIsDistributed | ( | void | ) |
Get if the communicator is distributed.
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. |
int XGTrackerCreate | ( | char const * | config, |
TrackerHandle * | handle | ||
) |
Create a new tracker.
config | JSON encoded parameters. |
rabit
and federated
.Some configurations are rabit
specific:
rabit
tracker to specify the address of the host.Some federated
specific configurations:
handle | The handle to the created tracker. |
int XGTrackerFree | ( | TrackerHandle | handle | ) |
Free a tracker instance. This should be called after XGTrackerWaitFor(). If the tracker is not properly waited, this function will shutdown all connections with the tracker, potentially leading to undefined behavior.
handle | The handle to the tracker. |
int XGTrackerRun | ( | TrackerHandle | handle, |
char const * | config | ||
) |
Start the tracker. The tracker runs in the background and this function returns once the tracker is started.
handle | The handle to the tracker. |
config | Unused at the moment, preserved for the future. |
int XGTrackerWaitFor | ( | TrackerHandle | handle, |
char const * | config | ||
) |
Wait for the tracker to finish, should be called after XGTrackerRun(). This function will block until the tracker task is finished or timeout is reached.
handle | The handle to the tracker. |
config | JSON encoded configuration. No argument is required yet, preserved for the future. |
int XGTrackerWorkerArgs | ( | TrackerHandle | handle, |
char const ** | args | ||
) |
Get the arguments needed for running workers. This should be called after XGTrackerRun().
handle | The handle to the tracker. |
args | The arguments returned as a JSON document. |