nvflare.app_opt.xgboost.histogram_based_v2.adaptors.xgb_adaptor module

class XGBClientAdaptor(in_process)[source]

Bases: AppAdaptor

XGBClientAdaptor specifies commonly required methods for client adaptor implementations.

Constructor of XGBClientAdaptor

configure(config: dict, fl_ctx: FLContext)[source]

Called by XGB Executor to configure the target.

The rank, world size, and number of rounds are required config parameters.

Parameters:
  • config – config data

  • fl_ctx – FL context

Returns: None

set_sender(sender: Sender)[source]

Set the sender to be used to send XGB operation requests to the server.

Parameters:

sender – the sender to be set

Returns: None

class XGBServerAdaptor(in_process)[source]

Bases: AppAdaptor

XGBServerAdaptor specifies commonly required methods for server adaptor implementations.

abstract all_gather(rank: int, seq: int, send_buf: bytes, fl_ctx: FLContext) bytes[source]

Called by the XGB Controller to perform Allgather operation, per XGBoost spec.

Parameters:
  • rank – rank of the calling client

  • seq – sequence number of the request

  • send_buf – operation input data

  • fl_ctx – FL context

Returns: operation result

abstract all_gather_v(rank: int, seq: int, send_buf: bytes, fl_ctx: FLContext) bytes[source]

Called by the XGB Controller to perform AllgatherV operation, per XGBoost spec.

Parameters:
  • rank – rank of the calling client

  • seq – sequence number of the request

  • send_buf – input data

  • fl_ctx – FL context

Returns: operation result

abstract all_reduce(rank: int, seq: int, data_type: int, reduce_op: int, send_buf: bytes, fl_ctx: FLContext) bytes[source]

Called by the XGB Controller to perform Allreduce operation, per XGBoost spec.

Parameters:
  • rank – rank of the calling client

  • seq – sequence number of the request

  • data_type – data type of the input

  • reduce_op – reduce operation to be performed

  • send_buf – input data

  • fl_ctx – FL context

Returns: operation result

abstract broadcast(rank: int, seq: int, root: int, send_buf: bytes, fl_ctx: FLContext) bytes[source]

Called by the XGB Controller to perform Broadcast operation, per XGBoost spec.

Parameters:
  • rank – rank of the calling client

  • seq – sequence number of the request

  • root – root rank of the broadcast

  • send_buf – input data

  • fl_ctx – FL context

Returns: operation result

configure(config: dict, fl_ctx: FLContext)[source]

Called by XGB Controller to configure the target.

The world_size is a required config parameter.

Parameters:
  • config – config data

  • fl_ctx – FL context

Returns: None