Communication can be a major bottleneck in distributed systems. Dask-CUDA addresses this by supporting integration with UCX, an optimized communication framework that provides high-performance networking and supports a variety of transport methods, including NVLink and InfiniBand for systems with specialized hardware, and TCP for systems without it. This integration is enabled through UCX-Py, an interface that provides Python bindings for UCX.
To use UCX with NVLink or InfiniBand, relevant GPUs must be connected with NVLink bridges or NVIDIA Mellanox InfiniBand Adapters, respectively. NVIDIA provides comparison charts for both NVLink bridges and InfiniBand adapters.
UCX integration requires an environment with both UCX and UCX-Py installed; see UCX-Py Installation for detailed instructions on this process.
When using UCX, each NVLink and InfiniBand memory buffer must create a mapping between each unique pair of processes they are transferred across; this can be quite costly, potentially in the range of hundreds of milliseconds per mapping. For this reason, it is strongly recommended to use RAPIDS Memory Manager (RMM) to allocate a memory pool that is only prone to a single mapping operation, which all subsequent transfers may rely upon. A memory pool also prevents the Dask scheduler from deserializing CUDA data, which will cause a crash.
Beginning with Dask-CUDA 22.02 and assuming UCX >= 1.11.1, specifying UCX transports is now optional.
A local cluster can now be started with
LocalCUDACluster(protocol="ucx"), implying automatic UCX transport selection (
UCX_TLS=all). Starting a cluster separately – scheduler, workers and client as different processes – is also possible, as long as Dask scheduler is created with
dask-scheduler --protocol="ucx" and connecting a
dask-cuda-worker to the scheduler will imply automatic UCX transport selection, but that requires the Dask scheduler and client to be started with
DASK_DISTRIBUTED__COMM__UCX__CREATE_CUDA_CONTEXT=True. See Enabling UCX communication for more details examples of UCX usage with automatic configuration.
Configuring transports manually is still possible, please refer to the subsection below.
In addition to installations of UCX and UCX-Py on your system, for manual configuration several options must be specified within your Dask configuration to enable the integration.
Typically, these will affect
UCX_SOCKADDR_TLS_PRIORITY, environment variables used by UCX to decide what transport methods to use and which to prioritize, respectively.
However, some will affect related libraries, such as RMM:
distributed.comm.ucx.cuda_copy: true– required.
UCX_TLS, enabling CUDA transfers over UCX.
distributed.comm.ucx.tcp: true– required.
UCX_TLS, enabling TCP transfers over UCX; this is required for very small transfers which are inefficient for NVLink and InfiniBand.
distributed.comm.ucx.nvlink: true– required for NVLink.
UCX_TLS, enabling NVLink transfers over UCX; affects intra-node communication only.
distributed.comm.ucx.infiniband: true– required for InfiniBand.
UCX_TLS, enabling InfiniBand transfers over UCX.
For optimal performance with UCX 1.11 and above, it is recommended to also set the environment variables
UCX_MEMTYPE_REG_WHOLE_ALLOC_TYPES=cuda, see documentation here and here for more details on those variables.
distributed.comm.ucx.rdmacm: true– recommended for InfiniBand.
UCX_SOCKADDR_TLS_PRIORITY, enabling remote direct memory access (RDMA) for InfiniBand transfers. This is recommended by UCX for use with InfiniBand, and will not work if InfiniBand is disabled.
distributed.rmm.pool-size: <str|int>– recommended.
Allocates an RMM pool of the specified size for the process; size can be provided with an integer number of bytes or in human readable format, e.g.
"4GB". It is recommended to set the pool size to at least the minimum amount of memory used by the process; if possible, one can map all GPU memory to a single pool, to be utilized for the lifetime of the process.
These options can be used with mainline Dask.distributed. However, some features are exclusive to Dask-CUDA, such as the automatic detection of InfiniBand interfaces. See Dask-CUDA – Motivation for more details on the benefits of using Dask-CUDA.
See Enabling UCX communication for examples of UCX usage with different supported transports.