pgf90(1)

πŸ“¦ version 26.9, in arch rolling

okay bestie, this is the pgf90(1) page from the General Commands Manual β€” welcome to the Fortran compiler group chat πŸ’…βœ¨

🌸 NAME 🌸

nvfortran β€” The NVIDIA Fortran compiler

πŸ¦‹ SYNOPSIS πŸ¦‹

nvfortran [ -flag ]...  sourcefile...

πŸ’– DESCRIPTION πŸ’–

okay so pgf90 is literally an alias for nvfortran. nvfortran is a Fortran compiler for NVIDIA GPUs and AMD and Intel CPUs. It supports ISO Fortran 2003 and many features of Fortran 2008, supports GPU parallel programming with OpenACC, and supports multicore CPU programming with OpenACC and OpenMP. nvfortran invokes the Fortran compiler, assembler, and linker with options derived from its command line arguments. iconic behavior, no cap πŸ’…

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

  • .f, .for, .ftn β€” fixed-format Fortran source; compile
  • .f90, .f95, .f03 β€” free-format Fortran source; compile
  • .F, .FOR, .FTN, .fpp, .FPP β€” fixed-format Fortran source; preprocess, compile
  • .F90, .F95, .F03 β€” free-format Fortran source; preprocess, compile
  • .cuf β€” free-format CUDA Fortran source; compile
  • .CUF β€” free-format CUDA Fortran source; preprocess, compile
  • .s β€” assembler source; assemble
  • .S β€” assembler source; preprocess, assemble
  • .o β€” object file; passed to linker
  • .a β€” library archive file; passed to linker

C file suffixes are also recognized and compiled with the NVC compiler; see NVC and NVIDIA User's Guide. Other files are passed to the linker (if linking is requested) with a warning message. noted 🫢

Unless one overrides the default action using a command-line option, nvfortran deletes the intermediate preprocessor and assembler files (see the options -c, -E, -F, and -Mkeepasm); if a single Fortran program is compiled and linked with one nvfortran 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, -F, or -S options, or unless compilation errors stop the whole process. very β€œclean up your own mess” energy 🧚


πŸ’… 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. okay bestie, this part is basically the whole squad lined up by vibe β€” the deep dives are coming later πŸ”₯

⭐ Overall Options ⭐

  • --
  • -#
  • -###
  • -c
  • -[no]defaultoptions
  • -dryrun
  • -drystdinc
  • -dumpversion
  • -echo
  • --flagcheck
  • -flags
  • -fmax-errors=<n>
  • --gcc-toolchain=path
  • -help[=option]
  • -Manno
  • -Minform=level
  • -Mdetail
  • -Mkeepasm
  • -M[no]list
  • -noswitcherror
  • -o file
  • -rc rcfile
  • -S
  • -show
  • -silent
  • -time
  • -V
  • -V<ver>
  • -v
  • --version
  • -w
  • -Werror
  • -x language
  • -x none
  • -Wpass,option
  • -Ypass,directory

πŸš€ Optimization Options πŸš€

  • -fast
  • -f[no-]cx-limited-range
  • -fastsse
  • -fPIC
  • -fpic
  • -KPIC
  • -Kpic
  • -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-]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 πŸ•΅οΈ

  • -C
  • -g
  • -gopt
  • -M[no]bounds
  • -Mchkptr
  • -Mchkstk
  • -Mcoff
  • -Mdwarf2
  • -Mdwarf3
  • -Melf
  • -Mnodwarf
  • -[no]traceback

🧚 Preprocessor Options 🧚

  • -Dmacro
  • -E
  • -F
  • -Idirectory
  • -isystem directory
  • -Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff]
  • -Mnostddef
  • -Mnostdinc
  • -Mpreprocess
  • -Umacro
  • -YI,directory
  • -Yp,directory

πŸ› οΈ Assembler Options πŸ› οΈ

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

πŸ”— Linker Options πŸ”—

  • -acclibs
  • --[no-]as-needed
  • -Bdynamic
  • -Bstatic
  • -Bstatic-nvidia
  • -c++libs
  • -cudaforlibs
  • -cudalib=libname
  • -cudalibs
  • -fortranlibs
  • -g77libs
  • -Ldirectory
  • -llibrary
  • -m
  • -Mcudalib=libname
  • -M[no]eh_frame
  • -Mnostartup
  • -Mnostdlib
  • -M[no]rpath
  • -Mmkl
  • -nvmalloc
  • -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
  • -byteswapio
  • -csuffix=suffix
  • -fsuffix=suffix
  • -FSUFFIX=suffix
  • -cuda=option
  • -i2
  • -i4
  • -i8
  • -i8storage
  • -Mallocatable[=95|03]
  • -M[no]backslash
  • -Mbyteswapio
  • -Mcray=pointer
  • -Mcuda=option
  • -M[no]dalign
  • -M[no]dclchk
  • -M[no]defaultunit
  • -M[no]dlines
  • -Mdollar=char
  • -Mextend
  • -Mfixed
  • -M[no]free[form]
  • -M[no]i4
  • -M[no]iomutex
  • -Mlibsuffix=suffix
  • -M[no]llalign
  • -Mnomain
  • -Mobjsuffix=suffix
  • -M[no]onetrip
  • -M[no]r8
  • -M[no]r8intrinsics=float
  • -M[no]recursive
  • -M[no]ref_externals
  • -M[no]save
  • -M[no]signextend
  • -M[no]stack_arrays
  • -Mstandard
  • -Msyntax-only
  • -M[no]unixlogical
  • -M[no]upcase
  • -module directory
  • -Munlink_module
  • -r4
  • -r8
  • -Wh,argument[,argument]...

