NVCC options compatibility (v1.5)
Option | Description | Status |
"-o, --output-file <file>" | Specifies the name and location of the output file. | ✅ |
"-objtemp, --objdir-as-tempdir" | Creates all intermediate files in the same directory as the object file. | ✅ |
"-include, --pre-include <file,…>" | Specifies header files to pre-include during preprocessing. | ✅ |
"-l, --library <library,…>" | Specifies libraries to use during linking, without the file extension. | ✅ |
"-D, --define-macro <def,…>" | Defines macros to use during preprocessing. | ✅ |
"-U --undefine-macro <def,…>" | Undefines an existing macro during preprocessing or compilation. | ✅ |
"-I, --include-path <path,…>" | Specifies include search paths. | ✅ |
"-isystem, --system-include <path,…>" | Specifies system include search paths. | ✅ |
"-L, --library-path <path,…>" | Specifies library search paths. | ✅ |
"-odir, --output-directory <directory>" | Specifies the directory for the output file. | ✅ |
"-MF, --dependency-output <file>" | Specifies the dependency output file. | ✅ |
"-MP, --generate-dependency-targets" | Adds an empty target for each dependency. | ✅ |
"-ccbin, --compiler-bindir <directory>" | Specifies the directory where the default host compiler executable resides. | ✅ |
"-allow-unsupported-compiler, --allow-unsupported-compiler" | Disables the | ✅ |
"-arbin, --archiver-binary <executable>" | Specifies the path to the archiver tool for creating static libraries with | ✅ |
"-cudart, --cudart <none|shared|static>" | Specifies the type of CUDA runtime library to use: none, shared (dynamic), or static. | ✅ |
"-cudadevrt, --cudadevrt <none|static>" | Specifies the type of CUDA device runtime library to use: none or static. | ❌ |
"-ldir, --libdevice-directory <directory>" | Specifies the directory that contains the | ✅ |
"-target-dir, --target-directory <dir>" | Specifies the subfolder in the targets directory that contains the default include and library paths. | ✅ |
"-link, --link" | Specifies the default behavior: compile and link all input files. | ✅ |
"-lib, --lib" | Compiles input files into object files as needed, and adds them to the specified library output file. | ✅ |
"-dlink, --device-link" | Links object files with relocatable device code and | ✅ |
"-dc, --device-c" | Compiles each | ✅ |
"-dw, --device-w" | Compiles each | ✅ |
"-cuda, --cuda" | Compiles each | ✅ |
"-c, --compile" | Compiles each | ✅ |
"-fatbin, --fatbin" | Compiles all | ✅ |
"-cubin, --cubin" | Compiles all | ✅ |
"-ptx, --ptx" | Compiles all | ✅ |
"-E, --preprocess" | Preprocesses all | ✅ |
"-M, --generate-dependencies" | Generates a dependency file for the | ✅ |
"-MM, --generate-nonsystem-dependencies" | Same as | ✅ |
"-MD, --generate-dependencies-with-compile" | This option cannot be specified with | ✅ |
"-MMD, --generate-nonsystem-dependencies-with-compile" | Same as | ✅ |
"-run, --run" | Compiles and links all input files into an executable, and then runs it. | ✅ |
"-pg, --profile" | Instruments the generated code for profiling with | ❌ |
"-g, --debug" | Generates debug information for host code. | ✅ |
"-G, --device-debug" | Generates debug information for device code. | ✅ |
"-ewp, --extensible-whole-program" | Generates extensible whole program device code, deferring the resolution of some calls until linking with | ❌ |
"-no-compress, --no-compress" | Does not compress device code in the fatbin. | ❌ |
"-lineinfo, --generate-line-info" | Generates line-number information for device code. | ✅ |
"-opt-info, --optimization-info <kind,…>" | Provides optimization reports for the specified kind of optimization.
The following tags are supported:
| ❌ |
"-O, --optimize <level>" | Specifies the optimization level for host code. | ✅ |
"-dlto, --dlink-time-opt" | Performs link-time optimization of device code. The | ✅ |
"-ftemplate-backtrace-limit, --ftemplate-backtrace-limit <limit>" | Sets the maximum number of template instantiation notes for a single warning or error. | ✅ |
"-ftemplate-depth, --ftemplate-depth <limit>" | Sets the maximum instantiation depth for template classes. | ✅ |
"-noeh, --no-exceptions" | Disables exception handling for host code. | ✅ |
"-shared, --shared" | Generates a shared library during linking. | ✅ |
"-x, --x <c|c++|cu>" | Explicitly specifies the language for the input files, rather than letting the compiler infer it from the file name suffix. | ✅ |
"-std, --std <c++03|c++11|c++14|c++17>" | Selects a particular C++ dialect. | ✅ |
"-nohdinitlist, --no-host-device-initializer-list" | Prevents member functions of | ✅ |
"-expt-relaxed-constexpr, --expt-relaxed-constexpr" | Experimental flag: Allows host code to invoke | ✅ |
"-extended-lambda, --extended-lambda" "-expt-extended-lambda, --expt-extended-lambda" | Allows | ✅ |
"-m, --machine <32|64>" "-m32, --m32" "-m64, --m64" | Specifies a 32-bit or 64-bit architecture. | ✅ |
"-hls, --host-linker-script <use-lcs|gen-lcs>" | Uses the host linker script to enable support for certain CUDA-specific requirements when building executables or shared libraries (GNU/Linux only). | ✅ |
"-aug-hls, --augment-host-linker-scipt" | Generates a host linker script that augments an existing one (GNU/Linux only). | ✅ |
"-dopt, --dopt <=on>" | Enables device code optimization. When specified with | ✅ |
"-r, --host-relocatable-link" | When used with | ✅ |
"-gen-opt-lto, --gen-opt-lto" | Runs the optimizer passes before generating the LTO intermediate representation (IR). | ✅ |
"-Xcompiler, --compiler-options <options,…>" | Specifies options directly to the compiler/preprocessor. | ✅ |
"-Xlinker, --linker-options <options,…>" | Specifies options directly to the host linker. | ✅ |
"-Xarchive, --archive-options <options,…>" | Specifies options directly to the library manager. | ✅ |
"-Xptxas, --ptxas-options <options,…>" | Specifies options directly to | ✅ |
"-Xnvlink,--nvlink-options <options,…>" | Specifies options directly to | ✅ |
"-forward-unknown-to-host-compiler, --forward-unknown-to-host-compiler" | Forwards unknown options to the host compiler. | ✅ |
"-forward-unknown-to-host-linker, --forward-unknown-to-host-linker" | Forwards unknown options to the host linker. | ✅ |
"-noprof, --dont-use-profile" | Does not use configurations from the | ❌ |
"-t, --threads number" | Specifies the maximum number of threads to use for executing compilation steps in parallel. This option can improve compilation speed when compiling for multiple architectures. | ✅ |
"-dryrun, --dryrun" | Lists the compilation sub-commands without executing them. | ✅ |
"-v, --verbose" | Lists the compilation sub-commands while executing them. | ✅ |
"-keep, --keep" "-save-temps, --save-temps" | Keeps all intermediate files that are generated during internal compilation steps. | ✅ |
"-keep-dir, --keep-dir <directory>" | Keeps all intermediate files that are generated during internal compilation steps in this directory. | ✅ |
"-clean, --clean-targets" | Deletes all non-temporary files that the same | ✅ |
"-run-args, --run-args <arguments,…>" | Specifies command-line arguments for the executable when used with | ✅ |
"-idp, --input-drive-prefix <prefix>" | Specifies the input drive prefix. | ❌ |
"-ddp, --dependency-drive-prefix <prefix>" | Specifies the dependency drive prefix. | ❌ |
"-dp, --drive-prefix <prefix>" | Specifies the drive prefix. | ❌ |
"-MT, --dependency-target-name <target>" | Specifies the target name of the generated rule when generating a dependency file. | ✅ |
"--no-align-double" | Prevents | ❌ |
"-nodlink, --no-device-link" | Skips the device link step when linking object files. | ❌ |
"-allow-unsupported-compiler, --allow-unsupported-compiler" | Disables the | ✅ |
"-default-stream, --default-stream <legacy|null|per-thread>" | Specifies the stream that CUDA commands from the compiled program are sent to by default. | ✅ |
--gpu-architecture | Specifies the NVIDIA virtual GPU architecture for which to compile the CUDA input files. | ✅ |
"-arch, --gpu-architecture <arch|all|all-major>" | Specifies the NVIDIA virtual GPU architecture for which to compile the CUDA input files. | ✅ |
"-code, --gpu-code <code,…>" | Specifies the name of the NVIDIA GPU to assemble and optimize PTX for. | ✅ |
"-gencode, --generate-code <specification>" | Provides a more general and flexible way to specify architectures than | ✅ |
"-rdc, --relocatable-device-code <true|false>" | Enables or disables the generation of relocatable device code. If disabled, executable device code is generated. Relocatable device code requires linking before execution. | ✅ |
"-e, --entries <entry,…>" | Specifies which global entry functions to generate code for. PTX is generated for all entry functions, but only the selected entry functions are assembled. Entry function names must be provided in their mangled form. | ✅ |
"-maxrregcount, --maxrregcount <amount>" | Specifies the maximum number of registers that GPU functions can use. | ✅ |
"-use_fast_math, --use_fast_math" | Uses the fast math library.
| ✅ |
"-ftz, --ftz <true|false>" | Controls single-precision denormals support.
| ✅ |
"-prec-div, --prec-div <true|false>" | This option controls single-precision floating-point division and reciprocals.
| ✅ |
"-prec-sqrt, --prec-sqrt <true|false>" | This option controls single-precision floating-point square root.
| ✅ |
"-fmad, --fmad <true|false>" | Enables or disables the contraction of floating-point multiplications and additions/subtractions into floating-point multiply-add (FMAD, FFMA, or DFMA) operations. | ✅ |
"-extra-device-vectorization, --extra-device-vectorization" | Enables more aggressive device code vectorization. | ✅ |
"-astoolspatch, --compile-as-tools-patch" | Compiles patch code for CUDA tools. Implies | ✅ |
"-keep-device-functions, --keep-device-functions" | In whole program compilation mode, preserves user-defined, external-linkage | ✅ |
"-w, --disable-warnings" | Suppresses all warning messages. | ✅ |
"-src-in-ptx, --source-in-ptx" | Interleaves source code as comments in the PTX output. | ✅ |
"-restrict, --restrict" | Asserts that all kernel pointer parameters are | ✅ |
"-Wno-deprecated-gpu-targets, --Wno-deprecated-gpu-targets" | Suppresses warnings about deprecated GPU target architectures. | ✅ |
"-Wno-deprecated-declarations, --Wno-deprecated-declarations" | Suppresses warnings on the use of a deprecated entity. | ✅ |
"-Wreorder, --Wreorder" | Generates warnings when member initializers are reordered. | ✅ |
"-Wdefault-stream-launch, --Wdefault-stream-launch" | Generates a warning when an explicit stream argument is not provided in the | ✅ |
"-Wext-lambda-captures-this, --Wext-lambda-captures-this" | Generates a warning when an extended lambda implicitly captures | ✅ |
"-Werror, --Werror <kind,…>" | Treats warnings of the specified kinds as errors.
Accepted kinds are:
| ✅ |
"-err-no, --display-error-number" | Displays a diagnostic number for each message from the CUDA frontend compiler (note: not the host compiler). | ❌ |
"-no-err-no, --no-display-error-number" | Disables the display of a diagnostic number for messages from the CUDA frontend compiler (note: not the host compiler). | ❌ |
"-diag-error, --diag-error <errNum,…>" | Emits an error for specified diagnostic messages generated by the CUDA frontend compiler (note: does not affect diagnostics generated by the host compiler/preprocessor). | ❌ |
"-diag-suppress, --diag-suppress <errNum,…>" | Suppresses specified diagnostic messages generated by the CUDA frontend compiler (note: does not affect diagnostics generated by the host compiler/preprocessor). | ❌ |
"-diag-warn, --diag-warn <errNum,…>" | Emits a warning for specified diagnostic messages generated by the CUDA frontend compiler (note: does not affect diagnostics generated by the host compiler/preprocessor). | ❌ |
"-res-usage, --resource-usage" | Shows GPU code resource usage, such as registers and memory. | ✅ |
"-h, --help" | Displays help information for this tool. | ✅ |
"-V, --version" | Displays version information for this tool. | ✅ |
"-optf, --options-file <file,…>" | Includes command-line options from a specified file. | ✅ |
"-time, --time <filename>" | Generates a comma-separated value (CSV) table with the time taken by each compilation phase and appends it to the specified file. If the file is empty, column headings are generated in the first row.
If the file name is ' | ✅ |
"-qpp-config, --qpp-config <config>" | Specifies the configuration ( | ❌ |
"-code-ls, --list-gpu-code" | Lists the GPU architectures ( | ✅ |
"-arch-ls, --list-gpu-arch" | Lists the virtual device architectures ( | ✅ |
--Wmissing-launch-bounds, -Wmissing-launch-bounds | Generates a warning when a | ✅ |
"-allow-expensive-optimizations, --allow-expensive-optimizations" | Allows the compiler to perform expensive optimizations by using the maximum available resources (memory and compile time).
If unspecified, this feature is enabled by default for optimization level | ❌ |
"-c, --compile-only" | Generates a relocatable object file. | ✅ |
"-dlcm, --def-load-cache" | Default cache modifier for global/generic loads.
Default value: | ✅ |
"-dscm, --def-store-cache" | Default cache modifier for global/generic stores. | ✅ |
"-g, --device-debug" | Generates debug information for device code. | ✅ |
"-disable-optimizer-consts, --disable-optimizer-consts" | Disables the use of the optimizer constant bank. | ✅ |
"-e, --entry <entry,…>" | Specifies which global entry functions to generate code for. | ✅ |
"-fmad, --fmad" | Enables or disables the contraction of floating-point multiplications and additions/subtractions into floating-point multiply-add (FMAD, FFMA, or DFMA) operations. | ✅ |
"-flcm, --force-load-cache" | Forces the specified cache modifier on global/generic loads. | ✅ |
"-fscm, --force-store-cache" | Forces the specified cache modifier on global/generic stores. | ✅ |
"-lineinfo, --generate-line-info" | Generates line-number information for device code. | ✅ |
"-arch, --gpu-name <gpuname>" | Specifies the name of the NVIDIA GPU to generate code for.
This option also accepts virtual compute architectures, in which case code generation is suppressed. This can be used for parsing only.
Allowed values for this option: | ✅ |
"-h, --help" | Displays help information. | ✅ |
"-m, --machine" | Specifies a 32-bit or 64-bit architecture. | ✅ |
"-maxrregcount, --maxrregcount <amount>" | Specifies the maximum number of registers that GPU functions can use. | ✅ |
"-O, --opt-level <N>" | Specifies the optimization level. Default value: 3. | ✅ |
"-optf, --options-file <file,…>" | Includes command-line options from a specified file. | ✅ |
"-preserve-relocs, --preserve-relocs" | Generates relocatable references for variables and preserves the relocations in the linked executable. | ❌ |
"-sp-bound-check, --sp-bound-check" | Generates a stack-pointer bounds-checking code sequence.
This option is enabled automatically with | ✅ |
"-v, --verbose" | Enables verbose mode, which prints code generation statistics. | ✅ |
"-V, --version" | Displays version information. | ✅ |
"-Werror, --warning-as-error" | Treats all warnings as errors. | ✅ |
"-warn-double-usage, --warn-on-double-precision-use" | Warns if double-precision values are used in an instruction. | ✅ |
"-warn-lmem-usage, --warn-on-local-memory-usage" | Warns if local memory is used. | ✅ |
"-warn-spills, --warn-on-spills" | Warns if registers are spilled to local memory. | ✅ |
"-astoolspatch, --compile-as-tools-patch" | Compiles patch code for CUDA tools.
Shall not be used in conjunction with | ✅ |
"-pic, --position-independent-code" | Generates position-independent code. | ✅ |
"-maxntid, --maxntid" | Specifies the maximum number of threads that a thread block can have. | ✅ |
"-minnctapersm, --minnctapersm" | Specifies the minimum number of Cooperative Thread Arrays (CTAs) to be mapped to a Streaming Multiprocessor (SM). | ✅ |
"-w, --disable-warnings" | Suppresses all warning messages. | ✅ |
"-preserve-relocs, --preserve-relocs" | Preserves resolved relocations in the linked executable. | ❌ |
"-v, --verbose" | Enables verbose mode, which prints code generation statistics. | ✅ |
"-Werror, --warning-as-error" | Treats all warnings as errors. | ✅ |
"-suppress-arch-warning, --suppress-arch-warning" | Suppresses warnings about objects that do not contain code for the target architecture. | ❌ |
"-suppress-stack-size-warning, --suppress-stack-size-warning" | Suppresses the warning that is otherwise printed when the stack size cannot be determined. | ✅ |
"-dump-callgraph, --dump-callgraph" | Dumps information about the call graph and register usage. | ✅ |
--dump-callgraph-no-demangle (-dump-callgraph-no-demangle) | Dumps call graph information without demangling. | ✅ |
--Xptxas (-Xptxas) | Specifies ptxas options (only used with LTO). | ❌ |
--cpu-arch (-cpu-arch) | Specifies the name of the CPU target architecture. | ❌ |
--extra-warnings (-extrawarn) | Emits extra warnings about possible problems. | ❌ |
--gen-host-linker-script (-ghls) | Specifies the type of host linker script to be generated. | ❌ |
--ignore-host-info (-ignore-host-info) | Ignores information about host references, so device code that could potentially be referenced by the host is not removed. | ❌ |
--keep-system-libraries (-keep-system-libraries) | Does not optimize away system library (e.g. | ❌ |
--kernels-used (-kernels-used) | Specifies which kernels are used. This can be part of a kernel name to match any kernels containing that string. If this option is used, all other kernels are considered dead code and are removed. | ❌ |
--options-file (-optf) | Includes command-line options from the specified file. | ❌ |
--report-arch (-report-arch) | Reports the SM target architecture in error messages. | ❌ |
--suppress-debug-info (-suppress-debug-info) | Does not preserve debug symbols in the output. This option is ignored if used without the | ❌ |
--variables-used (-variables used) | Specifies which variables are used. This can be part of a variable name to match any variable with that string in its name. If this option is used, all other variables are considered dead code and are potentially removed unless they are accessed from other device code. | ❌ |
--device-stack-protector {true|false} (-device-stack-protector) | Enables or disables the generation of stack canaries in device code (used only with LTO). Stack canaries help protect against certain types of memory safety bugs that involve stack-local variables. The compiler uses heuristics to assess the risk of such a bug in each function. Only functions deemed high-risk will use a stack canary. | ❌ |