Skip to content
ArchLabXPublic

About

An example workload for testing GPU Clusters

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

bench: GPU benchmark for LLM inference and TFHE

1. Description

This benchmark measures the performance of the GPU partitions on the cluster. One Slurm job does all of the tests. One job takes approximately 5 to 8 minutes.

The cluster has these GPU types:

Partition GPU
rtx-batch, rtx-devel NVIDIA RTX PRO 6000 Blackwell
b200-batch, b200-devel, b200-fullnode NVIDIA B200

The benchmark has three parts:

Part Software Tests
Native CUDA (cuda/) Module cuda/13.1.1. The job compiles the code with nvcc -arch=native. Memory bandwidth (STREAM). Memory latency (pointer chase in L1, L2 and HBM). A tiled FP32 GEMM kernel compared with cuBLAS. cuBLAS FP64 and BF16 GEMM. A fused TFHE bootstrap kernel.
PyTorch (bench.py, gpubench/) Module pytorch/26.04-py3 (NGC container). Memory bandwidth and host transfer. GEMM from FP64 to FP8 and INT8. Flash attention. LLM inference with a model that has the Llama-3-8B shape. TFHE bootstrap with an FP64 FFT. A 60-second load test for thermal throttling.
NCCL (nccl_bench.py) PyTorch container. All-reduce bus bandwidth. This test runs only when the job has more than one GPU.

2. Procedure: run the benchmark

2.1 Run on the two GPU types

  1. Go to the project directory.

  2. Submit the jobs:

    ./submit_all.sh

    This command submits one job to rtx-devel and one job to b200-devel.

  3. Monitor the jobs:

    squeue --me
  4. When the jobs are complete, show the comparison table:

    python3 compare.py

2.2 Run on one partition

  • To use the default partition (rtx-devel), type:

    sbatch run_bench.sbatch
  • To use a different partition, add -p:

    sbatch -p b200-devel run_bench.sbatch
  • To include the NCCL test, request more than one GPU:

    sbatch -p b200-devel --gpus=8 run_bench.sbatch
  • To do a short test (approximately 3 minutes), set BENCH_ARGS:

    BENCH_ARGS=--quick sbatch run_bench.sbatch

3. Results

Each job writes these files:

File Contents
logs/gpu-bench-<jobid>.out The log of the job. You can read it.
results/<partition>-<jobid>.json All of the measured values. The headline key contains the most important values.
results/plots/<partition>-<jobid>/ The charts for this job.
results/plots/all/dashboard.png The charts for all of the jobs. Each GPU type has a different color.

3.1 Procedure: make the charts again

  1. Load the PyTorch module:

    module load pytorch/26.04-py3
  2. Run the plot script with the result files that you select:

    python plot_results.py results/rtx-devel-*.json results/b200-devel-*.json --outdir results/plots/cmp

4. Test details

4.1 LLM inference (gpubench/llm.py)

The model has the shape of Llama-3-8B:

  • 8.0 billion parameters
  • Hidden size 4096, 32 layers
  • 32 query heads and 8 KV heads (GQA)
  • FFN size 14336, vocabulary 128256
  • BF16 weights with random values

The test does not download model weights.

The prefill test uses batch 1 and batch 4, with 2048 tokens each. Prefill speed is limited by compute. The test reports tokens per second, time to first token and TFLOPS.

The decode test uses batch 1 to batch 128, with a KV cache of 1024 tokens. The test uses a CUDA graph. Decode speed is limited by memory bandwidth. The test reports tokens per second and effective bandwidth. Effective bandwidth is the bytes of weights and KV cache that one step reads, divided by the step time. Compare decode_b1_eff_GBps with mem.read_GBps. This comparison shows how near decode is to the memory limit.

The model does not include RoPE, sampling or a paged KV cache.

4.2 TFHE bootstrap

There are two different implementations of the programmable bootstrap (PBS). Each implementation does blind rotation and sample extraction. Key switching is not included.

Each implementation does a functional test. The test encrypts random messages. The test applies the lookup table f(m) = 3m + 1 mod 4. Then the test decrypts the results and compares them with the correct values.

Implementation Method Parameters
cuda/tfhe_pbs.cu Fused kernel (cuFHE style). One thread block does the full blind rotation of one ciphertext. Exact negacyclic NTT with the Goldilocks prime. 32-bit torus. n = 630, N = 1024, k = 1, l = 3, Bg = 2^7
gpubench/tfhe.py PyTorch. 64-bit torus with a complex128 FFT (TFHE-rs method). n = 630, N = 1024, l = 3 and n = 742, N = 2048, l = 1

The CUDA kernel reports bootstraps per second for batch 1 to batch 16384. It also reports the latency of one bootstrap.

The PyTorch version starts many small kernels. Thus, kernel launch time limits its speed at small batch sizes. Use it as an FP64 FFT stress test. Do not use it as an absolute TFHE performance value.

WARNING: The keys use low noise levels. This code is not secure. Use it only for benchmarks.

FFT-based TFHE uses FP64 arithmetic. The B200 has much more FP64 throughput than the RTX PRO 6000. The gemm.fp64 value and the PyTorch TFHE values show this difference. The NTT kernel uses only 64-bit integer operations.

5. Notes

  • The pytorch module runs a Singularity container. The module does not give the --nv option to Singularity. Without --nv, the container cannot find the GPU. The job script sets SINGULARITY_COMMAND_OPTS=--nv. Set this variable also when you use the container interactively.
  • The job script unloads the cuda module before it starts the container. This prevents conflicts between the host CUDA libraries and the container CUDA libraries.
  • Each job compiles the CUDA code in build/<partition>-<jobid>/. The option -arch=native selects sm_100 on the B200 and sm_120 on the RTX PRO 6000.

6. Files

File Function
run_bench.sbatch The job script. It compiles and runs the CUDA tests, then runs the PyTorch tests, the NCCL test and the plot script.
submit_all.sh Submits one job to rtx-devel and one job to b200-devel.
compare.py Shows a table that compares the results of the jobs.
plot_results.py Makes dashboard.png and one PNG file for each chart.
bench.py Starts the PyTorch tests. Options: --quick, --only, --out.
gpubench/ The PyTorch tests: basic.py (memory, GEMM, attention, load test), llm.py, tfhe.py.
cuda/ The CUDA tests: membw.cu, gemm.cu, tfhe_pbs.cu, common.cuh.
nccl_bench.py The multi-GPU all-reduce test.

About

An example workload for testing GPU Clusters

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages