如何在 Linux 中读取 CUDA .cubin 二进制文件?

发布于 2024-09-30 19:17:56 字数 320 浏览 0 评论 0原文

我正在尝试获取 CUDA 程序中每个内核的每个线程的寄存器数量。这将帮助我使用 CUDA 占用计算器 (http://developer.download.nvidia.com/compute/cuda/CUDA_Occupancy_calculator.xls) 来确定我的程序的 GPU 的最高占用率。

但是,我已经使用 -cubin 标志生成了 .cubin 文件,但无法按照 NVIDIA (http://forums.nvidia.com/index.php?showtopic=31279) 的建议在 vim/othertexteditors 中读取它。有谁知道如何阅读它吗?

谢谢

I'm trying to get the number of registers per thread for each of my kernels in my CUDA program. This will help me use the CUDA Occupancy Calculator (http://developer.download.nvidia.com/compute/cuda/CUDA_Occupancy_calculator.xls) as to determine the highest occupancy of the GPU for my program.

However, I have generated the .cubin file using the -cubin flag but I am unable to read it in vim/othertexteditors, as suggested by NVIDIA (http://forums.nvidia.com/index.php?showtopic=31279). Does anyone know how to get to read it?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不…忘初心 2024-10-07 19:17:56

最简单的解决方案是将 -Xptxas -v 传递给 nvcc ,如下所示

$ nvcc -Xptxas -v foo.cu
ptxas info    : Compiling entry function '_Z9my_kernelPfS_f' for 'sm_10'
ptxas info    : Used 2 registers, 20+16 bytes smem

或者,您可以使用 cudaFuncGetAttributes API 函数,用于在运行时获取必要的值。

The easiest solution is to pass -Xptxas -v to nvcc like so

$ nvcc -Xptxas -v foo.cu
ptxas info    : Compiling entry function '_Z9my_kernelPfS_f' for 'sm_10'
ptxas info    : Used 2 registers, 20+16 bytes smem

Alternatively, you can use the cudaFuncGetAttributes API function to obtain the necessary values at runtime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文