pgf77(1)

๐Ÿ“ฆ version 26.9, in arch rolling

๐ŸŒธ NAME ๐ŸŒธ

nvfortran โ€” The NVIDIA Fortran compiler. Bestie, you're reading the pgf77(1) page from the General Commands Manual, and it's giving "important compiler lore" โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

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

๐Ÿ’– DESCRIPTION ๐Ÿ’–

Okay so pgf77 is literally an alias for nvfortran. And nvfortran is a Fortran compiler for NVIDIA GPUs and AMD and Intel CPUs. No cap. ๐Ÿ’…

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. It invokes the Fortran compiler, assembler, and linker with options derived from its command line arguments. Slay. ๐Ÿซถ

The suffixes of source file names tell you what type of processing is going to happen:

  • .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. Lowkey important. โญ

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. Periodt. ๐Ÿ’€


โœจ 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. It's a lot, bestie โ€” hydrate first. ๐Ÿ“

๐ŸŽ€ Overall Options ๐ŸŽ€

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

๐Ÿ’œ Optimization Options ๐Ÿ’œ

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

๐Ÿฆ‹ Debugging Options ๐Ÿฆ‹

  • -C โ€” debugging option.
  • -g โ€” debugging option.
  • -gopt โ€” debugging option.
  • -M[no]bounds โ€” debugging option.
  • -Mchkptr โ€” debugging option.
  • -Mchkstk โ€” debugging option.
  • -Mcoff โ€” debugging option.
  • -Mdwarf2 โ€” debugging option.
  • -Mdwarf3 โ€” debugging option.
  • -Melf โ€” debugging option.
  • -Mnodwarf โ€” debugging option.
  • -[no]traceback โ€” debugging option.

๐ŸŒˆ Preprocessor Options ๐ŸŒˆ

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

๐Ÿงš Assembler Options ๐Ÿงš

  • -Wa,argument[,argument]... โ€” assembler option.
  • -Ya,directory โ€” assembler option.

๐Ÿ”ฅ Linker Options ๐Ÿ”ฅ

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

๐ŸŒธ Language Options ๐ŸŒธ

  • -asmsuffix=suffix โ€” language option.
  • -byteswapio โ€” language option.
  • -csuffix=suffix โ€” language option.
  • -fsuffix=suffix โ€” language option.
  • -FSUFFIX=suffix โ€” language option.
  • -cuda=option โ€” language option.
  • -i2 โ€” language option.
  • -i4 โ€” language option.
  • -i8 โ€” language option.
  • -i8storage โ€” language option.
  • -Mallocatable[=95|03] โ€” language option.
  • -M[no]backslash โ€” language option.
  • -Mbyteswapio โ€” language option.
  • -Mcray=pointer โ€” language option.
  • -Mcuda=option โ€” language option.
  • -M[no]dalign โ€” language option.
  • -M[no]dclchk โ€” language option.
  • -M[no]defaultunit โ€” language option.
  • -M[no]dlines โ€” language option.
  • -Mdollar=char โ€” language option.
  • -Mextend โ€” language option.
  • -Mfixed โ€” language option.
  • -M[no]free[form] โ€” language option.
  • -M[no]i4 โ€” language option.
  • -M[no]iomutex โ€” language option.
  • -Mlibsuffix=suffix โ€” language option.
  • -M[no]llalign โ€” language option.
  • -Mnomain โ€” language option.
  • -Mobjsuffix=suffix โ€” language option.
  • -M[no]onetrip โ€” language option.
  • -M[no]r8 โ€” language option.
  • -M[no]r8intrinsics=float โ€” language option.
  • -M[no]recursive โ€” language option.
  • -M[no]ref_externals โ€” language option.
  • -M[no]save โ€” language option.
  • -M[no]signextend โ€” language option.
  • -M[no]stack_arrays โ€” language option.
  • -Mstandard โ€” language option.
  • -Msyntax-only โ€” language option.
  • -M[no]unixlogical โ€” language option.
  • -M[no]upcase โ€” language option.
  • -module directory โ€” language option.
  • -Munlink_module โ€” language option.
  • -r4 โ€” language option.
  • -r8 โ€” language option.
  • -Wh,argument[,argument]... โ€” language option.

