|
| 1 | +# UCX Perftest |
| 2 | + |
| 3 | +[UCX](https://openucx.org/) (Unified Communication X) provides a |
| 4 | +high-performance messaging API that abstracts over verbs, TCP, shared |
| 5 | +memory, CUDA-IPC, ROCm-IPC, and other transports. `ucx_perftest` is its |
| 6 | +micro-benchmark — bandwidth and latency tests for tag matching, active |
| 7 | +messages, RMA put/get, streams, atomics, and more. Like `perftest`, each |
| 8 | +test is a two-process program: one rank is the server, the other dials in. |
| 9 | + |
| 10 | +`examples/ucx/ucx.sh` is a thin wrapper that launches both ranks across |
| 11 | +two hosts with `srun`, so you can benchmark inter-node UCX bandwidth or |
| 12 | +latency in one command and watch the traffic in `rdmatop` from another |
| 13 | +shell. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- A working Slurm cluster with both hosts as compute nodes, and |
| 18 | + `ucx_perftest` installed on both: |
| 19 | + ```bash |
| 20 | + sudo apt install -y ucx-utils |
| 21 | + ``` |
| 22 | +- `srun` reachable from where you launch the script (any login or |
| 23 | + compute node in the cluster). |
| 24 | +- An RDMA device that is ACTIVE on both ends (`rdma link`, `ucx_info -d`) |
| 25 | + and a netdev with an IPv4 address reachable between the two hosts — |
| 26 | + UCX uses it for the wire-up handshake. |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +```bash |
| 31 | +./examples/ucx/ucx.sh <host1> <host2> [test_name] |
| 32 | +# host1 -> rank 0 -> server |
| 33 | +# host2 -> rank 1 -> client (dials host1) |
| 34 | +# test_name defaults to tag_bw; run `ucx_perftest -h` for the full list |
| 35 | +# host1/host2 must be Slurm NodeNames (see `sinfo -N -h -o %N`) |
| 36 | +``` |
| 37 | + |
| 38 | +`ucx_perftest` is **iteration-based** (`-n N`), not duration-based like |
| 39 | +`ib_write_bw`'s `-D 30`. The default `PERF_ITER=5000000` is sized for |
| 40 | +roughly 30 s at 64 KB messages on a 100 GbE link. |
| 41 | + |
| 42 | +## Examples |
| 43 | + |
| 44 | +```bash |
| 45 | +# UCP tag matching bandwidth (default test), ~30 s |
| 46 | +./examples/ucx/ucx.sh host1 host2 |
| 47 | + |
| 48 | +# UCP tag matching latency |
| 49 | +./examples/ucx/ucx.sh host1 host2 tag_lat |
| 50 | + |
| 51 | +# UCP RMA put bandwidth, 1 MiB messages, 1 M iterations (~10 s) |
| 52 | +PERF_SIZE=1048576 PERF_ITER=1000000 \ |
| 53 | + ./examples/ucx/ucx.sh host1 host2 ucp_put_bw |
| 54 | + |
| 55 | +# UCP RMA get bandwidth |
| 56 | +./examples/ucx/ucx.sh host1 host2 ucp_get |
| 57 | + |
| 58 | +# UCP active message bandwidth at 1 MiB messages |
| 59 | +PERF_SIZE=1048576 ./examples/ucx/ucx.sh host1 host2 ucp_am_bw |
| 60 | + |
| 61 | +# Sweep small-message tag latency (more iters because each one is cheap) |
| 62 | +PERF_SIZE=8 PERF_ITER=50000000 \ |
| 63 | + ./examples/ucx/ucx.sh host1 host2 tag_lat |
| 64 | + |
| 65 | +# Pin to a different RDMA device + matching netdev |
| 66 | +UCX_DEV=mlx5_0:1 UCX_NETDEV=enp49s0f0np0 \ |
| 67 | + ./examples/ucx/ucx.sh host1 host2 |
| 68 | + |
| 69 | +# Pin to a Slurm partition / extra srun args |
| 70 | +SRUN_EXTRA="-p all" ./examples/ucx/ucx.sh host1 host2 |
| 71 | + |
| 72 | +# Run inside the enroot container image (see Container Image below) |
| 73 | +SRUN_EXTRA="--container-image=$HOME/changning/rdmatop/examples/ucx/ucx+latest.sqsh" \ |
| 74 | + ./examples/ucx/ucx.sh host1 host2 |
| 75 | +``` |
| 76 | + |
| 77 | +## Container Image |
| 78 | + |
| 79 | +`examples/ucx/Dockerfile` is a slim 87 MB Ubuntu 22.04 image with |
| 80 | +`perftest` + `ucx-utils` and the verbs runtime libs. |
| 81 | + |
| 82 | +```bash |
| 83 | +# Build the image and import to ucx+latest.sqsh next to the Makefile. |
| 84 | +# Run on each node (no shared FS): |
| 85 | +cd examples/ucx && make |
| 86 | + |
| 87 | +# Run inside the container: |
| 88 | +SRUN_EXTRA="--container-image=$PWD/ucx+latest.sqsh" \ |
| 89 | + ./ucx.sh host1 host2 tag_bw |
| 90 | + |
| 91 | +# For HIP / rocm-smi inside, rebuild with the ROCm SDK base: |
| 92 | +BASE_IMAGE=rocm/dev-ubuntu-22.04:6.2.4 make |
| 93 | +``` |
| 94 | + |
| 95 | +## Environment Variables |
| 96 | + |
| 97 | +| Variable | Default | Purpose | |
| 98 | +|-----------------------------|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------| |
| 99 | +| `UCX_DEV` | `mlx5_1:1` | Exported as `UCX_NET_DEVICES` | |
| 100 | +| `UCX_NETDEV` | `enp49s0f1np1` | Netdev paired with `UCX_DEV`; used to look up host1's IP | |
| 101 | +| `PERF_SIZE` | `65536` | Message size, passed as `-s` | |
| 102 | +| `PERF_ITER` | `5000000` | Iterations, passed as `-n` (~30 s at 64 KB / 100 GbE) | |
| 103 | +| `PERF_EXTRA` | (empty) | Extra args appended verbatim to `ucx_perftest` | |
| 104 | +| `SRUN_EXTRA` | (empty) | Extra args passed to `srun` (e.g. `--gres=gpu:1`, `--container-image=...`) | |
| 105 | +| `UCX_TLS` | `rc_verbs,ud_verbs,self,sm,tcp` | Transports UCX is allowed to use. | |
| 106 | +| `UCX_SOCKADDR_TLS_PRIORITY` | `tcp` | Wire-up handshake transport. TCP stays robust when multiple HCAs are present. | |
| 107 | +| `UCX_WARN_UNUSED_ENV_VARS` | `n` | Silences UCX's warning about unrecognised `UCX_*` vars when you set additional ones in the launching shell. | |
| 108 | + |
| 109 | +## Related Links |
| 110 | + |
| 111 | +- [UCX](https://openucx.org/) — Unified Communication X framework |
| 112 | +- [`ucx_perftest` source](https://github.com/openucx/ucx/tree/master/src/tools/perf) |
| 113 | +- [Slurm](https://slurm.schedmd.com/) — `srun` launcher |
| 114 | +- [enroot](https://github.com/NVIDIA/enroot) + [pyxis](https://github.com/NVIDIA/pyxis) — used for the `--container-image` path |
0 commit comments