🎯 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
  • -M[no]longbranch
  • -M[no]second_underscore
  • -M[no]varargs
  • -Mwritable-strings
  • -mcmodel=small|medium
  • -stdpar=option
  • -nostdpar
  • -ta=target
  • -target=option
  • -tp=target
When source files are compiled using any of the following options, the same option(s) should be passed when using nvfortran to link the objects: -g -mp -Mconcur -Mipa -Mprof πŸ‘‘

🌈 Overall Options 🌈

okay bestie, these are the big picture switches β€” the ones that tell the driver what kind of mood it's in today πŸ’…

  • -- β€” everything after this switch is treated as a filename. That's it, that's the whole vibe. But heads up: most tools will not allow a filename starting with a dash, so these should be avoided πŸ™ˆ
  • -# β€” display the invocations of the compiler, assembler, and linker. These invocations are the command lines created by nvfortran. So you get to see exactly what it's cooking πŸ”₯
  • -### β€” display invocations of the compiler, assembler and linker, but do not execute them. Same tea as -# but it's all show, no go ✨
  • -c β€” skip the link step; compile and assemble only. Iconic low-commitment behavior πŸŽ€
  • -defaultoptions (default) / -nodefaultoptions β€” use (don't use) the default options set in site-specific or user-specific PREOPTIONS or POSTOPTIONS driver variables. Basically: are we trusting the site's pre-set homework or not 🫢
  • -dryrun β€” use this option to display the invocations of the compiler, assembler, and linker but do not execute them. Rehearsal mode, fr fr 🧚
  • -drystdinc β€” display the standard include directories without invoking the compiler. Peek at the include dirs, no compiler needed πŸ’–
  • -dumpversion β€” display the shortened version of the compiler. For example, 21.11 or 22.3. Just the numbers, no yapping ⭐
  • -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. It's giving "I'm just here to check the vibes" πŸ‘€
  • -flags β€” display all valid nvfortran command-line options in alphabetical order. The full menu, alphabetized, slay πŸ“‹
  • -fmax-errors=<n> β€” specify maximum numbers of errors before terminating compilation. Cute lil' error budget you get to set πŸ’€
  • --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. Flexible much? πŸ¦‹
  • -help[=option] β€” displays command-line options recognized by nvfortran on the standard output. nvfortran -help -otherswitch will give help about -otherswitch. The default is to list nvfortran 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 nvfortran configuration; this is the same as -show.
  • -Manno β€” produce annotated assembly files, where source code is intermixed with assembly language; implies -Mkeepasm. Honestly kind of a serve, seeing both together 🌸
  • -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 β€” noted, bestie πŸ“Œ

  • -Mdetail β€” display enhanced error messages that include source line and column pointer. This is currently available for syntax errors and some semantic errors. Like a little pointing finger at your mistake 🫡
  • -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. By default? No listing. Rn anyway 🌈
  • -noswitcherror β€” ignore unknown command line switches after printing an warning message; the default behavior is to print an error message and halt. So this is the "please be chill about my typos" switch πŸ™ˆ
  • -o file β€” use file as the name of the executable program, rather than the default a.out. If used with -c or -S and a single input file, file is used as the name of the object or assembler output file. Name it yourself, main character energy πŸ‘‘
  • -rc rcfile β€” specifies the name of a nvfortran 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. Pay attention to which kind of path you're giving it, ok? πŸ’…
  • -S β€” skip the assembly and link steps. Leave the output from the compile step in a file named file.s for each file named, for instance, file.f. See also -o. Assembly output, no assembly-ing 😌
  • -show β€” produce help information describing the current nvfortran configuration. Receipts for your setup 🧾
  • -silent β€” do not print warning messages. Same as -Minform=severe. Silence is golden ✨
  • -time β€” print execution times for the various steps in the compiler itself. Where did the milliseconds go, bestie ⏱️
  • -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. Version select, lowkey iconic 🌟
  • -v β€” verbose mode; print out the command line for each tool before it is executed. All the receipts, live πŸ“
  • --version β€” display version messages and other information.
  • -w β€” do not print warning messages.
  • -Werror β€” turn all warning messages into errors. Glow-up or glow-down depending on your code, ngl πŸ”₯
  • -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. Back to vibes-based detection 😌
  • -Wpass,option[,option...] β€” pass option to the specified pass. Each comma-delimited option is passed as a separate argument. The passes are:
    • h β€” for the Fortran 90/95 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:
    • h β€” search for the Fortran 90/95 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 ⚑

this is where the compiler gets its little gym membership πŸ‹οΈβ€β™€οΈ

  • -fast β€” chooses generally optimal flags for the target platform. Use nvfortran -fast -help to see the equivalent switches. Note this sets the optimization level to a minimum of 2; see -O. One switch, whole glow-up πŸ’«
  • -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. Know which one you're getting, bestie πŸŽ€
  • -fastsse β€” chooses generally optimal flags for a processor that supports to vectorize for the SSE/AVX instructions. Use nvfortran -fastsse -help to see the equivalent switches. Vectorize era πŸ¦‹
  • -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). Shared libs, we love her πŸ’–
  • -KPIC β€” equivalent to -fpic; provided for compatibility with other compilers.
  • -Kpic β€” equivalent to -fpic; provided for compatibility with other compilers.
  • -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. Very specific, very demure 🌸
  • -Mconcur[=option[,option,...]]
