GPU Glossary
Host Software·1 min read

NVIDIA CUDA Compiler Drivernvcc

The toolchain that compiles CUDA C/C++ programs into "fat binaries" containing host code plus PTX and/or SASS for the GPU.

The NVIDIA CUDA Compiler Driver, nvcc, compiles CUDA C/C++ programs. Its output is a binary executable that conforms to the host ABI and also embeds PTX and/or SASS for the GPU to run. This combined artifact is called a "fat binary".

Fat binaries can be inspected with ordinary binary tools, like readelf on Linux, and also with the specialized CUDA Binary Utilities.

Choosing what GPU code to embed#

Both --gpu-architecture and --gpu-code control which device code goes into the binary:

Code Versioned by Option value
PTX Compute Capability compute_XYz
SASS SM architecture version sm_XYz

Passing compute_XYz to --gpu-code also generates SASS with the same version as the PTX.

Host code#

nvcc hands host (CPU) code to the host system's compiler driver, such as gcc. "Compiler driver" here means a program that orchestrates compilation steps; don't confuse it with hardware drivers like the NVIDIA GPU Drivers.

See the nvcc documentation for details.

  • nvrtc: compiles CUDA C++ to PTX at runtime, in-process
  • CUDA Binary Utilities: tools for inspecting nvcc output
  • PTX: the virtual ISA embedded in fat binaries
  • SASS: the architecture-specific assembly embedded in fat binaries