nvc++(1)

๐Ÿ“ฆ version 26.9, in arch rolling

nvc++(1) โ€” from the General Commands Manual ๐Ÿ’– okay bestie, this is the whole manual page for the NVIDIA GNU-compatible C++ compiler, and we are getting through it together, no skips, no cap.

๐ŸŒธ NAME ๐ŸŒธ

nvc++ โ€” The NVIDIA GNU-compatible C++ compiler. Literally the icon. ๐Ÿ‘‘

โœจ SYNOPSIS โœจ

nvc++ [ -flag ]...  sourcefile...

๐Ÿ’… DESCRIPTION ๐Ÿ’…

nvc++ is a C++17 compiler for NVIDIA GPUs and AMD and Intel CPUs. It supports ISO C++17, supports GPU parallel programming with OpenACC, and supports multicore CPU programming with OpenACC and OpenMP. nvc++ invokes the C++ compiler, assembler and linker with options derived from its command line arguments, and maintains link compatibility with the GNU C++ compiler. ๐Ÿซถ

Suffixes of source file names indicate the type of processing to be done:

  • .c, .C, .cc, .cpp, .cxx, .c++ โ€” C++ source; preprocess, compile
  • .i โ€” C++ source after preprocessing; compile
  • .cu โ€” CUDA source; preprocess, compile
  • .cup โ€” Preprocessed CUDA source; compile
  • .s โ€” assembler source; assemble
  • .S โ€” assembler source; preprocess, assemble
  • .o โ€” object file; passed to linker
  • .a โ€” library archive file; passed to linker

If coinstalled with nvfortran, Fortran file suffixes are also recognized and compiled with the nvfortran compilers; see nvfortran and the NVIDIA User's Guide. Other files are passed to the linker (if linking is requested) with a warning message. ๐Ÿ‘€

Unless one overrides the default action using a command-line option, nvc++ deletes the intermediate preprocessor and assembler files (see the options -c, -E, -P, --no_line_commands, --preprocess, and -Mkeepasm); if a single C++ program is compiled and linked with one nvc++ command, the intermediate object file is also deleted. Linking is the last stage of the compile process, unless you use one of the -c, -E, -P, --no_line_commands, --preprocess, or -S options, or unless compilation errors stop the whole process. ๐Ÿ’€


๐ŸŒˆ OPTIONS ๐ŸŒˆ

Options must be separate; -cs is different from -c -s. Here is a list of all options, grouped by type. More detailed explanations are in following sections. ๐ŸŽ€

๐Ÿซถ Overall Options โ€” the full roster ๐Ÿซถ

-- -# -### --actual_o_filefilename -c -[no]defaultoptions
--diag_errorarg --diag_remarkarg --diag_suppressarg
--diag_warningarg --display_error_number -dryrun -drystdinc
-dumpversion -echo --flagcheck -flags -fmax-errors=<n>
--gcc-toolchain=path -help[=option] -Manno -M[no]idiom
-Minform=level -Mint128 -Mkeepasm -M[no]list -noswitcherror
--nvcchost -o file -rc rcfile -S -show -silent -time -V -V<ver>
-v --version -W[no]-deprecated-declarations -Werror -Wpedantic
-W[no-]sign-compare -W[no-]unused-but-set-parameter
-W[no-]unused-but-set-variable -W[no-]unused-parameter
-W[no-]unused-variable -w -x language -x none -Wpass,option
-Ypass,directory

๐Ÿš€ Optimization Options ๐Ÿš€

-alias=option -fast -f[no-]cx-limited-range -fastsse -fPIC -fpic
-KPIC -Kpic -M[no]autoinline=option -Mcache_align -Mconcur=option
-M[no]depchk -M[no]dse -Mextract=option -M[no]fma -M[no]frame
-M[no]info=option -Minline=option -Minstrument=option
-M[no]ipa=option -M[no]lre[=assoc|noassoc] -M[no]movnt
-Mneginfo=option -Mnoopenmp -Mnosgimp -Mnovintr -Mpfi[=option]
-Mpfo[=option] -M[no]pre -M[no]prefetch=option -Mprof=option
-M[no]propcond -Mquad -Msafe_lastval -M[no]safeptr=option
-M[no-]signed-zeros -M[no]stride0 -M[no]unroll=option
-M[no]unsafe_par_align -M[no]vect=option -M[no]zerotrip
-mp[=option] -nomp -Olevel -pg

๐Ÿ› Debugging Options ๐Ÿ›

-g -gopt -M[no]bounds -Mchkstk -Mcoff -Mdwarf2 -Mdwarf3 -Melf
-Mnodwarf -[no]traceback -nvmalloc

๐Ÿงช Preprocessor Options ๐Ÿงช

-C -Dmacro -define_macromacro --dependencies
--dependencies_quoted_only --dependencies_to_filefilename
--dependencies_to_file_quoted_onlyfilename
--dependencies_to_stdout --dependencies_to_stdout_quoted_only -E
-Idirectory -include file --include_directorydirectory -idirafter
directory -isystem directory -iquote directory -M
-Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff]
-MD -MM -MMD[filename] -MQ -MT -Mnostddef -Mnostdinc -Mpreprocess
-N --no_line_commands -P --preprocess -Umacro -undefine_macroname
-YI,directory -Yp,directory

๐Ÿงฐ Assembler Options ๐Ÿงฐ

-Wa,argument[,argument]...  -Ya,directory

๐Ÿ”— Linker Options ๐Ÿ”—

-acclibs --[no-]as-needed -Bdynamic -Bstatic -Bstatic-nvidia
-Bsymbolic -cudaforlibs -cudalib=libname -cudalibs -fortranlibs
-g77libs -Ldirectory -llibrary -m -Mcudalib=libname
-M[no]eh_frame -Mnostartup -Mnostdlib -M[no]rpath -Mmkl -pthread
-Rdirectory -r -rpath directory -s -shared -soname name -static
-static-nvidia -uname --[no-]whole-archive -Wl,option[,option]...
-Xlinker option[,option]...  -YC,directory -Yl,directory
-YL,directory -YP,directory -YS,directory -YU,directory

๐Ÿ—ฃ๏ธ Language Options ๐Ÿ—ฃ๏ธ

-$ -A -a --[no_]alternative_tokens --[no_]anachronisms
--[no_]array_new_and_delete -asmsuffix=suffix
--[no_]auto_instantiation -B -cuda=option --[no_]bool
--[no_]brief_diagnostics --[no_]builtin --comments
--compress_names --no_compress_names -cppsuffix=suffix
--create_pchfilename --c++standard
--[no_]distinct_template_signatures --dollar -enumber
--early_tiebreaker --[no_]enum_overloading --error_limitnumber
--[no_]explicit -fix_so_init --[no_]for_init_diff_warning
--force_vtbl -fno-builtin --gnu_extensions --[no_]guiding_decls
--ieeenum --[no_]implicit_include --[no_]implicit_typename
--late_tiebreaker --list --[no_]llalign --long_lifetime_temps
--[no_]long_preserving_rules -M[no]builtin -M[no]dalign
-Mdollar=char -Mfcon -M[no]llalign -Mlibsuffix=suffix
-Mobjsuffix=suffix -Mschar -M[no]signextend -M[no]single -Muchar
--[no_]namespaces --new_for_init --no_exceptions
--no_use_before_set_warnings --no_warnings
--[no_]non_const_ref_anachronism --old_for_init
--[no_]old_specializations --pch --pch_dirdirectory --pch_memnum
--[no_]pch_messages --pedantic --preincludefilename
--prelink_objects --remarks --remove_unneeded_entities
--[no_]restrict --[no_]rtti --short_lifetime_temps
-std=c++standard --suppress_vtbl --timing --trace_includes
--[no_]typename --use_pchfilename --using_std
--[no_]wrap_diagnostics -Xfilename

๐ŸŽฏ Target-specific Options ๐ŸŽฏ

-acc -noacc -cuda=option -gpu=option -K[no]ieee -Ktrap=option
-march=target -m[no-]daz-ftz -M[no]daz -M[no]flushz
-M[no]fpmisalign -M[no]fprelaxed=option -M[no]func32 -Mgccbugs
-M[no]longbranch -M[no]second_underscore -Mwritable-strings
-mcmodel=small|medium -stdpar=option -nostdpar -ta=target
-target=option -tp=target

When source files are compiled using -g, -mp, -Mconcur, -Mipa, or -Mprof the same option should be used when using nvc++ to link the objects. ๐Ÿ”ฅ

๐Ÿ’– Overall Options โ€” the deep dive ๐Ÿ’–

