linux-rdma/perftest

repository·master·Indexed 21 days ago

https://github.com/linux-rdma/perftest

A collection of micro-benchmarks written over uverbs to measure the bandwidth and latency performance of RDMA and Ethernet hardware and software stacks. It utilizes a client-server model and includes specialized tools for bandwidth (BW) and latency (lat) testing, support for GPUDirect (CUDA and MUSA), Raw Ethernet benchmarks, and real-time data validation for RDMA transfers.

Tokens
3.8K
Snippets
10
Records
18
Agent score
77%

What's inside perftest

  1. Use Data Validation for RDMA transfers

    master

    The --data_validation feature provides real-time verification of RDMA data transfers to detect corruption, DMA races, or stale data. It works for ib_write_bw and ib_read_bw using RC connection types.

    Supported Backends:

    • Host Memory: Uses SIMD-accelerated validators (AVX-512, AVX2, SSE4.2, or ARM NEON).
    • GPU Memory: Uses a CUDA kernel plugin (libperftest_kernels.so) if --use_cuda is enabled.

    Requirements:

    • Connection type must be RC.
    • Tests must be bandwidth tests (ib_write_bw, ib_read_bw).
    • tx_depth (-t) must be $\ge 32$ and identical on both sides.
    • Hardware must support SIMD (AVX2/NEON/SSE42).

    Incompatible Options: Cannot be used with -a, --post_list > 1, --run_infinitely, --mr_per_qp, --gpu_touch, --use-null-mr, or --payload_file_path.

    Interpreting Results:

    • errors: Real corruption detected. The transfer failed.
    • races: Temporary mismatch because new data arrived during verification. Normal.
    • skips: Transfer rate exceeded verification rate. Normal.
    • retries: Inconsistency at the tail of a chunk due to PCIe ordering. Normal.
    # Host memory WRITE validation
    ./ib_write_bw -d mlx5_0 --data_validation -t 128
    
    # GPU memory WRITE validation
    ./ib_write_bw -d mlx5_0 --use_cuda=0 --data_validation -t 128
  2. Enable Data Validation for RDMA transfers

    master

    The --data_validation flag enables real-time verification that received data matches expected byte patterns. This works with both host memory (using SIMD acceleration like AVX-512/AVX2/SSE4.2/NEON) and GPU memory (via CUDA kernel plugin).

    Requirements:

    • Must use RC (Reliable Connection) connection type.
    • Must use WRITE or READ verbs (e.g., ib_write_bw, ib_read_bw).
    • Must be a Bandwidth test (not latency).
    • tx_depth (-t) must be the same on both server and client (minimum 32).
    • Requires host memory or --use_cuda.

    Incompatible with:

    • -a, --post_list > 1, --run_infinitely, --mr_per_qp, --gpu_touch, --use-null-mr, --payload_file_path.

    Note: Some bandwidth degradation is expected, especially in READ mode. Using 2MB or 1GB huge pages is recommended to improve performance.

    # Example usage (conceptual)
    ./ib_write_bw -s 8388608 -t 32 --data_validation
  3. Configure CPU and NUMA affinity

    master

    Perftest automatically attempts to bind benchmark threads and memory to the NUMA node associated with the IB device to minimize cross-node latency.

    Affinity Options:

    • Automatic (Default): No flags needed. Perftest reads the NIC's NUMA node from sysfs.
    • --pin_cores=<cores>:** Pin to specific CPU core(s) (e.g., 5 or 0-3,8). Mutually exclusive with --numa_node.
    • --numa_node=<node>:** Bind to a specific NUMA node. Mutually exclusive with --pin_cores.
    • --disable_numa:** Disable automatic NUMA binding entirely.

    Note: These options are not supported for raw Ethernet benchmarks. Perftest respects external affinity settings (like numactl) and will skip automatic binding if they are detected.

    Requirements: --numa_node and automatic detection require libnuma.

    # Pin to a specific CPU core
    ./ib_write_bw --pin_cores=5 -d mlx5_0
    
    # Bind to NUMA node 1
    ./ib_write_bw --numa_node=1 -d mlx5_0
    
    # Explicitly disable NUMA binding
    ./ib_write_bw --disable_numa -d mlx5_0
  4. How GPUDirect works in perftest

    master

    Perftest supports GPUDirect for RDMA transfers to/from GPU memory.

    Requirements:

    • CUDA Toolkit 11.7+ and NVIDIA Open-Source GPU Kernel Modules 515+.
    • For CUDA Runtime API support, build with ./configure --enable-cudart.
    • If CUDA libraries are in non-standard paths, set LDFLAGS before building.

    Usage: Use the --use_cuda=<gpu_index> flag. To use DMA-BUF, also include the --use_cuda_dmabuf flag.

    MUSA (Moore Threads) Support: If musa.h is not in /usr/local/musa/include, pass MUSA_H_PATH to ./configure. Use --use_musa=<gpu_index> and --use_musa_dmabuf. Note: MUSA device-memory ib_write_lat tests MUST use --write_with_imm.

    # Example: Using CUDA for RDMA Write
    ./ib_write_bw -d mlx5_0 --use_cuda=0 -a
    
    # Example: Using CUDA with DMA-BUF
    ./ib_send_bw -d mlx5_0 --use_cuda=0 --use_cuda_dmabuf
  5. How to run Perftest benchmarks

    master

    Perftest benchmarks follow a client-server model. To run a test, you must execute the same test binary on both the server and the client machines, ensuring that all mode-specific options are identical.

    Server: Run the test binary with your desired options.

    ./<test_name> <options>

    Client: Run the test binary with the same options, followed by the server's IP address.

    ./<test_name> <options> <server_ip_address>

    Important Notes:

    • Options specific to a mode must be the same on both server and client.
    • You may need to run these applications with sudo if you are not the root user.
    • Applications are typically installed in /usr/bin/.
    • Errors reported to stderr are sourced from rdma-core.
    # Example 1: Bidirectional bandwidth test using Write verb
    # Server
    ./ib_write_bw -s 8388608 -b -D 5 -q 3
    # Client
    ./ib_write_bw -s 8388608 -b -D 5 -q 3 1.1.1.2
    
    # Example 2: Latency test using Read verb
    # Server
    ./ib_read_lat -s 32 -n 5000
    # Client
    ./ib_read_lat -s 32 -n 5000 192.168.0.1
  6. Build perftest for SPARC64

    master

    To build the perftest suite for a SPARC64 target, use the following sequence of commands. This involves generating the configuration files, running a cross-compilation configure step with specific host and target flags, and compiling with verbose output to assist in debugging.

    ./autogen.sh
    ./configure --build= --host=sparc64-redhat-linux-gnu --target=sparc64-linux --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info
    make clean && make V=1
  7. Run perftest benchmarks

    master

    Benchmarks are run in a client-server model. The server starts the test, and the client connects to the server's IP address.

    Crucial Requirement: The exact same options must be passed to both the server and the client for the test to function correctly.

    Execution Pattern:

    • Server: ./<test_name> <options>
    • Client: ./<test_name> <options> <server_ip>

    Example for a bandwidth test:

    # On Server
    ./ib_write_bw -d mlx5_0
    
    # On Client
    ./ib_write_bw -d mlx5_0 192.168.1.1
    # Server
    ./<test name> <options>
    
    # Client
    ./<test name> <options> <server IP address>
  8. Install perftest

    master

    To install the perftest collection, clone the repository and use the standard autotools build process. You can specify a custom installation directory using the --prefix flag during the configuration step.

    Note for CUDA support: The build system automatically detects cuda.h. For versions earlier than 25.07, you must explicitly provide the path via CUDA_H_PATH during ./configure.

    git clone https://github.com/linux-rdma/perftest.git
    cd perftest/
    ./autogen.sh
    ./configure --prefix=<Directory path>
    make
    make install
  9. Configure custom payloads

    master

    You can use the --payload_file_path option to pass a text file containing a specific pattern to be used as the RDMA verb payload.

    Format: The file must contain patterns in DWORDs, separated by commas, in hex format.

    Example content: 0xddccbbaa,0xff56f00d,0xffffffff,0x21ab025b

    Supported Tests:

    • ib_write_bw, ib_read_bw, ib_send_bw, ib_read_lat, ib_send_lat.

    Note: A 0-size pattern is not allowed.

  10. Latency test specific options

    master

    Use these flags when running latency benchmarks (e.g., ib_send_lat, ib_read_lat).

    OptionDescription
    -C, --report-cyclesReport times in CPU cycle units
    -H, --report-histogramPrint a histogram of results (default: summary only)
    -U, --report-unsortedPrint unsorted results (default: sorted)
  11. Bandwidth test specific options

    master

    Use these flags when running bandwidth benchmarks (e.g., ib_send_bw, ib_write_bw).

    OptionDescription
    -b, --bidirectionalMeasure bidirectional bandwidth (default: uni)
    -N, --no peak-bwCancel peak-bw calculation (default: with peak-bw)
    -Q, --cq-modGenerate Cqe only after <cq-mod> completion
    -t, --tx-depth=<dep>Size of tx queue (default: 128)
    -O, --dualportRun in dual-port mode (2 QPs). Both ports must be active
    -D, --duration=<sec>Run for a fixed number of seconds
    -f, --margin=<sec>When using -D, measure results within this margin (default: 2)
    -l, --post_list=<list size>Post list of send WQEs of <list size> instead of single post
    --recv_post_list=<list size>Post list of receive WQEs of <list size> instead of single post
    -q, --qp=<num of qp's>Number of QPs running in the process (default: 1)
    --run_infinitelyRun until interrupted, printing results every 5 seconds
  12. Common CLI options for all perftest tests

    master

    These options are available across most benchmark tools in the collection.

    OptionDescription
    -h, --helpDisplay help message
    -p, --port=<port>Listen/connect on port (default: 18515)
    -R, --rdma_cmConnect QPs using rdma_cm
    -z, --comm_rdma_cmUse rdma_cm to exchange data (uses regular QPs)
    -m, --mtu=<mtu>QP MTU size (default: active_mtu from ibv_devinfo)
    -c, --connection=<type>Connection type: RC/UC/UD/XRC/DC/SRD (default: RC)
    -d, --ib-dev=<dev>Use specific IB device (default: first found)
    -i, --ib-port=<port>Use specific network port of IB device (default: 1)
    -s, --size=<size>Message size (default: 1)
    -a, --allRun sizes from 2 to 2^23
    -n, --iters=<iters>Number of exchanges (min 100, default: 1000)
    -V, --versionDisplay version
    -e, --eventsSleep on CQ events (default: poll)
    -F, --CPU-freqDo not fail if cpufreq_ondemand is active
    -I, --inline_size=<size>Max size for inline mode
    -u, --qp-timeout=<timeout>QP timeout: (4 uSec)*(2^timeout) (default: 14)
    -S, --sl=<sl>Service Level (default: 0)
    -r, --rx-depth=<dep>Receive queue depth (default: 600)