NVCC options compatibility (v1.4)

Updated at:
Copy as MD

Parameter

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 object file's directory.

✅

-include, --pre-include <file,…>

Specifies header files to pre-include during preprocessing.

✅

-l, --library <library,…>

Specifies libraries to use in the linking stage, 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 output file directory.

✅

-MF, --dependency-output <file>

Specifies the dependency output file.

✅

-MP, --generate-dependency-targets

Adds an empty target for each dependency in the dependency file.

✅

-ccbin, --compiler-bindir <directory>

Specifies the directory of the default host compiler executable.

✅

-allow-unsupported-compiler, --allow-unsupported-compiler

Disables the nvcc check for supported host compiler versions.

✅

-arbin, --archiver-binary <executable>

Specifies the path to the archiver tool for creating a static library with the --lib option.

✅

-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 containing the libdevice library files.

✅

-target-dir, --target-directory <dir>

Specifies the subfolder name 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, if needed, and adds the results to the specified library output file.

✅

-dlink, --device-link

Links object files with relocatable device code, .ptx, .cubin, and .fatbin files into a single object file with executable device code for the host linker.

✅

-dc, --device-c

Compiles each input file (.c, .cc, .cpp, .cxx, .cu) into an object file containing relocatable device code. This is equivalent to --relocatable-device-code=true --compile.

✅

-dw, --device-w

Compiles each input file (.c, .cc, .cpp, .cxx, .cu) into an object file containing executable device code. This is equivalent to --relocatable-device-code=false --compile.

✅

-cuda, --cuda

Compiles each .cu input file into a .cu.cpp.ii file. Not supported with --relocatable-device-code=true.

✅

-c, --compile

Compiles each .c, .cc, .cpp, .cxx, and .cu input file into an object file.

✅

-fatbin, --fatbin

Compiles all .cu, .ptx, and .cubin inputs into device-only .fatbin files, discarding any host code from .cu files.

✅

-cubin, --cubin

Compiles all .cu and .ptx inputs into device-only .cubin files, discarding any host code from .cu files.

✅

-ptx, --ptx

Compiles all .cu inputs into device-only .ptx files, discarding any host code.

✅

-E, --preprocess

Preprocesses all .c, .cc, .cpp, .cxx, and .cu input files.

✅

-M, --generate-dependencies

Generates a Makefile-compatible dependency file for the input file.

✅

-MM, --generate-nonsystem-dependencies

Same as -M, but excludes system header files (Linux only).

✅

-MD, --generate-dependencies-with-compile

Generates a dependency file and compiles the source. This option cannot be used with -E. The dependency filename is set by -MF. Otherwise, it is derived by replacing the suffix of the output file (from -o) or the input file with '.d'.

✅

-MMD, --generate-nonsystem-dependencies-with-compile

Same as -MD, but excludes system header files (Linux only).

✅

-run, --run

Compiles and links all input files into an executable, then runs it.

✅

-pg, --profile

Instruments the generated code for gprof profiling.

✅

-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, allowing some calls to be resolved at link time with libcudadevrt.

✅

-no-compress, --no-compress

Disables compression of device code in the fatbinary.

✅

-lineinfo, --generate-line-info

Generates line-number information for device code.

✅

-opt-info, --optimization-info <kind,…>

Provides optimization reports for a specified kind. The inline kind is supported and emits remarks about function inlining.

✅

-O, --optimize <level>

Specifies the optimization level for host code.

✅

-dlto, --dlink-time-opt

Enables link-time optimization (LTO) for device code. Alias: -lto.

✅

-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 the linking stage.

✅

-x, --x <c|c++|cu>

Explicitly specifies the language of input files, overriding inference from the file extension.

✅

-std, --std <c++03|c++11|c++14|c++17>

Selects a particular C++ dialect.

✅

-nohdinitlist, --no-host-device-initializer-list

Prevents std::initializer_list member functions from being implicitly treated as __host__ __device__ functions.

✅

-expt-relaxed-constexpr, --expt-relaxed-constexpr

Experimental: Allows host code to invoke __device__ constexpr functions, and device code to invoke __host__ constexpr functions.

✅

-extended-lambda, --extended-lambda
-expt-extended-lambda, --expt-extended-lambda

Allows __host__ and __device__ annotations in lambda declarations.

✅

-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 support CUDA-specific requirements when building executables or shared libraries (GNU/Linux only).

✅

-aug-hls, --augment-host-linker-scipt

Enables generation of a host linker script that augments an existing host linker script (GNU/Linux only).

✅

-dopt, --dopt <=on>

Enables device code optimization. When specified with -G, enables limited debug information (currently, only line number information) for optimized device code. This option is implicit unless -G is specified.

✅

-r, --host-relocatable-link

With -hls=gen-lcs, generates a host linker script for a host relocatable link (ld -r).

✅

