gigl.distributed.utils.rpc_init#

init_rpc for sampling workers, with the TensorPipe channels taken from an environment variable.

init_rpc_with_options is a copy of GLT’s graphlearn_torch.distributed.rpc.init_rpc.

Differences from GLT’s init_rpc (each one is marked # GiGL change: in the code):

  1. The TensorPipe channels come from the channels argument, which defaults to ("basic",). GLT always uses ["mpt_uv", "basic"].

  2. There is no is_dynamic argument. No caller here needs it; the graph-store init_server and init_client, which do, call GLT’s init_rpc.

  3. Module state is written as glt_rpc._rpc_inited = ... instead of with global, because this code lives in another module. GLT’s helpers (all_gather, barrier, rpc_is_initialized) read that state.

With channels=("mpt_uv", "basic"), the TensorPipe options, the module state and the side effects are the same as GLT’s.

GltInitRpcDriftTest hashes the source of GLT’s init_rpc, shutdown_rpc and rpc_is_initialized. A GLT upgrade that changes any of them fails the test; compare the copy with the new source when it does.

The channels come from SAMPLING_RPC_CHANNELS_ENV in gigl/distributed/constants.py, which describes each value.

Call sites that read the variable, through init_rpc_from_env:

  • The colocated loader worker (init_neighbor_loader_worker).

  • The dataset-building process (dataset_factory).

  • The colocated sampling producer (DistSamplingProducer).

  • The graph-store sampling worker subprocesses (shared_dist_sampling_producer).

Call sites that ignore the variable and call GLT’s init_rpc with GLT’s channels, mpt_uv and basic:

  • The graph-store init_server and init_client (dist_server and compute), which accept is_dynamic.

  • GLT’s own init_server and init_client.

Processes that read the variable, whose default is basic, and processes that do not, which use mpt_uv and basic, share basic, so a mixed deployment connects. Set GIGL_SAMPLING_RPC_CHANNELS=mpt_uv,basic to use GLT’s channels in the processes that read the variable.

Where an invalid value fails:

  • Before any worker is spawned, in DistSamplingProducer.init and SharedDistSamplingBackend.init_backend. Both read the variable in the parent process first.

  • In the mp.spawn child of the dataset-building process; mp.spawn re-raises its error.

  • At startup of each colocated loader worker.

Attributes#

Functions#

init_rpc_from_env(master_addr, master_port[, ...])

Calls init_rpc_with_options with the channels from the environment.

init_rpc_with_options(master_addr, master_port[, ...])

Initializes RPC on the current process like GLT's init_rpc, with chosen channels.

sampling_rpc_channels_from_env()

Returns the channels from the environment, defaulting to basic.

Module Contents#

gigl.distributed.utils.rpc_init.init_rpc_from_env(master_addr, master_port, num_rpc_threads=16, rpc_timeout=180)[source]#

Calls init_rpc_with_options with the channels from the environment.

Parameters:
  • master_addr (str)

  • master_port (int)

  • num_rpc_threads (int)

  • rpc_timeout (float)

Return type:

None

gigl.distributed.utils.rpc_init.init_rpc_with_options(master_addr, master_port, num_rpc_threads=16, rpc_timeout=180, channels=DEFAULT_CHANNELS)[source]#

Initializes RPC on the current process like GLT’s init_rpc, with chosen channels.

Parameters:
  • master_addr (str) – Address of the rendezvous master.

  • master_port (int) – Port of the rendezvous master.

  • num_rpc_threads (int) – Size of the RPC worker thread pool.

  • rpc_timeout (float) – RPC timeout in seconds, also used for the bring-up gather and barrier.

  • channels (Sequence[str]) – TensorPipe channels in priority order; any of basic, mpt_uv, cma without repeats, and basic is required.

Return type:

None

gigl.distributed.utils.rpc_init.sampling_rpc_channels_from_env()[source]#

Returns the channels from the environment, defaulting to basic.

Raises:

ValueError – If the variable is set to an invalid value, including an empty list.

Return type:

tuple[str, Ellipsis]

gigl.distributed.utils.rpc_init.DEFAULT_CHANNELS: Final[tuple[str, Ellipsis]] = ('basic',)[source]#
gigl.distributed.utils.rpc_init.logger[source]#