dgl.distributed.initialize

dgl.distributed.initialize(ip_config, max_queue_size=21474836480, net_type='socket', num_worker_threads=1)[source]

Initialize DGL’s distributed module

This function initializes DGL’s distributed module. It acts differently in server or client modes. In the server mode, it runs the server code and never returns. In the client mode, it builds connections with servers for communication and creates worker processes for distributed sampling.

Parameters
  • ip_config (str) – File path of ip_config file

  • max_queue_size (int) –

    Maximal size (bytes) of client queue buffer (~20 GB on default).

    Note that the 20 GB is just an upper-bound and DGL uses zero-copy and it will not allocate 20GB memory at once.

  • net_type (str, optional) –

    Networking type. Valid options are: 'socket', 'tensorpipe'.

    Default: 'socket'

  • num_worker_threads (int) – The number of OMP threads in each sampler process.

Note

Users have to invoke this API before any DGL’s distributed API and framework-specific distributed API. For example, when used with Pytorch, users have to invoke this function before Pytorch’s pytorch.distributed.init_process_group.