pgf90(1)
okay bestie, this is the pgf90(1) page from the General Commands Manual β welcome to the Fortran compiler group chat π
β¨
πΈ NAME πΈ
nvfortran β The NVIDIA Fortran compiler
π¦ SYNOPSIS π¦
nvfortran [ -flag ]... sourcefile...
π DESCRIPTION π
okay so pgf90 is literally an alias for nvfortran. nvfortran is a Fortran compiler for NVIDIA GPUs and AMD and Intel CPUs. It supports ISO Fortran 2003 and many features of Fortran 2008, supports GPU parallel programming with OpenACC, and supports multicore CPU programming with OpenACC and OpenMP. nvfortran invokes the Fortran compiler, assembler, and linker with options derived from its command line arguments. iconic behavior, no cap π
Suffixes of source file names indicate the type of processing to be done:
.f,.for,.ftnβ fixed-format Fortran source; compile.f90,.f95,.f03β free-format Fortran source; compile.F,.FOR,.FTN,.fpp,.FPPβ fixed-format Fortran source; preprocess, compile.F90,.F95,.F03β free-format Fortran source; preprocess, compile.cufβ free-format CUDA Fortran source; compile.CUFβ free-format CUDA Fortran source; preprocess, compile.sβ assembler source; assemble.Sβ assembler source; preprocess, assemble.oβ object file; passed to linker.aβ library archive file; passed to linker
C file suffixes are also recognized and compiled with the NVC compiler; see NVC and NVIDIA User's Guide. Other files are passed to the linker (if linking is requested) with a warning message. noted π«Ά
Unless one overrides the default action using a command-line option, nvfortran deletes the intermediate preprocessor and assembler files (see the options -c, -E, -F, and -Mkeepasm); if a single Fortran program is compiled and linked with one nvfortran command, the intermediate object file is also deleted. Linking is the last stage of the compile process, unless you use one of the -c, -E, -F, or -S options, or unless compilation errors stop the whole process. very βclean up your own messβ energy π§
π OPTIONS π
Options must be separate; -cs is different from -c -s. Here is a list of all options, grouped by type. More detailed explanations are in following sections. okay bestie, this part is basically the whole squad lined up by vibe β the deep dives are coming later π₯
β Overall Options β
---#-###-c-[no]defaultoptions-dryrun-drystdinc-dumpversion-echo--flagcheck-flags-fmax-errors=<n>--gcc-toolchain=path-help[=option]-Manno-Minform=level-Mdetail-Mkeepasm-M[no]list-noswitcherror-o file-rc rcfile-S-show-silent-time-V-V<ver>-v--version-w-Werror-x language-x none-Wpass,option-Ypass,directory
π Optimization Options π
-fast-f[no-]cx-limited-range-fastsse-fPIC-fpic-KPIC-Kpic-Mcache_align-Mconcur=option-M[no]depchk-M[no]dse-Mextract=option-M[no]fma-M[no]frame-M[no]idiom-M[no]info=option-Minline=option-Minstrument=option-M[no]ipa=option-M[no]lre[=assoc|noassoc]-M[no]movnt-Mneginfo=option-Mnoopenmp-Mnosgimp-Mnovintr-Mpfi[=option]-Mpfo[=option]-M[no]pre-M[no]prefetch=option-Mprof=option-M[no]propcond-Mquad-Msafe_lastval-M[no-]signed-zeros-M[no]stride0-M[no]unroll=option-M[no]unsafe_par_align-M[no]vect=option-M[no]zerotrip-mp[=option]-nomp-Olevel-pg
π΅οΈ Debugging Options π΅οΈ
-C-g-gopt-M[no]bounds-Mchkptr-Mchkstk-Mcoff-Mdwarf2-Mdwarf3-Melf-Mnodwarf-[no]traceback
π§ Preprocessor Options π§
-Dmacro-E-F-Idirectory-isystem directory-Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff]-Mnostddef-Mnostdinc-Mpreprocess-Umacro-YI,directory-Yp,directory
π οΈ Assembler Options π οΈ
-Wa,argument[,argument]...-Ya,directory
π Linker Options π
-acclibs--[no-]as-needed-Bdynamic-Bstatic-Bstatic-nvidia-c++libs-cudaforlibs-cudalib=libname-cudalibs-fortranlibs-g77libs-Ldirectory-llibrary-m-Mcudalib=libname-M[no]eh_frame-Mnostartup-Mnostdlib-M[no]rpath-Mmkl-nvmalloc-pthread-Rdirectory-r-rpath directory-s-shared-soname name-static-static-nvidia-uname--[no-]whole-archive-Wl,option[,option]...-Xlinker option[,option]...-YC,directory-Yl,directory-YL,directory-YS,directory-YU,directory
π£οΈ Language Options π£οΈ
-asmsuffix=suffix-byteswapio-csuffix=suffix-fsuffix=suffix-FSUFFIX=suffix-cuda=option-i2-i4-i8-i8storage-Mallocatable[=95|03]-M[no]backslash-Mbyteswapio-Mcray=pointer-Mcuda=option-M[no]dalign-M[no]dclchk-M[no]defaultunit-M[no]dlines-Mdollar=char-Mextend-Mfixed-M[no]free[form]-M[no]i4-M[no]iomutex-Mlibsuffix=suffix-M[no]llalign-Mnomain-Mobjsuffix=suffix-M[no]onetrip-M[no]r8-M[no]r8intrinsics=float-M[no]recursive-M[no]ref_externals-M[no]save-M[no]signextend-M[no]stack_arrays-Mstandard-Msyntax-only-M[no]unixlogical-M[no]upcase-module directory-Munlink_module-r4-r8-Wh,argument[,argument]...
π― Target-specific Options π―
-acc-noacc-gpu=option-K[no]ieee-Ktrap=option-march=target-m[no-]daz-ftz-M[no]daz-M[no]flushz-M[no]fpmisalign-M[no]fprelaxed=option-M[no]func32-M[no]longbranch-M[no]second_underscore-M[no]varargs-Mwritable-strings-mcmodel=small|medium-stdpar=option-nostdpar-ta=target-target=option-tp=target
When source files are compiled using any of the following options, the same option(s) should be passed when usingnvfortranto link the objects:-g-mp-Mconcur-Mipa-Mprofπ
π Overall Options π
okay bestie, these are the big picture switches β the ones that tell the driver what kind of mood it's in today π
--β everything after this switch is treated as a filename. That's it, that's the whole vibe. But heads up: most tools will not allow a filename starting with a dash, so these should be avoided π-#β display the invocations of the compiler, assembler, and linker. These invocations are the command lines created bynvfortran. So you get to see exactly what it's cooking π₯-###β display invocations of the compiler, assembler and linker, but do not execute them. Same tea as-#but it's all show, no go β¨-cβ skip the link step; compile and assemble only. Iconic low-commitment behavior π-defaultoptions(default) /-nodefaultoptionsβ use (don't use) the default options set in site-specific or user-specificPREOPTIONSorPOSTOPTIONSdriver variables. Basically: are we trusting the site's pre-set homework or not π«Ά-dryrunβ use this option to display the invocations of the compiler, assembler, and linker but do not execute them. Rehearsal mode, fr fr π§-drystdincβ display the standard include directories without invoking the compiler. Peek at the include dirs, no compiler needed π-dumpversionβ display the shortened version of the compiler. For example,21.11or22.3. Just the numbers, no yapping β-echo [=go|stop]β echo the command line flags and (by default) stop. This is useful when the compiler is invoked by a script.goβ don't stop after echoing the command line.stop(default)β do stop after echoing the command line.
--flagcheckβ don't compile anything; just emit any messages for command-line switch errors. Return a success error code if there are no command-line switch errors. It's giving "I'm just here to check the vibes" π-flagsβ display all validnvfortrancommand-line options in alphabetical order. The full menu, alphabetized, slay π-fmax-errors=<n>β specify maximum numbers of errors before terminating compilation. Cute lil' error budget you get to set π--gcc-toolchain=pathβ specify gcc toolchain location using path to gcc directory or gcc executable. The argument can either be gcc root directory,<root directory>/bin, or the gcc executable itself. Flexible much? π¦-help[=option]β displays command-line options recognized bynvfortranon the standard output.nvfortran -help -otherswitchwill give help about-otherswitch. The default is to listnvfortrancommand line options by group; options are:groupsβ print out the groups into which the switches are organized.asmβ print help for assembler command-line options.debugβ print help for debugging command-line options.languageβ print help for language-specific command-line options.linkerβ print help for linker options.optβ print help for optimization command-line options.otherβ print help for any other command-line options.overallβ print help for overall command-line options.phaseβ print help for the known compiler phases.preproβ print help for preprocessor command-line options.suffixβ describe the known file suffixes.switchβ print all switches in alphabetical order.targetβ print help for target-specific command-line options.variableβ show thenvfortranconfiguration; this is the same as-show.
-Mannoβ produce annotated assembly files, where source code is intermixed with assembly language; implies-Mkeepasm. Honestly kind of a serve, seeing both together πΈ-Minform=levelβ specify the minimum level of error severity that the compiler displays during compilation.fatalβ instructs the compiler to display fatal error messages.file(default) /nofileβ print out (don't print out) the names of files as they are compiled; this is only active when there is more than one file on the command line.severeβ instructs the compiler to display severe and fatal error messages.warnβ instructs the compiler to display warning, severe and fatal error messages.informβ instructs the compiler to display all error messages (inform, warn, severe and fatal).
The default is -Minform=warn β noted, bestie π
-Mdetailβ display enhanced error messages that include source line and column pointer. This is currently available for syntax errors and some semantic errors. Like a little pointing finger at your mistake π«΅-Mkeepasmβ keep the assembly file for each source file, but continue to assemble and link the program. This is mainly for use in compiler performance analysis and debugging π-Mlist/-Mnolist(default) β create (don't create) a listing file. By default? No listing. Rn anyway π-noswitcherrorβ ignore unknown command line switches after printing an warning message; the default behavior is to print an error message and halt. So this is the "please be chill about my typos" switch π-o fileβ use file as the name of the executable program, rather than the 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 it yourself, main character energy π-rc rcfileβ 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. Pay attention to which kind of path you're giving it, ok? π-Sβ skip the assembly and link steps. Leave the output from the compile step in a file namedfile.sfor each file named, for instance,file.f. See also-o. Assembly output, no assembly-ing π-showβ produce help information describing the currentnvfortranconfiguration. Receipts for your setup π§Ύ-silentβ do not print warning messages. Same as-Minform=severe. Silence is golden β¨-timeβ print execution times for the various steps in the compiler itself. Where did the milliseconds go, bestie β±οΈ-Vβ display version messages and other information.-V<ver>β if the specified version of the compiler is installed, that version of the compiler is invoked. Version select, lowkey iconic π-vβ verbose mode; print out the command line for each tool before it is executed. All the receipts, live π--versionβ display version messages and other information.-wβ do not print warning messages.-Werrorβ turn all warning messages into errors. Glow-up or glow-down depending on your code, ngl π₯-x languageβ specify explicitly the language for the input files (instead of choosing based on the file name suffix). Possible values for language are: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. Back to vibes-based detection π-Wpass,option[,option...]β pass option to the specified pass. Each comma-delimited option is passed as a separate argument. The passes are:hβ for the Fortran 90/95 front end,0β for the compiler back end,aβ for the assembler,iβ for the interprocedural analyzer, 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 β‘
this is where the compiler gets its little gym membership ποΈββοΈ
-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 of 2; see-O. One switch, whole glow-up π«-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. Know which one you're getting, bestie π-fastsseβ chooses generally optimal flags for a processor that supports to vectorize for the SSE/AVX instructions. Usenvfortran -fastsse -helpto see the equivalent switches. Vectorize era π¦-fPICβ equivalent to-fpic; provided for compatibility with other compilers.-fpicβ instructs the compiler to generate position-independent code which can be used to create shared object files (dynamically linked libraries). Shared libs, we love her π-KPICβ equivalent to-fpic; provided for compatibility with other compilers.-Kpicβ equivalent to-fpic; provided for compatibility with other compilers.-Mcache_alignβ align unconstrained data objects of size greater than or equal 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. Very specific, very demure πΈ-Mconcur[=option[,option,...]]
β οΈ bestie listen β this option has been deprecated and will be removed in a future release. Do not build your whole personality on it π
Instructs the compiler to enable auto-concurrentization of loops. This also sets the optimization level to a minimum of 2; see -O. If -Mconcur is specified, multiple processors will be used to execute loops which the compiler determines to be parallelizable. When linking, the -Mconcur switch must be specified or unresolved references will occur. The OMP_NUM_THREADS or NCPUS environment variables control how many processors will be used to execute parallelized loops. The options can be one or more of the following:
allcoresβ uses literally every available core when the environment variablesOMP_NUM_THREADSandNCPUSare not set π . This must be specified at link time, no cap.altcode:n,noaltcodeβ generate (don't generate) alternate scalar code for parallelized loops. The parallelizer generates scalar code to be executed whenever the loop count is less than or equal ton. Ifnoaltcodeis specified, the parallelized version of the loop is always executed regardless of the loop count. Periodt.altreduction[:n]β generate alternate scalar code for parallelized loops containing a reduction. If a parallelized loop contains a reduction, the parallelizer generates scalar code to be executed whenever the loop count is less than or equal ton. Tiny-loop safety vibes β¨.assoc(default),noassocβ enable (disable) parallelization of loops with reductions. Iconic.cncall,nocncall(default) β assume (don't assume) that loops containing calls are safe to parallelize. Also, no minimum loop count threshold must be satisfied before parallelization will occur, and last values of scalars are assumed to be safe. That's the tea β.dist:blockβ parallelize with block distribution. Contiguous blocks of iterations of a parallelizable loop are assigned to the available processors. Chunky blocks, slay.dist:cyclicβ parallelize with cyclic distribution. The outermost parallelizable loop in any loop nest is parallelized. If a parallelized loop is innermost, its iterations are allocated to processors cyclically. For example, if there are 3 processors executing a loop, processor 0 performs iterations 0, 3, 6, etc; processor 1 performs iterations 1, 4, 7, etc; and processor 2 performs iterations 2, 5, 8, etc. Round-robin realness π.innermost,noinnermost(default) β enable (disable) parallelization of innermost loops. Your call, bestie.levels:nβ parallelize loops nested at mostnlevels deep; the default is3. Three layers deep is the vibe unless you say otherwise.
-Mdepchk(default),-Mnodepchkβ assume (don't assume) that potential data dependencies exist. π-Mnodepchkmay result in incorrect code, so maybe don't unless you're feeling fearless.-Mdse,-Mnodse(default) β enable (disable) the dead store elimination optimization. Bye bye useless stores π.-Mextract=[option[,option,...]]β run the subprogram extraction phase to get ready for inlining. The=lib: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. If it looks like a name, it is one.name:subprogram[,subprogram]β specifies the name of a subprogram or subprograms to be extracted. Explicit and cute.lib:directoryβ specifies the name of a directory to contain the extracted subprograms; this directory will be created if it does not exist. Magic folder energy β¨.[size:]numberβ a numeric option is assumed to be a size. Functions containingnumberor less statements are extracted. If bothnumberandfunctionare specified, then functions matching the given name(s) or meeting the size requirements are extracted. That's the whole deal.
-Mfma,-Mnofma(default) β generate (don't generate) fused multiply-add (FMA) instructions on the CPU and GPU for targets that support it. FMA instructions are generally faster than separate multiply-add instructions, and can generate higher precision results since the multiply result is not rounded before the addition. Delaying rounding until after addition, however, may cause results to differ from those obtained with the unfused multiply-add instructions. FMA instructions are enabled at optimization levels higher than-O1. Speed and precision drama π₯.-Mframe,-Mnoframe(default) β set up (don't set up) a true stack frame pointer for functions;-Mnoframeallows slightly more efficient operation when a stack frame is not needed, but some options override-Mnoframe. Keep that in mind, bestie.-Midiom,-Mnoidiom(default) β enable loop idiom recognition. Memory copy, memory set, and memory zero loops are recognized and replaced with calls to their respective optimized versions. It's giving smart compiler behavior π.-Minfo[=option[,option,...]],-Mnoinfo(default) β emit useful information tostderr. The options are:allβ includes optionsaccel,inline,ipa,loop,lre,mp,opt,par,stdpar,vect. The full package π .accelβ emit information about accelerator region targeting.ftnβ emit Fortran-specific information.inlineβ emit information about functions extracted and inlined.intensityβ this option has been deprecated and will be removed in a future version. Emit compute intensity information about loops. So maybe don't get attached π.ipaβ emit information about the optimizations enabled by interprocedural analysis (IPA).loop|optβ emit information about loop optimizations. This includes information about vectorization and loop unrolling.lreβ emit information about loop-carried redundancy elimination.mpβ emit information about OpenMP parallel regions.parβ emit information about loop parallelization.pfoβ emit profile feedback informationtime|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. So that's your default info dump, iykyk.
-Minline[=option[,option,...]]β pass options to the function inliner. The options are:lib:filename.extβ specify an inline library created by a previous-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. Convenient, fr fr.except:funcβ specifies which functions should not be inlined. No thank you to those.[name:]functionβ a non-numeric option is assumed to be a function name. Ifname:is specified, what follows is always the name of a function. Crystal clear β¨.pragmaβ Fortran Only: inline only those procedures that have a!NVF$ INLINEpragma on the source line immediately before the procedure'sSUBROUTINEorFUNCTIONstatement. Very specific, very Fortran.[maxsize:]numberβ a numeric option is assumed to be a size. Functions of sizenumberor less are inlined. If bothnumberandfunctionare specified, then functions matching the given name(s) or meeting the size requirements are inlined. Size limits but make it chic.reshapeβ for Fortran, the default is to not inline subprograms with array arguments if the array shape does not match the shape in the caller. This overrides the default. Shape-shifting but for inlining π¦.smallsize:numberβ always inline functions of size smaller thannumberregardless of other size limits. Small but mighty.totalsize:numberβ stop inlining in a function when the function's total inlined size reaches thenumberspecified. Gotta cap it somewhere.
-Minstrument [=option]β generate additional code to enable function-level instrumentation. This option implies-Mframe. The option is:functions(default) β the one and only option listed here.
-Mipa [=option[,option,...]],-Mnoipa(default) β enable and specify options for InterProcedural Analysis (IPA). π Note: IPA is not compatible with parallel make environments (e.g.,pmake). IPA also sets the optimization level to a minimum of2; see-O. If no option list is specified, then it is equivalent to-Mipa=const. The options are:align,noalign(default) β enable (disable) recognition when pointer targets are all cache-line aligned, allowing better SSE code generation. Aligned and iconic.arg,noarg(default) β remove (don't remove) arguments replaced by-Mipa=ptr,const.-Mipa=noargimplies-Mipa=nolocalarg. Note the implication, bestie.const(default),noconstβ enable (disable) propagation of constants across procedure calls. Constant queen π.f90ptr,nof90ptr(default) β enable (disable) Fortran 90 pointer disambiguation across procedure calls.fastβ chooses generally optimal-Mipaflags for the target platform; usenvfortran -Mipa -helpto see the equivalent options. Speedrun those flags.forceβ force all objects to recompile regardless of whether IPA information has changed. No stale objects allowed.globals,noglobals(default) β analyze (don't analyze) which globals are modified by procedure calls. Global tea β.inline:nβ determine additional functions to inline, allowing up tonlevels of inlining. Additional suboptions are:except:procβ disables inlining of procedureproc. Not them.nopfoβ ignore any profile frequency information from-Mpfowhen choosing which functions to inline. No profile peer pressure.reshape,noreshape(default) β enable (disable) Fortran inlining with mismatched array shapes. Shape mismatch? Sometimes we vibe.
ipofileβ save IPA information in a.ipofile instead of the default of appending the information to the object file. File management slay.jobs:nβ use up tonjobs in parallel to reoptimize object files. Parallel reoptimization realness.
keepobj(default) /nokeepobjβ keeps the optimized object files around (or doesn't π), using file name mangling, so your next application builds recompile way faster. Literally free time back, bestie.libc/nolibc(default) β optimize calls to certain standard C library routines (or don't β¨).libinline/nolibinline(default) β lets routines from libraries get inlined (or not). Heads up:-Mipa=libinlineimplies-Mipa=inline, iykyk.libopt/nolibopt(default) β allows recompiling and reoptimizing routines from libraries with IPA information (off by default, so flip it if you want that π).localarg/nolocalarg(default) β turns on (or off) the feature that externalizes local variables so arguments can be replaced by-Mipa=ptr. And yes:-Mipa=localargimplies-Mipa=argπmain:funcβ names a function to serve as the global entry point. You can pass it multiple times fr fr. Side effect: it disables linking.ptr/noptr(default) β enables (or disables) pointer disambiguation across procedure calls.pure/nopure(default) β detect pure functions, or don't, no pressure π¦quietβ don't print out messages about which files get recompiled at link time. peace and quiet, iconic.reaggregation/noreaggregation(default) β enables (or disables) global struct reaggregation. Run this and it can change the order of struct members, or split structs into multiple structs, all to improve memory locality and cache utilization. Lowkey dramatic but it's for a good cause.requiredβ returns an error condition if IPA gets inhibited for any reason, instead of the default behavior of just linking without IPA optimization. Strict mode energy.safe:function | library β declares that the named function, or all functions in the named library, are safe. A safe procedure doesn't call back into the known procedures and doesn't change any known global variables. And the stakes: without-Mipa=safe, any unknown procedures will cause IPA to fail πsafeall/nosafeall(default) β declares that all unknown functions are safe (or not safe). See-Mipa=safeabove for the deets.shape/noshape(default) β perform (or don't perform) Fortran 90 shape propagation β¨summaryβ only collect IPA summary information when compiling. This prevents IPA optimization of this file, but allows optimization for the other files linked with this file. Team player behavior π«Άvestigial/novestigial(default) β remove (or don't remove) functions that are not called.-Mlre[=assoc|noassoc],-Mnolreβ enable (or disable) loop-carried redundancy elimination π₯ Theassocoption allows expression reassociation, andnoassocdisallows expression reassociation. That's the whole distinction, no cap.-Mmovnt,-Mnomovntβ force (or disable) generation of nontemporal moves. Ngl,-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 are not performed. Real talk though: use the-Minfoflag instead π-Mnoopenmpβ when-mpis present, ignore the OpenMP pragmas. just straight up ignoring them.-Mnosgimpβ when-mpis present, ignore the SGI parallelization pragmas.-Mnovintrβ do not generate vector intrinsic calls.-Mpfi[=option]β generate profile feedback instrumentation, which includes extra code to collect run-time statistics to be used in a subsequent compile. And bestie, listen:-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. Requirement check: there must be a profile feedback filepgfi.outin the current directory, and it has to contain the result of an execution of the program compiled with-Mpfiβ¨ The options are:indirect/noindirect(default) β enable (or disable) indirect function call inlining. This one needs 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. cozy little hot paths πΈ- *
dir=directory*** β specify the directory containing thepgfi.out` profile feedback information file. The default is the current directory.
-Mpre,-Mnopre(default) β enable (or disable) the partial redundancy elimination optimization.-Mprefetch[=option:n],-Mnoprefetchβ add (or don't add) prefetch instructions for those processors that support them (Pentium 4,Opteron).-Mprefetchis default onOpteron;-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. Use these and your resulting executable creates a performance profile you can view and analyze with thePGPROFperformance profiler π For the descriptions below: old-style profiling implies compiler-generated source instrumentation. MPICH-style profiling implies the use of instrumented wrappers for MPI library routines. The-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. Cute rename, same vibe β¨
On Linux systems that have OProfile installed,PGPROFsupports collection of performance data without recompilation. Use of-Mprof=dwarfis useful for this mode of profiling. no recompile era π
-Mpropcond(default),-Mnopropcondβ enable (or disable) propagation of constant values derived from conditional branches with equality tests.-Mquadβ align large objects on quad-word boundaries. big objects deserve big alignment π-Msafe_lastvalβ in the case where a scalar is used after a loop, but is not defined on every iteration of the loop, the compiler does not by default parallelize the loop. This option tells the compiler it's safe to parallelize the loop. you're taking the wheel here π«Ά-Msigned-zeroes(default),-Mno-signed-zerosβ toggles whether to honor (-Msigned-zeros) or ignore (-Mno-signed-zeros) issues associated with a signed0.0during optimization. yes,0.0has lore.-Mstride0,-Mnostride0(default) β generate (or don't generate) alternate code for a loop that contains an induction variable whose increment may be zero.-Munroll[=option[,option...]],-Mnounroll(default) β invoke (or don't invoke) the loop unroller. Note that this also sets the optimization level to a minimum of2; 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. And 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. (same deal as above, just multi-block bestie π)-Mnounrolltells the compiler not to unroll loops. periodt.
-Munsafe_par_align,-Mnounsafe_par_alignβ use (or don't use) aligned moves for array loads in parallelized loops, as long as the first element of the array is aligned. This is only effective with-Mvect=simd. And the reason it's called unsafe: there are situations where the array elements allocated to some processors are not aligned π so like, know what you're doing.-Mvect[=option[,option...]],-Mnovect(default) β pass options to the internal vectorizer. This also sets the optimization level to a minimum of2, 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. two loops becoming one? that's giving main character energy πprefetchβ use prefetch instructions in loops where profitable.
simd[:{128|256|512}](default) /nosimdβ bestie, this one tells the compiler to actually use vector SIMD instructions (AVX,AVX2,AVX512) π . You can slap an argument on it to limit the whole thing to 128-bit SIMD instructions, and ngl, asking for 512-bit SIMD is only possible on target processors that supportAVX512β no faking it, the hardware has to eat. π¦uniform/nouniform(default) β performs the same optimizations in the vectorized and residual loops. Heads up tho: this may affect the performance of the residual loop. π
Okay so these next ones are also supported, but they're not recommended for new development β unless you're an experienced user β and they may be phased out in future releases. So like, proceed with your eyes open, queen. π
assoc(default) /noassocβ enable (or disable) certain associativity conversions that can change the results of a computation due to floating-point roundoff error differences. The classic: changing the order of additions, which is mathematically correct but can be computationally different, because roundoff error said "not today." πcachesize:number(default=automatic) β tells the vectorizer, when it's doing cache tiling optimizations, to assume a cache size of number. πgather(default) /nogatherβ enable (disable) vectorization of loops with indirect array references. β¨idiom(default) /noidiomβ enable idiom recognition; it's the alternate form of-Midiom. iykyk π§levels:nβ set the maximum nest level of loops to optimize. πͺpartialβ enable partial loop vectorization via innermost loop distribution. lowkey fancy fr fr πΈshort/noshort(default) β enable (disable) recognition of short vector operations that arise from scalar code outside of loops or within the body of loops. πsizelimit[:number]/nosizelimit(default) β limit the size of loops that get vectorized; the default is to attempt to vectorize all loops. main character energy, honestly πtile/notile(default) β enable (disable) loop tiling to optimize for cache locality. π
-Mnovect disables the vectorizer, and it's the default at -O0 and -O1. Periodt.
-Mzerotrip(default) /-Mnozerotripβ include (don't include) a zero-trip test for loops. Fr fr, only use-Mnozerotripwhen all loops are known to execute at least once. Don't be reckless. π-mp[=option]β enables OpenMP pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices or multi-processor systems. The options allowed are:gpuβ compile OpenMP directives for parallel execution on the GPU. πmulticore(default) β compile OpenMP directives for parallel execution on the CPU. π»align/noalign(default) β modify (don't modify) default loop iteration scheduling to align iterations with array references. The default is to use simple static scheduling. β¨autopar(default) /noautoparβ enable loop autoparallelization ofomp loopconstructs. π₯omptβ link against OMPT-enabled OpenMP library. π
-nompβ ignore OpenMP directives and do not link against OpenMP runtime libraries. Not me ignoring OpenMP's texts π-O[level]β set the optimization level. If-Ois not specified, then the default level is1if-gis not specified, and0if-gis specified. If a number is not supplied with-Othen the optimization level is set to2. The levels and their meanings are:-O0β sets the optimization level to0. A basic block is generated for each statement. No scheduling is done between statements. No global optimizations are performed. It's giving "we're just vibing." π-O1β sets the optimization level to1. Scheduling within extended basic blocks is performed. No global optimizations are performed. π¦-Oβ sets the optimization level to2, 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. (may or may not π)-Ofastβ enables-O3,-Mfprelaxed,-Mstack_arrays,-Mno-nan,Mno-inf, and-fcx-limited-range. Note that-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. Obsessed. π
-pgβ enablegprof-style sample-based profiling; implies-Mframe. π
πΈ Debugging Options πΈ
-Cβ add array bounds checking; the same as-Mbounds. Safety first, bestie. π«Ά-gβ generate symbolic debug information. This also sets the optimization level to zero, unless a-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. Not me warning you twice π-goptβ generate symbolic debug information, without affecting optimizations. This may give confusing results when debugging with optimizations; it's intended for use with other tools that use the debug information. π§-Mbounds/-Mnobounds(default) β add (don't add) array bound checking. β¨-Mchkptrβ check for unintended de-referencing ofNULLpointers. Ty bestie, this is a public service. π-Mchkstkβ check the stack for available space upon entry to and before the start of a parallel region. Useful when many private variables are declared. πͺ-Mcoffβ generate aCOFFformatted object. π-Mdwarf2β generateDWARF2debug information with-g. π¦-Mdwarf3β generateDWARF3debug information with-g. πΈ-Melfβ generate anELFformatted object. π-Mnodwarfβ don't add the default dwarf information. π-traceback(default) /-notracebackβ add debug information for runtime traceback. When things go sideways at runtime, you'll want the receipts. π₯
β¨ Preprocessor Options β¨
-Dname[=def]β define name to be def in the preprocessor. If def is missing, it's assumed to be empty. If the=sign is missing, then name is defined to be the string1. iykyk π-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β 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. Order matters, queen β it's literally a whole lineup. π-isystem directoryβ same as-I, but mark the directory as a system directory. π-Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff]β only runs the preprocessor on the input file(s); by default, the output is written 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. Nope, none, not today. π-Mnostdincβ do not search in the standard location for include files when those files are not found elsewhere. π¦-Mpreprocessβ run the preprocessor on Fortran or assembler source files. By default, the preprocessor is run when the source's suffix is.fpp,.F,.F90,.F95, or.HPF. π-Unameβ remove the definition of the name macro in the preprocessor. Bye bestie π-YI,directoryβ change the standard include directory to directory. π-Yp,directoryβ look in directory for the preprocessor executable. π
π Assembler Options π
-Wa,option[,option...]β pass each comma-delimited option to the assembler. π«Ά-Ya,directoryβ look in directory for the assembler executable. β
π Linker Options π
okay bestie, this is the part where your object files actually get stitched together into something you can run π the linker is lowkey the main character here, and these flags are how you talk to it. let's go β¨
-acclibsβ link-time vibes only: adds the accelerator libraries to the link line π--as-needed,--no-as-neededβ passed straight to the linker.--as-neededtells the linker to only set theDT_NEEDEDflag for shared libraries that come after it, requiring those libraries at run time β but only if they're actually used to satisfy references.--no-as-neededrestores the default behavior. iykyk π-Bdynamicβ passed to the linker to specify dynamic binding. slay, dynamic era π«-Bstaticβ this one is exactly the same as-static. go peek at-staticfor the details, no cap π-Bstatic-nvidiaβ same as-static-nvidia. yes, again, check-static-nvidiafor the full tea π«-c++libsβ link-time glow-up: adds the C++ runtime libraries so you can do that mixed-language programming thing π₯-cudaforlibsβ link-time option that adds the CUDA Fortran runtime libraries, enabling mixed-language programming. also implies-fortranlibsπ (it's giving "package deal")-cudalib[=libname[,libname...]]β adds CUDA-optimized libraries to the link line. when you don't specify anything, the compiler links all the necessary CUDA-optimized libraries.-cudalibwill use the version of the library that matches the CUDA version you're on. the libraries it recognizes are, in order:cublascublasmpcufftcufftmpcufftwcurandcusolvercusolvermpcusparsecutensorncclnvblasnvshmemnvtx3
that's the whole squad, bestie π
-cudalibsβ β οΈ this one has been deprecated, please refer to-cudalib. (it was a link-time option to add the CUDA runtime API library, but it's retired now, rip π)-fortranlibsβ link-time option adding the Fortran runtime libraries so mixed-language programming can happen π§-g77libsβ link-time option that lets object files generated by GNUg77(orgcc) get linked into nvfortran main programs. bridging the eras fr fr πΈ-Ldirectoryβ passed to the linker; adds directory to the list of directories the linker searches for libraries π (you'll want this one, trust)-llibraryβ passed to the linker; loads the library lib*library*.a from the standard library directory. also see the-Loption above, they're besties π«Ά-mβ makes the linker display a link map. we love transparency β¨-Mcudalib[=libname[,libname...]]β β οΈ deprecated, please refer to-cudalib. adds CUDA-optimized libraries to the link line; with no option specified, the compiler links all the necessary CUDA-optimized libraries π (same energy, older spelling)-Meh_frame,-Mnoeh_frameβ adds (or doesn't add) arguments to the link line to preserve the stack frame information for zero-cost exception handling frames. the default is-Mnoeh_frameunless you changed it in a site or user rcfile π-Mnostartupβ do not link in the usual startup routine. heads up though: that routine contains the entry point for the program π-Mnostdlibβ do not link in the standard libraries when linking a program. bold move, bestie π-Mrpath(default),-Mnorpathβ by default,-rpathgets added to the link line, giving the directories that contain the required runtime shared objects. use-Mnorpathto tell the driver not to add any-rpathswitches to the link line π¦-Mmklβ adds Intel's Math Kernel libraries to the link line. requires that the environment variableMKLROOTbe set to the path of your local MKL installation (specifically, the part of the path that precedeslib/<arch>) π₯-nvmallocβ use a custom host memory allocator. fancy π-pthreadβ adds support for multithreading with the pthreads library. this option sets flags for both the preprocessor and the linker, two-for-one π-Rdirectoryβ passed to the linker; tells it to hard-code the pathname directory into the search path for generated shared object files. β οΈ heads up: there cannot be a space betweenRand directory-rβ passed to the linker; generates a re-linkable object file π-rpathdirectory β passed to the linker to add directory to the runtime shared library search path π£οΈ-sβ passed to the linker; strips symbol table information. goodbye symbols, you won't be missed βοΈ-sharedβ passed to the linker. tells it to generate a shared object file (aka a dynamically linked library). implies-fpicπ-sonamename β passed to the linker. when creating a shared object, it tells the linker to set the internalDT_SONAMEfield to the specified name π·οΈ-staticβ passed to the linker to specify static binding πΏ-static-nvidiaβ statically links in the NVIDIA runtime libraries while using dynamic linking for the system libraries. implies-Mnorpathβ¨-unameβ passed to the linker; generates an undefined reference π»--whole-archive,--no-whole-archiveβ passed to the linker.--whole-archivetells it 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. two ways to say the same thing, pick your fighter π«-YC,directoryβ look in directory for the standard compiler library files π-Yl,directoryβ look in directory for the linker π-YL,directoryβ change the standard library directory to directory π-YS,directoryβ look in directory for the standard system startup object files π-YU,directoryβ passed to the linker; change the library search path π§
πΈ LANGUAGE OPTIONS πΈ
okay bestie, this whole section is about telling the compiler what language it's looking at and how to read it β suffixes, integer sizes, form rules, all of it π
-asmsuffix=suffixβ says "hey, any file with this suffix? that's an assembly language file, bestie." π-byteswapioβ swaps bytes from big-endian to little-endian (or the other way round, no cap) on input/output of unformatted Fortran data. Turning this on means you can read/write Fortran unformatted data files that are compatible with the ones produced on Sun or SGI systems. β¨-csuffix=suffixβ declares that a file with the given suffix is a C source file. π«Ά-fsuffix=suffixβ same deal but for Fortran: this suffix means Fortran source file.-FSUFFIX=suffixβ also declares a suffix as a Fortran source file (yes it's the uppercase-twin of the one above, she has main character energy too π).-cuda[=option[,option...]β enables CUDA Fortran: adds the CUDA include paths and links against the CUDA runtime libraries.-cudais required on the link line β so if you used-cudawhile compiling, you must also use it for linking, fr fr. For target-specific stuff go look at-gpu. For linking extra CUDA libraries (math libraries and friends, iykyk) go look at-cudalib. These sub-options let you tailor how CUDA Fortran accelerator regions get compiled:charstringβ enables limited support for character strings inside GPU kernels.madconstβ puts Module Array Descriptors in CUDA Constant Memory. β¨
-i2β treatsINTEGERvariables as two bytes.-i4β treatsINTEGERvariables as four bytes.-i8β treats defaultINTEGERandLOGICALvariables as eight bytes, and uses 64-bits for computations when you're doing operations involving integers. π₯-i8storageβ allocates 8 bytes forINTEGERandLOGICAL.-Mallocatable[=95|03]β picks whether you get Fortran 1995 or Fortran 2003 semantics for assignments to allocatable objects and to allocatable components of derived types. The 1995 vibes require you to allocate the object or component, and require that an array object or component be conformant before the assignment. The 2003 vibes require the compiler to add code that checks whether the object or component is allocated and whether an array object is conformant before the assignment β and to allocate or reallocate if not. π-Mbackslash,-Mnobackslash(default) β do (or don't) treat backslash as a normal, non-escape character in strings.-Mnobackslashmakes the standard C backslash escape sequences get recognized inside quoted strings;-Mbackslashmakes the backslash just like any other character, periodt.-Mbyteswapioβ the-byteswapiotwin: swaps bytes from big-endian to little-endian or vice versa on input/output of unformatted Fortran data. Use of this option enables reading/writing Fortran unformatted data files compatible with those produced on Sun or SGI systems. π¦-Mcray=pointerβ forces Cray Fortran (CF77) compatibility for the listed options. Possible options include:pointerβ for purposes of optimization, assume that pointer-based variables do not overlap the storage of any other variable. π
-Mcuda[=option[,option...]β β οΈ heads up bestie, this one has been deprecated, please refer to-cuda. It enables CUDA (and CUDA Fortran) and links with the CUDA libraries.-Mcudais required on the link line if there are no CUDA Fortran source files specified on the command line. And if-Mcudais used in compilation, it must also be used for linking β same rules, different spelling. π-Mdalign(default),-Mnodalignβ align (or don't align) doubles in structures on 8-byte boundaries. Careful:-Mnodalignmay lead to data alignment exceptions. π-Mdclchk,-Mnodclchk(default) β require (or don't require) that all variables be declared.-Mdefaultunit,-Mnodefaultunit(default) β treat (or don't treat)'*'as stdout/stdin regardless of the status of units 6/5.-Mnodefaultunitmakes*a synonym for 5 on input and 6 on output;-Mdefaultunitmakes*a synonym for stdin on input and stdout on output. β¨-Mdlines,-Mnodlines(default) β treat (or don't treat) lines beginning withDin column 1 as executable statements, ignoring theD.-Mdollar=charβ sets the character used to replace dollar signs in names to be char. Default is an underscore (_). π-Mextendβ allows 132-column source lines. iconic for those long lines that just won't quit.-Mfixedβ processes Fortran source using fixed form specifications. The-Mfreeoptions are the ones that 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.-Mnofreeand-Mfixedspecify fixed form formatting. By default, files with a.f90,.F90,.f95or.F95extension use freeform formatting. π-Mi4(default),-Mnoi4β treat (or don't treat)INTEGERasINTEGER*4.-Mnoi4treatsINTEGERasINTEGER*2.-Miomutex,-Mnoiomutex(default) β generate (or don't generate) critical section calls around Fortran I/O statements. π₯-Mlibsuffix=suffixβ declares that a file with the given suffix is an object library file.-Mllalign(default),-Mnollalignβ align (or don't align) long longs orINTEGER*8in structures or common blocks on 8-byte boundaries.-Mllalignis the default, bestie.-Mnomainβ when the link step is called, don't include the object file that calls the Fortran main program. Super useful when you're using thenvfortrandriver to link programs whose main program is written in C or C++, with one or more subroutines written in Fortran. π«Ά-Mobjsuffix=suffixβ declares that a file with the given suffix is a binary object file.-Monetrip,-Mnoonetrip(default) β force (or don't force) eachDOloop to be iterated at least once.-Mr8,-Mnor8(default) β treat (or don't treat)REALasDOUBLE PRECISIONand real constants as double precision constants.-Mr8intrinsics [=float],-Mnor8intrinsics(default) β treat (or don't treat) the intrinsicsCMPLXasDCMPLXandREALasDBLE.floatβ also treat theFLOATintrinsic asDBLE. β¨
-Mrecursive,-Mnorecursive(default) β allocate (or don't allocate) local variables on the stack, which is what allows recursion. Heads up:SAVEd, data-initialized, or namelist members are always allocated statically, no matter what this switch is set to. π-Mref_externals,-Mnoref_externals(default) β force (or don't force) references to names appearing inEXTERNALstatements.-Msave,-Mnosave(default) β assume (or don't assume) that all local variables are subject to theSAVEstatement.-Msavemay let a lot of older Fortran programs actually run, but ngl it can greatly reduce performance. π-Msignextend(default),-Mnosignextendβ sign extend (or don't sign extend) when a narrowing conversion overflows. Example time: when-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 (or on the heap).-Mstandardβ flags non-ANSI-Fortran usage. little snitch behavior, but make it compiler.-Msyntax-onlyβ performs only syntax checking, semantic checking, and Fortran module (.mod) file generation. that's it, that's the whole job. β¨-Munixlogical,-Mnounixlogical(default) β when-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, bestie), a logical is considered to be.TRUE.if its value is odd and.FALSE.if its value is even. yes, even. we don't make the rules. π-Mupcase,-Mnoupcase(default) β preserve (or don't preserve) case in names.-Mnoupcasecauses all names to be converted to lower case. π Note that if-Mupcaseis used, then the variable name'X'is different than the variable name'x', and keywords must be in lower case. icon behavior honestly.-module directoryβ save/search for module files in directory. π-Munlink_moduleβ 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β interpretsDOUBLE PRECISIONvariables asREAL. downgrade era.-r8β interpretsREALvariables asDOUBLE PRECISION. Equivalent to using the options-Mr8and-Mr8intrinsics. upgrade era. π₯-Wh,option[,option...]β passes each comma-delimited option to the Fortran 90/95 front end. here, you hold this π«Ά
π₯ TARGET-SPECIFIC OPTIONS π₯
-accβ enables OpenACC pragmas and directives so you can explicitly parallelize regions of code for execution by accelerator devices. Peep the-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 that don't 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 that doesn't adhere to the OpenACC standard. no warnings, just vibes check failed, we're done here πwait(default),nowaitβ wait for each compute kernel to finish.
-noaccβ disables OpenACC directives and does not link with OpenACC libraries. π¦-gpu=optionβ use the following sub-options to tailor the compilation of target accelerator regions:autocompareβ Automatically compares CPU/GPU results. Accelerated code sections run in redundant mode, and data gets compared whenever it would ordinarily be moved off the accelerator. Itβs giving βtrust but verify,β bestie β¨ccXYβ Generates code for a device with compute capability XY. You can list multiple compute capabilities and get one version for each. By default, the compiler detects the compute capability for each installed GPU. Use-help -gputo see the valid compute capabilities for your installation.ccallβ Generates code for all compute capabilities supported for this target and by the selected CUDA Toolkit version. Literally all of them πccnativeβ Detects the visible GPUs on the system and generates code for them. If no device is available, the default compute capability is used (cc50).ccall-majorβ Compiles for all major supported compute capabilities. Heads up: it does not include PTX for the highest major virtual architecture; see the-gpu=[no]rdcoption for that support.cudaX.Yβ Uses CUDA X.Y Toolkit compatibility, where installed.deepcopyβ Enables Full Deepcopy support in OpenACC Fortran. Iconic.fastmathβ Enables the fast math library, which includes faster but lower-precision implementations of certain math and intrinsic functions.flushz,noflushz(default) β Enables (or disables) flush-to-zero mode on the GPU.fma,nofmaβ Generates (or does not generate) fused multiply-add operations on the GPU. This is enabled by default at optimization level-O1.implicitsections,noimplicitsections(default) β Changes (or does not change) array element references in OpenACC and OpenMP data clauses to array-section references.interceptdeallocations,nointerceptdeallocationsβ Intercepts (or does not intercept) LIBC function calls (e.g.free) and calls the corresponding CUDA memory deallocation version if the address is in pinned or managed memory, and the regular version otherwise.keepbinβ Keeps the generated CUDA binary, with a.cubinsuffix.keepgpuβ Keeps the generated CUDA GPU source files, with a.gpusuffix.keepltoirβ Keeps the generated GPU LTOIR files, with a.ltoirsuffix. Works only when-gpu=ltois enabled.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 Ltime Optimization (Device LTO).maxregcount:nβ Sets the maximum number of registers to use in the generated GPU code.managedβ Allocates any dynamically allocated data in CUDA Managed memory. This option must appear in both the compile and link lines. It may not be used with-gpu=pinned.interceptβ Intercepts LIBC function calls (e.g.free) and calls their managed memory version if the address is in managed memory, and the regular version otherwise.
nomanagedβ Does not allocate any dynamically allocated data in CUDA Managed memory. Use it with-stdparto prevent 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 prevent 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. It may not be used with-gpu=managed|unified.interceptβ Intercepts LIBC function calls (e.g.free) and calls their pinned memory version if the address is in pinned memory, and the regular version otherwise.
mem:[mode]β Selects the GPU memory mode from one of these options:separate,managed,unified. This option cannot be combined with-gpu=pinned,gpu=managed, or-gpu=unified. Bestie, pick one lane π«Άmem:separateβ All data are in separate CPU and GPU memories. Explicit memory copies are performed when data are accessed from both CPU and GPU.mem:managedβ Allocates any dynamically allocated data in CUDA Managed Memory. Data that are not allocated dynamically are in separate GPU memory and are copied explicitly between CPU and GPU memories. This option must appear in both the compile and link lines.mem:unifiedβ Compiles for full CUDA Unified Memory capability, where system memory is accessible from the GPU. All variables in the CPU code are accessible from the GPU without explicit directives or attributes. This mode utilizes system and managed memory for dynamically allocated data unless explicit behavior is set through the-gpu=mem:unified:[no]managedallocsubflags. This option must appear in both the compile and link lines.
mem:unified:managedalloc,mem:unified:nomanagedallocβ Allocates (or does not allocate) any dynamically allocated data in CUDA Managed Memory.mem:separate:pinnedalloc,mem:separate:nopinnedallocβ Allocates (or does not allocate) any dynamically allocated data in CUDA Pinned host memory.ptxinfoβ Prints ptxas information.rdc(default),nordcβ Generates (or does not generate) relocatable device code for separate compilation, and invokes the device linker before the host linker at the link step.redundantβ Runs accelerated code redundantly on the CPU. Implied byautocompare.safecacheβ Allows variable-sized array sections in cache directives; the compiler assumes they fit into CUDA shared memory.sm_XYβ Generates code for a device with compute capability XY. You can list multiple compute capabilities and get one version for each. By default, the compiler detects the compute capability for each installed GPU. Use-help -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. 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=tripcountis not specified. Note that this behavior is not compliant with the OpenACC specification. To ensure compliance with the specification, please use-gpu=tripcount:device.tripcount:deviceβ Calculates loop trip counts on the device for some compute constructs. Note that this behavior is compliant with the OpenACC specification, though it is not the default behavior. To explicitly enable the default behavior, please use-gpu=tripcount:host.tripcount:warn,tripcount:nowarnβ Enables (or disables) compile-time warnings when loop trip counts are calculated on the host instead of on the device.tripcount:check,tripcount:nocheckβ Inserts (or does not insert) runtime checks to ensure the trip count value calculated on the device matches the trip count value calculated on the host. To enable reporting of differences, set the environment 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 utilizes system and managed memory for dynamically allocated data unless explicit behavior is set through-gpu=[no]managed. This option must appear in both the compile and link lines. It may not be used with-gpu=pinned.interceptβ Intercepts LIBC function calls (e.g.free) and calls their unified version if the address is in unified memory, and the regular version otherwise.
unroll,nounrollβ Automatically unrolls (or does not unroll) inner loops. This is enabled by default at optimization level-O3.
-Kieee,-Knoieee(default) β Performs floating-point operations in strict conformance with the IEEE 754 standard. Some optimizations are disabled with-Kieee, and a more accurate math library is used. The default-Knoieeeuses faster but very slightly less accurate methods.-Ktrap=option[,option]...β Controls the behavior of the processor when floating-point exceptions occur during program execution. Possible options include:denormβ Trap on denormalized operands.divzβ Trap on divide by zero.fpβ Trap on floating-point exceptions.inexactβ Trap on inexact result.invβ Trap on invalid operation.none(default) β Disable all traps.-Ktrap=inv,none,ovfimplies-Ktrap=ovf.ovfβ Trap on floating-point overflow.unfβ Trap on floating-point underflow. Heads up:-Ktrapis only meaningful when compiling a C/C++ main function or Fortran main program.
-Ktrap=fp is shorthand for -Ktrap=divz,inv,ovf.
okay so these options correspond to the processor's floating-point exception mask bits. Normally, the processor's exception mask bits are enabled, meaning floating-point exceptions are masked; the processor recovers from the exception and continues execution. If a mask bit is off (unmasked) and the corresponding exception occurs, execution terminates with a floating-point exception (Linux FPE signal). highkey important stuff, bestie π
-march=targetβ this is the same as-tp; please refer to-tpfor details.-m[no-]daz-ftzβ specify how denormals are handled by the processor at runtime.-mno-daz-ftzspecifies that denormal operands and results are honored, and it's shorthand for-Mnodaz-Mnoflushz.-mdaz-ftzis the default setting and specifies that denormal operands and results are treated as zero, and it's shorthand for-Mdaz-Mflushz.-Mdaz,-Mnodazβ enable [disable] mode to treat denormal (subnormal) floating-point operands as zero.-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. slay, compiler knows what's up β¨
-Mfunc32(default),-Mnofunc32β align (don't align) functions on 32 byte boundaries.-Mlongbranch,-Mnolongbranch(default) β enable (disable) long branches.-Msecond_underscore,-Mnosecond_underscore(default) β add (don't add) a second underscore to the name of a Fortran global if its name already contains an underscore. This option is useful for maintaining compatibility with g77, which adds a second underscore to such symbols by default.-Mvarargs,-Mnovarargs(default) β generate code for calls made from Fortran to C routines to use varargs calling sequence.-Mwritable-stringsβ store string constants in the writable data segment.-mcmodel=small|mediumβ pick the code model, bestie:smallβ limits the combined area for a user's object or executable to 4GB. The maximum code size is 2GB.mediumβ allows unrestricted data size. The maximum code size is 2GB.
-stdpar=optionβ enable (ISO Fortran 2018) DO-CONCURRENT. parallel vibes incoming π¦gpuβ (ISO Fortran 2018) DO-CONCURRENT is compiled for parallel execution on the GPU. This option implies-gpu=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 file.file.aβ library of object files.file.fβ fixed-format Fortran source file.file.Fβ fixed-format Fortran source file that requires preprocessing.file.f90β free-format Fortran source file.file.F90β free-format Fortran source file that requires preprocessing.file.f95β free-format Fortran source file.file.F95β free-format Fortran source file that requires preprocessing.file.f03β free-format Fortran source file.file.F03β free-format Fortran source file that requires preprocessing.file.forβ fixed-format Fortran source file.file.fppβ fixed-format Fortran source file that requires preprocessing.file.cufβ free-format CUDA Fortran source file.file.CUFβ free-format CUDA Fortran source file that requires preprocessing.file.ipaβ InterProcedural Analyzer (IPA) file.file.ipoβ InterProcedural Analyzer (IPA) file.file.oβ object file.file.sβ assembler source file..mynvfortranrcβ you may add custom switches or make other additions tonvfortranby creating a file named.mynvfortranrcin your home directory. customization era π
The installation of this version of the compiler resides in Basedir/Linux_x86_64/dev/; other versions may coexist in Basedir/Linux_x86_64/release/. Basedir is the root of the compiler installation directory, specified by the installer. The default is /opt/nvidia/hpc_sdk.
The compiler installation subdirectories are:
compilers/bin/β compiler and tool executables and configuration files (rcfiles).compilers/include/β compiler include files.compilers/lib/β runtime libraries and object files.comm_libs/β communication libraries, including NCCL and NVSHMEM.math_libs/β math libraries, including cuBLAS, cuTENSOR, cuSPARSE, cuFFT, cuSOLVER, and cuRAND.profilers/β profilers, including Nsight Compute and Nsight Systems.
π SEE ALSO π
Go check nvc (1), nvc++ (1), and the NVIDIA User's Guide. iykyk π
π¨ DIAGNOSTICS π¨
The compiler produces information and error messages as it translates the input program. The linker and assembler may issue their own error messages. not me getting diagnostics at the function π
That's the page, bestie β it's dated September 2026 and signed pgf90(1). periodt, go compile something iconic π«Άβ¨
π¦ where this page comes from
- 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