NVIDIA CUDA 编译器驱动程序NVIDIA CUDA Compiler Driver
NVIDIA CUDA 编译器驱动(NVIDIA CUDA Compiler Driver,即 nvcc)是用于编译 CUDA C/C++ 程序的工具链。它输出符合主机 ABI 的二进制可执行文件,其中包含要在 GPU 上执行的 PTX 和/或 SASS —— 这种文件被称为 "胖二进制文件"(fat binary)。 这些二进制文件可以使用与其他二进制文件相同的工具(如 Linux 上的 readelf)进行检查,还可以使用专门的 CUDA 二进制工具集 进行额外操作。
其中包含的 PTX 代码通过 计算能力 (Compute Capability) 进行版本控制,可通过向 --gpu-architecture 或 --gpu-code 选项传递 compute_XYz 值来配置。
包含的 SASS 代码则通过 流式多处理器架构版本 (SM architecture version) 进行版本控制,通过向 --gpu-architecture 或 --gpu-code 选项传递 sm_XYz 值来配置。将 compute_XYz 传递给 --gpu-code 也会触发生成与 PTX 版本相同的 SASS 代码。
主机/CPU 代码的编译通过主机系统的编译器驱动,例如 gcc 编译器驱动程序。请注意,不要将编译器驱动程序与硬件驱动程序(如 NVIDIA GPU 驱动程序)混淆。
nvcc 的文档可以在 此处 找到。
英文原文(Modal GPU Glossary)
The NVIDIA CUDA Compiler Driver is a toolchain for compiling CUDA C/C++ programs. It outputs binary executables that conform to the host ABI and include PTX and/or SASS to be executed on the GPU — a so-called "fat binary". These binaries are inspectable with the same tools used for other binaries, like readelf on Linux, but can be additionally manipulated with the specialized CUDA Binary Utilities.
The included PTX code is versioned by Compute Capability, configured by passing compute_XYz values to the --gpu-architecture or --gpu-code options.
The included SASS code is versioned by SM architecture version, configured by passing sm_XYz values to the --gpu-architecture or --gpu-code options. Passing compute_XYz to --gpu-code will also trigger the generation of SASS code with the same version as the PTX.
Compilation of host/CPU code is done using the host system's compiler driver, e.g. the gcc compiler driver. Note that compiler drivers are not to be confused with hardware drivers, like the NVIDIA GPU Drivers.
The documentation for nvcc can be found here.
相关词条
本词条改编自 Modal GPU Glossary(CC BY 4.0)· 中文翻译 miter6/gpu-glossary-zh,MAE 整理排版。