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

class XGBClientAdaptor(in_process: bool, per_msg_timeout: float, tx_timeout: float)[source]

Bases: AppAdaptor, ABC

XGBClientAdaptor specifies commonly required methods for client adaptor implementations.

Constructor of XGBClientAdaptor.

Parameters:
  • in_process (bool)

  • per_msg_timeout (float) – Number of seconds to wait for each message before timing out.

  • tx_timeout (float) – Timeout for the entire transaction.

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

class XGBServerAdaptor(in_process: bool)[source]

Bases: AppAdaptor

XGBServerAdaptor specifies commonly required methods for server adaptor implementations.

For example, an XGB server could be run as a gRPC server process, or be run as part of the FLARE’s FL server process. Similarly, an XGB client could be run as a gRPC client process, or be run as part of the FLARE’s FL client process.

Each type of XGB Target requires an appropriate adaptor to integrate it with FLARE’s XGB Controller or Executor.

Constructor of AppAdaptor.

Parameters:
  • app_name (str) – The name of the application.

  • in_process (bool) – Whether to call the AppRunner.run() in the same process or not.

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