-gen-opt-lto, --gen-opt-lto

Runs the optimizer passes before generating the LTO IR.

✅

-Xcompiler, --compiler-options <options,…>

Passes options directly to the host compiler/preprocessor.

✅

-Xlinker, --linker-options <options,…>

Passes options directly to the host linker.

✅

-Xarchive, --archive-options <options,…>

Passes options directly to the library manager.

✅

-Xptxas, --ptxas-options <options,…>

Passes options directly to ptxas, the PTX optimizing assembler.

✅

-Xnvlink,--nvlink-options <options,…>

Passes options directly to nvlink, the device linker.

✅

-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

Ignores configurations from the nvcc.profile file.

✅

-t, --threads number

Specifies the maximum number of parallel threads for compilation steps. This option can improve compilation speed when compiling for multiple architectures.

✅

-dryrun, --dryrun

Lists the compilation sub-commands without executing them.

✅

-v, --verbose

Lists compilation sub-commands as they are executed.

✅

-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 compilation files in this directory.

✅

-clean, --clean-targets

Deletes all non-temporary files that the same nvcc command would generate without this option.

✅

-run-args, --run-args <arguments,…>

Specifies command-line arguments for the executable when used in conjunction with --run.

✅

-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 -malign-double from being passed to the compiler on 32-bit platforms.

✅

-nodlink, --no-device-link

Skips the device link step when linking object files.

✅

-allow-unsupported-compiler, --allow-unsupported-compiler

Disables the nvcc check for supported host compiler versions.

✅

-default-stream, --default-stream <legacy|null|per-thread>

Specifies the stream that CUDA commands from the compiled program will be sent to by default.

✅

--gpu-architecture

Specifies the NVIDIA virtual GPU architecture to compile for.

✅

-arch, --gpu-architecture <arch|all|all-major>

Specifies the NVIDIA virtual GPU architecture to compile for.

✅

-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 way to specify targets than --gpu-architecture and --gpu-code.

✅

-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 must be linked before it can be executed.

✅

-e, --entries <entry,…>

Specifies the global entry functions for which to generate code. PTX is generated for all entry functions, but only the selected entry functions are assembled. Function names must be mangled.

✅

-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. Implies --ftz=true, --prec-div=false, --prec-sqrt=false, and --fmad=true.

✅

-ftz, --ftz <true|false>

Controls single-precision denormal support. true flushes denormals to zero; false preserves them.

✅

-prec-div, --prec-div <true|false>

Controls single-precision division and reciprocals. true enables IEEE round-to-nearest mode; false enables a fast approximation.

✅

-prec-sqrt, --prec-sqrt <true|false>

Controls single-precision square root. true enables IEEE round-to-nearest mode; false enables a fast approximation.

✅

-fmad, --fmad <true|false>

Enables or disables contracting floating-point multiplies and adds into fused multiply-add (FMA) operations.

✅

-extra-device-vectorization, --extra-device-vectorization

Enables more aggressive device code vectorization.

✅

-astoolspatch, --compile-as-tools-patch

Compiles patch code for CUDA tools. This implies --keep-device-functions. May only be used with --ptx, --cubin, or --fatbin. Cannot be used with -rdc=true or -ewp.

✅

-keep-device-functions, --keep-device-functions

In whole-program compilation mode, preserves user-defined external linkage __device__ function definitions in the generated PTX.

✅

-w, --disable-warnings

Inhibits all warning messages.

✅

-src-in-ptx, --source-in-ptx

Interleaves source code in the generated PTX.

✅

-restrict, --restrict

Asserts that all kernel pointer parameters are restrict pointers.

✅

-Wno-deprecated-gpu-targets, --Wno-deprecated-gpu-targets

Suppresses warnings about deprecated GPU target architectures.

✅

-Wno-deprecated-declarations, --Wno-deprecated-declarations

Suppresses warnings about using a deprecated entity.

✅

-Wreorder, --Wreorder

Generates warnings when member initializers are reordered.

✅

-Wdefault-stream-launch, --Wdefault-stream-launch

Generates a warning if a kernel launch is missing an explicit stream argument.

✅

-Wext-lambda-captures-this, --Wext-lambda-captures-this

Generates a warning when an extended lambda implicitly captures this.

✅

-Werror, --Werror <kind,…>

Makes warnings of the specified kinds into errors.
The following is the list of warning kinds accepted by this option:
all-warnings
Treat all warnings as errors.
cross-execution-space-call
Be more strict about unsupported cross-execution-space calls. The compiler will generate an error instead of a warning for a call from a __host__ __device__ to a __host__ function.
reorder
Generate errors when member initializers are reordered.
default-stream-launch
Generate an error when an explicit stream argument is not provided in the <<<...>>> kernel launch syntax.
ext-lambda-captures-this
Generate an error when an extended lambda implicitly captures this.
deprecated-declarations
Generate an error on use of a deprecated entity.












