让 B300 上的 cudaMemcpy 加速 5 倍 [P]

Reddit r/MachineLearning 工具

摘要

一位开发者发布了开源工具 cudamemcpy-tuner,可将 NVIDIA B300 GPU 上使用可分页内存的 cudaMemcpy 传输速度提升至原来的 5 倍,通过一条 `cmt tune` 命令,即可将 1 GB 数据从 CPU 复制到 GPU 的速度从 10.2 GB/s 提升至 51.5 GB/s。

https://preview.redd.it/cjz9xy3rht1i1.png?width=1600&format=png&auto=webp&s=0eea8a5d9e53d5ea4593ce1a629bc7342a049ffa 大家好,我做了一个工具,可以加快 cudaMemcpy 从可分页内存进行的数据传输。例如:# B300,将一个 1 GB 的张量复制到 GPU 再复制回来:import time, torch x = torch.ones(1 << 30, dtype=torch.uint8) y = x.to("cuda"); y.cpu() for name, copy in [("CPU -> GPU", lambda: (x.to("cuda"), torch.cuda.synchronize()))]: t = time.perf_counter() for _ in range(5): copy() print(f"{name}: {5 * x.nbytes / (time.perf_counter() - t) / 1e9:.1f} GB/s") $ python bench.py CPU -> GPU: 10.2 GB/s $ cmt tune -- python bench.py CPU -> GPU: 51.5 GB/s 博客:https://maknee.github.io/blog/2026/CudaMemcpy/ 代码:https://github.com/Maknee/cudamemcpy-tuner
查看原文

相似文章

# 为加速 MoE 的预填充与解码,对 DDR5 进行超频

Reddit r/LocalLLaMA

一名开发者展示,在运行 llama.cpp(使用 SYCL 后端)的 Intel B70 上,对采用 AMD 7950X 平台的系统进行 DDR5 内存超频,可以带来适度但可测量的性能提升:对于无法完全放入显存的 MoE 模型,预填充速度最高提升 14%,token 生成速度提升 8%。随着上下文长度加深,收益还会进一步扩大。

CUDA 共享内存交错

Hacker News Top

本文解释了CUDA共享内存交错技术,用于优化GPU内存访问模式,并通过代码示例展示性能提升。