okay now we're zooming in on the Overall Options one by one. Same facts, more sparkle. ๐Ÿฆ‹

  • -- โ€” Anything after this switch is treated as a filename. Note that most tools will not allow a filename starting with a dash, so these should be avoided. like, avoid avoid.
  • -# โ€” Display the invocations of the compiler, assembler, and linker. These invocations are the command lines created by nvc++.
  • -### โ€” Display invocations of the compiler, assembler and linker, but do not execute them.
  • --actual_o_filefilename โ€” Name the object file.
  • -c โ€” Skip the link step; compile and assemble only.
  • -defaultoptions (default), -nodefaultoptions โ€” Use (don't use) the default options set in site-specific or user-specific PREOPTIONS or POSTOPTIONS driver variables.
  • --diag_errorarg โ€” Override the normal error severity of the specified diagnostic message(s); the message(s) may be specified using a mnemonic error tag or using the error number.
  • --diag_remarkarg โ€” Override the normal error severity of the specified diagnostic message(s); the message(s) may be specified using a mnemonic error tag or using the error number.
  • --diag_suppressarg โ€” Override the normal error severity of the specified diagnostic message(s); the message(s) may be specified using a mnemonic error tag or using the error number.
  • --diag_warningarg โ€” Override the normal error severity of the specified diagnostic message(s); the message(s) may be specified using a mnemonic error tag or using the error number.
  • --display_error_number โ€” Display the error message number in any diagnostic messages that are generated. The option may be used to determine the error number to be used when overriding the severity of a diagnostic message.
  • -dryrun โ€” Use this option to display the invocations of the compiler, assembler, and linker but do not execute them.
  • -drystdinc โ€” Display the standard include directories without invoking the compiler.
  • -dumpversion โ€” Display the shortened version of the compiler. For example, 21.11 or 22.3.
  • -echo [=go|stop] โ€” Echo the command line flags and (by default) stop. This is useful when the compiler is invoked by a script.
    • go โ€” Don't stop after echoing the command line.
    • stop(default) โ€” Do stop after echoing the command line.
  • --flagcheck โ€” Don't compile anything; just emit any messages for command-line switch errors. Return a success error code if there are no command-line switch errors.
  • -flags โ€” Display all valid nvc++ command-line options in alphabetical order.
  • -fmax-errors=<n> โ€” Specify maximun numbers of errors before terminating compilation.
  • --gcc-toolchain=path โ€” Specify gcc toolchain location using path to gcc directory or gcc executable. The argument can either be gcc root directory, <root directory>/bin, or the gcc executable itself.
  • -help[=option] โ€” Displays command-line options recognized by nvc++ on the standard output. nvc++ -help -otherswitch will give help about -otherswitch. The default is to list nvc++ command line options by group; options are:
    • groups โ€” Print out the groups into which the switches are organized.
    • asm โ€” Print help for assembler command-line options.
    • debug โ€” Print help for debugging command-line options.
    • language โ€” Print help for language-specific command-line options.
    • linker โ€” Print help for linker options.

Still in overall-options land, finishing the -help topics real quick:

  • opt โ€” Print help for optimization command-line options.
  • other โ€” Print help for any other command-line options.
  • overall โ€” Print help for overall command-line options.
  • phase โ€” Print help for the known compiler phases.
  • prepro โ€” Print help for preprocessor command-line options.
  • suffix โ€” Describe the known file suffixes.
  • switch โ€” Print all switches in alphabetical order.
  • target โ€” Print help for target-specific command-line options.
  • variable โ€” Show the nvc++ configuration; this is the same as -show.
  • -Manno โ€” Produce annotated assembly files where source code is intermixed with assembly language; this implies -Mkeepasm. Cute for staring at, lowkey.
  • -Midiom, -Mnoidiom (default) โ€” Enable loop idiom recognition. Memory copy, memory set, and memory zero loops are recognized and replaced with calls to their respective optimized versions.
  • -Minform=level โ€” Specify the minimum level of error severity that the compiler displays during compilation. The levels are:
    • fatal โ€” Instructs the compiler to display fatal error messages.
    • file (default), nofile โ€” Print out (don't print out) the names of files as they are compiled; this is only active when there is more than one file on the command line.
    • severe โ€” Instructs the compiler to display severe and fatal error messages.
    • warn โ€” Instructs the compiler to display warning, severe and fatal error messages.
    • inform โ€” Instructs the compiler to display all error messages (inform, warn, severe and fatal).

The default is -Minform=warn.

  • -Mint128 โ€” Enable extended integer types __int128 and unsigned __int128. Big ints, bestie.
  • -Mkeepasm โ€” Keep the assembly file for each source file, but continue to assemble and link the program. This is mainly for use in compiler performance analysis and debugging.
  • -Mlist, -Mnolist (default) โ€” Create (don't create) a listing file.
  • -noswitcherror โ€” Ignore unknown command line switches after printing a warning message; the default behavior is to print an error message and halt.
๐Ÿ’€ Heads up: default nvc++ is not chill about unknown switches โ€” it errors out and stops.
  • --nvcchost โ€” Enable the pgc++ compiler as the CUDA native host compiler.
  • -o file โ€” Use file as the name of the executable program, rather than the default a.out. If used with -c, -P, or -S, and a single input file, file is used as the name of the object, preprocessor, or assembler output file.
  • -rc rcfile โ€” Specifies the name of a nvc++ startup configuration file. If rcfile is a full pathname, then use the specified file. If rcfile is a relative pathname, use the file name as found in the $DRIVER directory.
  • -S โ€” Skip the assembly and link steps. Leave the output from the compile step in a file named file.s for each file named file.c.
  • -show โ€” Produce help information describing the current nvc++ configuration.
  • -silent โ€” Do not print warning messages. Same as -Minform=severe.
  • -time โ€” Print execution times for the various steps in the compiler itself.
  • -V โ€” Display version messages and other information.
  • -V<ver> โ€” If the specified version of the compiler is installed, that version of the compiler is invoked.
  • -v โ€” Verbose mode; print out the command line for each tool before it is executed.
  • --version โ€” Display version messages and other information.
  • -Wdeprecated-declarations, -Wno-deprecated-declarations โ€” Emit or suppress warnings about use of functions, variables and types marked as deprecated using the deprecated attribute.
  • -Werror โ€” Turn all warning messages into errors. The glow-up from "hmm" to "nope" fr.
  • -Wpedantic, -pedantic โ€” Issue strict ANSI warnings.
  • -Wsign-compare, -Wno-sign-compare โ€” Emit or suppress warnings when comparisons are made between signed and unsigned operands.
  • -Wunused-but-set-parameter, -Wno-unused-but-set-parameter โ€” Emit or suppress warnings when parameters are set but unused. Implies -W[no]-unused-but-set-variable.
  • -Wunused-but-set-variable, -Wno-unused-but-set-variable โ€” Emit or suppress warnings when variables are set but unused. Implies -W[no]-unused-but-set-parameter.
  • -Wunused-parameter, -Wno-unused-parameter โ€” Emit or suppress warnings about unused parameters.
  • -Wunused-variable, -Wno-unused-variable โ€” Emit or suppress warnings about local variables that are defined but are never referenced.
  • -w โ€” Do not print warning messages.
  • -x language โ€” Specify explicitly the language for the input files (instead of choosing based on the file name suffix). Possible values for language are:
    • c
    • cpp c++ cpp-output
    • f F
    • f95 f95-cpp-input
    • f90 F90
    • f77 f77-cpp-input
    • cuf CUF
    • asm ASM assembler assembler-with-cpp
  • -x none โ€” Turn off language specification, so the input files are handled according to their suffixes.
  • -Wpass,option[,option...] โ€” Pass option to the specified pass. Each comma-delimited option is passed as a separate argument. The passes are:
    • c โ€” for the C++ front end,
    • 0 โ€” for the compiler back end,
    • a โ€” for the assembler,
    • i โ€” for the interprocedural analyzer, and
    • l โ€” for the linker.
  • -Ypass,directory โ€” Look in directory for pass pass, rather than in the standard area. The passes are:
    • c โ€” Search for the C++ front end executable in directory.
    • 0 โ€” Search for the compiler back end executable in directory.
    • a โ€” Search for the assembler executable in directory.
    • C โ€” Search for the compiler library in directory.
    • i โ€” Search for the InterProcedural Analyzer (IPA) in directory.
    • l โ€” Search for the linker in directory.
    • I โ€” Set the compiler's standard include directory to directory. The standard include directory is set to a default value by the driver and can be overridden by this option.
    • L โ€” If the linker supports the -YL option, then pass the option -YL,directory to the linker. Otherwise, use directory as the standard library location.
    • S โ€” Search for the startup object files in directory.
    • U โ€” If the linker supports the -YU option, then pass the option -YU,directory to the linker. Otherwise this option is ignored.

โœจ Optimization Options โœจ

  • -alias=option โ€” Specifies whether to optimize using ANSI C type-based pointer disambiguation rules. The options can be one of:
    • ansi โ€” Assume ANSI C type-based pointer disambiguation rules apply; this can enable better optimization in some cases. The rules state that a load or store through a pointer of any type will not conflict with a load or store of a variable or through a pointer of a different type. This is the default with -O2 and above.
    • traditional โ€” Assume traditional C semantics apply. The compiler will assume that a load or store through any pointer might conflict with any variable or pointer dereference unless it can prove otherwise. This is the default with -O1 and below, and when there is a type-cast pointer reference in the function.
  • -fast โ€” Chooses generally optimal flags for the target platform. Use nvc++ -fast -help to see the equivalent switches. Note this sets the optimization level to a minimum of 2; see -O. Basically the "just make it fast" button, bestie.
  • -fcx-limited-range โ€” Specify that complex division does not need range reduction. -fno-cx-limited-range specifies that complex division does need range reduction. -fcx-limited-range is the default setting at optimization level -Ofast.
  • -fastsse โ€” Chooses generally optimal flags for a processor that supports to vectorize for the SSE/AVX instructions. Use nvc++ -fastsse -help to see the equivalent switches.
  • -fPIC โ€” Equivalent to -fpic; provided for compatibility with other compilers.
  • -fpic โ€” Instructs the compiler to generate position-independent code which can be used to create shared object files (dynamically linked libraries).
  • -KPIC โ€” Equivalent to -fpic; provided for compatibility with other compilers.
  • -Kpic โ€” Equivalent to -fpic; provided for compatibility with other compilers.
  • -Mautoinline[option[,option...], -Mnoautoinline (default) โ€” Enable inlining of functions with the inline attribute. -Mautoinline is implied with the -fast switch. The options are:
    • levels:n โ€” Inline up to n levels of function calls; the default is to inline up to 10 levels.
    • maxsize:n โ€” Only inline functions with a size of n or less. The size roughly corresponds to the number of statements in the function, though the correspondence is not direct. The default is to inline functions with a size of 100 or less.
    • totalsize:n โ€” Stop inlining when this function reaches a size of n. The default is to stop inlining when a size of 8000 has been reached.
  • -Mcache_align โ€” Align unconstrained data objects of size greater than or equal to 16 bytes on cache-line boundaries. An unconstrained object is a variable or array that is not a member of an aggregate structure or common block, is not allocatable, and is not an automatic array. Alignment slay ๐Ÿ’…
  • -Mconcur[=option[,option,...]] โ€” okay so heads up bestie: this option has been deprecated and is gonna get removed in a future release ๐Ÿ˜ญ. It tells the compiler to enable auto-concurrentization of loops (yes that's the actual word, and yes it slays). This also sets the optimization level to a minimum of 2; peep -O. If -Mconcur is specified, multiple processors will be used to execute loops that the compiler decides are parallelizable. Important link-time tea: when linking, the -Mconcur switch must be specified or you'll get unresolved references, which is so not the vibe. The OMP_NUM_THREADS or NCPUS environment variables control how many processors will be used to execute the parallelized loops. The options can be one or more of the following:
    • allcores โ€” use all available cores when the environment variables OMP_NUM_THREADS and NCPUS are not set. This must be specified at link time, no cap ๐Ÿซถ.
    • altcode:n / noaltcode โ€” generate (or don't generate) alternate scalar code for parallelized loops. The parallelizer generates scalar code to be executed whenever the loop count is less than or equal to n. If noaltcode is specified, the parallelized version of the loop is always executed regardless of the loop count.
    • altreduction[:n] โ€” generate alternate scalar code for parallelized loops containing a reduction. If a parallelized loop contains a reduction, the parallelizer generates scalar code to be executed whenever the loop count is less than or equal to n.
    • assoc (default) / noassoc โ€” enable (or disable) parallelization of loops with reductions.
    • cncall / nocncall (default) โ€” assume (or don't assume) that loops containing calls are safe to parallelize. Also, no minimum loop count threshold must be satisfied before parallelization will occur, and last values of scalars are assumed to be safe.
    • dist:block โ€” parallelize with block distribution. Contiguous blocks of iterations of a parallelizable loop are assigned to the available processors. Iconic, honestly.
    • dist:cyclic โ€” parallelize with cyclic distribution. The outermost parallelizable loop in any loop nest is parallelized. If a parallelized loop is innermost, its iterations are allocated to processors cyclically. For example, if there are 3 processors executing a loop, processor 0 performs iterations 0, 3, 6, etc; processor 1 performs iterations 1, 4, 7, etc; and processor 2 performs iterations 2, 5, 8, etc. Look at that rotation, we love to see it โœจ.
    • innermost / noinnermost (default) โ€” enable (or disable) parallelization of innermost loops.
    • levels:n โ€” parallelize loops nested at most n levels deep; the default is 3.

  • -Mdepchk (default) / -Mnodepchk โ€” assume (or don't assume) that potential data dependencies exist. Careful though: -Mnodepchk may result in incorrect code ๐Ÿ˜ฌ โ€” the -Msafeptr switch provides a less dangerous way to accomplish the same thing. Use the safe route, bestie.
  • -Mdse / -Mnodse (default) โ€” enable (or disable) the dead store elimination optimization. Clean up those useless writes, periodt.
  • -Mextract=[option[,option,...]] โ€” run the subprogram extraction phase to prepare for inlining. The =lib:filename option must be used with this switch to name an extract library. See -Minline for more details on inlining. The options are:
    • subprogram[,subprogram] โ€” a non-numeric option not containing a period is assumed to be the name of a subprogram to be extracted.
    • name:subprogram[,subprogram] โ€” specifies the name of a subprogram or subprograms to be extracted.
    • lib:directory โ€” specifies the name of a directory to contain the extracted subprograms; this directory will be created if it does not exist. It's giving "make yourself at home" ๐ŸŽ€.
    • [size:]number โ€” a numeric option is assumed to be a size. Functions containing number or less statements are extracted. If both number and function are specified, then functions matching the given name(s) or meeting the size requirements are extracted.
  • -Mfma / -Mnofma (default) โ€” generate (or don't generate) fused multiply-add (FMA) instructions on the CPU and GPU for targets that support it. FMA instructions are generally faster than separate multiply-add instructions, and can generate higher precision results since the multiply result is not rounded before the addition. But bestie, listen: delaying rounding until after addition, however, may cause results to differ from those obtained with the unfused multiply-add instructions. FMA instructions are enabled at optimization levels higher than -O1.
  • -Mframe / -Mnoframe (default) โ€” set up (or don't set up) a true stack frame pointer for functions; -Mnoframe allows slightly more efficient operation when a stack frame is not needed, but some options override -Mnoframe. Nothing personal, it's just a stack thing ๐Ÿ’….
  • -Minfo[=option[,option,...]] / -Mnoinfo (default) โ€” emit useful information to stderr. The options are:
    • all โ€” includes options accel, inline, ipa, loop, lre, mp, opt, par, stdpar, vect. The whole squad, assembled ๐ŸŒˆ.
    • accel โ€” emit information about accelerator region targeting.
    • ftn โ€” emit Fortran-specific information.
    • inline โ€” emit information about functions extracted and inlined.
    • intensity โ€” this option has been deprecated and will be removed in a future version ๐Ÿ˜ญ. Emit compute intensity information about loops.
    • ipa โ€” emit information about the optimizations enabled by interprocedural analysis (IPA).
    • loop / opt โ€” emit information about loop optimizations. This includes information about vectorization and loop unrolling.
    • lre โ€” emit information about loop-carried redundancy elimination.
    • mp โ€” emit information about OpenMP parallel regions.
    • par โ€” emit information about loop parallelization.
    • pfo โ€” emit profile feedback information.
    • time / stat โ€” emit compilation statistics.
    • stdpar โ€” emit information about parallelization of C++ parallel algorithms and Fortran DO CONCURRENT loops.
    • vect โ€” emit information about automatic loop vectorization.

With no options, -Minfo is the same as -Minfo=accel,ipa,loop,lre,mp,opt,par,stdpar,vect.

  • -Minline[=option[,option,...]] โ€” pass options to the function inliner. The options are:
    • lib:filename.ext โ€” specify an inline library created by a previous -Mextract option. Functions from the specified library are inlined. If no library is specified, functions are extracted from a temporary library created during an extract prepass.
    • except:func โ€” specifies which functions should not be inlined. Respectfully, stay out โœ‹.
    • [name:]function โ€” a non-numeric option is assumed to be a function name. If name: is specified, what follows is always the name of a function.
    • pragma โ€” Fortran Only: inline only those procedures that have a !NVF$ INLINE pragma on the source line immediately before the procedure's SUBROUTINE or FUNCTION statement.
    • [maxsize:]number โ€” a numeric option is assumed to be a size. Functions of size number or less are inlined. If both number and function are specified, then functions matching the given name(s) or meeting the size requirements are inlined.
    • reshape โ€” for Fortran, the default is to not inline subprograms with array arguments if the array shape does not match the shape in the caller. This overrides the default.
    • smallsize:number โ€” always inline functions of size smaller than number regardless of other size limits.
    • totalsize:number โ€” stop inlining in a function when the function's total inlined size reaches the number specified. Gotta cap it somewhere ๐Ÿซถ.
  • -Minstrument [=option] โ€” generate additional code to enable function-level instrumentation. This option implies -Mframe. The option is:
    • functions (default) โ€” the one and only, lowkey main character energy ๐Ÿ‘‘.
  • -Mipa [=option[,option,...]] / -Mnoipa (default) โ€” enable and specify options for InterProcedural Analysis (IPA). Note: IPA is not compatible with parallel make environments (e.g., pmake) ๐Ÿ™ˆ. IPA also sets the optimization level to a minimum of 2; see -O. If no option list is specified, then it is equivalent to -Mipa=const. The options are:
    • align / noalign (default) โ€” enable (or disable) recognition when pointer targets are all cache-line aligned, allowing better SSE code generation.
    • arg / noarg (default) โ€” remove (or don't remove) arguments replaced by -Mipa=ptr,const. -Mipa=noarg implies -Mipa=nolocalarg.
    • const (default) / noconst โ€” enable (or disable) propagation of constants across procedure calls.
    • f90ptr / nof90ptr (default) โ€” enable (or disable) Fortran 90 pointer disambiguation across procedure calls.
    • fast โ€” chooses generally optimal -Mipa flags for the target platform; use nvc++ -Mipa -help to see the equivalent options.
    • force โ€” force all objects to recompile regardless of whether IPA information has changed. No skipping, everybody re-runs it ๐Ÿƒโ€โ™€๏ธ.
    • globals / noglobals (default) โ€” analyze (or don't analyze) which globals are modified by procedure calls.
    • inline:n โ€” determine additional functions to inline, allowing up to n levels of inlining. Additional suboptions are:
      • except:proc โ€” disables inlining of procedure proc.
      • nopfo โ€” ignore any profile frequency information from -Mpfo when choosing which functions to inline.
  • reshape, noreshape (default) โ€” turns Fortran inlining with mismatched array shapes on and off. Default is off, bestie.
  • ipofile โ€” saves IPA info in a .ipo file instead of the default vibe, which is appending that info straight to the object file.
  • jobs:n โ€” uses up to n jobs in parallel to reoptimize object files. parallel slay โœจ
  • keepobj (default), nokeepobj โ€” keeps or doesn't keep the optimized object files, using file name mangling, so later application builds can skip some recompiling. default is keep.
  • libc, nolibc (default) โ€” optimize calls to certain standard C library routines, or don't. default is don't.
  • libinline, nolibinline (default) โ€” allow or don't allow inlining from routines in libraries; -Mipa=libinline implies -Mipa=inline.
  • libopt, nolibopt (default) โ€” allow or don't allow recompiling and reoptimizing routines from libraries with IPA information.
  • localarg, nolocalarg (default) โ€” enables or disables the feature that externalizes local variables so arguments can be replaced by -Mipa=ptr; -Mipa=localarg implies -Mipa=arg.
  • main:func โ€” specifies a function to serve as a global entry point; it may appear multiple times; this disables linking.
  • ptr, noptr (default) โ€” enable or disable pointer disambiguation across procedure calls.
  • pure, nopure (default) โ€” detect or don't detect pure functions.
  • quiet โ€” don't print out messages about which files are recompiled at link time. peace and quiet, iconic.
  • reaggregation, noreaggregation (default) โ€” enable or disable global struct reaggregation. this can change the order of struct members, or split structs into multiple structs, to improve memory locality and cache utilization.
  • required โ€” returns an error condition if IPA is inhibited for any reason, instead of the default behavior of linking without IPA optimization.
  • safe:[function|library] โ€” declares that the named function, or all functions in the named library, are safe; a safe procedure does not call back into the known procedures and does not change any known global variables. without -Mipa=safe, any unknown procedures will cause IPA to fail.
  • safeall, nosafeall (default) โ€” declares that all unknown functions are safe or not safe; see -Mipa=safe.
  • shape, noshape (default) โ€” perform or don't perform Fortran 90 shape propagation.
  • summary โ€” only collects IPA summary information when compiling; this prevents IPA optimization of this file, but allows optimization for other files linked with this file.
  • vestigial, novestigial (default) โ€” remove or don't remove functions that are not called.

  • -Mlre[=assoc|noassoc], -Mnolre โ€” enable or disable loop-carried redundancy elimination. the assoc option allows expression reassociation, and noassoc disallows expression reassociation.
  • -Mmovnt, -Mnomovnt โ€” force or disable generation of nontemporal moves. -Mmovnt used with -fastsse can sometimes be faster than -fastsse alone. by default nontemporal moves are generated for loops with large loop counts.
  • -Mneginfo=option[,option...] โ€” tells the compiler to produce info on why certain optimizations are not performed. lowkey use the -Minfo flag instead.
  • -Mnoopenmp โ€” when -mp is present, ignore the OpenMP pragmas.
  • -Mnosgimp โ€” when -mp is present, ignore the SGI parallelization pragmas.
  • -Mnovintr โ€” do not generate vector intrinsic calls.
  • -Mpfi[=option] โ€” generates profile feedback instrumentation; this includes extra code to collect run-time statistics to be used in a subsequent compile; -Mpfi must also appear when the program is linked. when the program is run, a profile feedback file pgfi.out will be generated; see -Mpfo. the allowed options are:
    • indirect, noindirect (default) โ€” enable or disable collection of indirect function call targets, which can be used for indirect function call inlining.
  • -Mpfo[=option[,option,...]] โ€” enables profile feedback optimizations; there must be a profile feedback file pgfi.out in the current directory, which contains the result of an execution of the program compiled with -Mpfi. the options are:
    • indirect, noindirect (default) โ€” enable or disable indirect function call inlining; this requires a pgfi.out file generated from a binary built with -Mpfi=indirect.
    • layout (default), nolayout โ€” enable or disable basic block layout to take advantage of instruction cache locality by keeping hot paths close together.
    • dir=directory โ€” specify the directory containing the pgfi.out profile feedback information file; the default is the current directory.
  • -Mpre, -Mnopre (default) โ€” enable or disable the partial redundancy elimination optimization.
  • -Mprefetch[=option:n], -Mnoprefetch โ€” add or don't add prefetch instructions for those processors that support them (Pentium 4, Opteron); -Mprefetch is default on Opteron; -Mnoprefetch is default on other processors. the options are:
    • distance:d โ€” set the fetch-ahead distance for prefetch instructions to d cache lines.
    • n:n โ€” set the maximum number of prefetch instructions to generate in a loop to n.
    • nta โ€” use the prefetchnta instruction.
    • plain โ€” use the prefetch instruction.
    • t0 โ€” use the prefetcht0 instruction.
    • w โ€” allow the AMD-specific prefetchw instruction.
  • -Mprof[=option[,option,...]] โ€” set performance profiling options. using these options will cause the resulting executable to create a performance profile that can be viewed and analyzed with the PGPROF performance profiler. in the descriptions below, old-style profiling implies compiler-generated source instrumentation. MPICH-style profiling implies the use of instrumented wrappers for MPI library routines. the -Mprof options are:
    • dwarf โ€” generate limited DWARF symbol information sufficient for most performance profilers.
    • func โ€” perform old-style function level profiling.
    • hwcts โ€” generate a profile using event-based sampling of hardware counters via the PAPI interface (PAPI must be installed).
    • lines โ€” perform old-style line level profiling.
    • time โ€” generate a profile using time-based instruction-level statistical sampling. this is equivalent to -pg, except that the profile is saved in a file named pgprof.out instead of gmon.out.

on Linux systems that have OProfile installed, PGPROF supports collection of performance data without recompilation. use of -Mprof=dwarf is useful for this mode of profiling. ๐Ÿงš

  • -Mpropcond (default), -Mnopropcond โ€” enable or disable propagation of constant values derived from conditional branches with equality tests.
  • -Mquad โ€” align large objects on quad-word boundaries.
  • -Msafe_lastval โ€” in the case where a scalar is used after a loop, but is not defined on every iteration of the loop, the compiler does not by default parallelize the loop. however, this option tells the compiler it is safe to parallelize the loop.
  • -Msafeptr[=option[,option,...]], -Mnosafeptr (default) โ€” override or don't override data dependence between C pointers and between pointers and variables or arrays. this option must be used with care since the potential exists for code to be generated that will result in unexpected or incorrect results as is defined by ANSI C. however, when used properly, this option has the potential to greatly enhance the performance of code, especially floating-point oriented loops. combinations of the options may be used and interact appropriately.
bestie, be careful with this one: it can absolutely change what your code means if you get it wrong. the original warning is real, not a vibe check. ๐Ÿ’€
  • all โ€” all pointers are assumed not to overlap or conflict with other data objects; -Msafeptr with no options implies -Msafeptr=all.
  • arg | dummy โ€” C dummy arguments (pointers and arrays) are treated with the same copyin/copyout semantics as Fortran dummy arguments.
  • auto | local โ€” C local or auto variables (pointers and arrays) are assumed not to overlap or conflict with other data objects and are independent.
  • global โ€” C global or extern variables (pointers and arrays) are assumed not to overlap or conflict with other data objects and are independent.
  • static โ€” C static variables (pointers and arrays) are assumed not to overlap or conflict with other data objects and are independent.
  • -Msigned-zeroes (default), -Mno-signed-zeros โ€” toggles whether to honor (-Msigned-zeros) or ignore (-Mno-signed-zeros) issues associated with a signed 0.0 during optimization.
  • -Mstride0, -Mnostride0 (default) โ€” generate or don't generate alternate code for a loop that contains an induction variable whose increment may be zero.
  • -Munroll[=option[,option...]], -Mnounroll (default) โ€” invoke or don't invoke the loop unroller. this also sets the optimization level to a minimum of 2; see -O. the option is one of the following:
    • c:m โ€” instructs the compiler to completely unroll loops with a constant loop count less than or equal to m, a supplied constant. if this value is not supplied, the m count is set to 1. if m is set to 1, a compiler heuristic determines the maximum loop count at which such loops will be completely unrolled.
  • n:u โ€” tells the compiler to unroll a single-block loop u times ๐Ÿ’ซ โ€” specifically a loop that is not completely unrolled, or one that has a non-constant loop count. If you don't hand it a u, the unroller just computes the number of times a candidate loop is unrolled. Math girl summer ๐Ÿงฎ
    • m:u โ€” same energy, but for a multi-block loop: unroll it u times when it's not completely unrolled or has a non-constant loop count. Again, no u supplied means the unroller computes the number of times a candidate loop is unrolled. Let her cook ๐Ÿ‘ฉโ€๐Ÿณ
  • -Mnounroll โ€” instructs the compiler not to unroll loops. Periodt. Loops stay exactly as they are ๐Ÿ’…
  • -Munsafe_par_align, -Mnounsafe_par_align โ€” use (or don't use) aligned moves for array loads in parallelized loops, as long as the first element of the array is aligned. This is only effective with -Mvect=simd. And bestie, it's called unsafe for a reason ๐Ÿ˜ญ โ€” there are situations where the array elements allocated to some processors are not aligned.
  • -Mvect [=option[,option,...]], -Mnovect (default) โ€” passes options to the internal vectorizer. This also sets the optimization level to a minimum of 2, the equivalent of -O; for more info see optimization levels under -O. If you don't specify an option list, then these vector optimizations get used: assoc,cachesize:c,simd:256, where c is the actual cache size of the machine โœจ The -Mvect options are:
    • altcode (default), noaltcode โ€” enable (disable) alternate code generation for vector loops, depending on such characteristics as array alignments and loop counts.
    • fuse, nofuse (default) โ€” enable (disable) loop fusion to combine adjacent loops into a single loop ๐Ÿซถ
    • prefetch โ€” use prefetch instructions in loops where profitable.
    • simd[:{128|256|512}] (default), nosimd โ€” use vector SIMD instructions (AVX, AVX2, AVX512) instructions. The argument may be used to limit usage to 128-bit SIMD instructions. Specifying 512-bit SIMD instructions is only possible for target processors that support AVX512. No cap, 512-bit is the whole personality ๐Ÿ”ฅ
    • uniform, nouniform (default) โ€” perform the same optimizations in the vectorized and residual loops. Heads up though: this may affect the performance of the residual loop ๐Ÿ‘€

These options are also supported, but are not recommended for use in new development, except by experienced users, and may be phased out in future releases ๐ŸŒฑ (iykyk, legacy vibes):

  • assoc (default), noassoc โ€” enable (disable) certain associativity conversions that can change the results of a computation due to floating-point roundoff error differences. A typical optimization is to change the order of additions, which is mathematically correct, but can be computationally different, due to roundoff error. Likeโ€ฆ the vibes are the same but the digits are not ๐Ÿ˜ญ
  • cachesize:number (default=automatic) โ€” instructs the vectorizer, when performing cache tiling optimizations, to assume a cache size of number.
  • gather (default), nogather โ€” enable (disable) vectorization of loops with indirect array references.
  • idiom (default), noidiom โ€” enable idiom recognition; alternate form of -Midiom.
  • levels:n โ€” set maximum nest level of loops to optimize.
  • partial โ€” enable partial loop vectorization via innermost loop distribution.
  • short, noshort (default) โ€” enable (disable) recognition of short vector operations that arise from scalar code outside of loops or within the body of loops.
  • sizelimit[:number], nosizelimit (default) โ€” limit the size of loops that are vectorized; the default is to attempt to vectorize all loops. Ambition ๐Ÿ’…
  • tile, notile (default) โ€” enable (disable) loop tiling to optimize for cache locality.

-Mnovect disables the vectorizer, and is the default at -O0 and -O1.

  • -Mzerotrip (default), -Mnozerotrip โ€” include (don't include) a zero-trip test for loops. Only use -Mnozerotrip when all loops are known to execute at least once โš ๏ธ like, known known.
  • -mp[=option] โ€” enable OpenMP pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices or multi-processor system ๐ŸŒˆ The options allowed are:
    • gpu โ€” compile OpenMP directives for parallel execution on the GPU.
    • multicore (default) โ€” compile OpenMP directives for parallel execution on the CPU.
    • align, noalign (default) โ€” modify (don't modify) default loop iteration scheduling to align iterations with array references. The default is to use simple static scheduling.
    • autopar (default), noautopar โ€” enable loop autoparallelization of omp loop constructs.
    • ompt โ€” link against OMPT-enabled OpenMP library.
  • -nomp โ€” ignore OpenMP directives and do not link against OpenMP runtime libraries. Not today ๐Ÿ’€
  • -O[level] โ€” set the optimization level. If -O is not specified, then the default level is 1 if -g is not specified, and 0 if -g is specified. If a number is not supplied with -O then the optimization level is set to 2. The optimization levels and their meanings are as follows:
    • -O0 โ€” sets the optimization level to 0. A basic block is generated for each statement. No scheduling is done between statements. No global optimizations are performed. Bare minimum era ๐Ÿ™ˆ
    • -O1 โ€” sets the optimization level to 1. Scheduling within extended basic blocks is performed. No global optimizations are performed.
    • -O โ€” sets the optimization level to 2, with no SIMD vectorization enabled. All level 1 optimizations are performed. In addition, traditional scalar optimizations such as induction recognition and loop invariant motion are performed by the global optimizer.
    • -O2 โ€” all -O optimizations are performed. In addition, more advanced optimizations such as SIMD code generation, cache alignment and partial redundancy elimination are enabled. Obsessed with her actually ๐ŸŽ€
    • -O3 โ€” all -O1 and -O2 optimizations are performed. In addition, this level enables more aggressive code hoisting and scalar replacement optimizations that may or may not be profitable. She's trying her best, okay ๐Ÿ˜Œ
    • -Ofast โ€” enables -O3, -Mfprelaxed, -Mstack_arrays, -Mno-nan, Mno-inf, and -fcx-limited-range. Note -Mstack_array is disabled when both command line options -Ofast and -stdpar are enabled.
    • -O4 โ€” all -O1, -O2, and -O3 optimizations are performed. In addition, hoisting of guarded invariant floating-point expressions is enabled. Final boss energy ๐Ÿ‘‘
  • -pg โ€” enable gprof-style sample-based profiling; implies -Mframe.

๐Ÿ› Debugging Options ๐Ÿ›

  • -g โ€” generate symbolic debug information. This also sets the optimization level to zero, unless a -O switch is present on the command line. Symbolic debugging may give confusing results if an optimization level other than zero is selected. And ngl, using -O0 the generated code will be slower than code generated at other optimization levels โ€” that's the trade-off, bestie ๐Ÿข
  • -gopt โ€” generate symbolic debug information, without affecting optimizations. This may give confusing results when debugging with optimizations; it is intended for use with other tools that use the debug information ๐Ÿ”ง
  • -Mbounds, -Mnobounds (default) โ€” add (don't add) array bounds checking. Bounds checking is not applied to a subscripting pointer. Just so we're clear ๐Ÿซถ
  • -Mchkstk โ€” check the stack for available space upon entry to and before the start of a parallel region. Useful when many private variables are declared. Stack said "let me check my schedule" ๐Ÿ“‹
  • -Mcoff โ€” generate a COFF formatted object.
  • -Mdwarf2 โ€” generate DWARF2 debug information with -g.
  • -Mdwarf3 โ€” generate DWARF3 debug information with -g.
  • -Melf โ€” generate an ELF formatted object.
  • -Mnodwarf โ€” don't add the default dwarf information. Not me gatekeeping the debug info ๐Ÿ™ˆ
  • -traceback, -notraceback (default) โ€” add debug information for runtime traceback.
  • -nvmalloc โ€” use a custom host memory allocator.

โœจ Preprocessor Options โœจ

Bestie, this is where you tell the compiler how to handle all the preprocessor stuff before the main character compilation era begins. Letโ€™s go ๐Ÿ’…

  • -C โ€” preserve comments in preprocessed C source files. Your comments stay alive, iconic.
  • -Dname[=def] โ€” define name to def in the preprocessor. If def is missing, itโ€™s assumed to be empty. If the = sign is missing, then name is defined to be the string 1. Cute, simple, no cap.
  • -define_macroname[=def] โ€” the same as -Dname[=def]. Define name to def in the preprocessor. If def is missing, itโ€™s assumed to be empty.
  • --dependencies โ€” generate a list of make dependences and print them to stdout.
  • --dependencies_quoted_only โ€” generate a list of make dependences for quoted include files only, and print them to standard output.
  • --dependencies_to_filefilename โ€” generate a list of make dependences and print them to the file filename.
  • --dependencies_to_file_quoted_onlyfilename โ€” generate a list of make dependences for quoted include files only, and print them to the file filename.
  • --dependencies_to_stdout โ€” generate a list of make dependences and print them to standard output.
  • --dependencies_to_stdout_quoted_only โ€” generate a list of make dependences for quoted include files only, and print them to standard output.
  • -E โ€” preprocess each .c file and send the result to standard output. No compilation, assembly, or linking is performed. Itโ€™s giving โ€œjust the preprocessor, maโ€™amโ€ ๐Ÿ’–
  • -Idirectory โ€” add directory to the compilerโ€™s search path for include files. For include files surrounded by < >, each -I directory is searched followed by the standard area. For include files surrounded by " ", the directory containing the file containing the #include directive is searched, followed by the -I directories, followed by the standard area.
  • -include file โ€” include the source code of the indicated file at the beginning of the compilation.
  • --include_directorydirectory โ€” add directory to the compilerโ€™s search path for include files. For include files surrounded by < >, each --include_directory directory is searched followed by the standard area. For include files surrounded by " ", the directory containing the file containing the #include directive is searched, followed by the --include_directory directories, followed by the standard area.
  • -idirafter directory โ€” add a directory to the end of the include file search path, after the standard include directories, and mark it as a system include directory.
  • -isystem directory โ€” same as -I, but mark the directory as a system directory.
  • -iquote directory โ€” add a directory to the beginning of the include file search path, and use it only when processing includes with quotes.
  • -M โ€” generate a list of make dependences and print them to stdout. Also: -MQ and -MT are synonyms. Yes, thatโ€™s what it says ๐Ÿซถ
  • -Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff] โ€” only runs the preprocessor on the input file(s); by default, the output is written to file.i, unless renamed with the -o switch. The options are:
    • comment nocomment โ€” keep (donโ€™t keep) C-style comments in the preprocessed output.
    • include:file โ€” include this file before processing the source file.
    • m โ€” print makefile dependencies to stdout, a la -M.
    • md โ€” print makefile dependencies to file.d, a la -MD.
    • mm โ€” print makefile dependencies to stdout, ignoring system includes (includes with angle braces), a la -MM.
    • mmd โ€” print makefile dependencies to file.d, ignoring system includes (includes with angle braces), a la -MMD.
    • mq:'target' โ€” print makefile dependencies to stdout, a la -MQ.
    • mt:target โ€” print makefile dependencies to stdout, a la -MT.
    • line โ€” include line numbers into the preprocessed output.
    • suffix:suff โ€” when generating makefile dependencies, name the dependent file file.suff; the default is to name the dependent file file.o.
  • -MD โ€” generate a list of make dependences and print them to the file file.d, where file is the root name of the file under compilation.
  • -MM โ€” generate a list of make dependences and print them to stdout; ignore system includes.
  • -MMD[filename] โ€” generate a list of make dependences and print them to the specified file, if given, or to file file.d, where file is the root name of the file under compilation. Ignore system includes.
  • -MQ โ€” generate a list of make dependences and print them to stdout.
  • -MT โ€” generate a list of make dependences and print them to stdout.
  • -Mnostddef โ€” do not predefine any macros to the preprocessor.
  • -Mnostdinc โ€” do not search in the standard location for include files when those files are not found elsewhere.
  • -Mpreprocess โ€” run the preprocessor on assembler source files.
  • -N โ€” preprocess each file and leave the output in a file named file.i for each file named file.c.
  • --no_line_commands โ€” preprocess each file and leave the output in a file named file.i for each file named file.cc; remove comments and leave out line control information.
  • -P โ€” stop after preprocessing.
  • --preprocess โ€” preprocess each file and leave the output in a file named file.i for each file named file.cc; remove comments and add line control information.
  • -Uname โ€” remove the definition of the name macro in the preprocessor.
  • -undefine_macroname โ€” undefine a macro; see -U.
  • -YI,directory โ€” change the standard include directory to directory.
  • -Yp,directory โ€” look in directory for the preprocessor executable.

๐Ÿ› ๏ธ Assembler Options ๐Ÿ› ๏ธ

Tiny section, but still important, bestie ๐ŸŽ€

  • -Wa,option[,option...] โ€” pass each comma-delimited option to the assembler.
  • -Ya,directory โ€” look in directory for the assembler executable.

๐ŸŽ€ Linker Options ๐ŸŽ€

okay bestie, linker era is here ๐Ÿ’… this is where we tell the linker what to do, and every one of these flags is lowkey important โ€” so let's get into it, no cap.

  • -acclibs โ€” link-time option to add the accelerator libraries to the link line.
  • --as-needed, --no-as-needed โ€” passed to the linker. --as-needed instructs the linker to only set the DT_NEEDED flag for subsequent shared libraries, requiring those libraries at run time, if they are used to satisfy references. --no-as-needed restores the default behavior.
  • -Bdynamic โ€” passed to the linker to specify dynamic binding.
  • -Bstatic โ€” same as -static; please refer to -static for details.
  • -Bstatic-nvidia โ€” same as -static-nvidia; please refer to -static-nvidia for details.
  • -Bsymbolic โ€” passed to linker; specify symbolic binding.
  • -cudaforlibs โ€” link-time option to add the CUDA Fortran runtime libraries, allowing mixed-language programming. Implies -fortranlibs.
  • -cudalib[=libname[,libname...]] โ€” add CUDA-optimized libraries to the link line. When no option is specified the compiler will link all necessary CUDA-optimized libraries. -cudalib will use the version of the library appropriate to the CUDA version being used. The libraries recognized are:
    • cublas
    • cublasmp
    • cufft
    • cufftmp
    • cufftw
    • curand
    • cusolver
    • cusolvermp
    • cusparse
    • cutensor
    • nccl
    • nvblas
    • nvshmem
    • nvtx3
  • -cudalibs โ€” this one has been deprecated, bestie; please refer to -cudalib. Link-time option to add the CUDA runtime API library.
  • -fortranlibs โ€” link-time option to add the Fortran runtime libraries, allowing mixed-language programming.
  • -g77libs โ€” link-time option which allows object files generated by GNU g77 (or gcc) to be linked in to nvc++ main programs.
  • -Ldirectory โ€” passed to the linker; add directory to the list of directories in which the linker searches for libraries.
  • -llibrary โ€” passed to the linker; load the library liblibrary.a from the standard library directory. See also the -L option.
  • -m โ€” cause the linker to display a link map.
  • -Mcudalib[=libname[,libname...]] โ€” deprecated, please refer to -cudalib. Add CUDA-optimized libraries to the link line. When no option is specified the compiler will link all necessary CUDA-optimized libraries.
  • -Meh_frame, -Mnoeh_frame โ€” add (don't add) arguments to the link line to preserve the stack frame information for zero-cost exception handling frames. The default is -Mnoeh_frame unless changed in a site or user rcfile.
  • -Mnostartup โ€” do not link in the usual startup routine. This routine contains the entry point for the program.
  • -Mnostdlib โ€” do not link in the standard libraries when linking a program.
  • -Mrpath (default), -Mnorpath โ€” the default is to add -rpath to the link line giving the directories containing the required runtime shared objects. Use -Mnorpath to instruct the driver not to add any -rpath switches to the link line.
  • -Mmkl โ€” add Intel's Math Kernel libraries to the link line. Requires that the environment variable MKLROOT be set to the path to the local MKL installation (the part of the path that precedes lib/<arch>).
  • -pthread โ€” adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker.
  • -Rdirectory โ€” passed to the linker; instructs the linker to hard-code the pathname directory into the search path for generated shared object files. Note that there cannot be a space between R and directory.
  • -r โ€” passed to the linker; generate a re-linkable object file.
  • -rpath directory โ€” passed to the linker to add the directory to the runtime shared library search path.
  • -s โ€” passed to the linker; strip symbol table information.
  • -shared โ€” passed to the linker. Instructs the linker to generate a shared object file (dynamically linked library). Implies -fpic.
  • -soname name โ€” passed to the linker. When creating a shared object, instructs the linker to set the internal DT_SONAME field to the specified name.
  • -static โ€” passed to the linker to specify static binding.
  • -static-nvidia โ€” statically link in the NVIDIA runtime libraries, while using dynamic linking for the system libraries; implies -Mnorpath.
  • -uname โ€” passed to the linker; generate undefined reference.
  • --whole-archive, --no-whole-archive โ€” passed to the linker. Instructs the linker to include all objects in subsequent archive files. --no-whole-archive restores the default behavior.
  • -Wl,option[,option]... โ€” pass each comma-delimited option to the linker.
  • -Xlinker option[,option]... โ€” pass each comma-delimited option to the linker.
  • -YC,directory โ€” look in directory for the standard compiler library files.
  • -Yl,directory โ€” look in directory for the linker.
  • -YL,directory โ€” change the standard library directory to directory.
  • -YP,directory โ€” add a standard library directory.
  • -YS,directory โ€” look in directory for the standard system startup object files.
  • -YU,directory โ€” passed to the linker; change library search path.

โœจ Language Options โœจ

okay now we're in language mode ๐Ÿฆ‹ these options control how the compiler reads your actual C++ vibes โ€” tokens, templates, comments, standards, all of it ๐Ÿ’–

  • -$ โ€” accept dollar signs in identifiers.
  • -A โ€” same as --strict. Enable strict ANSI/ISO mode, which issues error messages when non-standard features are used, and disables features that conflict with ANSI/ISO C or C++.
  • -a โ€” enable ANSI/ISO mode; issue warning messages when non-standard features are used.
  • --alternative_tokens, --no_alternative_tokens (default) โ€” enable (disable) recognition of alternative tokens; this controls recognition of digraph tokens and of the operator (e.g., and) keywords.
  • --anachronisms, --no_anachronisms (default) โ€” allow (disallow) C++ anachronisms.
  • --array_new_and_delete, --no_array_new_and_delete โ€” enable array new and delete operations.
  • -asmsuffix=suffix โ€” define that a file with the given suffix is an assembly language file.
  • --auto_instantiation (default), --no_auto_instantiation โ€” enable (disable) automatic instantiation of templates.
  • -B โ€” allow C++-style comments in source code; these begin with the characters // and continue to the end of the current line. Such comments are stripped unless you specify the -C option.
  • -cuda[=option[,option...] โ€” enable CUDA Fortran; add CUDA include paths, and link with the CUDA runtime libraries. -cuda is required on the link line. If -cuda is used in compilation, it must also be used for linking. For target specific options, please refer to -gpu. For linking additional CUDA libraries (e.g. math libraries), please refer to -cudalib. Use the following sub-options to tailor the compilation of CUDA Fortran accelerator regions:
    • charstring โ€” enable limited support for character strings in GPU kernels.
    • madconst โ€” put Module Array Descriptors in CUDA Constant Memory.
  • --bool (default), --no_bool โ€” enable (disable) recognition of the bool datatype.
  • --brief_diagnostics, --no_brief_diagnostics (default) โ€” enable (disable) brief diagnostic mode; when enabled, the original source line is not displayed, and the error message is not wrapped even when too long to fit on a single line.
  • --builtin (default), --no_builtin โ€” compile (don't compile) with builtin math subroutine support, certain math library routines inlined.
  • --comments โ€” preserve comments.
  • --compress_names, --no_compress_names (default) โ€” compress C++ mangled names to fit into 1024 characters. All C++ user code must be compiled with the same setting of --compress_names or --no_compress_names.
  • -cppsuffix=suffix โ€” define that a file with the given suffix is a C++ source file.
  • --create_pchfilename โ€” create a precompiled header file with the specified name, if applicable. This switch conflicts with --pch (automatic PCH mode).
  • --c++standard โ€” specify the C++ language standard to use when compiling. Possible values are:
    • 03 โ€” the 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect reports. This is the default if no --c++ option is specified.
    • 11 โ€” the 2011 ISO C++ standard plus amendments.
    • 14 โ€” the 2014 ISO C++ standard plus amendments.
    • 17 โ€” the 2017 ISO C++ standard plus amendments.
    • 20 โ€” the next revision of the ISO C++ standard. Support is experimental and will change in future releases.
  • --distinct_template_signatures, --no_distinct_template_signatures (default) โ€” enable (disable) distinct name mangling for templates and nontemplates.
  • --dollar โ€” accept dollar signs in identifiers.
  • -enumber โ€” set the C++ front end error limit to the specified number. The C++ compiler will abandon compilation after the specified number of errors.
  • --early_tiebreaker โ€” select the way that tie-breakers (e.g., cv-qualifier differences) apply in overload resolution. In "early" tie-breaker processing, the tie-breakers are considered at the same time as other measures of the goodness of the match of an argument value and the corresponding parameter type (this is the standard approach). This is the default for Linux; see --late_tiebreaker.
  • --enum_overloading, --no_enum_overloading โ€” enable (disable) support for using operator functions to overload builtin operations on enum-typed operands. The default is --enum_overloading, except on WIN64.
  • --error_limitnumber โ€” set the C++ front end error limit to the specified number. The C++ compiler will abandon compilation after the specified number of errors. By default, the limit is 100.
  • --explicit (default), --no_explicit โ€” enable (disable) support for the explicit keyword.
  • -fix_so_init โ€” tells the prelinker to gather up .init sections into an assembly file ๐Ÿ’…
  • --for_init_diff_warning (default) / --no_for_init_diff_warning โ€” turn on (or off) a warning that fires when a program compiled under the new for-init scoping rules would behave differently under the old rules. The compiler is being a lil snitch and honestly? good for it ๐Ÿซถ
  • --force_vtbl โ€” force the definition of virtual function tables in cases where the heuristic the front end uses to decide on defining virtual function tables gives it literally no guidance bestie; see --suppress_vtbl โœจ
  • -fno-builtin โ€” same option as -Mno-builtin. Go read -Mno-builtin for the details, iykyk ๐Ÿ’–
  • --gnu_extensions โ€” allow gnu extensions like include_next, which you need to compile Linux system header files. This is the default on Linux systems ๐Ÿง
  • --guiding_decls, --no_guiding_decls (default) โ€” enable guiding declarations of template functions โœจ
  • --ieeenum โ€” IEEE floating-point support ๐Ÿ’…
  • --implicit_include (default), --no_implicit_include โ€” enable (disable) implicit inclusion of source files as a method of finding definitions of template entities to be instantiated ๐ŸŒธ
  • --implicit_typename (default), --no_implicit_typename โ€” enable (disable) implicit determination, from context, of whether a template parameter dependent name is a type or a nontype ๐Ÿ”ฅ
  • --late_tiebreaker โ€” picks how tie-breakers (think: cv-qualifier differences) apply in overload resolution. In "late" tiebreaker processing, tie-breakers get ignored during the initial comparison and only get considered if two functions are otherwise equally good on all arguments; then the tie-breakers can be used to choose one function over another. This is the default for WIN65; see --early_tiebreaker ๐Ÿ‘‘
  • --listfilename โ€” generate raw listing information in the file filename. This info is likely gonna be used to generate a formatted listing. The raw listing file contains raw source lines, information on transitions into and out of include files, and diagnostics generated by the front end ๐Ÿ“‹
  • --llalign, --no_llalign โ€” align (don't align) long longs in structures on 8-byte boundaries; same as -M[no]llalign. --llalign is the default for 64-bit systems โญ
  • --long_lifetime_temps โ€” select long lifetime for temporaries, meaning to the earliest of end of scope, end of switch clause, or the next label; this one's used by cfront. See --short_lifetime_temps ๐Ÿ•ฐ๏ธ
  • --long_preserving_rules, --no_long_preserving_rules (default) โ€” enable (disable) the K&R usual arithmetic conversion rules with respect to long ๐Ÿ’œ
  • -Mbuiltin (default), -Mnobuiltin โ€” compile (don't compile) with math subroutine builtin support, which causes selected math library routines to be inlined ๐Ÿงฎ
  • -Mdalign (default), -Mnodalign โ€” align (don't align) doubles in structures on 8-byte boundaries. Heads up: -Mnodalign may lead to data alignment exceptions ๐Ÿ˜ญ
  • -Mdollar=char โ€” set the character used to replace dollar signs in names to be char. Default is an underscore (_) ๐Ÿ’ฒ
  • -Mfcon โ€” treat non-suffixed floating-point constants as float, rather than double. This may improve the performance of single-precision code ๐Ÿš€
  • -Mllalign (default), -Mnollalign โ€” align (don't align) long longs or INTEGER*8 in structures or common blocks on 8-byte boundaries. -Mllalign is the default โœจ
  • -Mlibsuffix=suffix โ€” define that a file with the given suffix is an object library file ๐Ÿ“š
  • -Mobjsuffix=suffix โ€” define that a file with the given suffix is a binary object file ๐Ÿ“ฆ
  • -Mschar (default) โ€” specify that the char type is signed by default; see -Muchar ๐ŸŽ€
  • -Msignextend (default), -Mnosignextend โ€” sign extend (don't sign extend) when a narrowing conversion overflows. Example time: when -Msignextend is in effect and an integer containing the value 65535 is converted to a short, the value of the short will be -1. ANSI C specifies that the result of such conversions are undefined ๐Ÿ’€
  • -Msingle, -Mnosingle (default) โ€” suppress (don't suppress) the ANSI-specified conversion of float to double when passing arguments to a function with no prototype in scope. -Msingle may result in faster code when single precision is used a lot, but it is non-ANSI compliant ๐Ÿ™ˆ
  • -Muchar โ€” specify that the char type is unsigned by default; see -Mschar ๐ŸŒˆ
  • --namespaces, --no_namespaces โ€” enable (disable) support for namespaces ๐Ÿท๏ธ
  • --new_for_init โ€” controls the scope of a declaration in a for-init-statement; the new standard-conforming rules in effect wrap the entire for statement in its own implicitly generated scope. This is the default except on WIN64; see --old_for_init ๐ŸŒ€
  • --no_exceptions โ€” disable exception handling support. Throw expressions and try/catch statements will result in compilation errors. Exception specifications will be ignored โš ๏ธ
  • --no_use_before_set_warnings โ€” suppress warning messages about variables used before being set ๐Ÿคซ
  • --no_warnings โ€” suppress all warning messages. living that fearless life fr fr ๐Ÿ’…
  • --non_const_ref_anachronism, --no_non_const_ref_anachronism โ€” allow (don't allow) references to nonconst to bind to class rvalue ๐ŸŒธ
  • --old_for_init โ€” controls the scope of a declaration in a for-init-statement; the old cfront-compatible scoping rules mean the declaration is in the scope to which the for statement itself belongs. This is the default for WIN64; see --new_for_init ๐Ÿ•น๏ธ
  • --old_specializations, --no_old_specializations โ€” enable (disable) old-style specialization declarations ๐Ÿ—‚๏ธ
  • --pch โ€” automatically use and/or create a precompiled header file. Careful bestie: this command conflicts with --use_pch or --create_pch (manual PCH mode) ๐Ÿ’ฅ
  • --pch_dirdirectory โ€” name the directory in which to search for and/or create a precompiled header file. This option may be used with automatic PCH mode (--pch) or manual PCH mode (--create_pch or --use_pch) ๐Ÿ“
  • --pch_memnum โ€” specify the memory to be used for PCG processing ๐Ÿง 
  • --pch_messages, --no_pch_messages โ€” enable (disable) the display of a message indicating that a precompiled header file was created or used in the current compilation ๐Ÿ’ฌ
  • --pedantic โ€” don't suppress warnings from system include files. she's thorough ๐Ÿ‘€
  • --preincludefilename โ€” specify a file to be included at the beginning of compilation to set system-dependent macros, types, etc. โ€” filename energy ๐Ÿงš
  • --prelink_objects โ€” when used with the --one_instantiation_per_object switch, this creates template instantiations for a set of objects that are about to become a template library. This is required for template libraries that reference other template libraries ๐Ÿ”—
  • --remarks โ€” issue remarks, which are diagnostic messages even milder than warnings ๐Ÿฃ
  • --remove_unneeded_entities โ€” remove unnecessary IL entries ๐Ÿงน
  • --restrict, --no_restrict (default) โ€” enable (disable) the use of the restrict keyword ๐Ÿšง
  • --rtti (default), --no_rtti โ€” enable (disable) support for RTTI (runtime type information) features: dynamic_cast, typeid ๐ŸŽญ
  • --short_lifetime_temps (default) โ€” select short lifetime for temporaries, meaning to the end of the full expression; this is the C++ standard. See --long_lifetime_temps โณ
  • -std=c++standard โ€” specify the C++ language standard to use when compiling. Same as --c++standard ๐Ÿ“
  • --suppress_vtbl (default) โ€” suppress definition of virtual function tables in cases where the heuristic used by the front end to decide on definition of virtual function tables provides no guidance. The virtual function table for a class is defined if the compilation contains a definition of the first non-inline non-pure virtual function of the class ๐Ÿ‘ป
  • --timing โ€” display C++ front end compilation times โฑ๏ธ
  • --trace_includes โ€” list include files ๐Ÿ”
  • --typename, --no_typename โ€” enable (disable) typename ๐Ÿท๏ธ
  • --use_pchfilename โ€” use a precompiled header file of the specified name (filename) as part of the current compilation. This command conflicts with --pch ๐Ÿ’ฅ
  • --using_std (default), --no_using_std โ€” enable (disable) implicit use of the std namespace when standard header files are included ๐Ÿ“›
  • --wrap_diagnostics, --no_wrap_diagnostics โ€” enable (disable) diagnostic wrapping ๐Ÿ“
  • -Xfilename โ€” generate cross reference information and place output in the specified file (filename) ๐Ÿ—บ๏ธ

๐ŸŽฏ Target-specific Options ๐ŸŽฏ

  • -acc โ€” enable OpenACC pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices. See the -gpu flag to select options specific to NVIDIA GPUs. The options are:
    • autopar (default), noautopar โ€” enable loop autoparallelization within parallel constructs โšก
    • gpu (default) โ€” compile OpenACC directives for parallel execution on the GPU ๐Ÿ–ฅ๏ธ
    • host โ€” compile OpenACC directives for serial execution on the host CPU ๐ŸŒ
    • legacy โ€” suppress warnings about deprecated PGI accelerator directives ๐Ÿ•ฐ๏ธ
    • multicore โ€” compile OpenACC directives for parallel execution on the host CPU ๐Ÿงต
    • routinepar, noroutinepar (default) โ€” infer parallelism level clause (gang, worker, vector) in implicit routine directives ๐Ÿ”ฎ
    • routineseq, noroutineseq (default) โ€” compile every routine for the device, as if it had a routine seq directive ๐Ÿ“œ
    • strict โ€” issue warnings when accelerator directives are encountered which do not adhere to the OpenACC standard ๐Ÿšจ
    • sync โ€” ignore async clauses, and run every data transfer and kernel launch on the default sync queue โฒ๏ธ
  • verystrict โ€” aborts compilation with a fatal error if an accelerator directive shows up that does not adhere to the OpenACC standard. It is giving strict, and it means it ๐Ÿ’…
  • wait (default), nowait โ€” wait is the default and waits for each compute kernel to finish; nowait is the no-wait variant.
  • -noacc โ€” disables OpenACC directives and does not link with OpenACC libraries. Simple, iconic, no extra drama.
  • -cuda[=option[,option...] โ€” enables CUDA Fortran, adds CUDA include paths, and links with the CUDA runtime libraries. -cuda is required on the link line. If -cuda is used in compilation, it must also be used for linking. For target-specific options, go look at -gpu. For linking additional CUDA libraries (e.g. math libraries), go look at -cudalib. Use these sub-options to tailor compilation of CUDA Fortran accelerator regions:
    • charstring โ€” enables limited support for character strings in GPU kernels.
    • madconst โ€” puts Module Array Descriptors in CUDA Constant Memory.

  • -gpu=option โ€” use these sub-options to tailor compilation of target accelerator regions. Yes bestie, there are a lot of them, and every single one is staying ๐Ÿซถ
    • autocompare โ€” automatically compares CPU/GPU results. Accelerated code sections run in redundant mode, and data is compared whenever it would ordinarily be moved off the accelerator.
    • ccXY โ€” generates code for a device with compute capability XY. Multiple compute capabilities can be specified, and one version is generated for each. By default, the compiler detects the compute capability for each installed GPU. Use -help -gpu to see the valid compute capabilities for your installation.
    • ccall โ€” generates code for all compute capabilities supported for this target and by the selected CUDA Toolkit version.
    • ccnative โ€” detects the visible GPUs on the system and generates codes for them. If no device is available, the default compute capability is used (cc50).
    • ccall-major โ€” compiles for all major supported compute capabilities (does not include PTX for the highest major virtual architecture; see -gpu=[no]rdc for that support).
    • cudaX.Y โ€” uses CUDA X.Y Toolkit compatibility, where installed.
    • deepcopy โ€” enables Full Deepcopy support in OpenACC Fortran.
    • fastmath โ€” enables the fast math library, which includes faster but lower-precision implementations of certain math and intrinsic functions.
    • flushz, noflushz (default) โ€” enable (disable) flush-to-zero mode on the GPU. noflushz is the default.
    • fma, nofma โ€” generate (do not generate) fused multiply-add operations on the GPU. This is enabled by default at optimization level -O1.
    • implicitsections, noimplicitsections (default) โ€” change (do not change) array element references in OpenACC and OpenMP data clause to array sections references.
    • interceptdeallocations, nointerceptdeallocations โ€” intercept (do not intercept) LIBC function calls (e.g. free) and call the corresponding CUDA memory deallocation version if the address is in pinned or managed memory, and the regular version otherwise.
    • keepbin โ€” keeps the generated CUDA binary, with a .cubin suffix.
    • keepgpu โ€” keeps the generated CUDA GPU source files, with a .gpu suffix.
    • keepltoir โ€” keeps the generated GPU LTOIR files, with a .ltoir suffix. Works only when -gpu=lto is enabled.
    • keepptx โ€” keeps the generated portable assembly files, with a .ptx suffix.
    • lineinfo, nolineinfo (default) โ€” generate debugging line information. nolineinfo is the default.
    • loadcache:[L1|L2] โ€” generate code to cache global memory loads in the L1 or L2 hardware cache.
    • lto โ€” enables Device Link Ltime Optimization (Device LTO).
    • maxregcount:n โ€” sets the maximum number of registers to use in the generated GPU code.
    • managed โ€” allocates any dynamically allocated data in CUDA Managed memory. This option must appear in both the compile and link lines. This option may not be used with -gpu=pinned.
      • intercept โ€” intercepts LIBC function calls (e.g. free) and calls their managed memory version if the address is in managed memory, and the regular version otherwise.
    • nomanaged โ€” does not allocate any dynamically allocated data in CUDA Managed memory. Use with -stdpar to prevent that flag's implicit use of -gpu=managed when CUDA Managed memory capability is detected.
    • nounified โ€” does not compile for CUDA Unified memory capability. Use with -stdpar to prevent that flag's implicit use of -gpu=unified when CUDA Unified memory capability is detected.
    • pinned โ€” allocates any dynamically allocated data in CUDA Pinned host memory. This option must appear in both the compile and link lines. This option may not be used with -gpu=managed|unified.
      • intercept โ€” intercepts LIBC function calls (e.g. free) and calls their pinned memory version if the address is in pinned memory, and the regular version otherwise.
    • mem:[mode] โ€” selects GPU memory mode from one of the following options: separate, managed, unified. This option cannot be combined with -gpu=pinned, gpu=managed or -gpu=unified.
      • mem:separate โ€” all data are in separate CPU and GPU memories. Explicit memory copies are performed when data are accessed from both CPU and GPU.
      • mem:managed โ€” allocates any dynamically allocated data in CUDA Managed Memory. Data that are not allocated dynamically are in separate GPU memory and are copied explicitly between CPU and GPU memories. This option must appear in both the compile and link lines.
      • mem:unified โ€” compiles for full CUDA Unified Memory capability, where system memory is accessible from the GPU. All variables in the CPU code are accessible from the GPU without explicit directives or attributes. This mode utilizes system and managed memory for dynamically allocated data unless explicit behavior is set through -gpu=mem:unified:[no]managedalloc subflags. This option must appear in both the compile and link lines.
    • mem:unified:managedalloc, mem:unified:nomanagedalloc โ€” allocate (do not allocate) any dynamically allocated data in CUDA Managed Memory.
    • mem:separate:pinnedalloc, mem:separate:nopinnedalloc โ€” allocate (do not allocate) any dynamically allocated data in CUDA Pinned host memory.
    • ptxinfo โ€” prints ptxas information.
    • rdc (default), nordc โ€” generate (do not generate) relocatable device code for separate compilation, and invoke the device linker before the host linker at the link step. rdc is the default.
    • redundant โ€” runs accelerated code redundantly on the CPU. Implied by autocompare.
    • safecache โ€” allows variable-sized array sections in cache directives; the compiler assumes they fit into CUDA shared memory.
    • sm_XY โ€” generates code for a device with compute capability XY. Multiple compute capabilities can be specified, and one version is generated for each. By default, the compiler detects the compute capability for each installed GPU. Use -help -gpu to see the valid compute capabilities for your installation.
    • stacklimit:limit (default), nostacklimit โ€” this option has been deprecated and will be removed in a future release. It gives an error if the total stack size of a kernel or procedure exceeds limit KBytes. The default is stacklimit:512.
    • tripcount:host โ€” calculates loop trip counts on the host for some compute constructs. This is the default behavior when -gpu=tripcount is not specified. Note that this behavior is not compliant with the OpenACC specification. To ensure compliance with the specification, please use -gpu=tripcount:device.
    • tripcount:device โ€” calculates loop trip counts on the device for some compute constructs. Note that this behavior is compliant with the OpenACC specification, though it is not the default behavior. To explicitly enable the default behavior, please use -gpu=tripcount:host.
    • tripcount:warn, tripcount:nowarn โ€” enable (disable) compile-time warnings when loop trip counts are calculated on the host instead of on the device.
    • tripcount:check, tripcount:nocheck โ€” insert (do not insert) runtime checks to ensure the trip count value calculated on the device matches the trip count value calculated on the host. To enable reporting of differences, set the environment variable NVCOMPILER_ACC_CHECK_TRIPCOUNT.
    • unified โ€” compiles for CUDA Unified memory capability, where system memory is accessible from the GPU. All variables in the CPU code are accessible from the GPU without explicit directives or attributes. This mode utilizes system and managed memory for dynamically allocated data unless explicit behavior is set through -gpu=[no]managed. This option must appear in both the compile and link lines. This option may not be used with -gpu=pinned.
      • intercept โ€” intercepts LIBC function calls (e.g. free) and calls their unified version if the address is in unified memory, and the regular version otherwise.
    • unroll, nounroll โ€” automatically (do not) unroll inner loops. This is enabled by default at optimization level -O3.
  • -Kieee, -Knoieee (default) โ€” does your floating-point math in strict conformance with the IEEE 754 standard, no games. Fair warning: -Kieee turns off some optimizations and pulls in a more accurate math library, so it's the "correct but slower" bestie. The default -Knoieee uses faster but very slightly less accurate methods. Slay either way, just know the tradeoff ๐Ÿ’…
  • -Ktrap=option[,option]... โ€” controls what the processor does when floating-point exceptions pop off during program execution. The possible options include:
    • denorm โ€” trap on denormalized operands.
    • divz โ€” trap on divide by zero.
    • fp โ€” trap on floating-point exceptions.
    • inexact โ€” trap on inexact result.
    • inv โ€” trap on invalid operation.
    • none (default) โ€” disable all the traps. Heads up: -Ktrap=inv,none,ovf implies -Ktrap=ovf.
    • ovf โ€” trap on floating-point overflow.
    • unf โ€” trap on floating-point underflow. Also, -Ktrap is only meaningful when you're compiling a C/C++ main function or a Fortran main program, iykyk.

Quick shortcut: -Ktrap=fp is shorthand for -Ktrap=divz,inv,ovf.

These options map to the processor's floating-point exception mask bits. Normally the processor's exception mask bits are enabled, meaning floating-point exceptions are masked โ€” the processor recovers from the exception and just keeps going, main character energy. But if a mask bit is off (unmasked) and that exception happens, execution terminates with a floating-point exception (Linux FPE signal). ๐Ÿ˜ญ So like, unmask responsibly.

  • -march=target โ€” literally the same thing as -tp. Go read the -tp section below for the deets, bestie.
  • -m[no-]daz-ftz โ€” specifies how denormals are handled by the processor at runtime. -mno-daz-ftz says denormal operands and results are honored โ€” shorthand for -Mnodaz -Mnoflushz. And -mdaz-ftz is the default setting, saying denormal operands and results get treated as zero โ€” shorthand for -Mdaz -Mflushz. Two vibes, pick one ๐Ÿฆ‹
  • -Mdaz, -Mnodaz โ€” enable [disable] the mode that treats denormal (subnormal) floating-point operands as zero. -Mdaz is the default setting for x86_64 and aarch64 processors. Periodt.
  • -Mflushz, -Mnoflushz โ€” enable [disable] setting floating-point denormal (subnormal) results to zero. -Mflushz is the default setting for x86_64 and aarch64 processors. Yes, both defaults are the same processors, it's giving consistency ๐Ÿ’–
  • -Mfpmisalign, -Mnofpmisalign โ€” allow (don't allow) vector arithmetic instructions with memory operands that are not aligned on 16-byte boundaries. Alignment girlies stay winning โœจ
  • -Mfprelaxed [=option[,option,...]], -Mnofprelaxed (default) โ€” perform (don't perform) certain floating-point operations using relaxed precision when it improves speed. The options are:
    • div โ€” perform divide using relaxed precision.
    • intrinsic โ€” perform certain intrinsic functions using relaxed precision.
    • order, noorder โ€” allow (don't allow) expression reordering, including factoring stuff like computing a*b+a*c as a*(b+c).
    • recip โ€” perform reciprocal operations using relaxed precision.
    • rsqrt โ€” perform reciprocal square root (1/sqrt) using relaxed precision.
    • sqrt โ€” perform square root using relaxed precision.

With no options at all, -Mfprelaxed will choose to generate relaxed precision code for those operations that give a significant performance improvement, depending on the target processor. Vibes-based optimization, honestly iconic ๐Ÿ”ฅ

  • -Mfunc32 (default), -Mnofunc32 โ€” align (don't align) functions on 32 byte boundaries. Cute and tidy ๐ŸŽ€
  • -Mgccbugs โ€” matches the behavior of certain bugs in gcc. Yes bestie, we're recreating the bugs on purpose. Compatibility is wild.
  • -Mlongbranch, -Mnolongbranch (default) โ€” enable (disable) long branches.
  • -Msecond_underscore, -Mnosecond_underscore (default) โ€” add (don't add) a second underscore to the name of a Fortran global if its name already contains an underscore. This one's useful for keeping compatibility with g77, which adds a second underscore to such symbols by default. Legacy friendship maintenance ๐Ÿซถ
  • -Mwritable-strings โ€” stores string constants in the writable data segment. Write away, babe.
  • -mcmodel=small|medium โ€” pick your memory model:
    • small โ€” limits the combined area for a user's object or executable to 4GB. The maximum code size is 2GB.
    • medium โ€” allows unrestricted data size. The maximum code size is 2GB.

Two sizes, same 2GB code ceiling. Choose your fighter ๐Ÿ’€

  • -stdpar=option โ€” enables (ISO C++17) Parallel Algorithms. The options:
    • gpu โ€” (ISO C++17) Parallel Algorithms are compiled for parallel execution on the GPU. This option implies -gpu=mem:unified on targets with full CUDA Unified memory capability and -gpu=mem:managed otherwise.
    • gpu:acc โ€” (ISO C++17) Parallel Algorithms are compiled for parallel execution on the GPU implemented with OpenACC. Same deal: implies -gpu=mem:unified on targets with full CUDA Unified memory capability and -gpu=mem:managed otherwise.
    • multicore โ€” (ISO C++17) Parallel Algorithms are compiled for parallel execution on the CPU.
  • -nostdpar โ€” executes (ISO C++17) Parallel Algorithms sequentially. One at a time, no chaos, lowkey peaceful ๐ŸŒธ
  • -ta=target โ€” okay so this option has been deprecated, please refer to -acc instead. The sub-forms:
    • -ta=tesla โ€” deprecated, please refer to -acc=gpu and -gpu.
    • -ta=multicore โ€” deprecated, please refer to -acc=multicore.
    • -ta=host โ€” deprecated, please refer to -acc=host.

All of these are giving "retired but still in the group chat" ๐Ÿ™ˆ

  • -target=option โ€” selects the target for all the parallel programming paradigms you're using (OpenACC, OpenMP, Standard Languages). The possibilities are:
    • gpu โ€” globally set the target device to an NVIDIA GPU.
    • multicore โ€” globally set the target device to the host CPU.
  • -tp=target โ€” specifies the type of the target processor. Run this:
nvc++ -help -tp

to display the list of recognized target processors. Go get your list, bestie โญ


๐Ÿ“ FILES ๐Ÿ“

  • a.out โ€” executable output file
  • pgpf.out โ€” Profile feedback data file; see -Mpfi
  • pgprof.out โ€” PGPROF output file; see -Mprof
  • file.a โ€” library of object files
  • file.C โ€” C++ source file
  • file.cc โ€” C++ source file
  • file.cpp โ€” C++ source file
  • file.cxx โ€” C++ source file
  • file.c++ โ€” C++ source file
  • file.i โ€” C++ source file after preprocessing
  • file.cu โ€” CUDA source file
  • file.cup โ€” CUDA source file after preprocessing.
  • file.ipa โ€” InterProcedural Analyzer (IPA) file
  • file.ipo โ€” InterProcedural Analyzer (IPA) file
  • file.o โ€” object file
  • file.s โ€” assembler source file.
  • file.ti โ€” C++ template instantiation file
  • .mynvc++rc โ€” you may add custom switches or make other additions to nvc++ by creating a file named .mynvc++rc in your home directory. Customization era ๐Ÿ’…

The installation of this version of the compiler resides in Basedir/Linux_x86_64/dev/; other versions may coexist in Basedir/Linux_x86_64/release/. Basedir is the root of the compiler installation directory, specified by the installer. The default is /opt/nvidia/hpc_sdk. Noted and memorized ๐Ÿ“Œ

The compiler installation subdirectories are:

  • compilers/bin/ โ€” Compiler and tool executables and configuration files (rcfiles).
  • compilers/include/ โ€” Compiler include files.
  • compilers/lib/ โ€” Runtime libraries and object files.
  • comm_libs/ โ€” Communication libraries, including NCCL and NVSHMEM.
  • math_libs/ โ€” Math libraries, including cuBLAS, cuTENSOR, cuSPARSE, cuFFT, cuSOLVER, and cuRAND.
  • profilers/ โ€” Profilers, including Nsight Compute and Nsight Systems.

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

nvc (1), nvfortran (1), and the NVIDIA User's Guide. Go read the whole friend group ๐Ÿซถ


๐Ÿฉบ DIAGNOSTICS ๐Ÿฉบ

The compiler produces information and error messages as it translates the input program. The linker and assembler may also issue their own error messages โ€” so if you see something spicy scroll by, it might not even be the compiler's fault, ngl ๐Ÿ’€


And that's the whole page, bestie! This masterpiece is from the nvc++(1) manual page, dated September 2026 โ€” go off, September 2026, you ate ๐Ÿ‘‘โœจ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from