pgcc(1)

πŸ“¦ version 26.9, in arch rolling

πŸ’– pgcc(1) πŸ’–

okay so this is pgcc(1) from the General Commands Manual, and we are diving all the way in, bestie. No cap, this page is long, but it's giving β€œcompiler lore” and we're gonna get through it together. πŸ’…


✨ NAME ✨

nvc β€” The NVIDIA ANSI and K&R C compiler. And yes, pgcc is literally an alias for nvc, so same energy, different name. 🫢


🌈 SYNOPSIS 🌈

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so pgcc is an alias for nvc. nvc is a C11 compiler for NVIDIA GPUs and AMD and Intel CPU. It supports C11, 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. iconic behavior, honestly. πŸ‘‘

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

  • .c β€” C source; preprocess, compile
  • .i β€” C source after preprocessing; 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 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, 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, or -S options, or unless compilation errors stop the whole process. πŸ’€


πŸ’… OPTIONS πŸ’…

Options must be separate; -cs is different from -c -s. fr fr, do not smoosh them together. Here is a list of all options, grouped by type. More detailed explanations are in following sections. 🌸

πŸŽ€ Overall Options πŸŽ€

  • --
  • -#
  • -###
  • -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
  • -Minform=level
  • -Mint128
  • -Mkeepasm
  • -M[no]list
  • -noswitcherror
  • -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]idiom
  • -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

🧚 Preprocessor Options 🧚

  • -C
  • -Dmacro
  • -dD
  • -dI
  • -dM
  • -dN
  • -E
  • -Idirectory
  • -include file
  • -idirafter directory
  • -isystem directory
  • -iquote directory
  • -M
  • -Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff]
  • -MD
  • -MM
  • -MMD
  • -MQ
  • -MT
  • -Mnostddef
  • -Mnostdinc
  • -Mpreprocess
  • -P
  • -Umacro
  • -YI,directory
  • -Yp,directory

πŸ”§ Assembler Options πŸ”§

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

πŸ”— Linker Options πŸ”—

  • -acclibs
  • --[no-]as-needed
  • -Bdynamic
  • -Bstatic
  • -Bstatic-nvidia
  • -Bsymbolic
  • -c++libs
  • -cudaforlibs
  • -cudalib=libname
  • -cudalibs
  • -fortranlibs
  • -g77libs
  • -Ldirectory
  • -llibrary
  • -m
  • -Mcudalib=libname
  • -M[no]eh_frame
  • -Mnostartup
  • -Mnostdlib
  • -M[no]rpath
  • -Mmkl
  • -nvmalloc
  • -pgc++libs
  • -pgf90libs
  • -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
  • -YS,directory
  • -YU,directory

πŸ—£οΈ Language Options πŸ—£οΈ

  • -asmsuffix=suffix
  • -B
  • -c8x
  • -c89
  • -c9x
  • -c99
  • -c11
  • -c1x
  • -cuda=option
  • -csuffix=suffix
  • -fno-builtin
  • -M[no]asmkeyword
  • -M[no]builtin
  • -M[no]dalign
  • -Mdollar=char
  • -Mfcon
  • -M[no]llalign
  • -Mlibsuffix=suffix
  • -M[no]m128
  • -Mobjsuffix=suffix
  • -Mschar
  • -M[no]signextend
  • -M[no]single
  • -Muchar
  • -M[no]variadic_macros
  • -Xa
  • -Xc
  • -Xs
  • -Xt

🎯 Target-specific Options 🎯

  • -acc
  • -noacc
  • -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
  • -ta=target
  • -target=option
  • -tp=target
⚠️ Note: 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 πŸ’…

