1. Command option types and notation
Nvcc recognizes three types of command options: boolean (flag-) options, single value options, and list (multivalued-) options.
Boolean options do not have an argument: they are either specified on a command line or not. Single value options must be specified at most once, and list (multivalued-) options may be repeated.
Examples of each of these option types are, respectively: -v (switch to verbose mode), -o (specify
output file), and –I (specify include path).
Single value options and list options must have arguments, which must follow the name of the
option itself by either one of more spaces or an equals character. In some cases of compatibility with gcc (such as –I, -l and -L), the value of the option may also immediately follow the option itself, without being separated by spaces.
The individual values of multivalued options may be separated by commas in a single instance of the option, or the option may be repeated, or any combination of these two cases.
Hence, for the two sample options mentioned above that may take values, the following notations are legal:
-o file -o=file -Idir1,dir2 -I=dir3 -I dir4,dir5
The option type in the tables in the remainder of this section can be recognized as follows: boolean options do not have arguments specified in the first column, while the other two types do. List options can be recognized by the repeat indicator “,…” at the end of the argument.
Each option has a long name and a short name, which can be used interchangedly. These two variants are distinguished by the number of hyphens that must precede the option name: long names must be preceded by two hyphens, while short names must be preceded by a single hyphen. An example of this is the long alias of
–I, which is
Long options are intended for use in build scripts, where size of the option is less important than descriptive value. In contrast, short options are intended for interactive use. For nvcc, this distinction may be of dubious value, because many of its options are well known compiler driver options, and the names of many other single- hyphen options were already chosen before nvcc was developed (and not especially short). However, the distinction is a useful convention, and the ‘short’ options names may be shortened in future releases of the CUDA Toolkit.
Long options are described in the first columns of the options tables, and short options occupy the second columns.
2. Command option description
2.1. Options for specifying the compilation phase
Options of this category specify up to which stage the input files must be compiled.
2.2. File and path specifications
2.3. Options altering compiler/linker behavior
2.4. Options for passing specific phase options
These allow for passing options directly to the intended compilation phase. Using these, users have the ability to pass options to the lower level compilation tools without the need for nvcc to know about each and every such option.
2.5 Options for guiding the compiler driver
2.6. Options for steering CUDA compilation
2.7. Options for steering GPU code generation
2.8. Generic tool options