๐Ÿ‘‘ Target-specific Options ๐Ÿ‘‘

  • -acc โ€” target-specific option.
  • -noacc โ€” target-specific option.
  • -gpu=option โ€” target-specific option.
  • -K[no]ieee โ€” target-specific option.
  • -Ktrap=option โ€” target-specific option.
  • -march=target โ€” target-specific option.
  • -m[no-]daz-ftz โ€” target-specific option.
  • -M[no]daz โ€” target-specific option.
  • -M[no]flushz โ€” target-specific option.
  • -M[no]fpmisalign โ€” target-specific option.
  • -M[no]fprelaxed=option โ€” target-specific option.
  • -M[no]func32 โ€” target-specific option.
  • -M[no]longbranch โ€” target-specific option.
  • -M[no]second_underscore โ€” target-specific option.
  • -M[no]varargs โ€” target-specific option.
  • -Mwritable-strings โ€” target-specific option.
  • -mcmodel=small|medium โ€” target-specific option.
  • -stdpar=option โ€” target-specific option.
  • -nostdpar โ€” target-specific option.
  • -ta=target โ€” target-specific option.
  • -target=option โ€” target-specific option.
  • -tp=target โ€” target-specific option.

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 (the general-vibes zone) ๐ŸŒˆ

  • -- โ€” everything after this switch is treated as a filename, periodt. But real talk: most tools will not allow a filename that starts with a dash, so likeโ€ฆ just avoid those ๐Ÿ’€
  • -# โ€” shows you the invocations of the compiler, assembler, and linker. These invocations are the command lines created by nvfortran. It's giving backstage pass ๐ŸŽŸ๏ธ
  • -### โ€” same energy as -#, it displays the invocations of the compiler, assembler and linker, but does not execute them. Look, don't touch โœจ
  • -c โ€” skip the link step. Compile and assemble only, bestie.
  • -defaultoptions (default) / -nodefaultoptions โ€” use (or don't use ๐Ÿซฃ) the default options set in site-specific or user-specific PREOPTIONS or POSTOPTIONS driver variables.
  • -dryrun โ€” use this one to display the invocations of the compiler, assembler, and linker but not execute them. Rehearsal only, no show ๐ŸŒธ
  • -drystdinc โ€” displays the standard include directories without invoking the compiler. No cap.
  • -dumpversion โ€” displays the shortened version of the compiler. For example, 21.11 or 22.3.
  • -echo [=go|stop] โ€” echoes the command line flags and (by default) stops. This is genuinely so 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. Returns a success error code if there are no command-line switch errors. Vibe check only ๐Ÿ˜Œ
  • -flags โ€” displays all valid nvfortran command-line options in alphabetical order.
  • -fmax-errors=<n> โ€” specify the maximum number of errors before terminating compilation. (Original page spells it "maximun" and honestly? iconic typo, but it means maximum ๐ŸŽ€)
  • --gcc-toolchain=path โ€” specify the gcc toolchain location using path to the gcc directory or gcc executable. The argument can be either the gcc root directory, <root directory>/bin, or the gcc executable itself.
  • -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, and the 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 โ€” produces annotated assembly files, where source code is intermixed with assembly language; implies -Mkeepasm. It's giving annotated director's cut ๐ŸŽฌ
  • -Minform=level โ€” specify the minimum level of error severity that the compiler displays during compilation. The levels are:
    • fatal โ€” instructs the compiler to display fatal error messages.
    • file (default) / nofile โ€” print out (don't print out) the names of files as they are compiled; this is only active when there is more than one file on the command line.
    • severe โ€” instructs the compiler to display severe and fatal error messages.
    • warn โ€” instructs the compiler to display warning, severe and fatal error messages.
    • inform โ€” instructs the compiler to display all error messages (inform, warn, severe and fatal).

The default is -Minform=warn.

  • -Mdetail โ€” displays enhanced error messages that include source line and column pointer. This is currently available for syntax errors and some semantic errors. So helpful it hurts ๐Ÿ˜ญ
  • -Mkeepasm โ€” keeps the assembly file for each source file, but continues 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. Forgiving queen ๐Ÿ’…
  • -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.
  • -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.
  • -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.
  • -show โ€” produce help information describing the current nvfortran configuration.
  • -silent โ€” do not print warning messages. Same as -Minform=severe. Shhh ๐Ÿคซ
  • -time โ€” print execution times for the various steps in the compiler itself. Timer on, 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.
  • -v โ€” verbose mode; print out the command line for each tool before it is executed.
  • --version โ€” display version messages and other information.
  • -w โ€” do not print warning messages.
  • -Werror โ€” turn all warning messages into errors. No more "lol it's just a warning" energy, they're real now ๐Ÿ”ฅ
  • -x language โ€” specify explicitly the language for the input files (instead of choosing based on the file name suffix). The 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:
    • 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 โšก

  • -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. Speedy girly pop ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ
  • -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 nvfortran -fastsse -help to see the equivalent switches.
  • -fPIC โ€” equivalent to -fpic; provided for compatibility with other compilers.
  • -fpic โ€” instructs the compiler to generate position-independent code which can be used to create shared object files (dynamically linked libraries).
  • -KPIC โ€” equivalent to -fpic; provided for compatibility with other compilers.
  • -Kpic โ€” equivalent to -fpic; provided for compatibility with other compilers.
  • -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. Organized and aligned, as she should be ๐ŸŽ€
  • -Mconcur[=option[,option,...]] โ€” > โš ๏ธ heads up bestie, this option has been deprecated and will be removed in a future release. Don't get attached ๐Ÿ’€

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 all available cores when the environment variables OMP_NUM_THREADS and NCPUS are not set. โš ๏ธ this one must be specified at link time, no exceptions bestie.
  • altcode:n, noaltcode โ€” generate (or don't generate, respectively) alternate scalar code for parallelized loops. Here's the tea โ˜•: the parallelizer whips up scalar code that gets executed whenever the loop count is less than or equal to n. But if you say noaltcode, the parallelized version of the loop is always executed, no matter what the loop count is. main character behavior fr.
  • altreduction[:n] โ€” generates alternate scalar code for parallelized loops that contain a reduction. If a parallelized loop has a reduction in it, the parallelizer generates scalar code that gets executed whenever the loop count is less than or equal to n. ๐Ÿ’–
  • assoc (default), noassoc โ€” enable (or disable) parallelization of loops with reductions.
  • cncall, nocncall (default) โ€” assume (or don't assume) that loops containing calls are safe to parallelize. Also, with this, no minimum loop count threshold has to be satisfied before parallelization will happen, and last values of scalars are assumed to be safe. ๐Ÿ‘‘
  • dist:block โ€” parallelize with block distribution. Contiguous blocks of iterations of a parallelizable loop get assigned to the available processors. clean, simple, slay.
  • dist:cyclic โ€” parallelize with cyclic distribution. The outermost parallelizable loop in any loop nest is the one that gets parallelized. If a parallelized loop is innermost, its iterations are allocated to processors cyclically. Example time ๐Ÿ“: 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. iconic rotation honestly.
  • innermost, noinnermost (default) โ€” enable (or disable) parallelization of innermost loops.
  • levels:n โ€” parallelize loops nested at most n levels deep; the default is 3.

  • -Mdepchk (default), -Mnodepchk โ€” assume (or don't assume) that potential data dependencies exist. ๐Ÿšจ bestie listen to me: -Mnodepchk may result in incorrect code. like, wrong-answers incorrect. don't play with it.
  • -Mdse, -Mnodse (default) โ€” enable (or disable) the dead store elimination optimization.
  • -Mextract=[option[,option,...]] โ€” runs the subprogram extraction phase to prep for inlining. The =lib:filename option must be used with this switch to name an extract library. Peep -Minline for more details on inlining. โœจ
    • subprogram[,subprogram] โ€” a non-numeric option that doesn't contain 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 fewer statements are extracted. If both number and function are specified, then functions matching the given name(s) or meeting the size requirements are extracted.
  • -Mfma, -Mnofma (default) โ€” generate (or don't generate) fused multiply-add (FMA) instructions on the CPU and GPU for targets that support it. FMA instructions are generally faster than separate multiply-add instructions, and they can generate higher precision results since the multiply result isn't rounded before the addition. But plot twist ๐Ÿ˜ญ: delaying rounding until after the addition may cause results to differ from those you'd get with the unfused multiply-add instructions. FMA instructions are enabled at optimization levels higher than -O1.
  • -Mframe, -Mnoframe (default) โ€” set up (or don't set up) a true stack frame pointer for functions. -Mnoframe allows slightly more efficient operation when a stack frame isn't needed, but heads up: some options override -Mnoframe. ๐Ÿ’…
  • -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. glow-up via pattern matching, we love to see it.
  • -Minfo[=option[,option,...]], -Mnoinfo (default) โ€” emit useful information to stderr. The options are:
    • all โ€” includes the 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. It emits compute intensity information about loops. ๐Ÿ’€ (rest in peace, bestie.)
    • 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 at all, -Minfo is the same as -Minfo=accel,ipa,loop,lre,mp,opt,par,stdpar,vect.

  • -Minline[=option[,option,...]] โ€” passes 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. (no thank you, not you.)
    • [name:]function โ€” a non-numeric option is assumed to be a function name. If name: is specified, what follows is always the name of a function.
    • pragma โ€” Fortran Only: inline only those procedures that have a !NVF$ INLINE pragma on the source line immediately before the procedure's SUBROUTINE or FUNCTION statement.
    • [maxsize:]number โ€” a numeric option is assumed to be a size. Functions of size number or less are inlined. If both number and function are specified, then functions matching the given name(s) or meeting the size requirements are inlined.
    • reshape โ€” for Fortran, the default is to not inline subprograms with array arguments if the array shape doesn't match the shape in the caller. This overrides the default. ๐Ÿฆ‹
    • smallsize:number โ€” always inline functions of size smaller than number, regardless of other size limits.
    • totalsize:number โ€” stop inlining in a function when that function's total inlined size reaches the number specified.
  • -Minstrument [=option] โ€” generate additional code to enable function-level instrumentation. This option implies -Mframe. The option is:
    • functions (default)
  • -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; peep -O. If no option list is specified, then 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 allows better SSE code generation. โœจ
    • arg, noarg (default) โ€” remove (or don't remove) arguments replaced by -Mipa=ptr,const. -Mipa=noarg implies -Mipa=nolocalarg.
    • const (default), noconst โ€” enable (or disable) propagation of constants across procedure calls.
    • f90ptr, nof90ptr (default) โ€” enable (or disable) Fortran 90 pointer disambiguation across procedure calls.
    • fast โ€” chooses generally optimal -Mipa flags for the target platform; use nvfortran -Mipa -help to see the equivalent options. iykyk.
    • force โ€” force all objects to recompile regardless of whether IPA information has changed.
    • globals, noglobals (default) โ€” analyze (or don't analyze) which globals are modified by procedure calls.
    • inline:n โ€” determine additional functions to inline, allowing up to n levels of inlining. Additional suboptions are:
      • except:proc โ€” disables inlining of procedure proc.
      • nopfo โ€” ignore any profile frequency information from -Mpfo when choosing which functions to inline.
      • reshape, noreshape (default) โ€” enable (or disable) Fortran inlining with mismatched array shapes.
    • ipofile โ€” save IPA information in a .ipo file instead of the default of appending the information to the object file. ๐ŸŽ€
    • jobs:n โ€” use up to n jobs in parallel to reoptimize object files. multitasking queen behavior.
  • keepobj (default), nokeepobj โ€” keep (or don't keep) the optimized object files, using file name mangling, so your later application builds recompile less stuff. it's giving "future you says thank you" ๐Ÿ’–
  • libc, nolibc (default) โ€” optimize (or don't optimize) calls to certain standard C library routines โœจ
  • libinline, nolibinline (default) โ€” allow (or don't allow) inlining from routines in libraries. heads up: -Mipa=libinline implies -Mipa=inline ๐Ÿซถ
  • libopt, nolibopt (default) โ€” allow (or don't allow) recompiling and reoptimizing routines from libraries that have IPA information ๐Ÿ”
  • localarg, nolocalarg (default) โ€” enable (or disable) the feature that externalizes local variables so arguments can be replaced by -Mipa=ptr. also, -Mipa=localarg implies -Mipa=arg, iykyk ๐Ÿ’…
  • main:func โ€” name a function to serve as a global entry point. you can drop this multiple times if you want; 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. shh, main character silence ๐Ÿคซ
  • reaggregation, noreaggregation (default) โ€” enable (or disable) global struct reaggregation. ngl this one can change the order of struct members, or split structs into multiple structs, to improve memory locality and cache utilization โ€” iconic behaviour, lowkey rearranging your furniture ๐Ÿ›‹๏ธโœจ
  • required โ€” return an error condition if IPA is inhibited for any reason, instead of the default behaviour of linking without IPA optimization. like, if it can't do the thing it's gonna tell you ๐Ÿšจ
  • safe:[function|library] โ€” declares that the named function, or every function in the named library, is safe. a safe procedure does not call back into the known procedures and does not change any known global variables. and bestie, 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 it allows optimization for other files linked with this file. teamwork, but make it compiler ๐Ÿซถ
  • vestigial, novestigial (default) โ€” remove (or don't remove) functions that are not called. bye bye dead code ๐Ÿ‘‹๐Ÿ’€
  • -Mlre[=assoc|noassoc], -Mnolre โ€” enable (or disable, with -Mnolre) loop-carried redundancy elimination. the assoc option allows expression reassociation, and noassoc disallows expression reassociation ๐ŸŽ€
  • -Mmovnt, -Mnomovnt โ€” force (or disable) generation of nontemporal moves. -Mmovnt used with -fastsse can sometimes be faster than -fastsse alone, which is kind of a slay. 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. but fr, use the -Minfo flag instead ๐Ÿ’…
  • -Mnoopenmp โ€” when -mp is present, ignore the OpenMP pragmas ๐Ÿ™ˆ
  • -Mnosgimp โ€” when -mp is present, ignore the SGI parallelization pragmas ๐Ÿ™ˆ
  • -Mnovintr โ€” do not generate vector intrinsic calls ๐Ÿšซ
  • -Mpfi[=option] โ€” generate profile feedback instrumentation. this includes extra code to collect run-time statistics for use in a subsequent compile, and -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. there must be a profile feedback file pgfi.out in the current directory, and it contains the result of an execution of the program compiled with -Mpfi. the options are:
    • indirect, noindirect (default) โ€” enable (or disable) indirect function call inlining. this requires a pgfi.out file generated from a binary built with -Mpfi=indirect ๐Ÿ”—
    • layout (default), nolayout โ€” enable (or disable) basic block layout, which takes advantage of instruction cache locality by keeping hot paths close together ๐Ÿ”ฅ
    • dir=directory โ€” specify the directory containing the pgfi.out profile feedback information file. the default is the current directory ๐Ÿ“
  • -Mpre, -Mnopre (default) โ€” enable (or disable) the partial redundancy elimination optimization โœจ
  • -Mprefetch[=option:n], -Mnoprefetch โ€” add (or don't add) prefetch instructions for those processors that support them (Pentium 4, Opteron). -Mprefetch is default on Opteron, and -Mnoprefetch is default on other processors. the options are:
    • distance:d โ€” set the fetch-ahead distance for prefetch instructions to d cache lines ๐Ÿ“
    • n:n โ€” set the maximum number of prefetch instructions to generate in a loop to n ๐Ÿ”ข
    • nta โ€” use the prefetchnta instruction ๐Ÿงš
    • plain โ€” use the prefetch instruction ๐Ÿ’ซ
    • t0 โ€” use the prefetcht0 instruction โญ
    • w โ€” allow the AMD-specific prefetchw instruction ๐Ÿ’œ
  • -Mprof[=option[,option,...]] โ€” set performance profiling options. using these options will cause the resulting executable to create a performance profile that can be viewed and analyzed with the PGPROF performance profiler. in the descriptions below, old-style profiling implies compiler-generated source instrumentation, and MPICH-style profiling implies the use of instrumented wrappers for MPI library routines. the -Mprof options are:
    • dwarf โ€” generate limited DWARF symbol information, sufficient for most performance profilers ๐Ÿงฌ
    • func โ€” perform old-style function level profiling ๐ŸŽฏ
    • hwcts โ€” generate a profile using event-based sampling of hardware counters via the PAPI interface (PAPI must be installed) ๐Ÿ–ฅ๏ธ
    • lines โ€” perform old-style line level profiling ๐Ÿ“
    • time โ€” generate a profile using time-based instruction-level statistical sampling. this is equivalent to -pg, except that the profile is saved in a file named pgprof.out instead of gmon.out โฑ๏ธ

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

  • -Mpropcond (default), -Mnopropcond โ€” enable (or disable) propagation of constant values derived from conditional branches with equality tests ๐ŸŽ€
  • -Mquad โ€” align large objects on quad-word boundaries ๐Ÿ“
  • -Msafe_lastval โ€” in the case where a scalar is used after a loop, but is not defined on every iteration of the loop, the compiler does not by default parallelize the loop. however, this option tells the compiler it is safe to parallelize the loop ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ
  • -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 0๏ธโƒฃ
  • -Mstride0, -Mnostride0 (default) โ€” generate (or don't generate) alternate code for a loop that contains an induction variable whose increment may be zero ๐Ÿ”„
  • -Munroll[=option[,option...]], -Mnounroll (default) โ€” invoke (or don't invoke) the loop unroller. this also sets the optimization level to a minimum of 2; see -O. the option is one of the following:
    • c:m โ€” 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. 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 ๐Ÿ”

and -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 bestie, it is unsafe because there are situations where the array elements allocated to some processors are not aligned ๐Ÿ˜ฌโš ๏ธ
  • -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 ๐Ÿซถ
    • prefetch โ€” use prefetch instructions in loops where profitable ๐Ÿ‘€
  • simd[:{128|256|512}] (default) / nosimd โ€” use vector SIMD instructions, like AVX, AVX2, AVX512 ๐Ÿ’… the argument is there so you can cap yourself at 128-bit SIMD instructions if you're feeling modest. And bestie, specifying 512-bit SIMD instructions is only possible for target processors that actually support AVX512, so check before you flex.
  • uniform / nouniform (default) โ€” do the same optimizations in the vectorized loops and the residual loops. Heads up: this may affect the performance of the residual loop ๐Ÿซถ

Okay so these next ones are also supported, but the manpage is literally like "not recommended for use in new development, except by experienced users, and may be phased out in future releases" โ€” so, like, they're giving legacy era, not main character energy. Use at your own risk, iykyk ๐Ÿ™ˆ

  • 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 move here is changing the order of additions โ€” mathematically correct, yes, but computationally different because, surprise, roundoff error exists ๐Ÿ˜ญ
  • 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; it's the alternate form of -Midiom โœจ
  • levels:n โ€” set the maximum nest level of loops to optimize.
  • 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 get vectorized; the default is, uh, attempting to vectorize all loops. go big or go home I guess ๐Ÿ’€
  • tile / notile (default) โ€” enable (or disable) loop tiling to optimize for cache locality.
  • -Mnovect โ€” disables the vectorizer entirely, and it's the default at -O0 and -O1.
  • -Mzerotrip (default) / -Mnozerotrip โ€” include (or don't include) a zero-trip test for loops. Only reach for -Mnozerotrip when all loops are known to execute at least once, no cap ๐Ÿซก
  • -mp[=option] โ€” enables OpenMP pragmas and directives so you can 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 (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.
  • -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 gets set to 2. The optimization levels and their meanings are, and I quote, as follows:
    • -O0 โ€” sets the optimization level to 0. A basic block is generated for each statement. No scheduling is done between statements. No global optimizations are performed. it's giving baby steps ๐ŸŽ€
    • -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. this is the sweet spot bestie ๐Ÿ’–
    • -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. (the "may or may not be profitable" is doing so much heavy lifting ๐Ÿ˜ญ)
    • -Ofast โ€” enables -O3, -Mfprelaxed, -Mstack_arrays, -Mno-nan, Mno-inf, and -fcx-limited-range. Note -Mstack_array is disabled when both command line options -Ofast and -stdpar are enabled.
    • -O4 โ€” all -O1, -O2, and -O3 optimizations are performed. In addition, hoisting of guarded invariant floating-point expressions is enabled.
  • -pg โ€” enable gprof-style sample-based profiling; implies -Mframe.

๐Ÿ› Debugging Options ๐Ÿ›

  • -C โ€” add array bounds checking; it's the same as -Mbounds.
  • -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 โ€” like, noticeably slower, bestie, that's the tradeoff ๐Ÿ˜ญ
  • -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 (or don't add) array bound checking.
  • -Mchkptr โ€” check for unintended de-referencing of NULL pointers. honestly iconic of it ๐Ÿซถ
  • -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.

๐ŸŒธ 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.
  • -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, bestie ๐Ÿ‘‘
  • -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 (or 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.
  • -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.
  • -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 whole section is the link-step era โ€” the driver is handing stuff off to the linker and we are keeping every single detail, no cap. ๐Ÿ”—โœจ

  • -acclibs โ€” link-time option that adds the accelerator libraries to the link line. ๐Ÿ’…
  • --as-needed, --no-as-needed โ€” passed to the linker. --as-needed tells 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. ๐ŸŒŸ
  • -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 nvfortran 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. โœจ
  • -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. --whole-archive 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 ๐Ÿ—ฃ๏ธ

Okay bestie, this is the big one โ€” all the flags that tell the compiler what flavour of Fortran you're speaking. Buckle up ๐Ÿ’…

  • -asmsuffix=suffix โ€” says "hey, a file with this suffix? that's an assembly language file." Custom extensions, slay.
  • -byteswapio โ€” swaps bytes from big-endian to little-endian, or vice versa, 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 this suffix is a C source file.
  • -fsuffix=suffix โ€” declares that a file with this suffix is a Fortran source file.
  • -FSUFFIX=suffix โ€” same energy, declares that a file with this suffix is a Fortran source file. (Yes, it's the uppercase twin, and yes, it's iconic in its own way ๐Ÿ‘‘)
  • -cuda[=option[,option...] โ€” enables CUDA Fortran, adds the CUDA include paths, and links with the CUDA runtime libraries. โš ๏ธ Heads up: -cuda is required on the link line. If -cuda is used in compilation, it must also be used for linking. For target specific options, go look at -gpu. For linking additional CUDA libraries (e.g. math libraries), go look at -cudalib. Then use these 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.
  • -i2 โ€” treat INTEGER variables as two bytes.
  • -i4 โ€” treat INTEGER variables as four bytes.
  • -i8 โ€” treat default INTEGER and LOGICAL variables as eight bytes. For operations involving integers, use 64-bits for computations. ๐Ÿงฎ
  • -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 allocatable components of derived types. Fortran 1995 semantics require you to allocate the object or component, and require that an array object or component be conformant before the assignment. Fortran 2003 semantics require the compiler to add code checking whether the object or component is allocated and whether an array object is conformant before the assignment โ€” and to allocate or reallocate if not. Bestie, that's the compiler doing your chores for you ๐Ÿซถ
  • -Mbackslash, -Mnobackslash (default) โ€” treat / don't treat backslash as a normal (non-escape) character in strings. -Mnobackslash causes the standard C backslash escape sequences to be recognized in quoted strings; -Mbackslash causes the backslash to be treated like any other character.
  • -Mbyteswapio โ€” swaps bytes from big-endian to little-endian or vice versa on input/output of unformatted Fortran data. Using it enables reading/writing of Fortran unformatted data files compatible with those produced on Sun or SGI systems.
  • -Mcray=pointer โ€” forces Cray Fortran (CF77) compatibility with respect to 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...] โ€” โš ๏ธ this option 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. If -Mcuda is used in compilation, it must also be used for linking.
  • -Mdalign (default), -Mnodalign โ€” align / don't align doubles in structures on 8-byte boundaries. Ngl -Mnodalign may lead to data alignment exceptions. ๐Ÿ’€
  • -Mdclchk, -Mnodclchk (default) โ€” require / don't require that all variables be declared. (The "no vibes allowed, declare everything" switch.)
  • -Mdefaultunit, -Mnodefaultunit (default) โ€” treat / don't treat '*' as stdout/stdin regardless of the status of units 6/5. -Mnodefaultunit causes * to be a synonym for 5 on input and 6 on output; -Mdefaultunit causes * to be a synonym for stdin on input and stdout on output.
  • -Mdlines, -Mnodlines (default) โ€” treat / 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. Long lines rights โœจ
  • -Mfixed โ€” processes Fortran source using fixed form specifications. The -Mfree options specify free form formatting. By default, files with a .f or .F extension use fixed form formatting.
  • -Mfree, -Mfreeform, -Mnofree, -Mnofreeform โ€” processes Fortran source using free form specifications. The -Mnofree and -Mfixed options specify fixed form formatting. By default, files with a .f90, .F90, .f95 or .F95 extension use freeform formatting. ๐Ÿฆ‹
  • -Mi4 (default), -Mnoi4 โ€” treat / don't treat INTEGER as INTEGER*4. -Mnoi4 treats INTEGER as INTEGER*2.
  • -Miomutex, -Mnoiomutex (default) โ€” generate / don't generate critical section calls around Fortran I/O statements.
  • -Mlibsuffix=suffix โ€” declares that a file with this suffix is an object library file.
  • -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.
  • -Mnomain โ€” when the link step is called, don't include the object file which calls the Fortran main program. Super useful for using the nvfortran driver to link programs with the main program written in C or C++ and one or more subroutines written in Fortran. iykyk ๐Ÿ”ฅ
  • -Mobjsuffix=suffix โ€” declares that a file with this suffix is a binary object file.
  • -Monetrip, -Mnoonetrip (default) โ€” force / don't force each DO loop to be iterated at least once.
  • -Mr8, -Mnor8 (default) โ€” treat / don't treat REAL as DOUBLE PRECISION and real constants as double precision constants.
  • -Mr8intrinsics [=float], -Mnor8intrinsics (default) โ€” treat / don't treat the intrinsics CMPLX as DCMPLX and REAL as DBLE.
    • float โ€” also treat the FLOAT intrinsic as DBLE.
  • -Mrecursive, -Mnorecursive (default) โ€” allocate / don't allocate local variables on the stack, thus allowing recursion. โš ๏ธ SAVEd, data-initialized, or namelist members are always allocated statically, regardless of the setting of this switch.
  • -Mref_externals, -Mnoref_externals (default) โ€” force / don't force references to names appearing in EXTERNAL statements.
  • -Msave, -Mnosave (default) โ€” assume / don't assume that all local variables are subject to the SAVE statement. -Msave may allow many older Fortran programs to run but can greatly reduce performance. ๐Ÿ˜ญ (the tradeoff is real)
  • -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.
  • -Mstack_arrays, -Mnostack_arrays (default) โ€” allocate automatic arrays on the stack (on the heap).
  • -Mstandard โ€” flags non-ANSI-Fortran usage. The compiler is snitching, but affectionately ๐Ÿ’…
  • -Msyntax-only โ€” performs only syntax checking, semantic checking, and Fortran module (.mod) file generation. Like a vibe check but for your code.
  • -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), a logical is considered to be .TRUE. if its value is odd and .FALSE. if its value is even.
  • -Mupcase, -Mnoupcase (default) โ€” preserve / don't preserve case in names. -Mnoupcase causes all names to be converted to lower case. โš ๏ธ Note that, if -Mupcase is used, then variable name 'X' is different than variable name 'x', and keywords must be in lower case. Case-sensitive Fortran era, we're living it ๐ŸŽ€
  • -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 โ€” interpret DOUBLE PRECISION variables as REAL.
  • -r8 โ€” interpret REAL variables as DOUBLE PRECISION. Equivalent to using the options -Mr8 and -Mr8intrinsics.
  • -Wh,option[,option...] โ€” passes each comma-delimited option to the Fortran 90/95 front end.

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

Accelerator time, bestie โ€” let's get this code running on the fancy hardware ๐Ÿ‘‘

-acc

  • -acc โ€” enables OpenACC pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices. See the -gpu flag to select options specific to NVIDIA GPUs. The options are:
    • autopar (default), noautopar โ€” enable loop autoparallelization within parallel constructs.
    • gpu (default) โ€” compile OpenACC directives for parallel execution on the GPU.
    • host โ€” compile OpenACC directives for serial execution on the host CPU.
    • legacy โ€” suppress warnings about deprecated PGI accelerator directives.
    • multicore โ€” compile OpenACC directives for parallel execution on the host CPU.
    • routineseq, noroutineseq (default) โ€” compile every routine for the device, as if it had a routine seq directive.
    • strict โ€” issue warnings when accelerator directives are encountered which do not adhere to the OpenACC standard.
    • sync โ€” ignore async clauses, and run every data transfer and kernel launch on the default sync queue.
    • verystrict โ€” abort compilation with a fatal error when an accelerator directive is encountered which does not adhere to the OpenACC standard. ๐Ÿ˜ค no notes, no mercy.
    • wait (default), nowait โ€” wait for each compute kernel to finish.
  • -noacc โ€” disables OpenACC directives and does not link with OpenACC libraries.

-gpu=option

  • -gpu=option โ€” use the following sub-options to tailor the compilation of target accelerator regions:

okay bestie, we're still deep in the -gpu sub-option buffet โ€” grab a plate, we're not done yet ๐Ÿ“

  • autocompare โ€” automatically compares CPU and GPU results for you. Accelerated code sections get run in redundant mode, and data gets compared whenever it would normally be shuffled off the accelerator. Free vibe check on your math โœจ
  • ccXY โ€” generates code for a device with compute capability XY. You can list multiple compute capabilities and it'll make one version for each. By default the compiler sniffs out the compute capability of every GPU you've got installed. Peep -help -gpu to see which compute capabilities are valid for your install ๐Ÿ‘€
  • ccall โ€” generates code for all the compute capabilities supported for this target and by the CUDA Toolkit version you picked. Go big or go home ๐Ÿ’…
  • ccnative โ€” detects the visible GPUs on your system and generates code for them. If no device is available, it falls back to the default compute capability, which is cc50.
  • ccall-major โ€” compiles for all major supported compute capabilities. Heads up though: it does not include PTX for the highest major virtual architecture โ€” for that support, see the -gpu=[no]rdc option.
  • cudaX.Y โ€” uses CUDA X.Y Toolkit compatibility, where it's installed.
  • deepcopy โ€” enables Full Deepcopy support in OpenACC Fortran.
  • fastmath โ€” turns on the fast math library. It's got faster but lower precision implementations of certain math and intrinsic functions. Speed โœจ accuracy ๐Ÿค
  • flushz, noflushz (default) โ€” enable (or disable) flush-to-zero mode on the GPU.
  • fma, nofma โ€” generate (or don't) fused multiply-add operations on the GPU. This one's enabled by default at optimization level -O1.
  • implicitsections, noimplicitsections (default) โ€” change (or don't change) array element references in OpenACC and OpenMP data clauses into array section references.
  • interceptdeallocations, nointerceptdeallocations โ€” intercept (or don't intercept) LIBC function calls like free, and call the matching 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. Only works when -gpu=lto is enabled.
  • keepptx โ€” keeps the generated portable assembly files, with a .ptx suffix.
  • lineinfo, nolineinfo (default) โ€” generate debugging line information.
  • loadcache:[L1|L2] โ€” generates code that caches global memory loads in the L1 or L2 hardware cache. Pick your cache bestie ๐Ÿ’œ
  • lto โ€” enables Device Link Time 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, and it may not be used with -gpu=pinned.
    • intercept โ€” intercepts LIBC function calls like free, and calls their managed memory version if the address is in managed memory, and the regular version otherwise.
  • nomanaged โ€” do not allocate any dynamically allocated data in CUDA Managed memory. Use it with -stdpar to stop that flag's implicit use of -gpu=managed when CUDA Managed memory capability gets detected.
  • nounified โ€” do not compile for CUDA Unified memory capability. Use it with -stdpar to stop that flag's implicit use of -gpu=unified when CUDA Unified memory capability gets detected.
  • pinned โ€” allocates any dynamically allocated data in CUDA Pinned host memory. This option must appear in both the compile and link lines, and it may not be used with -gpu=managed|unified.
    • intercept โ€” intercepts LIBC function calls like free, and calls their pinned memory version if the address is in pinned memory, and the regular version otherwise.
  • mem:[mode] โ€” picks your GPU memory mode, one of: separate, managed, unified. This one cannot be combined with -gpu=pinned, gpu=managed or -gpu=unified. Rude of it? maybe. Accurate? absolutely ๐Ÿ’€
    • mem:separate โ€” all data lives in separate CPU and GPU memories, and explicit memory copies happen when data is accessed from both CPU and GPU.
    • mem:managed โ€” allocates any dynamically allocated data in CUDA Managed Memory. Data that isn't dynamically allocated sits in separate GPU memory and gets 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. Every variable in the CPU code is accessible from the GPU without explicit directives or attributes. This mode uses system and managed memory for dynamically allocated data unless you set explicit behavior 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 โ€” allocate (or do not allocate) any dynamically allocated data in CUDA Managed Memory.
  • mem:separate:pinnedalloc, mem:separate:nopinnedalloc โ€” allocate (or do not allocate) any dynamically allocated data in CUDA Pinned host memory.
  • ptxinfo โ€” prints 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 โ€” runs accelerated code redundantly on the CPU. It's implied by autocompare.
  • safecache โ€” allows variable-sized array sections in cache directives; the compiler just assumes they fit into CUDA shared memory. Living dangerously, love that for you ๐Ÿ™ˆ
  • sm_XY โ€” generates code for a device with compute capability XY. Multiple compute capabilities are allowed and you get one version for each. By default the compiler detects the compute capability for every installed GPU. Run -help -gpu to see the valid compute capabilities for your installation.
  • stacklimit:limit (default), nostacklimit โ€” โš ๏ธ this option has been deprecated and will be removed in a future release. It gives an error if the total stack size of a kernel or procedure goes over 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 isn't specified. Heads up: this behavior is not compliant with the OpenACC specification โ€” if you need compliance, please use -gpu=tripcount:device.
  • tripcount:device โ€” calculates loop trip counts on the device for some compute constructs. This behavior is compliant with the OpenACC specification, though it's not the default. To explicitly turn the default back on, please use -gpu=tripcount:host.
  • tripcount:warn, tripcount:nowarn โ€” enable (or disable) compile-time warnings for when loop trip counts get calculated on the host instead of on the device.
  • tripcount:check, tripcount:nocheck โ€” insert (or don't insert) runtime checks making sure the trip count calculated on the device matches the one calculated on the host. To get differences reported, 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 uses 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, and it may not be used with -gpu=pinned.
    • intercept โ€” intercepts LIBC function calls like free, and calls their unified version if the address is in unified memory, and the regular version otherwise.
  • unroll, nounroll โ€” automatically (or don't) unroll inner loops. This is enabled by default at optimization level -O3. She unrolls ๐Ÿ’…

  • -Kieee, -Knoieee (default) โ€” performs floating-point operations in strict conformance with the IEEE 754 standard. Some optimizations get disabled with -Kieee, and a more accurate math library is used. The default -Knoieee goes for faster but very slightly less accurate methods. Pick your fighter โš”๏ธ
  • -Ktrap=option[,option]... โ€” controls how the processor behaves when floating-point exceptions pop off 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) โ€” disables all traps. Note that -Ktrap=inv,none,ovf implies -Ktrap=ovf.
    • ovf โ€” trap on floating-point overflow.
    • unf โ€” trap on floating-point underflow. btw -Ktrap is only meaningful when compiling a C/C++ main function or a Fortran main program.
-Ktrap=fp is shorthand for -Ktrap=divz,inv,ovf. Saved you some typing, you're welcome ๐Ÿซถ

...these options are literally the processor's floating-point exception mask bits, bestie. Normally the processor's exception mask bits are enabled, meaning floating-point exceptions are masked โ€” the processor recovers from the exception and keeps going. But if a mask bit is off (unmasked) and the matching exception happens, execution terminates with a floating-point exception (Linux FPE signal). ๐Ÿ’…

  • -march=target โ€” same exact thing as -tp, so go peek at -tp for the details, iykyk.
  • -m[no-]daz-ftz โ€” tells the processor how denormals are handled at runtime. -mno-daz-ftz means denormal operands and results are honored; it's shorthand for -Mnodaz -Mnoflushz. -mdaz-ftz is the default setting and says denormal operands and results get 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.
  • -Mlongbranch, -Mnolongbranch (default) โ€” enable (disable) long branches.
  • -Msecond_underscore, -Mnosecond_underscore (default) โ€” add (don't add) a second underscore to the name of a Fortran global if its name already contains an underscore. This one 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 the varargs calling sequence.
  • -Mwritable-strings โ€” store string constants in the writable data segment.
  • -mcmodel=small|medium โ€” pick your memory model vibe:
    • 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. Options are:
    • 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). The possibilities are:
    • gpu โ€” globally set the target device to an NVIDIA GPU.
    • multicore โ€” globally set the target device to the host CPU.
  • -tp=target โ€” 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. ๐Ÿ 

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), nvc++ (1), and the NVIDIA User's Guide. Go read those too, bestie. ๐Ÿ“š


๐Ÿšจ DIAGNOSTICS ๐Ÿšจ

The compiler produces information and error messages as it translates the input program. The linker and assembler may issue their own error messages, so don't blame the compiler for everything, okay? ๐Ÿ˜ญ๐Ÿ’€


That's the whole page, periodt. ๐ŸŽ€ This page is from September 2026, and it's the pgf77(1) manual page โ€” go off and compile something iconic, bestie. ๐Ÿ’–โœจ๐ŸŒˆ

๐Ÿ“ฆ where this page comes from