✅

-err-no, --display-error-number

Displays a diagnostic number for any message generated by the CUDA frontend compiler. Does not affect host compiler messages.

✅

-no-err-no, --no-display-error-number

Disables the display of a diagnostic number for any message generated by the CUDA frontend compiler. Does not affect host compiler messages.

✅

-diag-error, --diag-error <errNum,…>

Emits an error for specified diagnostic message(s) generated by the CUDA frontend compiler. This does not affect diagnostics generated by the host compiler/preprocessor.

✅

-diag-suppress, --diag-suppress <errNum,…>

Suppresses specified diagnostic message(s) generated by the CUDA frontend compiler. This does not affect diagnostics generated by the host compiler/preprocessor.

✅

-diag-warn, --diag-warn <errNum,…>

Emits a warning for specified diagnostic message(s) generated by the CUDA frontend compiler. This does not affect diagnostics generated by the host compiler/preprocessor.

✅

-res-usage, --resource-usage

Shows resource usage of the GPU code, such as registers and memory.

✅

-h, --help

Prints help information on this tool.

✅

-V, --version

Prints version information on this tool.

✅

-optf, --options-file <file,…>

Includes command line options from a specified file.

✅

-time, --time <filename>

Generates and appends a CSV table of compilation phase timings to the specified file. Column headings are added if the file is empty. Use - as the filename to print to stdout.

✅

-qpp-config, --qpp-config <config>

Specifies the configuration ([[compiler/]version,][target]) when using the q++ host compiler. The argument is forwarded to the q++ compiler with its -V flag.

✅

-code-ls, --list-gpu-code

Lists the GPU architectures (e.g., sm_XX) supported by the tool and exits.

✅

-arch-ls, --list-gpu-arch

Lists the virtual device architectures (e.g., compute_XX) supported by the tool and exits.

✅

--Wmissing-launch-bounds, -Wmissing-launch-bounds

Generates a warning when a __global__ function does not have an explicit __launch_bounds__ annotation.

✅

-allow-expensive-optimizations, --allow-expensive-optimizations

Enables the compiler to perform expensive optimizations using maximum available resources (memory and compile-time). If unspecified, this feature is enabled by default for optimization level O2 or higher.

✅

-c, --compile-only

Generates a relocatable object file.

✅

-dlcm, --def-load-cache

Sets the default cache modifier for global/generic load. Default value: ca.

✅

-dscm, --def-store-cache

Sets the default cache modifier for global/generic store.

✅

-g, --device-debug

Generates debug information for device code.

✅

-disable-optimizer-consts, --disable-optimizer-consts

Disables use of the optimizer constant bank.

✅

-e, --entry <entry,…>

Specifies the global entry functions for which to generate code.

✅

-fmad, --fmad

Enables or disables contracting floating-point multiplies and adds into fused multiply-add (FMA) operations.

✅

-flcm, --force-load-cache

Forces a specified cache modifier on global or generic loads.

✅

-fscm, --force-store-cache

Forces a specified cache modifier on global or 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 to suppress code generation, which is useful for parsing only. Allowed values include architectures from compute_35, sm_35, and lto_35 through compute_87, sm_87, and lto_87.

✅

-h, --help

Prints 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

Instructs ptxas to generate relocatable references for variables and preserve the corresponding relocations in the linked executable.

✅

-sp-bound-check, --sp-bound-check

Generates stack-pointer bounds-checking code sequences. This option is enabled automatically when --device-debug or --opt-level=0 is specified.

✅

-v, --verbose

Enables verbose mode, which prints code generation statistics.

✅

-V, --version

Prints version information.

✅

-Werror, --warning-as-error

Makes all warnings into errors.

✅

-warn-double-usage, --warn-on-double-precision-use

Generates a warning if double-precision values are used in an instruction.

✅

-warn-lmem-usage, --warn-on-local-memory-usage

Generates a warning if local memory is used.

✅

-warn-spills, --warn-on-spills

Generates a warning if registers are spilled to local memory.

✅

-astoolspatch, --compile-as-tools-patch

Compiles patch code for CUDA tools. Cannot be used with -Xptxas -c or -ewp.

✅

-pic, --position-independent-code

Generates position-independent code.

✅

-maxntid, --maxntid

Specifies the maximum number of threads per thread block.

✅

-minnctapersm, --minnctapersm

Specifies the minimum number of CTAs per SM.

✅

-w, --disable-warnings

Inhibits 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

Makes all warnings into errors.

✅

-suppress-arch-warning, --suppress-arch-warning

Suppresses the warning that an object file lacks code for the target architecture.

✅

-suppress-stack-size-warning, --suppress-stack-size-warning

Suppresses the warning for an undetermined stack size.

✅

-dump-callgraph, --dump-callgraph

Dumps call graph and register usage information.

✅