⚠️ bestie listen β€” this option has been deprecated and will be removed in a future release. Do not build your whole personality on 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 β€” uses literally every available core 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 (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. Periodt.
    • 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. Tiny-loop safety vibes ✨.
    • assoc (default), noassoc β€” enable (disable) parallelization of loops with reductions. Iconic.
    • 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. That's the tea β˜•.
    • dist:block β€” parallelize with block distribution. Contiguous blocks of iterations of a parallelizable loop are assigned to the available processors. Chunky blocks, slay.
    • 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. Round-robin realness πŸ”„.
    • innermost, noinnermost (default) β€” enable (disable) parallelization of innermost loops. Your call, bestie.
    • levels:n β€” parallelize loops nested at most n levels deep; the default is 3. Three layers deep is the vibe unless you say otherwise.
  • -Mdepchk (default), -Mnodepchk β€” assume (don't assume) that potential data dependencies exist. πŸ’€ -Mnodepchk may result in incorrect code, so maybe don't unless you're feeling fearless.
  • -Mdse, -Mnodse (default) β€” enable (disable) the dead store elimination optimization. Bye bye useless stores πŸ‘‹.
  • -Mextract=[option[,option,...]] β€” run the subprogram extraction phase to get ready 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 that doesn't contain a period is assumed to be the name of a subprogram to be extracted. If it looks like a name, it is one.
    • name:subprogram[,subprogram] β€” specifies the name of a subprogram or subprograms to be extracted. Explicit and cute.
    • lib:directory β€” specifies the name of a directory to contain the extracted subprograms; this directory will be created if it does not exist. Magic folder energy ✨.
    • [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. That's the whole deal.
  • -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. Speed and precision drama πŸ”₯.
  • -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. Keep that in mind, bestie.
  • -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. It's giving smart compiler behavior πŸ‘‘.
  • -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 full package πŸ’….
    • 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. So maybe don't get attached 😭.
    • 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. So that's your default info dump, iykyk.

  • -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. Convenient, fr fr.
    • except:func β€” specifies which functions should not be inlined. No thank you to those.
    • [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. Crystal clear ✨.
    • 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. Very specific, very Fortran.
    • [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. Size limits but make it chic.
    • 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. Shape-shifting but for inlining πŸ¦‹.
    • smallsize:number β€” always inline functions of size smaller than number regardless of other size limits. Small but mighty.
    • 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 option listed here.
  • -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 (disable) recognition when pointer targets are all cache-line aligned, allowing better SSE code generation. Aligned and iconic.
    • arg, noarg (default) β€” remove (don't remove) arguments replaced by -Mipa=ptr,const. -Mipa=noarg implies -Mipa=nolocalarg. Note the implication, bestie.
    • const (default), noconst β€” enable (disable) propagation of constants across procedure calls. Constant queen πŸ‘‘.
    • f90ptr, nof90ptr (default) β€” enable (disable) Fortran 90 pointer disambiguation across procedure calls.
    • fast β€” chooses generally optimal -Mipa flags for the target platform; use nvfortran -Mipa -help to see the equivalent options. Speedrun those flags.
    • force β€” force all objects to recompile regardless of whether IPA information has changed. No stale objects allowed.
    • globals, noglobals (default) β€” analyze (don't analyze) which globals are modified by procedure calls. Global tea β˜•.
    • inline:n β€” determine additional functions to inline, allowing up to n levels of inlining. Additional suboptions are:
      • except:proc β€” disables inlining of procedure proc. Not them.
      • nopfo β€” ignore any profile frequency information from -Mpfo when choosing which functions to inline. No profile peer pressure.
      • reshape, noreshape (default) β€” enable (disable) Fortran inlining with mismatched array shapes. Shape mismatch? Sometimes we vibe.
    • ipofile β€” save IPA information in a .ipo file instead of the default of appending the information to the object file. File management slay.
    • jobs:n β€” use up to n jobs in parallel to reoptimize object files. Parallel reoptimization realness.
  • keepobj (default) / nokeepobj β€” keeps the optimized object files around (or doesn't πŸ™ƒ), using file name mangling, so your next application builds recompile way faster. Literally free time back, bestie.
  • libc / nolibc (default) β€” optimize calls to certain standard C library routines (or don't ✨).
  • libinline / nolibinline (default) β€” lets routines from libraries get inlined (or not). Heads up: -Mipa=libinline implies -Mipa=inline, iykyk.
  • libopt / nolibopt (default) β€” allows recompiling and reoptimizing routines from libraries with IPA information (off by default, so flip it if you want that πŸ‘‘).
  • localarg / nolocalarg (default) β€” turns on (or off) the feature that externalizes local variables so arguments can be replaced by -Mipa=ptr. And yes: -Mipa=localarg implies -Mipa=arg πŸ’…
  • main:func β€” names a function to serve as the global entry point. You can pass it multiple times fr fr. Side effect: it disables linking.
  • ptr / noptr (default) β€” enables (or disables) pointer disambiguation across procedure calls.
  • pure / nopure (default) β€” detect pure functions, or don't, no pressure πŸ¦‹
  • quiet β€” don't print out messages about which files get recompiled at link time. peace and quiet, iconic.
  • reaggregation / noreaggregation (default) β€” enables (or disables) global struct reaggregation. Run this and it can change the order of struct members, or split structs into multiple structs, all to improve memory locality and cache utilization. Lowkey dramatic but it's for a good cause.
  • required β€” returns an error condition if IPA gets inhibited for any reason, instead of the default behavior of just linking without IPA optimization. Strict mode energy.
  • safe:function | library β€” declares that the named function, or all functions in the named library, are safe. A safe procedure doesn't call back into the known procedures and doesn't change any known global variables. And the stakes: 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 above for the deets.
  • 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 allows optimization for the other files linked with this file. Team player behavior 🫢
  • 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. That's the whole distinction, no cap.
  • -Mmovnt, -Mnomovnt β€” force (or disable) generation of nontemporal moves. Ngl, -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. Real talk though: use the -Minfo flag instead πŸ’€
  • -Mnoopenmp β€” when -mp is present, ignore the OpenMP pragmas. just straight up ignoring them.
  • -Mnosgimp β€” when -mp is present, ignore the SGI parallelization pragmas.
  • -Mnovintr β€” do not generate vector intrinsic calls.
  • -Mpfi[=option] β€” generate profile feedback instrumentation, which includes extra code to collect run-time statistics to be used in a subsequent compile. And bestie, listen: -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...]] β€” enable profile feedback optimizations. Requirement check: 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 one needs a pgfi.out file generated from a binary built with -Mpfi=indirect πŸŽ€
    • layout (default) / nolayout β€” enable (or disable) basic block layout, which takes advantage of instruction cache locality by keeping hot paths close together. cozy little hot paths 🌸
    • *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. Use these and your resulting executable creates a performance profile you can view and analyze with the PGPROF performance profiler πŸ‘‘ For 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. Cute rename, same vibe ✨
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. no recompile era πŸ’…
  • -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. big objects deserve big alignment πŸŽ€
  • -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. This option tells the compiler it's safe to parallelize the loop. you're taking the wheel here 🫢
  • -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. yes, 0.0 has lore.
  • -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. Note that this also sets the optimization level to a minimum of 2; see -O. The option is one of the following:
    • 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 is not 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 πŸ‘€
    • 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 is not 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 is not supplied, the unroller computes the number of times a candidate loop is unrolled. (same deal as above, just multi-block bestie 🌈)
    • -Mnounroll tells 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. And the reason it's called unsafe: there are situations where the array elements allocated to some processors are not aligned 😭 so like, know what you're doing.
  • -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 information see optimization levels under -O. If no option list is specified, then the following 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 such characteristics as array alignments and loop counts.
    • fuse / nofuse (default) β€” enable (or disable) loop fusion, which combines adjacent loops into a single loop. two loops becoming one? that's giving main character energy πŸ‘‘
    • prefetch β€” use prefetch instructions in loops where profitable.
  • simd[:{128|256|512}] (default) / nosimd β€” bestie, this one tells the compiler to actually use vector SIMD instructions (AVX, AVX2, AVX512) πŸ’…. You can slap an argument on it to limit the whole thing to 128-bit SIMD instructions, and ngl, asking for 512-bit SIMD is only possible on target processors that support AVX512 β€” no faking it, the hardware has to eat. πŸ¦‹
  • uniform / nouniform (default) β€” performs the same optimizations in the vectorized and residual loops. Heads up tho: this may affect the performance of the residual loop. πŸ‘€
Okay so these next ones are also supported, but they're not recommended for new development β€” unless you're an experienced user β€” and they may be phased out in future releases. So like, proceed with your eyes open, queen. πŸ’€
  • assoc (default) / noassoc β€” enable (or disable) certain associativity conversions that can change the results of a computation due to floating-point roundoff error differences. The classic: changing the order of additions, which is mathematically correct but can be computationally different, because roundoff error said "not today." 😭
  • 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 (disable) vectorization of loops with indirect array references. ✨
  • idiom (default) / noidiom β€” enable idiom recognition; it's the alternate form of -Midiom. iykyk 🧚
  • levels:n β€” set the maximum nest level of loops to optimize. πŸͺ†
  • partial β€” enable partial loop vectorization via innermost loop distribution. lowkey fancy fr fr 🌸
  • 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 get vectorized; the default is to attempt to vectorize all loops. main character energy, honestly πŸ‘‘
  • tile / notile (default) β€” enable (disable) loop tiling to optimize for cache locality. πŸ“

-Mnovect disables the vectorizer, and it's the default at -O0 and -O1. Periodt.


  • -Mzerotrip (default) / -Mnozerotrip β€” include (don't include) a zero-trip test for loops. Fr fr, only use -Mnozerotrip when all loops are known to execute at least once. Don't be reckless. πŸ™ˆ
  • -mp[=option] β€” enables OpenMP pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices or multi-processor systems. 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 me ignoring OpenMP's texts πŸ’€
  • -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 levels and their meanings are:
    • -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. It's giving "we're just vibing." 😌
    • -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. 🌈
    • -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. (may or may not 😭)
    • -Ofast β€” enables -O3, -Mfprelaxed, -Mstack_arrays, -Mno-nan, Mno-inf, and -fcx-limited-range. Note that -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. Obsessed. πŸ‘‘
  • -pg β€” enable gprof-style sample-based profiling; implies -Mframe. πŸŽ€

🌸 Debugging Options 🌸

  • -C β€” add array bounds checking; the same as -Mbounds. Safety first, bestie. 🫢
  • -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, the generated code will be slower than code generated at other optimization levels. Not me warning you twice πŸ’€
  • -gopt β€” generate symbolic debug information, without affecting optimizations. This may give confusing results when debugging with optimizations; it's intended for use with other tools that use the debug information. 🧚
  • -Mbounds / -Mnobounds (default) β€” add (don't add) array bound checking. ✨
  • -Mchkptr β€” check for unintended de-referencing of NULL pointers. Ty bestie, this is a public service. πŸ™
  • -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. πŸͺ†
  • -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. πŸ™ˆ
  • -traceback (default) / -notraceback β€” add debug information for runtime traceback. When things go sideways at runtime, you'll want the receipts. πŸ”₯

✨ Preprocessor Options ✨

  • -Dname[=def] β€” define name to be 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. iykyk πŸ’…
  • -E β€” preprocess each .c file and send the result to standard output. No compilation, assembly, or linking is performed. Just vibes and preprocessing. 😌
  • -F β€” stop after preprocessing. πŸ›‘
  • -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. Order matters, queen β€” it's literally a whole lineup. πŸŽ€
  • -isystem directory β€” same as -I, but mark the directory as a system directory. πŸ‘‘
  • -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. 🧚
  • -Mnostddef β€” do not predefine any macros to the preprocessor. Nope, none, not today. πŸ™…
  • -Mnostdinc β€” do not search in the standard location for include files when those files are not found elsewhere. πŸ¦‹
  • -Mpreprocess β€” run the preprocessor on Fortran or assembler source files. By default, the preprocessor is run when the source's suffix is .fpp, .F, .F90, .F95, or .HPF. πŸ’…
  • -Uname β€” remove the definition of the name macro in the preprocessor. Bye bestie πŸ‘‹
  • -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. 🫢
  • -Ya,directory β€” look in directory for the assembler executable. ⭐

πŸ”— Linker Options πŸ”—

okay bestie, this is the part where your object files actually get stitched together into something you can run πŸ’… the linker is lowkey the main character here, and these flags are how you talk to it. let's go ✨

  • -acclibs β€” link-time vibes only: adds the accelerator libraries to the link line πŸš€
  • --as-needed, --no-as-needed β€” passed straight to the linker. --as-needed tells the linker to only set the DT_NEEDED flag for shared libraries that come after it, requiring those libraries at run time β€” but only if they're actually used to satisfy references. --no-as-needed restores the default behavior. iykyk πŸŽ€
  • -Bdynamic β€” passed to the linker to specify dynamic binding. slay, dynamic era πŸ’«
  • -Bstatic β€” this one is exactly the same as -static. go peek at -static for the details, no cap πŸ“š
  • -Bstatic-nvidia β€” same as -static-nvidia. yes, again, check -static-nvidia for the full tea πŸ«–
  • -c++libs β€” link-time glow-up: adds the C++ runtime libraries so you can do that mixed-language programming thing πŸ”₯
  • -cudaforlibs β€” link-time option that adds the CUDA Fortran runtime libraries, enabling mixed-language programming. also implies -fortranlibs πŸ‘‘ (it's giving "package deal")
  • -cudalib[=libname[,libname...]] β€” adds CUDA-optimized libraries to the link line. when you don't specify anything, the compiler links all the necessary CUDA-optimized libraries. -cudalib will use the version of the library that matches the CUDA version you're on. the libraries it recognizes are, in order:
    • cublas
    • cublasmp
    • cufft
    • cufftmp
    • cufftw
    • curand
    • cusolver
    • cusolvermp
    • cusparse
    • cutensor
    • nccl
    • nvblas
    • nvshmem
    • nvtx3

that's the whole squad, bestie 🌈

  • -cudalibs β€” ⚠️ this one has been deprecated, please refer to -cudalib. (it was a link-time option to add the CUDA runtime API library, but it's retired now, rip πŸ’€)
  • -fortranlibs β€” link-time option adding the Fortran runtime libraries so mixed-language programming can happen 🧚
  • -g77libs β€” link-time option that lets object files generated by GNU g77 (or gcc) get linked into nvfortran main programs. bridging the eras fr fr 🌸
  • -Ldirectory β€” passed to the linker; adds directory to the list of directories the linker searches for libraries πŸ” (you'll want this one, trust)
  • -llibrary β€” passed to the linker; loads the library lib*library*.a from the standard library directory. also see the -L option above, they're besties 🫢
  • -m β€” makes the linker display a link map. we love transparency ✨
  • -Mcudalib[=libname[,libname...]] β€” ⚠️ deprecated, please refer to -cudalib. adds CUDA-optimized libraries to the link line; with no option specified, the compiler links all the necessary CUDA-optimized libraries πŸ’€ (same energy, older spelling)
  • -Meh_frame, -Mnoeh_frame β€” adds (or doesn'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 you changed it in a site or user rcfile πŸŽ€
  • -Mnostartup β€” do not link in the usual startup routine. heads up though: that routine contains the entry point for the program πŸ‘€
  • -Mnostdlib β€” do not link in the standard libraries when linking a program. bold move, bestie πŸ’…
  • -Mrpath (default), -Mnorpath β€” by default, -rpath gets added to the link line, giving the directories that contain the required runtime shared objects. use -Mnorpath to tell the driver not to add any -rpath switches to the link line πŸ¦‹
  • -Mmkl β€” adds Intel's Math Kernel libraries to the link line. requires that the environment variable MKLROOT be set to the path of your local MKL installation (specifically, the part of the path that precedes lib/<arch>) πŸ”₯
  • -nvmalloc β€” use a custom host memory allocator. fancy 😌
  • -pthread β€” adds support for multithreading with the pthreads library. this option sets flags for both the preprocessor and the linker, two-for-one πŸ’–
  • -Rdirectory β€” passed to the linker; tells it to hard-code the pathname directory into the search path for generated shared object files. ⚠️ heads up: there cannot be a space between R and directory
  • -r β€” passed to the linker; generates a re-linkable object file πŸ”
  • -rpath directory β€” passed to the linker to add directory to the runtime shared library search path πŸ›£οΈ
  • -s β€” passed to the linker; strips symbol table information. goodbye symbols, you won't be missed βœ‚οΈ
  • -shared β€” passed to the linker. tells it to generate a shared object file (aka a dynamically linked library). implies -fpic 🌟
  • -soname name β€” passed to the linker. when creating a shared object, it tells 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 links in the NVIDIA runtime libraries while using dynamic linking for the system libraries. implies -Mnorpath ✨
  • -uname β€” passed to the linker; generates an undefined reference πŸ‘»
  • --whole-archive, --no-whole-archive β€” passed to the linker. --whole-archive tells it 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. two ways to say the same thing, pick your fighter πŸ’«
  • -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 the library search path 🧭

🌸 LANGUAGE OPTIONS 🌸

okay bestie, this whole section is about telling the compiler what language it's looking at and how to read it β€” suffixes, integer sizes, form rules, all of it πŸ’…

  • -asmsuffix=suffix β€” says "hey, any file with this suffix? that's an assembly language file, bestie." πŸ’–
  • -byteswapio β€” swaps bytes from big-endian to little-endian (or the other way round, no cap) on input/output of unformatted Fortran data. Turning this on means you can read/write Fortran unformatted data files that are compatible with the ones produced on Sun or SGI systems. ✨
  • -csuffix=suffix β€” declares that a file with the given suffix is a C source file. 🫢
  • -fsuffix=suffix β€” same deal but for Fortran: this suffix means Fortran source file.
  • -FSUFFIX=suffix β€” also declares a suffix as a Fortran source file (yes it's the uppercase-twin of the one above, she has main character energy too πŸ‘‘).
  • -cuda[=option[,option...] β€” enables CUDA Fortran: adds the CUDA include paths and links against the CUDA runtime libraries. -cuda is required on the link line β€” so if you used -cuda while compiling, you must also use it for linking, fr fr. For target-specific stuff go look at -gpu. For linking extra CUDA libraries (math libraries and friends, iykyk) go look at -cudalib. These sub-options let you tailor how CUDA Fortran accelerator regions get compiled:
    • charstring β€” enables limited support for character strings inside GPU kernels.
    • madconst β€” puts Module Array Descriptors in CUDA Constant Memory. ✨
  • -i2 β€” treats INTEGER variables as two bytes.
  • -i4 β€” treats INTEGER variables as four bytes.
  • -i8 β€” treats default INTEGER and LOGICAL variables as eight bytes, and uses 64-bits for computations when you're doing operations involving integers. πŸ”₯
  • -i8storage β€” allocates 8 bytes for INTEGER and LOGICAL.
  • -Mallocatable[=95|03] β€” picks whether you get Fortran 1995 or Fortran 2003 semantics for assignments to allocatable objects and to allocatable components of derived types. The 1995 vibes require you to allocate the object or component, and require that an array object or component be conformant before the assignment. The 2003 vibes require the compiler to add code that checks whether the object or component is allocated and whether an array object is conformant before the assignment β€” and to allocate or reallocate if not. πŸ’…
  • -Mbackslash, -Mnobackslash (default) β€” do (or don't) treat backslash as a normal, non-escape character in strings. -Mnobackslash makes the standard C backslash escape sequences get recognized inside quoted strings; -Mbackslash makes the backslash just like any other character, periodt.
  • -Mbyteswapio β€” the -byteswapio twin: swaps bytes from big-endian to little-endian or vice versa on input/output of unformatted Fortran data. Use of this option enables reading/writing Fortran unformatted data files compatible with those produced on Sun or SGI systems. πŸ¦‹
  • -Mcray=pointer β€” forces Cray Fortran (CF77) compatibility for the listed options. Possible options include:
    • pointer β€” for purposes of optimization, assume that pointer-based variables do not overlap the storage of any other variable. πŸ™ˆ
  • -Mcuda[=option[,option...] β€” ⚠️ heads up bestie, this one has been deprecated, please refer to -cuda. It enables CUDA (and CUDA Fortran) and links with the CUDA libraries. -Mcuda is required on the link line if there are no CUDA Fortran source files specified on the command line. And if -Mcuda is used in compilation, it must also be used for linking β€” same rules, different spelling. πŸ’€
  • -Mdalign (default), -Mnodalign β€” align (or don't align) doubles in structures on 8-byte boundaries. Careful: -Mnodalign may lead to data alignment exceptions. 😭
  • -Mdclchk, -Mnodclchk (default) β€” require (or don't require) that all variables be declared.
  • -Mdefaultunit, -Mnodefaultunit (default) β€” treat (or don't treat) '*' as stdout/stdin regardless of the status of units 6/5. -Mnodefaultunit makes * a synonym for 5 on input and 6 on output; -Mdefaultunit makes * a synonym for stdin on input and stdout on output. ✨
  • -Mdlines, -Mnodlines (default) β€” treat (or don't treat) lines beginning with D in column 1 as executable statements, ignoring the D.
  • -Mdollar=char β€” sets the character used to replace dollar signs in names to be char. Default is an underscore (_). πŸŽ€
  • -Mextend β€” allows 132-column source lines. iconic for those long lines that just won't quit.
  • -Mfixed β€” processes Fortran source using fixed form specifications. The -Mfree options are the ones that specify free form formatting. By default, files with a .f or .F extension use fixed form formatting.
  • -Mfree, -Mfreeform, -Mnofree, -Mnofreeform β€” process Fortran source using free form specifications. -Mnofree and -Mfixed specify fixed form formatting. By default, files with a .f90, .F90, .f95 or .F95 extension use freeform formatting. πŸ’–
  • -Mi4 (default), -Mnoi4 β€” treat (or don't treat) INTEGER as INTEGER*4. -Mnoi4 treats INTEGER as INTEGER*2.
  • -Miomutex, -Mnoiomutex (default) β€” generate (or don't generate) critical section calls around Fortran I/O statements. πŸ”₯
  • -Mlibsuffix=suffix β€” declares that a file with the given suffix is an object library file.
  • -Mllalign (default), -Mnollalign β€” align (or don't align) long longs or INTEGER*8 in structures or common blocks on 8-byte boundaries. -Mllalign is the default, bestie.
  • -Mnomain β€” when the link step is called, don't include the object file that calls the Fortran main program. Super useful when you're using the nvfortran driver to link programs whose main program is written in C or C++, with one or more subroutines written in Fortran. 🫢
  • -Mobjsuffix=suffix β€” declares that a file with the given suffix is a binary object file.
  • -Monetrip, -Mnoonetrip (default) β€” force (or don't force) each DO loop to be iterated at least once.
  • -Mr8, -Mnor8 (default) β€” treat (or don't treat) REAL as DOUBLE PRECISION and real constants as double precision constants.
  • -Mr8intrinsics [=float], -Mnor8intrinsics (default) β€” treat (or don't treat) the intrinsics CMPLX as DCMPLX and REAL as DBLE.
    • float β€” also treat the FLOAT intrinsic as DBLE. ✨
  • -Mrecursive, -Mnorecursive (default) β€” allocate (or don't allocate) local variables on the stack, which is what allows recursion. Heads up: SAVEd, data-initialized, or namelist members are always allocated statically, no matter what this switch is set to. πŸ’…
  • -Mref_externals, -Mnoref_externals (default) β€” force (or don't force) references to names appearing in EXTERNAL statements.
  • -Msave, -Mnosave (default) β€” assume (or don't assume) that all local variables are subject to the SAVE statement. -Msave may let a lot of older Fortran programs actually run, but ngl it can greatly reduce performance. 😭
  • -Msignextend (default), -Mnosignextend β€” sign extend (or 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. πŸ’€
  • -Mstack_arrays, -Mnostack_arrays (default) β€” allocate automatic arrays on the stack (or on the heap).
  • -Mstandard β€” flags non-ANSI-Fortran usage. little snitch behavior, but make it compiler.
  • -Msyntax-only β€” performs only syntax checking, semantic checking, and Fortran module (.mod) file generation. that's it, that's the whole job. ✨
  • -Munixlogical, -Mnounixlogical (default) β€” when -Munixlogical is in effect, a logical is considered to be .TRUE. if its value is non-zero and .FALSE. otherwise. When -Mnounixlogical is in effect (the default, bestie), a logical is considered to be .TRUE. if its value is odd and .FALSE. if its value is even. yes, even. we don't make the rules. πŸ™ˆ
  • -Mupcase, -Mnoupcase (default) β€” preserve (or don't preserve) case in names. -Mnoupcase causes all names to be converted to lower case. πŸ“Œ Note that if -Mupcase is used, then the variable name 'X' is different than the variable name 'x', and keywords must be in lower case. icon behavior honestly.
  • -module directory β€” save/search for module files in directory. πŸŽ€
  • -Munlink_module β€” instructs nvfortran to unlink a symlink to the desired module file before writing out the module file. Without this option, nvfortran will follow the symlink and write the module file to the symlink's target β€” provided it has permission to write there. πŸ‘‘
  • -r4 β€” interprets DOUBLE PRECISION variables as REAL. downgrade era.
  • -r8 β€” interprets REAL variables as DOUBLE PRECISION. Equivalent to using the options -Mr8 and -Mr8intrinsics. upgrade era. πŸ”₯
  • -Wh,option[,option...] β€” passes each comma-delimited option to the Fortran 90/95 front end. here, you hold this 🫢

πŸ”₯ TARGET-SPECIFIC OPTIONS πŸ”₯

  • -acc β€” enables OpenACC pragmas and directives so you can explicitly parallelize regions of code for execution by accelerator devices. Peep 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.
    • 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 that don't adhere to the OpenACC standard. 🫣
    • sync β€” ignore async clauses and run every data transfer and kernel launch on the default sync queue.
    • verystrict β€” abort compilation with a fatal error when an accelerator directive is encountered that doesn't adhere to the OpenACC standard. no warnings, just vibes check failed, we're done here πŸ’€
    • wait (default), nowait β€” wait for each compute kernel to finish.
  • -noacc β€” disables OpenACC directives and does not link with OpenACC libraries. πŸ¦‹
  • -gpu=option β€” use the following sub-options to tailor the compilation of target accelerator regions:
  • autocompare β€” Automatically compares CPU/GPU results. Accelerated code sections run in redundant mode, and data gets compared whenever it would ordinarily be moved off the accelerator. It’s giving β€œtrust but verify,” bestie ✨
  • ccXY β€” Generates code for a device with compute capability XY. You can list multiple compute capabilities and get one version 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. Literally all of them πŸ’…
  • 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 β€” Compiles for all major supported compute capabilities. Heads up: it does not include PTX for the highest major virtual architecture; see the -gpu=[no]rdc option for that support.
  • cudaX.Y β€” Uses CUDA X.Y Toolkit compatibility, where installed.
  • deepcopy β€” Enables Full Deepcopy support in OpenACC Fortran. Iconic.
  • fastmath β€” Enables the fast math library, which includes faster but lower-precision implementations of certain math and intrinsic functions.
  • flushz, noflushz (default) β€” Enables (or disables) flush-to-zero mode on the GPU.
  • fma, nofma β€” Generates (or does not generate) fused multiply-add operations on the GPU. This is enabled by default at optimization level -O1.
  • implicitsections, noimplicitsections (default) β€” Changes (or does not change) array element references in OpenACC and OpenMP data clauses to array-section references.
  • interceptdeallocations, nointerceptdeallocations β€” Intercepts (or does not intercept) LIBC function calls (e.g. free) and calls 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) β€” Generates debugging line information.
  • loadcache:[L1|L2] β€” Generates 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. It 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 it 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 it 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. It 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 the GPU memory mode from one of these options: separate, managed, unified. This option cannot be combined with -gpu=pinned, gpu=managed, or -gpu=unified. Bestie, pick one lane 🫢
    • 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 the -gpu=mem:unified:[no]managedalloc subflags. This option must appear in both the compile and link lines.
  • mem:unified:managedalloc, mem:unified:nomanagedalloc β€” Allocates (or does not allocate) any dynamically allocated data in CUDA Managed Memory.
  • mem:separate:pinnedalloc, mem:separate:nopinnedalloc β€” Allocates (or does not allocate) any dynamically allocated data in CUDA Pinned host memory.
  • ptxinfo β€” Prints ptxas information.
  • rdc (default), nordc β€” Generates (or does not generate) relocatable device code for separate compilation, and invokes the device linker before the host linker at the link step.
  • 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. You can list multiple compute capabilities and get one version 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. 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 β€” Enables (or disables) compile-time warnings when loop trip counts are calculated on the host instead of on the device.
  • tripcount:check, tripcount:nocheck β€” Inserts (or does 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. It 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 unrolls (or does not unroll) inner loops. This is enabled by default at optimization level -O3.

  • -Kieee, -Knoieee (default) β€” Performs 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. Heads up: -Ktrap is only meaningful when compiling a C/C++ main function or Fortran main program.

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

okay so 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). highkey important stuff, bestie πŸ’…

  • -march=target β€” this 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, and it's shorthand for -Mnodaz -Mnoflushz. -mdaz-ftz is the default setting and specifies that denormal operands and results are treated as zero, and it's 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. slay, compiler knows what's up ✨

  • -Mfunc32 (default), -Mnofunc32 β€” align (don't align) functions on 32 byte boundaries.
  • -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.
  • -Mvarargs, -Mnovarargs (default) β€” generate code for calls made from Fortran to C routines to use varargs calling sequence.
  • -Mwritable-strings β€” store string constants in the writable data segment.
  • -mcmodel=small|medium β€” pick the code model, bestie:
    • 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.
  • -stdpar=option β€” enable (ISO Fortran 2018) DO-CONCURRENT. parallel vibes incoming πŸ¦‹
    • gpu β€” (ISO Fortran 2018) DO-CONCURRENT is compiled for parallel execution on the GPU. This option implies -gpu=unified on targets with Unified memory capability and -gpu=managed otherwise.
    • multicore β€” (ISO Fortran 2018) DO-CONCURRENT is compiled for parallel execution on the CPU.
  • -nostdpar β€” execute (ISO Fortran 2018) DO-CONCURRENT sequentially.
  • -ta=target β€” this option has been deprecated 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:
nvfortran -help -tp

to display the list of recognized target processors.


πŸ—‚οΈ FILES πŸ—‚οΈ

  • a.out β€” executable output file.
  • file.a β€” library of object files.
  • file.f β€” fixed-format Fortran source file.
  • file.F β€” fixed-format Fortran source file that requires preprocessing.
  • file.f90 β€” free-format Fortran source file.
  • file.F90 β€” free-format Fortran source file that requires preprocessing.
  • file.f95 β€” free-format Fortran source file.
  • file.F95 β€” free-format Fortran source file that requires preprocessing.
  • file.f03 β€” free-format Fortran source file.
  • file.F03 β€” free-format Fortran source file that requires preprocessing.
  • file.for β€” fixed-format Fortran source file.
  • file.fpp β€” fixed-format Fortran source file that requires preprocessing.
  • file.cuf β€” free-format CUDA Fortran source file.
  • file.CUF β€” free-format CUDA Fortran source file that requires preprocessing.
  • file.ipa β€” InterProcedural Analyzer (IPA) file.
  • file.ipo β€” InterProcedural Analyzer (IPA) file.
  • file.o β€” object file.
  • file.s β€” assembler source file.
  • .mynvfortranrc β€” you may add custom switches or make other additions to nvfortran by creating a file named .mynvfortranrc 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.

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 πŸ‘€

Go check nvc (1), nvc++ (1), and the NVIDIA User's Guide. iykyk πŸ’œ


🚨 DIAGNOSTICS 🚨

The compiler produces information and error messages as it translates the input program. The linker and assembler may issue their own error messages. not me getting diagnostics at the function 😭


That's the page, bestie β€” it's dated September 2026 and signed pgf90(1). periodt, go compile something iconic 🫢✨

πŸ“¦ where this page comes from