pgf77(1)
๐ธ 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 bynvfortran. 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-specificPREOPTIONSorPOSTOPTIONSdriver 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.11or22.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 validnvfortrancommand-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 bynvfortranon the standard output.nvfortran -help -otherswitchwill give help about-otherswitch. The default is to listnvfortrancommand 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 thenvfortranconfiguration; 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 ๐-ofile โ use file as the name of the executable program, rather than 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.-rcrcfile โ specifies the name of anvfortranstartup 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โ skip the assembly and link steps. Leave the output from the compile step in a file namedfile.sfor each file named, for instance,file.f. See also-o.-showโ produce help information describing the currentnvfortranconfiguration.-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 ๐ฅ-xlanguage โ specify explicitly the language for the input files (instead of choosing based on the file name suffix). The possible values for language are:ccppc++cpp-outputfFf95f95-cpp-inputf90F90f77f77-cpp-inputcufCUFasmASMassemblerassembler-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, 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,directoryto 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,directoryto 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. Speedy girly pop ๐โโ๏ธ๐จ-fcx-limited-rangeโ specify 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 to vectorize for the SSE/AVX instructions. Usenvfortran -fastsse -helpto 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 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, 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 variablesOMP_NUM_THREADSandNCPUSare 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 saynoaltcode, 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 is3.
-Mdepchk(default),-Mnodepchkโ assume (or don't assume) that potential data dependencies exist. ๐จ bestie listen to me:-Mnodepchkmay 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:filenameoption must be used with this switch to name an extract library. Peep-Minlinefor 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.-Mnoframeallows 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 tostderr. The options are:allโ includes the optionsaccel,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-Mextractoption. 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. Ifname:is specified, what 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 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 of2; 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=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; usenvfortran -Mipa -helpto 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-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 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=libinlineimplies-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=localargimplies-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. theassocoption allows expression reassociation, andnoassocdisallows expression reassociation ๐-Mmovnt,-Mnomovntโ force (or disable) generation of nontemporal moves.-Mmovntused with-fastssecan sometimes be faster than-fastssealone, 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-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 for use in a subsequent compile, and-Mpfimust also appear when the program is linked. when the program is run, a profile feedback filepgfi.outwill 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 filepgfi.outin 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 apgfi.outfile 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 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 those processors that support them (Pentium 4, Opteron).-Mprefetchis default on Opteron, and-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 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-Mprofoptions 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 namedpgprof.outinstead ofgmon.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 signed0.0during 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 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 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-Mvectoptions 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 ofnumber.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-O0and-O1.-Mzerotrip(default) /-Mnozerotripโ include (or don't include) a zero-trip test for loops. Only reach for-Mnozerotripwhen 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 ofomp loopconstructs.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-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 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-Ooptimizations 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-O1and-O2optimizations 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_arrayis disabled when both command line options-Ofastand-stdparare enabled.-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; it's the same as-Mbounds.-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. 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]โ definenameto bedefin the preprocessor. Ifdefis missing, it's assumed to be empty. If the=sign is missing, thennameis defined to be the string1.-Eโ preprocess each.cfile and send the result to standard output. No compilation, assembly, or linking is performed. just vibes and preprocessing โจ-Fโ stop after preprocessing.-Idirectoryโ adddirectoryto 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. 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 tofile.i, unless renamed with the-oswitch. 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 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.-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 thenamemacro in the preprocessor.-YI,directoryโ change the standard include directory todirectory.-Yp,directoryโ look indirectoryfor the preprocessor executable.
๐ง Assembler Options ๐ง
-Wa,option[,option...]โ pass each comma-delimited option to the assembler.-Ya,directoryโ look indirectoryfor 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-neededtells the linker to only set theDT_NEEDEDflag for subsequent shared libraries โ requiring those libraries at run time โ if they are used to satisfy references.--no-as-neededrestores the default behavior. ๐ซถ-Bdynamicโ passed to the linker to specify dynamic binding. โจ-Bstaticโ this option is the same as-static. Please refer to-staticfor details. ๐ซ-Bstatic-nvidiaโ this option is the same as-static-nvidia. Please refer to-static-nvidiafor 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.-cudalibwill use the version of the library appropriate to the CUDA version being used. The libraries recognized are:cublascublasmpcufftcufftmpcufftwcurandcusolvercusolvermpcusparsecutensorncclnvblasnvshmemnvtx3
-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 in tonvfortranmain 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.--whole-archiveinstructs 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 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:-cudais required on the link line. If-cudais 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โ treatINTEGERvariables as two bytes.-i4โ treatINTEGERvariables as four bytes.-i8โ treat defaultINTEGERandLOGICALvariables as eight bytes. For operations involving integers, use 64-bits for computations. ๐งฎ-i8storageโ allocates 8 bytes forINTEGERandLOGICAL.-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.-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 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.-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. Ngl-Mnodalignmay 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.-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 be char. Default is an underscore (_). ๐-Mextendโ allows 132-column source lines. Long lines rights โจ-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โ processes 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 treatINTEGERasINTEGER*4.-Mnoi4treatsINTEGERasINTEGER*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 orINTEGER*8in 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. Super useful for using thenvfortrandriver 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 treatREALasDOUBLE PRECISIONand real constants as double precision constants.-Mr8intrinsics [=float],-Mnor8intrinsics(default) โ treat / don't treat the intrinsicsCMPLXasDCMPLXandREALasDBLE.floatโ also treat theFLOATintrinsic asDBLE.
-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 inEXTERNALstatements.-Msave,-Mnosave(default) โ assume / don't assume that all local variables are subject to theSAVEstatement.-Msavemay 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-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โ 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-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. Case-sensitive Fortran era, we're living it ๐-module directoryโ save/search for module files in directory.-Munlink_moduleโ instructsnvfortranto unlink a symlink to the desired module file before writing out the module file. Without this option,nvfortranwill follow the symlink and write the module file to the symlink's target, provided it has permission to write there.-r4โ interpretDOUBLE PRECISIONvariables asREAL.-r8โ interpretREALvariables asDOUBLE PRECISION. Equivalent to using the options-Mr8and-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-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 aroutine seqdirective.strictโ issue warnings when accelerator directives are encountered which do not adhere to the OpenACC standard.syncโ ignoreasyncclauses, 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 -gputo 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 iscc50.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 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 likefree, 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.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.keepptxโ keeps the generated portable assembly files, with a.ptxsuffix.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 likefree, 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-stdparto stop that flag's implicit use of-gpu=managedwhen CUDA Managed memory capability gets detected.nounifiedโ do not compile for CUDA Unified memory capability. Use it with-stdparto stop that flag's implicit use of-gpu=unifiedwhen 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 likefree, 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=managedor-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]managedallocsubflags. 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 byautocompare.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 -gputo 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 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. 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 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 likefree, 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-Knoieeegoes 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,ovfimplies-Ktrap=ovf.ovfโ trap on floating-point overflow.unfโ trap on floating-point underflow. btw-Ktrapis only meaningful when compiling a C/C++ main function or a Fortran main program.
-Ktrap=fpis 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-tpfor the details, iykyk.-m[no-]daz-ftzโ tells the processor how denormals are handled at runtime.-mno-daz-ftzmeans denormal operands and results are honored; it's shorthand for-Mnodaz -Mnoflushz.-mdaz-ftzis 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.-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 one 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 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 to4GB. The maximum code size is2GB.mediumโ allows unrestricted data size. The maximum code size is2GB. ๐
-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). 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 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. 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
- 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