Okay bestie, these are the big-picture switches β€” the ones that tell the driver what kind of mood it’s in. Let’s go.

  • -- β€” Anything after this switch gets treated as a filename. But heads up: most tools will not allow a filename starting with a dash, so avoid those. 🫢
  • -# β€” 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. It’s giving β€œshow me the receipts, don’t actually run them” energy.
  • -c β€” Skip the link step; compile and assemble only.
  • -defaultoptions (default), -nodefaultoptions β€” Use (or 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. This one is lowkey useful for figuring out the error number you need when you’re 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 the β€œmaximun” (yes, spelled like that πŸ’€) 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.
    • 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; implies -Mkeepasm.
  • -Minform=level β€” Specify the minimum level of error severity that the compiler displays during compilation.
    • 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.
  • -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.
  • -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.
  • -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:
    • 0 β€” for the compiler,
    • 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:
    • 0 β€” Search for the compiler 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 optimizing using ANSI C type-based pointer disambiguation rules. The options can be one of:
  • ansi β€” assume the 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. Heads up bestie: this sets the optimization level to a minimum of 2; see -O.
  • -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. (same vibe, different spelling, we love a supportive sibling)
  • -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.
  • -Mconcur[=option[,option,...]] β€” ⚠️ heads up: this option has been deprecated and will be removed in a future release. It instructs the compiler to enable auto-concurrentization of loops. This also sets the optimization level to a minimum of 2; see -O. If -Mconcur is specified, multiple processors will be used to execute loops which the compiler determines to be parallelizable. When linking, the -Mconcur switch must be specified or unresolved references will occur 😭. The OMP_NUM_THREADS or NCPUS environment variables control how many processors will be used to execute 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.
    • altcode:n, noaltcode β€” generate (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 (disable) parallelization of loops with reductions.
    • cncall, nocncall (default) β€” assume (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.
    • 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 πŸŒ€.
    • innermost, noinnermost (default) β€” enable (disable) parallelization of innermost loops.
    • levels:n β€” parallelize loops nested at most n levels deep; the default is 3.
  • -Mdepchk (default), -Mnodepchk β€” assume (don't assume) that potential data dependencies exist. πŸ’€ -Mnodepchk may result in incorrect code; the -Msafeptr switch provides a less dangerous way to accomplish the same thing.
  • -Mdse, -Mnodse (default) β€” enable (disable) the dead store elimination optimization.
  • -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.
    • [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 (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. 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 (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 (rude, but okay).
  • -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 ✨.
  • -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.
    • 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 (sorry bestie, not you).
  • [name:]function β€” if the option isn't a number, bestie, it's a function name, periodt. And if you write it as name: with the colon? Then whatever comes after is always a function name, no guessing games πŸ’…
  • pragma β€” Fortran only πŸ§šβ™€οΈ Inline only those procedures that have a !NVF$ INLINE pragma sitting on the source line immediately before the procedure's SUBROUTINE or FUNCTION statement. Like a little VIP list for your subroutines πŸ‘‘
  • [maxsize:]number β€” a numeric option gets read as a size, duh. Functions of size number or less get inlined. And if you give it both a number and a function? Then it inlines the functions matching the given name(s) or meeting the size requirements. Both paths slay 🫢
  • reshape β€” For Fortran, the default is to not inline subprograms with array arguments if the array shape doesn't match the shape in the caller. This overrides that default, so like… go off, mismatch icon πŸ’…
  • smallsize:number β€” always inline functions of size smaller than number, regardless of any other size limits. Tiny functions, main character energy ✨
  • totalsize:number β€” stop inlining inside a function once that function's total inlined size reaches number. It's giving "we're full, no more guests at the function party" πŸŽ€

✨ -Minstrument [=option] ✨

Generate extra code so you can get function-level instrumentation β€” yes, this option implies -Mframe. The option is:

  • functions (default) β€” literally the default, bestie 😌

✨ -Mipa [=option[,option,...]], -Mnoipa (default) ✨

Turn on and specify options for InterProcedural Analysis (IPA). 🌈 Heads up though: IPA is not compatible with parallel make environments (like pmake, iykyk). Also, IPA sets the optimization level to a minimum of 2; peep -O. If you don't pass an option list at all, it's equivalent to -Mipa=const. The options are:

  • align, noalign (default) β€” enable (or disable) recognition when pointer targets are all cache-line aligned, which lets the compiler cook up better SSE code generation πŸ”₯
  • arg, noarg (default) β€” remove (or don't remove) arguments replaced by -Mipa=ptr,const. Oh and -Mipa=noarg implies -Mipa=nolocalarg, no cap 🫢
  • const (default), noconst β€” enable (or disable) propagation of constants across procedure calls. Constant queen behavior πŸ’œ
  • f90ptr, nof90ptr (default) β€” enable (or disable) Fortran 90 pointer disambiguation across procedure calls 🧚
  • fast β€” picks generally optimal -Mipa flags for the target platform; run nvc -Mipa -help to see the equivalent options. It's the "just pick for me" button ⭐
  • force β€” force all objects to recompile regardless of whether the IPA information changed. No skipping, bestie πŸ’€
  • globals, noglobals (default) β€” analyze (or don't analyze) which globals get modified by procedure calls πŸ‘€
  • inline:n β€” figure out additional functions to inline, allowing up to n levels of inlining. The sub-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) β€” enable (or disable) Fortran inlining with mismatched array shapes πŸ¦‹
  • ipofile β€” save IPA information in a .ipo file instead of the default, which is appending the info to the object file. Fancy πŸ’…
  • jobs:n β€” use up to n jobs in parallel to reoptimize object files. Multitasking icon ✨
  • keepobj (default), nokeepobj β€” keep (or don't keep) the optimized object files, using file name mangling, so subsequent application builds recompile faster πŸ”₯
  • libc, nolibc (default) β€” optimize calls to certain standard C library routines πŸ“
  • 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) β€” enable (or disable) the feature that externalizes local variables so arguments can be replaced by -Mipa=ptr. And -Mipa=localarg implies -Mipa=arg πŸ‘‘
  • main:func β€” specify a function to serve as a global entry point; it may appear multiple times; it 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 get recompiled at link time. Shhh 🀫
  • 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. Struct glow-up fr fr ✨
  • required β€” return an error condition if IPA is inhibited for any reason, instead of the default behavior of just linking without IPA optimization. It's giving "no plan B" 😀
  • 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 collect IPA summary information when compiling; this prevents IPA optimization of this file, but still allows optimization for other files linked with this file. Selfless behavior, honestly 🫢
  • vestigial, novestigial (default) β€” remove (or don't remove) functions that are not called. Bye to the flops nobody calls πŸ’…

✨ -Mlre[=assoc|noassoc], -Mnolre ✨

Enable (or disable) loop-carried redundancy elimination. The assoc option allows expression reassociation, and noassoc disallows expression reassociation. Pick your fighter 😌

✨ -Mmovnt, -Mnomovnt ✨

Force (or disable) generation of nontemporal moves. Lowkey, -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 spill the tea on why certain optimizations are not being performed πŸ‘€ But like β€” use the -Minfo flag instead, bestie πŸ’…

✨ -Mnoopenmp ✨

When -mp is present, just ignore the OpenMP pragmas. Not me pretending they're not there πŸ™ˆ

✨ -Mnosgimp ✨

When -mp is present, ignore the SGI parallelization pragmas. Also ghosted πŸ‘»

✨ -Mnovintr ✨

Do not generate vector intrinsic calls. Simple as that πŸ¦‹

✨ -Mpfi[=option] ✨

Generate profile feedback instrumentation; this includes extra code to collect run-time statistics that get used in a subsequent compile. Heads up: -Mpfi must also appear when the program is linked. When the program runs, a profile feedback file pgfi.out will be generated; peep -Mpfo for the other half of the story πŸŽ€ 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,...]] ✨

Enable profile feedback optimizations; there must be a profile feedback file pgfi.out in the current directory, and it has to contain 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. Hot paths, hot girl summer πŸ”₯
  • 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 makes the resulting executable create a performance profile that you can view and analyze with the PGPROF performance profiler πŸ‘‘ In the descriptions below, old-style profiling means compiler-generated source instrumentation. MPICH-style profiling means using 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 β€” no PAPI, no party 😭) πŸ“
  • lines β€” perform old-style line level profiling πŸ“
  • time β€” generate a profile using time-based instruction-level statistical sampling. This is literally the same energy as -pg, except the profile gets saved into a file called pgprof.out instead of gmon.out. slay πŸ’«
okay so on Linux systems that have OProfile installed, PGPROF supports collecting performance data without recompiling. Using -Mprof=dwarf is highkey useful for this mode of profiling 🧚
  • -Mpropcond (default) / -Mnopropcond β€” enable (or disable, if you pick the no one) propagation of constant values that come from conditional branches with equality tests. little constants, big moves πŸ’…
  • -Mquad β€” align large objects on quad-word boundaries. big things, tidy edges ✨
  • -Msafe_lastval β€” so picture this: a scalar gets used after a loop, but it's not defined on every single iteration of that loop. By default the compiler is like "nope, not parallelizing that" πŸ™ˆ. This option tells the compiler it's safe to parallelize the loop anyway. go off, compiler 🌈
  • -Msafeptr[=option[,option,...]] / -Mnosafeptr (default) β€” overrides (or doesn't override) data dependence between C pointers, and between pointers and variables or arrays. ⚠️ bestie, use this one with care β€” there's a real potential for code to be generated that gives you unexpected or incorrect results as defined by ANSI C. But when you use it properly, it has the potential to greatly enhance performance, especially for floating-point oriented loops. Different combinations of the options can be used and they interact appropriately πŸ’–
    • all β€” all pointers are assumed not to overlap or conflict with other data objects; -Msafeptr with no options implies -Msafeptr=all. all the things, independent 🫢
    • arg | dummy β€” C dummy arguments (pointers and arrays) get 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 they're independent. do your own thing, local girlie πŸ¦‹
    • 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. zero but make it ~signed~ πŸ’…
  • -Mstride0 / -Mnostride0 (default) β€” generate (or don't generate) alternate code for a loop that contains an induction variable whose increment may be zero. what if the step is zero tho πŸ‘€
  • -Munroll[=option[,option...]] / -Mnounroll (default) β€” invoke (or don't invoke, with -Mnounroll) the loop unroller. This also sets the optimization level to a minimum of 2; check -O for that whole situation. The option is one of these:
    • c:m β€” tells the compiler to completely unroll loops with a constant loop count less than or equal to m, a supplied constant. If this value isn't supplied, the m count is set to 1. And if m is set to 1, a compiler heuristic determines the maximum loop count at which such loops will be completely unrolled. unroll it all, idc πŸ’œ
    • n:u β€” tells the compiler to unroll u times a single-block loop which is not completely unrolled, or has a non-constant loop count. If u isn't supplied, the unroller computes the number of times a candidate loop is unrolled.
    • m:u β€” tells the compiler to unroll u times a multi-block loop which is not completely unrolled, or has a non-constant loop count. If u isn't supplied, the unroller computes the number of times a candidate loop is unrolled. πŸŒ€
    • -Mnounroll β€” instructs the compiler not to unroll loops. periodt. πŸ™…
  • -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. it's "unsafe" because there are situations where the array elements allocated to some processors are not aligned πŸ’€ β€” hence the name, bestie.
  • -Mvect [=option[,option,...]] / -Mnovect (default) β€” pass options to the internal vectorizer. This also sets the optimization level to a minimum of 2, the equivalent of -O; for more info on optimization levels, see -O. If no option list is specified, then these vector optimizations are used: assoc,cachesize:c,simd:256, where c is the actual cache size of the machine. ✨ the -Mvect options are ✨
    • altcode (default) / noaltcode β€” enable (or disable) alternate code generation for vector loops, depending on stuff like array alignments and loop counts.
    • fuse / nofuse (default) β€” enable (or disable) loop fusion, which combines adjacent loops into a single loop. two loops become one, iconic πŸŽ€
    • prefetch β€” use prefetch instructions in loops where profitable. getting ahead of the vibe check πŸ¦‹
    • simd[:{128|256|512}] (default) / nosimd β€” use vector SIMD instructions (AVX, AVX2, AVX512). 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. 512-bit only if your CPU is that girl πŸ’…
    • uniform / nouniform (default) β€” perform the same optimizations in the vectorized and residual loops. Heads up: this may affect the performance of the residual loop. ⭐
these next ones are also supported, but not recommended for use in new development, except by experienced users, and they may be phased out in future releases 🫢
  • assoc (default) / noassoc β€” enable (or disable) certain associativity conversions that can change the results of a computation due to floating-point roundoff error differences. A typical optimization is changing the order of additions, which is mathematically correct but can be computationally different because of roundoff error. math said yes, float said hmm 😭
  • cachesize:number (default=automatic) β€” tells the vectorizer, when it's doing cache tiling optimizations, to assume a cache size of number.
  • gather (default) / nogather β€” enable (or disable) vectorization of loops with indirect array references.
  • idiom (default) / noidiom β€” enable idiom recognition; this is an alternate form of -Midiom.
  • levels:n β€” set the maximum nest level of loops to optimize. how deep does the loop go πŸ”₯
  • partial β€” enable partial loop vectorization via innermost loop distribution.
  • short / noshort (default) β€” enable (or 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. all loops, no cap πŸ’š
  • tile / notile (default) β€” enable (or disable) loop tiling to optimize for cache locality. πŸŽ€
-Mnovect disables the vectorizer, and it's the default at -O0 and -O1. πŸ’…
  • -Mzerotrip (default) / -Mnozerotrip β€” include (or don't include) a zero-trip test for loops. Only use -Mnozerotrip when all loops are known to execute at least once. like, you actually know bestie, for real πŸ™ˆ
  • -mp[=option] β€” enable OpenMP pragmas and directives to explicitly parallelize regions of code so they can run on accelerator devices or on a multi-processor system. The options you're allowed to use are:
    • gpu β€” compile OpenMP directives for parallel execution on the GPU. GPU GIRLIE ERA πŸ”₯
    • multicore (default) β€” compile OpenMP directives for parallel execution on the CPU.
    • align / noalign (default) β€” modify (or 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 an OMPT-enabled OpenMP library. πŸ¦‹
  • -nomp β€” ignore OpenMP directives and do not link against OpenMP runtime libraries. openmp? don't know her πŸ’…
  • -O[level] β€” set the optimization level. If -O isn't specified, then the default level is 1 if -g isn't specified, and 0 if -g is specified. If a number isn't supplied with -O, then the optimization level gets set to 2. The optimization levels and their meanings are as follows: the optimization level lore πŸ‘‘
    • -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. chill mode, no thoughts head empty 🌸
    • -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. glow up, but make it scalar ✨
    • -O2 β€” all -O optimizations are performed. In addition, more advanced optimizations are enabled, like SIMD code generation, cache alignment, and partial redundancy elimination. πŸ”₯
    • -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. shoot your shot, compiler πŸ’–
    • -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. 🫢

okay so picking up right where we left off in the optimization saga, these last two are lowkey iconic:

  • -O4 β€” all the -O1, -O2, and -O3 optimizations are performed. plus, hoisting of guarded invariant floating-point expressions is enabled. she's doing the most, and honestly? slay.
  • -pg β€” enable gprof-style sample-based profiling; implies -Mframe. yes bestie, profiling mode activated πŸ’…

🐞 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 using -O0 means the generated code will be slower than code generated at other optimization levels. so like… debug tea but make it a little slow 😭
  • -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. it's giving "for the other tools, not for your little debugging era" ✨
  • -Mbounds, -Mnobounds (default) β€” add (don't add) array bounds checking. bounds checking is not applied to a subscripting pointer. important lil caveat, bestie 🫢
  • -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 check era πŸ”
  • -Mcoff β€” generate a COFF formatted object. retro lil object file vibe.
  • -Mdwarf2 β€” generate DWARF2 debug information with -g.
  • -Mdwarf3 β€” generate DWARF3 debug information with -g.
  • -Melf β€” generate an ELF formatted object. elf girlies rise 🌸
  • -Mnodwarf β€” don't add the default dwarf information.
  • -traceback, -notraceback (default) β€” add debug information for runtime traceback.

🌸 PREPROCESSOR OPTIONS 🌸

  • -C β€” preserve comments in preprocessed C source files. keep the lil notes bestie πŸŽ€
  • -Dname[=def] β€” define name to be def in the preprocessor. if def is missing, it is assumed to be empty. if the = sign is missing, then name is defined to be the string 1. yes, exactly 1, not a vibe, not a maybe.
  • -dD β€” print to standard output a list of the macros and their values as defined in the source files, along with the file name and line number where the definitions occur. full macro receipts πŸ“
  • -dI β€” print to standard output a list of all files included by the preprocessor, including the file name and line number where the include line occurred, and the full path of the included file. include forensic era πŸ”Ž
  • -dM β€” print to standard output a list of all the macros and their values as defined in the source files, along with the file name and line number where the definitions occur, as well as predefined and command-line macros. the whole macro group chat, exposed πŸ’€
  • -dN β€” like -dD, print to standard output a list of macro names, but not their values, as defined in the source files, along with the file name and line number where the definitions occur. names only, no values, mysterious ✨
  • -E β€” preprocess each .c file and send the result to standard output. no compilation, assembly, or linking is performed. just preprocessing and nothing else, periodt.
  • -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. search order lore, bestie 🫢
  • -include file β€” include the source code of the indicated file at the beginning of the compilation.
  • -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. end of the line, but make it system ✨
  • -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. quote-only behavior, we love a specialist πŸ’…
  • -M β€” generate a list of make dependences and print them to stdout. -MQ and -MT are synonyms. noted, bestie πŸ“Œ
  • -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. suffix customization, cute πŸŽ€
  • -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 β€” 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. 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. no pre-made macros, we rawdog 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. assembler files get the preprocessor treatment too, fancy ✨
  • -P β€” preprocess each file and leave the output in a file named file.i for each file named file.c.
  • -Uname β€” remove the definition of the name macro in the preprocessor. undefine era, we love to see it πŸ’…
  • -YI,directory β€” change the standard include directory to directory.
  • -Yp,directory β€” look in directory for the preprocessor executable.

πŸ› οΈ ASSEMBLER OPTIONS πŸ› οΈ

  • -Wa,option[,option...] β€” pass each comma-delimited option to the assembler. comma-separated little messages, delivered directly 🫢
  • -Ya,directory β€” look in directory for the assembler executable.

πŸ’– LINKER OPTIONS πŸ’–

okay bestie, this is the link-time era: every flag here is either passed straight to the linker or tells the driver what to feed it. no cap, these are all important πŸ’…

  • -acclibs β€” Link-time option to add the accelerator libraries to the link line.
  • --as-needed, --no-as-needed β€” Passed to the linker. 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 β€” This option is the same as -static. Please refer to -static for details.
  • -Bstatic-nvidia β€” This option is the same as -static-nvidia. Please refer to -static-nvidia for details.
  • -Bsymbolic β€” Passed to linker; specify symbolic binding.
  • -c++libs β€” Link-time option to add the C++ runtime libraries, allowing mixed-language programming.
  • -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 option has been deprecated 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...]] β€” This option has been 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>').
  • -nvmalloc β€” Use a custom host memory allocator.
  • -pgc++libs β€” Link-time option to add the C++ runtime libraries, allowing mixed-language programming.
  • -pgf90libs β€” Link-time option to add the PGF90 runtime libraries, allowing mixed-language programming.
  • -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]..., -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.
  • -YS,directory β€” Look in directory for the standard system startup object files.
  • -YU,directory β€” Passed to the linker; change library search path.

🌸 LANGUAGE OPTIONS 🌸

these are the β€œwhat language am I speaking rn” flags β€” so iconic for making the compiler understand your exact dialect πŸ’–

  • -asmsuffix=suffix β€” Define that a file with the given suffix is an assembly language file.
  • -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.
  • -c8x β€” Use the C89 standard as the C source language.
  • -c89 β€” Use the C89 standard as the C source language.
  • -c9x β€” Use the C99 standard as the C source language.
  • -c99 β€” Use the C99 standard as the C source language.
  • -c11 β€” Use the C11 standard as the C source language.
  • -c1x β€” Use the C11 standard as the C source language.
  • -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.
  • -csuffix=suffix β€” Define that a file with the given suffix is a C source file.
  • -fno-builtin β€” This option is the same as -Mno-builtin. Please refer to -Mno-builtin for details.
  • -Masmkeyword, -Mnoasmkeyword (default) β€” Allow (don't allow) the asm keyword in C source code. The format is: asm("<text>").
  • -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. -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.
  • -Mm128, -Mnom128 (default) β€” Recognize the datatypes __m128, __m128d and __m128i.
  • -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. For example, 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 is non-ANSI compliant.
  • -Muchar β€” Specify that the char type is unsigned by default; see -Mschar.
  • -Mvariadic_macros, -Mnovariadic_macros β€” Allow (disallow) variadic macros. Variadic macros are enabled by default.
  • -Xa β€” ANSI mode: Specify that the compiled language should conform to all ANSI features.
  • -Xc β€” Conformance mode: Specify that the compiled language should conform to all ANSI features, but warnings may be produced about some extensions.
  • -Xs β€” Standard mode: specify that the compiled language should conform to K&R C. This also implies -ansi=traditional.
  • -Xt β€” Specify that the compiled language should conform to K&R C. The compiler may produce warnings for semantics where ANSI C and K&R C conflict. This also implies -ansi=traditional.

πŸŽ€ 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 β€” turn loop autoparallelization on (or off) inside parallel constructs.
  • gpu (default) β€” OpenACC directives get compiled so stuff runs in parallel on the GPU.
  • host β€” OpenACC directives get compiled for serial execution on the host CPU. Yep, serial. One thing at a time, bestie.
  • legacy β€” shhh, no warnings about deprecated PGI accelerator directives. We don't talk about those.
  • multicore β€” OpenACC directives get compiled for parallel execution on the host CPU.
  • routinepar, noroutinepar (default) β€” infer the 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 β€” throw warnings when accelerator directives show up that don't adhere to the OpenACC standard. Snitch mode: activated.
  • sync β€” ignore async clauses, and run every data transfer and kernel launch on the default sync queue.
  • verystrict β€” same energy as strict but it goes full main-character: abort compilation with a fatal error when an accelerator directive doesn't adhere to the OpenACC standard.
  • wait (default), nowait β€” wait for each compute kernel to finish (or don't, live your truth ✨).

πŸ’… -noacc

Disable OpenACC directives entirely and don't link with OpenACC libraries. Bye bye accelerator land πŸ¦‹


πŸ”₯ -gpu=option

Okay bestie, this is the big one β€” use these sub-options to tailor the compilation of target accelerator regions. Buckle up, there's a lot πŸŽ€

  • autocompare β€” automatically compare CPU/GPU results. Accelerated code sections get run in redundant mode, and data gets compared whenever it would ordinarily be moved off the accelerator.
  • *ccXY* β€” generate code for a device with compute capability XY. Multiple compute capabilities can be specified, and one version gets 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 β€” generate code for all compute capabilities supported for this target and by the selected CUDA Toolkit version. Overachiever behavior, honestly iconic πŸ‘‘
  • ccnative β€” detects the visible GPUs on the system and generates code for them. If no device is available the default compute capability is used (cc50).
  • ccall-major β€” compile for all major supported compute capabilities (does not include PTX for the highest major virtual architecture β€” see the `-gpu=[no]rdc` option for that support).
  • *cudaX.Y* β€” use CUDA X.Y Toolkit compatibility, where installed.
  • deepcopy β€” enable Full Deepcopy support in OpenACC Fortran.
  • fastmath β€” enable the fast math library, which includes faster (but lower precision 😬) implementations of certain math and intrinsic functions. Speed vs. accuracy, the eternal struggle.
  • flushz, noflushz (default) β€” enable (disable) flush-to-zero mode on the GPU.
  • fma, nofma β€” generate (or don't) fused multiply-add operations on the GPU. This is enabled by default at optimization level -O1.
  • implicitsections, noimplicitsections (default) β€” change (or don't change) array element references in OpenACC and OpenMP data clauses to array section references.
  • interceptdeallocations, nointerceptdeallocations β€” intercept (or don't 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 β€” keep the generated CUDA binary, with a .cubin suffix.
  • keepgpu β€” keep the generated CUDA GPU source files, with a .gpu suffix.
  • keepltoir β€” keep the generated GPU LTOIR files, with a .ltoir suffix. Works only when `-gpu=lto` is enabled.
  • keepptx β€” keep the generated portable assembly files, with a .ptx suffix.
  • lineinfo, nolineinfo (default) β€” generate debugging line information.
  • loadcache:[L1|L2] β€” generate code to cache global memory loads in the L1 or L2 hardware cache.
  • lto β€” enable Device Link Ltime Optimization (Device LTO).
  • *maxregcount:n* β€” set the maximum number of registers to use in the generated GPU code.
  • managed β€” allocate 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 β€” intercept LIBC function calls (e.g. free) and call their managed memory version if the address is in managed memory, regular version otherwise.
  • nomanaged β€” do 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 β€” do 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 β€” allocate 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 β€” intercept LIBC function calls (e.g. free) and call their pinned memory version if the address is in pinned memory, regular version otherwise.
  • mem:[mode] β€” select 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 β€” allocate 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 β€” compile 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 β€” print ptxas information.
  • rdc (default), nordc β€” generate (or don't generate) relocatable device code for separate compilation, and invoke the device linker before the host linker at the link step.
  • redundant β€” run accelerated code redundantly on the CPU. Implied by autocompare.
  • safecache β€” allow variable-sized array sections in cache directives; the compiler assumes they fit into CUDA shared memory. Assumes. Bestie. Assumes πŸ™ˆ
  • *sm_XY* β€” generate code for a device with compute capability XY. Multiple compute capabilities can be specified, and one version gets 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. Give an error if the total stack size of a kernel or procedure exceeds *limit KBytes. The default is stacklimit:512.
  • tripcount:host β€” calculate 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 β€” calculate 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 (or don't 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 β€” compile 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. Heads up, bestie: this option must appear in both the compile and link lines. This option may not be used with -gpu=pinned.
    • intercept β€” intercept LIBC function calls (e.g. free) and call their unified version if address is in unified memory, regular version otherwise.
  • unroll, nounroll β€” automatically (do not) unroll inner loops. This is enabled by default at optimization level -O3.
  • -Kieee, -Knoieee (default) β€” perform floating-point operations in strict conformance with the IEEE 754 standard. Some optimizations are disabled with -Kieee, and a more accurate math library is used. The default -Knoieee uses faster but very slightly less accurate methods.
  • -Ktrap=option[,option]... β€” controls the behavior of the processor when floating-point exceptions occur during program execution. 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 traps. -Ktrap=inv,none,ovf implies -Ktrap=ovf.
    • ovf β€” trap on floating-point overflow.
    • unf β€” trap on floating-point underflow. -Ktrap is only meaningful when compiling a C/C++ main function or Fortran main program.

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

These options correspond 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 continues execution. If a mask bit is off (unmasked) and the corresponding exception occurs, execution terminates with a floating-point exception (Linux FPE signal).

  • -march=target β€” this option is the same as -tp. Please refer to -tp for details.
  • -m[no-]daz-ftz β€” specify how denormals are handled by the processor at runtime. -mno-daz-ftz specifies that denormal operands and results are honored. Shorthand for -Mnodaz -Mnoflushz. -mdaz-ftz default setting and specifies that denormal operands and results are treated as zero. Shorthand for -Mdaz -Mflushz.
  • -Mdaz, -Mnodaz β€” enable [disable] mode to treat denormal (subnormal) floating-point operands as zero. -Mdaz is the default setting for x86_64 and aarch64 processors.
  • -Mflushz, -Mnoflushz β€” enable [disable] setting floating-point denormal (subnormal) results to zero; -Mflushz is the default setting for x86_64 and aarch64 processors.
  • -Mfpmisalign, -Mnofpmisalign β€” allow (don't allow) vector arithmetic instructions with memory operands that are not aligned on 16-byte boundaries.
  • -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 such as 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, -Mfprelaxed will choose to generate relaxed precision code for those operations that generate a significant performance improvement, depending on the target processor.

  • -Mfunc32 (default), -Mnofunc32 β€” align (don't align) functions on 32 byte boundaries.
  • -Mgccbugs β€” match the behavior of certain bugs in gcc.
  • -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 option is useful for maintaining compatibility with g77, which adds a second underscore to such symbols by default.
  • -Mwritable-strings β€” store string constants in the writable data segment.
  • -mcmodel=small|medium
    • 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.
  • -ta=target β€” this option has been deprecated, bestie β€” please refer to -acc.
    • -ta=tesla β€” this option has been deprecated please refer to -acc=gpu and -gpu.
    • -ta=multicore β€” this option has been deprecated please refer to -acc=multicore.
    • -ta=host β€” this option has been deprecated please refer to -acc=host.
  • -target=option β€” select the target for all parallel programming paradigms used (OpenACC, OpenMP, Standard Languages); possibilities are:
    • gpu β€” globally set the target device to an NVIDIA GPU.
    • multicore β€” globally set the target device to the host CPU.
  • -tp=target β€” specify the type of the target processor. Issue:
nvc -help -tp

to display the list of recognized target processors.


πŸ“‚ FILES

  • a.out β€” executable output file
  • file.a β€” library of object files
  • file.c β€” C source file
  • file.i β€” C 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
  • .mynvcrc β€” you may add custom switches or make other additions to nvc by creating a file named .mynvcrc in your home directory.

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.

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.


🩺 DIAGNOSTICS

The compiler produces information and error messages as it translates the input program. The linker and assembler may issue their own error messages.


That’s the whole pgcc(1) page, bestie β€” source/version pgcc(1), date September 2026. Stay slaying those compiler flags! πŸ’…βœ¨

πŸ“¦ where this page comes from