nvfortran(1)
๐ nvfortran(1) ๐
okay so real talk, this page comes straight out of the General Commands Manual, and it's the full spec for nvfortran. grab a snack, we're going in ๐
โจ NAME โจ
nvfortran โ The NVIDIA Fortran compiler. that's her. that's the whole name section. iconic.
โจ SYNOPSIS โจ
nvfortran [ -flag ]... sourcefile...
โจ DESCRIPTION โจ
pgfortran is an alias for nvfortran โ same compiler, different name, iykyk ๐ซถ
nvfortran is a Fortran compiler for NVIDIA GPUs and AMD and Intel CPUs. it supports ISO Fortran 2003 (yes, all of it) plus a bunch of Fortran 2008 features, it does GPU parallel programming with OpenACC, and it does multicore CPU programming with OpenACC and OpenMP. she's versatile like that. nvfortran invokes the Fortran compiler, assembler, and linker, with options derived from its command line arguments โ so the flags you type literally steer the whole pipeline ๐
so, the suffix of your source file name tells her what to do with it. no guessing, the extension is the vibe check:
.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. anything else gets passed to the linker (if linking is requested) with a warning message โ so like, she'll do it, but she's gonna be vocal about it ๐
Unless you override the default action using a command-line option, nvfortran deletes the intermediate preprocessor and assembler files (see the options -c, -E, -F, and -Mkeepasm). and 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. so if the build dies halfway, bestie, nothing is getting cleaned up nicely ๐ญ
โจ OPTIONS โจ
โ ๏ธ options must be separate โ-csis different from-c -s. do not combine, do not pass go. she will not read your mind ๐
here's the full list of all the options, grouped by type. the detailed explanations live in the sections that follow.
๐ธ 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
๐ bestie listen to me. when source files are compiled using any of the following options, the same option(s) should be passed when usingnvfortranto link the objects:-g-mp-Mconcur-Mipa-Mprof. don't compile with the sauce and then link without it, that's how you get mystery behaviour and a sad afternoon ๐ญ
more sections incoming, stay with me ๐
โจ Overall Options โจ
--โ everything after this switch gets treated as a filename, periodt. Ngl though, most tools won't let a filename start with a dash anyway, so likeโฆ maybe just don't? ๐ซถ-#โ shows you the invocations of the compiler, assembler, and linker. These are literally the command lines thatnvfortrancreated. peek behind the curtain bestie ๐###โ same vibe, but it shows the invocations of the compiler, assembler and linker and does not execute them. window shopping only ๐-cโ skips the link step entirely; compile and assemble only. no linking, no problem โจ-defaultoptions(default) /-nodefaultoptionsโ use (or don't use) the default options that are set in site-specific or user-specificPREOPTIONSorPOSTOPTIONSdriver variables. you're the main character, you decide ๐-dryrunโ displays the invocations of the compiler, assembler, and linker but does not execute them. all the lore, none of the consequences ๐ฅ-drystdincโ displays the standard include directories without even invoking the compiler. just a little peek ๐-dumpversionโ displays the shortened version of the compiler. for example,21.11or22.3. cute little version drop ๐-echo [=go|stop]โ echoes the command line flags and (by default) stops. this is lowkey iconic 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โ doesn't compile anything, just emits any messages for command-line switch errors. returns a success error code if there are no command-line switch errors. a whole vibe check for your flags โญ-flagsโ displays all validnvfortrancommand-line options in alphabetical order. the full alphabetized menu, slay ๐-fmax-errors=<n>โ specifies the max number of errors before compilation terminates. (the manpage says "maximun" and honestly? iconic typo behavior, we love her ๐)- *
--gcc-toolchain=path* โ specifies the gcc toolchain location using path to the gcc directory or the gcc executable. the argument can be the gcc root directory,<root directory>/bin, or the gcc executable itself. flexible queen ๐ธ -help[=option]โ displays command-line options recognized bynvfortranon the standard output.nvfortran -help -otherswitchgives you help about-otherswitch. the default is to listnvfortrancommand line options by group. the options are:groupsโ prints 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 thenvfortranconfiguration; this is the same as-show.
-Mannoโ produces annotated assembly files where the source code is intermixed with assembly language. implies-Mkeepasm. a little collage of code ๐จ- *
-Minform=level* โ specifies the minimum level of error severity that the compiler displays during compilation.fatalโ tells 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's more than one file on the command line.severeโ tells the compiler to display severe and fatal error messages.warnโ tells the compiler to display warning, severe and fatal error messages.informโ tells the compiler to display all error messages (inform, warn, severe and fatal).
the default is -Minform=warn. yes, both defaults are stated, that's just how she is ๐
-Mdetailโ displays enhanced error messages that include a source line and column pointer. currently available for syntax errors and some semantic errors. she's pointing at exactly where you messed up, lovingly ๐ซถ-Mkeepasmโ keeps the assembly file for each source file, but continues to assemble and link the program. mainly for compiler performance analysis and debugging. keeping the receipts, ngl ๐งพ-Mlist/-Mnolist(default) โ create (or don't create) a listing file.-noswitcherrorโ ignores unknown command line switches after printing a warning message. the default behavior is to print an error message and halt. choose chaos ๐ญ-ofile โ use file as the name of the executable program instead of the defaulta.out. if used with-cor-Sand a single input file, file is used as the name of the object or assembler output file. name your baby ๐-rcrcfile โ specifies the name of annvfortranstartup 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$DRIVERdirectory. โจ-Sโ skips the assembly and link steps. leaves the output from the compile step in a file namedfile.sfor each file named, for instance,file.f. see also-o. assembly only, we're being efficient ๐-showโ produces help information describing the currentnvfortranconfiguration. ๐ฆ-silentโ do not print warning messages. same as-Minform=severe. shhh ๐คซ-timeโ prints execution times for the various steps in the compiler itself. clocking the tea โ-Vโ displays version messages and other information. ๐-V<ver> โ if the specified version of the compiler is installed, that version of the compiler is invoked. pick your era ๐ฅ-vโ verbose mode; prints out the command line for each tool before it's executed. she's narrating everything, and honestly? we're listening ๐--versionโ displays version messages and other information.-wโ do not print warning messages. ๐-Werrorโ turns all warning messages into errors. no notes, everything is a problem now ๐-xlanguage โ explicitly specifies 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โ turns off language specification, so the input files are handled according to their suffixes. back to vibes-based detection โจ-Wpass,option[,option...]โ passes 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, andlโ 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-YLoption, 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-YUoption, 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. usenvfortran -fast -helpto see the equivalent switches. note this sets the optimization level to a minimum of2; see-O. the glow-up option, fr fr ๐-fcx-limited-rangeโ specifies that complex division does not need range reduction.-fno-cx-limited-rangespecifies that complex division does need range reduction.-fcx-limited-rangeis the default setting at optimization level-Ofast. ๐-fastsseโ chooses generally optimal flags for a processor that supports vectorizing for the SSE/AVX instructions. usenvfortran -fastsse -helpto see the equivalent switches. โก-fPICโ equivalent to-fpic; provided for compatibility with other compilers. ๐-fpicโ tells the compiler to generate position-independent code which can be used to create shared object files (dynamically linked libraries). move anywhere, babe ๐ฆ-KPICโ equivalent to-fpic; provided for compatibility with other compilers.-Kpicโ equivalent to-fpic; provided for compatibility with other compilers.-Mcache_alignโ aligns unconstrained data objects of size greater than or equal to16bytes on cache-line boundaries. an unconstrained object is a variable or array that is not a member of an aggregate structure or common block, isn't allocatable, and isn't an automatic array. aligned and unbothered ๐-Mconcur[=option[,option...]]โ okay so heads up: this option has been deprecated and will be removed in a future release. ๐จ it tells the compiler to enable auto-concurrentization of loops. this also sets the optimization level to a minimum of2; see-O. if-Mconcuris specified, multiple processors will be used to execute loops which the compiler determines to be parallelizable. when linking, the-Mconcurswitch must be specified or unresolved references will occur. theOMP_NUM_THREADSorNCPUSenvironment variables control how many processors will be used to execute parallelized loops. the options can be one or more of the following:allcoresโ bestie, this one uses all available cores when the environment variablesOMP_NUM_THREADSandNCPUSaren't set. Tiny catch: you must specify it at link time. โจaltcode:n,noaltcodeโ generate (or don't generate, withnoaltcode) alternate scalar code for parallelized loops. The parallelizer whips up scalar code that runs whenever the loop count is less than or equal to n. But if you saynoaltcode? The parallelized version of the loop runs always, no matter how smol the loop count is. ๐altreduction[:n]โ same energy, but for parallelized loops that contain a reduction. If a parallelized loop has a reduction in it, the parallelizer generates scalar code to run whenever the loop count is less than or equal to n. ๐assoc(default),noassocโ enable (or disable) parallelization of loops with reductions. It's giving "on by default, bestie."cncall,nocncall(default) โ assume (or don't assume) that loops containing calls are safe to parallelize. Also, no minimum loop count threshold has to be satisfied before parallelization kicks in, and the last values of scalars are assumed to be safe. ๐ซถdist:blockโ parallelize with block distribution. Contiguous blocks of iterations of a parallelizable loop get handed out to the available processors. Chunky slices, no cap. ๐dist:cyclicโ parallelize with cyclic distribution. The outermost parallelizable loop in any loop nest is the one that gets parallelized. If the parallelized loop is innermost, its iterations are allocated to processors cyclically. Like, 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 slay. ๐innermost,noinnermost(default) โ enable (or disable) parallelization of innermost loops.levels:nโ parallelize loops nested at most n levels deep; the default is3. ๐ธ
-Mdepchk(default),-Mnodepchkโ assume (or don't assume) that potential data dependencies exist.
๐ Heads up: -Mnodepchk may result in incorrect code. Not me warning you and then you doing it anyway...
-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:filenameoption must be used with this switch to name an extract library. See-Minlinefor 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. ๐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 gets created if it doesn't already exist. โจ[size:]numberโ a numeric option is assumed to be a size. Functions containing number or fewer statements are extracted. And 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 real talk: delaying rounding until after the addition may cause results to differ from those you'd get with unfused multiply-add instructions. So like, vibe check your numerics. 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.-Mnoframeallows slightly more efficient operation when a stack frame isn't needed โ but some options override-Mnoframe, so don't come for it when that happens. ๐ฆ-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 called efficiency, look it up. ๐ฅ-Minfo[=option[,option,...]],-Mnoinfo(default) โ emit useful information tostderr. The options are:allโ includes the optionsaccel,inline,ipa,loop,lre,mp,opt,par,stdpar,vect. The whole buffet. ๐accelโ emit information about accelerator region targeting.ftnโ emit Fortran-specific information.inlineโ emit information about functions extracted and inlined.intensityโ โ ๏ธ this option has been deprecated and will be removed in a future version. Emit compute intensity information about loops.ipaโ emit information about the optimizations enabled by interprocedural analysis (IPA).loop|optโ emit information about loop optimizations. This includes info 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 FortranDO CONCURRENTloops.vectโ emit information about automatic loop vectorization.
With no options, -Minfo is the same as -Minfo=accel,ipa,loop,lre,mp,opt,par,stdpar,vect. โจ
-Minline[=option[,option,...]]โ passes options to the function inliner. The options are:lib:filename.extโ specify an inline library created by a previous-Mextractoption. Functions from the specified library get 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. (The "you're not invited" list.)[name:]functionโ a non-numeric option is assumed to be a function name. Ifname:is specified, whatever follows is always the name of a function.pragmaโ Fortran Only: inline only those procedures that have a!NVF$ INLINEpragma on the source line immediately before the procedure'sSUBROUTINEorFUNCTIONstatement. ๐[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 get 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 option overrides that default. ๐ฆsmallsize:numberโ always inline functions of size smaller than number, regardless of other size limits. Tiny function rights!! ๐ฅบtotalsize:numberโ stop inlining in a function when that function's total inlined size reaches the number specified. Boundaries, bestie. ๐
-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). Also, IPA sets the optimization level to a minimum of2; see-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. Note:-Mipa=noargimplies-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-Mipaflags for the target platform; runnvfortran -Mipa -helpto see the equivalent options. ๐forceโ force all objects to recompile regardless of whether IPA information has changed. Blunt but effective.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-Mpfowhen choosing which functions to inline.reshape,noreshape(default) โ enable (or disable) Fortran inlining with mismatched array shapes. ๐
ipofileโ save IPA information in a.ipofile 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. ๐
keepobj(default) /nokeepobjโ keep (or don't keep) the optimized object files, using file name mangling, so your later builds recompile faster. Free speed, bestie ๐ซถlibc/nolibc(default) โ optimize calls to certain standard C library routines.libinline/nolibinline(default) โ allow (or don't allow) inlining from routines in libraries. Heads up:-Mipa=libinlineimplies-Mipa=inlineโจlibopt/nolibopt(default) โ allow (or don't allow) recompiling and reoptimizing routines from libraries with IPA info.localarg/nolocalarg(default) โ enable (or disable) the feature that externalizes local variables so arguments can be replaced by-Mipa=ptr. Also:-Mipa=localargimplies-Mipa=arg.main:funcโ name a function to serve as a global entry point. You can use this multiple times, but 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. Silence is the vibe ๐คซreaggregation/noreaggregation(default) โ enable (or disable) global struct reaggregation. Real talk: this can change the order of struct members, or split structs into multiple structs, to improve memory locality and cache utilization. It be rearranging your structs ๐ญrequiredโ return an error condition if IPA is inhibited for any reason, instead of the default behavior of just linking without IPA optimization.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. 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 blocks IPA optimization of this file, but lets other files linked with it get optimized. It's giving teamwork ๐vestigial/novestigial(default) โ remove (or don't remove) functions that are never called.
-Mlre[=assoc|noassoc],-Mnolreโ enable (or disable) loop-carried redundancy elimination. Theassocoption allows expression reassociation, andnoassocdisallows expression reassociation.-Mmovnt,-Mnomovntโ force (or disable) generation of nontemporal moves. Fun fact:-Mmovntused with-fastssecan sometimes be faster than-fastssealone ๐ฅ 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 aren't performed. But bestie, use the-Minfoflag instead. ๐-Mnoopenmpโ when-mpis present, ignore the OpenMP pragmas.-Mnosgimpโ when-mpis 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 used in a subsequent compile, and-Mpfimust also appear when the program is linked. When the program runs, a profile feedback filepgfi.outgets 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 filepgfi.outin the current directory, containing the result of running the program compiled with-Mpfi. The options are:indirect/noindirect(default) โ enable (or disable) indirect function call inlining; this requires apgfi.outfile generated from a binary built with-Mpfi=indirect.layout(default) /nolayoutโ enable (or disable) basic block layout, so it takes advantage of instruction cache locality by keeping hot paths close together. Hot paths stay close, iykyk ๐ฅdir=directoryโ specify the directory containing thepgfi.outprofile 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 the processors that support them (Pentium 4, Opteron).-Mprefetchis default on Opteron;-Mnoprefetchis 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 theprefetchntainstruction.plainโ use theprefetchinstruction.t0โ use theprefetcht0instruction.wโ allow the AMD-specificprefetchwinstruction.
-Mprof[=option[,option,...]]โ set performance profiling options. Using these makes the resulting executable create a performance profile you can view and analyze with the PGPROF performance profiler โจ For the descriptions below: old-style profiling means compiler-generated source instrumentation, and MPICH-style profiling means using instrumented wrappers for MPI library routines. The-Mprofoptions are:dwarfโ generate limited DWARF symbol information, which is enough 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 the profile is saved in a file namedpgprof.outinstead ofgmon.out.
On Linux systems that have OProfile installed, PGPROF supports collection of performance data without recompilation. Using -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โ okay so picture this: a scalar is used after a loop, but it's not defined on every iteration of the loop. By default the compiler does not parallelize that loop. This option tells the compiler it's safe to parallelize it. Your call, bestie ๐ซถ-Msigned-zeroes(default),-Mno-signed-zerosโ toggles whether to honor (-Msigned-zeros) or ignore (-Mno-signed-zeros) issues associated with a signed0.0during optimization.-Mstride0,-Mnostride0(default) โ generate (or don't generate) alternate code for a loop that contains an induction variable whose increment may be zero.-Munroll[=option[,option...]],-Mnounroll(default) โ invoke (or don't invoke) the loop unroller. This also sets the optimization level to a minimum of 2; see-O. The option is one of the following:c:mโ tells the compiler to completely unroll loops with a constant loop count less than or equal to m, a supplied constant. If this value isn't supplied, the m count is set to1. If m is set to1, 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 isn't supplied, the unroller computes the number of times a candidate loop is unrolled.m:uโ tells the compiler to unroll u times a multi-block loop which is not completely unrolled, or has a non-constant loop count. If u isn't supplied, the unroller computes the number of times a candidate loop is unrolled.
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 why is it "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 info see optimization levels under-O. If no option list is specified, then these vector optimizations are used:assoc,cachesize:c,simd:256, where c is the actual cache size of the machine. The-Mvectoptions are:altcode(default) /noaltcodeโ enable (or disable) alternate code generation for vector loops, depending on things like array alignments and loop counts.fuse/nofuse(default) โ enable (or disable) loop fusion, which combines adjacent loops into a single loop. Two loops into one, it's giving efficiency ๐ฆprefetchโ use prefetch instructions in loops where profitable.
simd[:{128|256|512}](default) /nosimdโ use vector SIMD instructions (AVX, AVX2, AVX512). The argument can limit you to 128-bit SIMD instructions. Specifying 512-bit SIMD instructions is only possible for target processors that support AVX512. slay, but know your hardware ๐uniform/nouniform(default) โ perform the same optimizations in the vectorized and residual loops. This may affect the performance of the residual loop. lowkey a tradeoff vibe ๐
These options are also supported, but not recommended for use in new development, except by experienced users, and may be phased out in future releases:
assoc(default) /noassocโ enable (disable) certain associativity conversions that can change the results of a computation due to floating-point roundoff error differences. A typical optimization is to change the order of additions, which is mathematically correct, but can be computationally different, due to roundoff error. math girlies know this one gets spicy ๐ถ๏ธcachesize:number(default=automatic) โ tells the vectorizer, when performing cache tiling optimizations, to assume a cache size of number. manifesting a bigger cache for u โจgather(default) /nogatherโ enable (disable) vectorization of loops with indirect array references.idiom(default) /noidiomโ enable idiom recognition; alternate form of-Midiom.levels:nโ set maximum nest level of loops to optimize.partialโ enable partial loop vectorization via innermost loop distribution.short/noshort(default) โ enable (disable) recognition of short vector operations that arise from scalar code outside of loops or within the body of loops.sizelimit[:number]/nosizelimit(default) โ limit the size of loops that are vectorized; the default is to attempt to vectorize all loops. all loops? iconic. maybe chaotic. both ๐tile/notile(default) โ enable (disable) loop tiling to optimize for cache locality.
-Mnovect disables the vectorizer, and is the default at -O0 and -O1.
-Mzerotrip(default) /-Mnozerotripโ include (don't include) a zero-trip test for loops. Use-Mnozerotriponly when all loops are known to execute at least once. fr fr only if you're sure ๐ญ-mp[=option]โ enable OpenMP pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices or multi-processor system. The options allowed are:gpuโ compile OpenMP directives for parallel execution on the GPU. GPU main character energy ๐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 ofomp loopconstructs.omptโ link against OMPT-enabled OpenMP library.
-nompโ ignore OpenMP directives and do not link against OpenMP runtime libraries. no OpenMP, no problem bestie ๐ซถ-O[level]โ set the optimization level. If-Ois not specified, then the default level is 1 if-gis not specified, and 0 if-gis specified. If a number is not supplied with-Othen the optimization level is set to 2. The optimization levels and their meanings are as follows:-O0โ sets the optimization level to 0. A basic block is generated for each statement. No scheduling is done between statements. No global optimizations are performed.-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-Ooptimizations are performed. In addition, more advanced optimizations such as SIMD code generation, cache alignment and partial redundancy elimination are enabled.-O3โ all-O1and-O2optimizations are performed. In addition, this level enables more aggressive code hoisting and scalar replacement optimizations that may or may not be profitable.-Ofastโ enables-O3,-Mfprelaxed,-Mstack_arrays,-Mno-nan,Mno-inf, and-fcx-limited-range. Note-Mstack_arrayis disabled when both command line options-Ofastand-stdparare enabled. fast mode says go go go ๐ฅ-O4โ all-O1,-O2, and-O3optimizations 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; the same as-Mbounds. safety era ๐ก๏ธ-gโ generate symbolic debug information. This also sets the optimization level to zero, unless a-Oswitch is present on the command line. Symbolic debugging may give confusing results if an optimization level other than zero is selected. Using-O0the generated code will be slower than code generated at other optimization levels. debug mode: slower but honest ๐ญ-goptโ generate symbolic debug information, without affecting optimizations. This may give confusing results when debugging with optimizations; it is intended for use with other tools that use the debug information.-Mbounds/-Mnobounds(default) โ add (don't add) array bound checking.-Mchkptrโ check for unintended de-referencing of NULL pointers. NULL pointer jump scare warning ๐-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 is assumed to be empty. If the=sign is missing, then name is defined to be the string1.-Eโ preprocess each.cfile and send the result to standard output. No compilation, assembly, or linking is performed. just preprocess and dip โจ-Fโ stop after preprocessing.-Idirectoryโ add directory to the compiler's search path for include files. For include files surrounded by< >, each-Idirectory is searched followed by the standard area. For include files surrounded by" ", the directory containing the file containing the#includedirective is searched, followed by the-Idirectories, followed by the standard area.-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 tofile.i, unless renamed with the-oswitch. 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 tofile.d, a la-MD.mmโ print makefile dependencies to stdout, ignoring system includes (includes with angle braces), a la-MM.mmdโ print makefile dependencies tofile.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 filefile.suff; the default is to name the dependent filefile.o.
-Mnostddefโ do not predefine any macros to the preprocessor. blank slate vibe ๐ซง-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, welcome to the link era โ the part where all your cute little object files hold hands and become an executable or a shared object. These flags get passed through to the linker, or they tell the driver what to hand it. every single one matters ๐
-acclibsโ link-time option to add the accelerator libraries to the link line. โจ--as-needed,--no-as-neededโ passed to the linker.--as-neededtells it to only set theDT_NEEDEDflag for subsequent shared libraries โ which means requiring those libraries at run time โ if theyโre used to satisfy references.--no-as-neededrestores the default behavior. ๐ซถ-Bdynamicโ passed to the linker to specify dynamic binding.-Bstaticโ this is the same as-static; peep-staticfor the details. ๐-Bstatic-nvidiaโ this is the same as-static-nvidia; peep-static-nvidiafor the details.-c++libsโ link-time option to add the C++ runtime libraries, so mixed-language programming can do its thing. ๐-cudaforlibsโ link-time option to add the CUDA Fortran runtime libraries, allowing mixed-language programming. It 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.-cudalibwill use the version of the library appropriate to the CUDA version being used. The libraries it recognizes are:cublascublasmpcufftcufftmpcufftwcurandcusolvercusolvermpcusparsecutensorncclnvblasnvlamathnvshmemnvtx3
-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 GNUg77(orgcc) to be linked intonvfortranmain 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 libraryliblibrary.afrom the standard library directory. See also the-Loption. โญ-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_frameunless 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-rpathto the link line, giving the directories containing the required runtime shared objects. Use-Mnorpathto instruct the driver not to add any-rpathswitches to the link line. ๐-Mmklโ add Intelโs Math Kernel libraries to the link line. Requires that the environment variableMKLROOTbe set to the path to the local MKL installation (the part of the path that precedeslib/<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 betweenRand 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 internalDT_SONAMEfield to the specified name.-staticโ passed to the linker to specify static binding.-static-nvidiaโ statically link in the NVIDIA runtime libraries, while using dynamic linking for the system libraries; implies-Mnorpath. ๐-unameโ passed to the linker; generate undefined reference.--whole-archive,--no-whole-archiveโ passed to the linker. Instructs the linker to include all objects in subsequent archive files.--no-whole-archiverestores 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 batch is literally the โwhat kind of file is this and how should Fortran actโ squad ๐ keep these facts exact, because the compiler is not here for guesswork โจ
-asmsuffix=suffixโ says a file with the given suffix is an assembly language file ๐ ๏ธ-byteswapioโ swaps bytes from big-endian to little-endian or vice versa on input/output of unformatted Fortran data. Using this option enables reading/writing Fortran unformatted data files compatible with those produced on Sun or SGI systems ๐-csuffix=suffixโ says a file with the given suffix is a C source file ๐ป-fsuffix=suffixโ says a file with the given suffix is a Fortran source file ๐งก-FSUFFIX=suffixโ says a file with the given suffix is a Fortran source file ๐งก-cuda[=option[,option...]โ enables CUDA Fortran; adds CUDA include paths, and links with the CUDA runtime libraries.-cudais required on the link line. If-cudais used in compilation, it must also be used for linking. For target specific options, please refer to-gpu. For linking additional CUDA libraries (e.g. math libraries), please refer to-cudalib. Use these sub-options to tailor 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โ treats INTEGER variables as two bytes ๐-i4โ treats INTEGER variables as four bytes ๐-i8โ treats 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]โ selects whether to use Fortran 1995 or Fortran 2003 semantics for assignments to allocatable objects and allocatable components of derived types. Fortran 1995 semantics require the user to allocate the object or component and that an array object or component be conformant before the assignment. Fortran 2003 semantics require the compiler to add code to check 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) โ treat / donโt treat backslash as a normal (non-escape) character in strings.-Mnobackslashcauses the standard C backslash escape sequences to be recognized in quoted strings;-Mbackslashcauses 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 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 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. Enables CUDA (and CUDA Fortran), and links with the CUDA libraries.-Mcudais required on the link line if there are no CUDA Fortran source files specified on the command line. If-Mcudais used in compilation, it must also be used for linking ๐จ-Mdalign(default),-Mnodalignโ align / donโt align doubles in structures on 8-byte boundaries.-Mnodalignmay lead to data alignment exceptions โ ๏ธ-Mdclchk,-Mnodclchk(default) โ require / donโt require that all variables be declared ๐-Mdefaultunit,-Mnodefaultunit(default) โ treat / donโt treat'*'as stdout/stdin regardless of the status of units 6/5.-Mnodefaultunitcauses*to be a synonym for 5 on input and 6 on output;-Mdefaultunitcauses*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 char. Default is an underscore (_) ๐ฒ-Mextendโ allows 132-column source lines ๐-Mfixedโ processes Fortran source using fixed form specifications. The-Mfreeoptions specify free form formatting. By default files with a.for.Fextension use fixed form formatting ๐งฑ-Mfree,-Mfreeform,-Mnofree,-Mnofreeformโ process Fortran source using free form specifications. The-Mnofreeand-Mfixedoptions specify fixed form formatting. By default files with a.f90,.F90,.f95or.F95extension use freeform formatting ๐๏ธ-Mi4(default),-Mnoi4โ treat / donโt treat INTEGER as INTEGER*4.-Mnoi4treats INTEGER as INTEGER*2 ๐งฎ-Miomutex,-Mnoiomutex(default) โ generate / donโt generate critical section calls around Fortran I/O statements ๐-Mlibsuffix=suffixโ says a file with the given 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.-Mllalignis the default ๐-Mnomainโ when the link step is called, donโt include the object file which calls the Fortran main program. 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 ๐-Mobjsuffix=suffixโ says a file with the given 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.-Msavemay allow many older Fortran programs to run but can greatly reduce performance ๐ข-Msignextend(default),-Mnosignextendโ sign extend / donโt sign extend when a narrowing conversion overflows. For example, when-Msignextendis 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โ flag non-ANSI-Fortran usage ๐ฉ-Msyntax-onlyโ perform only syntax checking, semantic checking, and Fortran module (.mod) file generation ๐งช-Munixlogical,-Mnounixlogical(default) โ when-Munixlogicalis in effect, a logical is considered to be.TRUE.if its value is non-zero and.FALSE.otherwise. When-Mnounixlogicalis 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.-Mnoupcasecauses all names to be converted to lower case. Note that, if-Mupcaseis used, then variable name'X'is different than variable name'x', and keywords must be in lower case ๐-module directoryโ save/search for module files in directory ๐-Munlink_moduleโ instructs nvfortran to unlink a symlink to 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-Mr8and-Mr8intrinsics๐ฏ-Wh,option[,option...]โ pass each comma-delimited option to the Fortran 90/95 front end ๐
๐ฏ Target-specific Options ๐ฏ
-accโ enable OpenACC pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices. See the-gpuflag 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 ๐wait(default),nowaitโ wait for each compute kernel to finish ๐
-noaccโ disable OpenACC directives and do not link with OpenACC libraries ๐ซ-gpu=optionโ use the following sub-options to tailor the compilation of target accelerator regions:autocompareโ auto-compares CPU vs GPU results ๐ซถ. The accelerated code sections run in redundant mode, and data gets compared any time it would ordinarily get moved off the accelerator.ccXYโ generates code for a device with compute capability XY. You can list multiple compute capabilities and it makes one version for each. Default move: the compiler sniffs out the compute capability of every installed GPU all by itself โจ. Peep the valid compute capabilities for your install with-help -gpu.ccallโ generates code for all 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 the system and generates code for them. If no device is available, the default compute capability gets used (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]rdcoption ๐.cudaX.Yโ uses CUDA X.Y Toolkit compatibility, where installed.deepcopyโ enables Full Deepcopy support in OpenACC Fortran.fastmathโ turns on the fast math library, which includes faster-but-lower-precision implementations of certain math and intrinsic functions. Speed demon era ๐ฅ.flushz,noflushz(default) โ enables (disables) flush-to-zero mode on the GPU.fma,nofmaโ generates (does not generate) fused multiply-add operations on the GPU. It's on by default at optimization level-O1.implicitsections,noimplicitsections(default) โ changes (does not change) array element references in OpenACC and OpenMP data clauses into array section references.interceptdeallocations,nointerceptdeallocationsโ intercepts (does not intercept) LIBC function calls (e.g.free) and calls 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.cubinsuffix.keepgpuโ keeps the generated CUDA GPU source files, with a.gpusuffix.keepltoirโ keeps the generated GPU LTOIR files, with a.ltoirsuffix. Only works when-gpu=ltois enabled, iykyk.keepptxโ keeps the generated portable assembly files, with a.ptxsuffix.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 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 nope, 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-stdparto stop that flag's implicit use of-gpu=managedwhen CUDA Managed memory capability is detected.nounifiedโ does not compile for CUDA Unified memory capability. Use it with-stdparto stop that flag's implicit use of-gpu=unifiedwhen 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, and 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]โ picks the GPU memory mode from one of the options below:separate,managed,unified. This one cannot be combined with-gpu=pinned,gpu=managedor-gpu=unified๐ซ.mem:separateโ all data lives in separate CPU and GPU memories. Explicit memory copies happen when data are accessed from both CPU and GPU.mem:managedโ allocates any dynamically allocated data in CUDA Managed Memory. Data that aren't dynamically allocated live in separate GPU memory and get 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 explicit behavior is set through the-gpu=mem:unified:[no]managedallocsubflags. This option must appear in both the compile and link lines.
mem:unified:managedalloc,mem:unified:nomanagedallocโ allocates (does not allocate) any dynamically allocated data in CUDA Managed Memory.mem:separate:pinnedalloc,mem:separate:nopinnedallocโ allocates (does not allocate) any dynamically allocated data in CUDA Pinned host memory.ptxinfoโ prints ptxas information.rdc(default),nordcโ generates (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 byautocompare.safecacheโ allows variable-sized array sections in cache directives; the compiler just assumes they fit into CUDA shared memory ๐ง.sm_XYโ generates code for a device with compute capability XY. Multiple compute capabilities can be specified and one version gets generated for each. By default the compiler detects the compute capability for every installed GPU. Use-help -gputo see the valid compute capabilities for your installation.stacklimit:limit(default),nostacklimitโ okay so this option has been deprecated and is getting removed in a future release, no cap ๐ญ. It gives an error if the total stack size of a kernel or procedure exceeds limit KBytes. The default isstacklimit:512.tripcount:hostโ calculates loop trip counts on the host for some compute constructs. This is the default behavior when-gpu=tripcountisn't specified. Lowkey important: this behavior is not compliant with the OpenACC specification. Want compliance? Use-gpu=tripcount:device.tripcount:deviceโ calculates loop trip counts on the device for some compute constructs. This one is compliant with the OpenACC specification, even though it's not the default. To explicitly turn the default back on, use-gpu=tripcount:host.tripcount:warn,tripcount:nowarnโ enables (disables) compile-time warnings when loop trip counts are calculated on the host instead of on the device.tripcount:check,tripcount:nocheckโ inserts (does not insert) runtime checks to make sure the trip count value calculated on the device matches the one calculated on the host. Want the differences reported? Set the environment variableNVCOMPILER_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 (e.g.free) and calls their unified version if the address is in unified memory, and the regular version otherwise.
unroll,nounrollโ automatically (does not) unroll inner loops. On by default at optimization level-O3โจ.
-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, uses faster but very slightly less accurate methods.-Ktrap=option[,option]...โ controls what the processor does when floating-point exceptions happen while your program is running. Possible options include:denormโ traps on denormalized operands.divzโ traps on divide by zero.fpโ traps on floating-point exceptions.inexactโ traps on inexact result.invโ traps on invalid operation.none(default) โ disables all traps. Note that-Ktrap=inv,none,ovfimplies-Ktrap=ovf๐.ovfโ traps on floating-point overflow.unfโ traps on floating-point underflow. Ngl,-Ktrapis only meaningful when you're compiling a C/C++ main function or a Fortran main program.
-Ktrap=fpis shorthand for-Ktrap=divz,inv,ovf๐
okay so these options are literally all about the processor's floating-point exception mask bits, and they're giving "handle with care" energy. Normally the processor's exception mask bits are enabled, meaning floating-point exceptions are masked โ the processor recovers from the exception and just keeps going. But if a mask bit is off (unmasked) and the corresponding exception happens? ๐ Execution terminates with a floating-point exception (Linux FPE signal). No cap.
-march=targetโ this is the same as-tp, bestie. Peep-tpfor the details.-m[no-]daz-ftzโ specifies how denormals are handled by the processor at runtime.-mno-daz-ftzmeans denormal operands and results are honored โ shorthand for-Mnodaz -Mnoflushz.-mdaz-ftzis the default setting and means denormal operands and results are treated as zero โ shorthand for-Mdaz -Mflushz.-Mdaz,-Mnodazโ enable [disable] mode to treat denormal (subnormal) floating-point operands as zero.-Mdazis the default setting for x86_64 and aarch64 processors.-Mflushz,-Mnoflushzโ enable [disable] setting floating-point denormal (subnormal) results to zero.-Mflushzis 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 computinga*b+a*casa*(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 option is useful for maintaining compatibility withg77, 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 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=unifiedon targets with Unified memory capability and-gpu=managedotherwise.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=gpuand-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 filefile.aโ library of object filesfile.fโ fixed-format Fortran source filefile.Fโ fixed-format Fortran source file that requires preprocessingfile.f90โ free-format Fortran source filefile.F90โ free-format Fortran source file that requires preprocessingfile.f95โ free-format Fortran source filefile.F95โ free-format Fortran source file that requires preprocessingfile.f03โ free-format Fortran source filefile.F03โ free-format Fortran source file that requires preprocessingfile.forโ fixed-format Fortran source filefile.fppโ fixed-format Fortran source file that requires preprocessingfile.cufโ free-format CUDA Fortran source filefile.CUFโ free-format CUDA Fortran source file that requires preprocessingfile.ipaโ InterProcedural Analyzer (IPA) filefile.ipoโ InterProcedural Analyzer (IPA) filefile.oโ object filefile.sโ assembler source file.mynvfortranrcโ you may add custom switches or make other additions tonvfortranby creating a file named.mynvfortranrcin 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.
๐จ 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 if something looks cursed, check who's actually yelling at you ๐.
okay that's literally the whole page, bestie! source/version is nvfortran(1), dated September 2026 โ now go compile something iconic ๐
โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: nvhpc-compilers 26.9-1 ยท LicenseRef-NVIDIA-HPC-SDK
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms