pgf95(1)
โจ NAME โจ
okay so this is the pgf95(1) page from the General Commands Manual, and the whole vibe is: pgf95 is literally an alias for nvfortran, no cap.
nvfortran โ The NVIDIA Fortran compiler. main character energy fr fr ๐
๐ ๏ธ SYNOPSIS ๐ ๏ธ
nvfortran [ -flag ]... sourcefile...
๐ DESCRIPTION ๐
okay bestie, here's the tea: pgf95 is 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 honestly โจ
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. okay so don't be surprised when the linker gets involved, bestie ๐ซถ
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. it's giving cleanup era ๐ง
๐ OPTIONS ๐
Options must be separate; -cs is different from -c -s. not me stressing this, but like, yes bestie. Here is a list of all options, grouped by type. More detailed explanations are in following sections. ๐
๐ Overall Options ๐
---#-###-c-[no]defaultoptions-dryrun-drystdinc-dumpversion-echo--flagcheck-flags-fmax-errors=<n>--gcc-toolchain=path-help[=option]-Manno-Minform=level-Mdetail-Mkeepasm-M[no]list-noswitcherror-o file-rc rcfile-S-show-silent-time-V-V<ver>-v--version-w-Werror-x language-x none-Wpass,option-Ypass,directory
๐ฅ Optimization Options ๐ฅ
-fast-f[no-]cx-limited-range-fastsse-fPIC-fpic-KPIC-Kpic-Mcache_align-Mconcur=option-M[no]depchk-M[no]dse-Mextract=option-M[no]fma-M[no]frame-M[no]idiom-M[no]info=option-Minline=option-Minstrument=option-M[no]ipa=option-M[no]lre[=assoc|noassoc]-M[no]movnt-Mneginfo=option-Mnoopenmp-Mnosgimp-Mnovintr-Mpfi[=option]-Mpfo[=option]-M[no]pre-M[no]prefetch=option-Mprof=option-M[no]propcond-Mquad-Msafe_lastval-M[no-]signed-zeros-M[no]stride0-M[no]unroll=option-M[no]unsafe_par_align-M[no]vect=option-M[no]zerotrip-mp[=option]-nomp-Olevel-pg
๐ฆ Debugging Options ๐ฆ
-C-g-gopt-M[no]bounds-Mchkptr-Mchkstk-Mcoff-Mdwarf2-Mdwarf3-Melf-Mnodwarf-[no]traceback
๐ธ Preprocessor Options ๐ธ
-Dmacro-E-F-Idirectory-isystem directory-Mcpp=[[no]comment|m|md|mm|mmd|mq:target|mt:target|suffix:suff]-Mnostddef-Mnostdinc-Mpreprocess-Umacro-YI,directory-Yp,directory
๐ง Assembler Options ๐ง
-Wa,argument[,argument]...-Ya,directory
๐ Linker Options ๐
-acclibs--[no-]as-needed-Bdynamic-Bstatic-Bstatic-nvidia-c++libs-cudaforlibs-cudalib=libname-cudalibs-fortranlibs-g77libs-Ldirectory-llibrary-m-Mcudalib=libname-M[no]eh_frame-Mnostartup-Mnostdlib-M[no]rpath-Mmkl-nvmalloc-pthread-Rdirectory-r-rpath directory-s-shared-soname name-static-static-nvidia-uname--[no-]whole-archive-Wl,option[,option]...-Xlinker option[,option]...-YC,directory-Yl,directory-YL,directory-YS,directory-YU,directory
๐ Language Options ๐
-asmsuffix=suffix-byteswapio-csuffix=suffix-fsuffix=suffix-FSUFFIX=suffix-cuda=option-i2-i4-i8-i8storage-Mallocatable[=95|03]-M[no]backslash-Mbyteswapio-Mcray=pointer-Mcuda=option-M[no]dalign-M[no]dclchk-M[no]defaultunit-M[no]dlines-Mdollar=char-Mextend-Mfixed-M[no]free[form]-M[no]i4-M[no]iomutex-Mlibsuffix=suffix-M[no]llalign-Mnomain-Mobjsuffix=suffix-M[no]onetrip-M[no]r8-M[no]r8intrinsics=float-M[no]recursive-M[no]ref_externals-M[no]save-M[no]signextend-M[no]stack_arrays-Mstandard-Msyntax-only-M[no]unixlogical-M[no]upcase-module directory-Munlink_module-r4-r8-Wh,argument[,argument]...
โญ Target-specific Options โญ
-acc-noacc-gpu=option-K[no]ieee-Ktrap=option-march=target-m[no-]daz-ftz-M[no]daz-M[no]flushz-M[no]fpmisalign-M[no]fprelaxed=option-M[no]func32-M[no]longbranch-M[no]second_underscore-M[no]varargs-Mwritable-strings-mcmodel=small|medium-stdpar=option-nostdpar-ta=target-target=option-tp=target
When source files are compiled using any of the following options, the same option(s) should be passed when using nvfortran to link the objects: -g -mp -Mconcur -Mipa -Mprof. bestie, don't forget the link step matching energy, fr fr ๐
๐ธ Overall Options ๐ธ
--โ anything after this switch is treated as a filename. Note that most tools will not allow a filename starting with a dash, so bestie, avoid those. ๐-#โ display the invocations of the compiler, assembler, and linker. These invocations are the command lines created bynvfortran. โจ-###โ display invocations of the compiler, assembler and linker, but do not execute them. ๐ซถ-cโ skip the link step; compile and assemble only. ๐-defaultoptions(the default) and-nodefaultoptionsโ use (don't use) the default options set in site-specific or user-specificPREOPTIONSorPOSTOPTIONSdriver variables. ๐-dryrunโ use this option to display the invocations of the compiler, assembler, and linker but do not execute them. ๐ฆ-drystdincโ display the standard include directories without invoking the compiler. โญ-dumpversionโ display the shortened version of the compiler. For example,21.11or22.3. ๐-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. ๐-flagsโ display all validnvfortrancommand-line options in alphabetical order. ๐ฅ-fmax-errors=<n>โ specify maximun numbers of errors before terminating compilation. ๐ญ--gcc-toolchain=pathโ specify gcc toolchain location usingpathto gcc directory or gcc executable. The argument can either be 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; 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. ๐ธ-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) andnofileโ 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,severeandfatal).
The default is -Minform=warn.
-Mdetailโ display enhanced error messages that include source line and column pointer. This is currently available for syntax errors and some semantic errors. ๐-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. ๐ ๏ธ-Mlistand-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. ๐-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. ๐ฏ-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. ๐-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. ๐คซ-timeโ print execution times for the various steps in the compiler itself. โฑ๏ธ-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. ๐จ-x languageโ specify explicitly the language for the input files (instead of choosing based on the file name suffix). Possible values for language are: ๐ccpp,c++,cpp-outputf,Ff95,f95-cpp-inputf90,F90f77,f77-cpp-inputcuf,CUFasm,ASM,assembler,assembler-with-cpp
-x noneโ turn off language specification, so the input files are handled according to their suffixes. ๐-Wpass,option[,option...]โ pass option to the specified pass. Each comma-delimited option is passed as a separate argument. The passes are: ๐hโ for the Fortran 90/95 front end.0โ for the compiler back end.aโ for the assembler.iโ for the interprocedural analyzer.lโ for the linker.
-Ypass,directoryโ look in directory for pass pass, rather than in the standard area. The passes are: ๐hโ search for the Fortran 90/95 front end executable in directory.0โ search for the compiler back end executable in directory.aโ search for the assembler executable in directory.Cโ search for the compiler library in directory.iโ search for the InterProcedural Analyzer (IPA) in directory.lโ search for the linker in directory.Iโ set the compiler's standard include directory to directory. The standard include directory is set to a default value by the driver and can be overridden by this option.Lโ if the linker supports the-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. ๐-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. ๐ฆ-Mconcur[=option[,option,...]]โ > โ ๏ธ this option has been deprecated and will be removed in a future release. Instructs the compiler to enable auto-concurrentization of loops. This also sets the optimization level to a minimum of2; see-O. If-Mconcuris specified, multiple processors will be used to execute loops which the compiler determines to be parallelizable. When linking, the-Mconcurswitch must be specified or unresolved references will occur. TheOMP_NUM_THREADSorNCPUSenvironment variables control how many processors will be used to execute parallelized loops. The options can be one or more of the following: ๐allcoresโ bestie, this one just says "use ALL the cores" when the env varsOMP_NUM_THREADSandNCPUSaren't set. โก Tiny catch: it must be specified at link time, so don't be sneaky with it later.altcode:n,noaltcodeโ generate (or don't โ) alternate scalar code for parallelized loops. The parallelizer whips up scalar code that runs whenever the loop count is less than or equal to n. If you saynoaltcode, the parallelized version of the loop runs always, no matter what the loop count is.altreduction[:n]โ same vibe, but for parallelized loops that contain a reduction. If a parallelized loop has a reduction in it, the parallelizer generates scalar code that runs whenever the loop count is less than or equal to n.assoc(default),noassocโ turn on (or off) parallelization of loops with reductions.cncall,nocncall(default) โ assume (or don't assume ๐) that loops containing calls are safe to parallelize. It also means no minimum loop count threshold has to be met before parallelization happens, 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 handed out to the available processors. ๐ฐ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 get 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. ๐innermost,noinnermost(default) โ enable (disable) parallelization of innermost loops.levels:nโ parallelize loops nested at most n levels deep; the default is3.
-Mdepchk(default),-Mnodepchkโ assume (or don't assume) that potential data dependencies exist.
โ ๏ธ Heads up: -Mnodepchk may result in incorrect code. Like, actually wrong answers. Not a vibe. ๐
-Mdse,-Mnodse(default) โ enable (disable) the dead store elimination optimization.-Mextract=[option[,option,...]]โ run the subprogram extraction phase to get everything prepped 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 gets created if it doesn't already exist.[size:]numberโ a numeric option is assumed to be a size. Functions containing number or fewer statements are extracted. 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 can generate higher precision results since the multiply result isn't rounded before the addition. Delaying rounding until after addition, however, 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 some options override-Mnoframe. iykyk.-Midiom,-Mnoidiom(default) โ enable loop idiom recognition. Memory copy, memory set, and memory zero loops get recognized and replaced with calls to their respective optimized versions. Iconic behavior honestly. ๐-Minfo[=option[,option,...]],-Mnoinfo(default) โ emit useful information tostderr. The options are:allโ includes 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. Emit compute intensity information about loops.ipaโ emit information about the optimizations enabled by interprocedural analysis (IPA).loop|optโ emit information about loop optimizations. This includes 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. โจ
-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.except:funcโ specifies which functions should not be inlined. ๐ซ[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 the 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 isfunctions(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; see-O. If no option list is specified, then it's 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.arg/noarg(default) โ remove (don't remove) arguments replaced by-Mipa=ptr,const.-Mipa=noargimplies-Mipa=nolocalarg.const(default) /noconstโ enable (disable) propagation of constants across procedure calls.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.forceโ force all objects to recompile regardless of whether IPA information has changed.globals/noglobals(default) โ analyze (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 (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.
keepobj(default),nokeepobjโ keep (or don't keep) the optimized object files, using file name mangling, so that later application builds don't have to recompile everything. โจlibc,nolibc(default) โ optimize calls to certain standard C library routines (or don't ๐ ).libinline,nolibinline(default) โ allow (or don't allow) inlining from routines in libraries; heads up,-Mipa=libinlineimplies-Mipa=inline. ๐libopt,nolibopt(default) โ allow (or don't allow) recompiling and reoptimizing routines from libraries with IPA 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. ๐ฆmain:funcโ pick a function to serve as a global entry point; it may appear multiple times, and it disables linking. iconic.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 are recompiled at link time. silence is golden, bestie ๐คซreaggregation,noreaggregation(default) โ enable (or disable) global struct reaggregation. this one can change the order of struct members, or split structs into multiple structs, to improve memory locality and cache utilization. lowkey powerful.requiredโ return an error condition if IPA is inhibited for any reason, instead of the default behavior of just linking without IPA optimization.safe:[function|library]โ declares that the named function (or all functions in the named library) are safe; a safe procedure does not call back into the known procedures and does not change any known global variables. without-Mipa=safe, any unknown procedures will cause IPA to fail. โ ๏ธsafeall,nosafeall(default) โ declares that all unknown functions are safe (or not safe); see-Mipa=safe.shape,noshape(default) โ perform (or don't perform) Fortran 90 shape propagation.summaryโ only collect IPA summary information when compiling; this prevents IPA optimization of this file, but allows optimization for other files linked with this file. teamwork fr ๐ซถvestigial,novestigial(default) โ remove (or don't remove) functions that are not called. bye bestie ๐
-Mlre[=assoc|noassoc],-Mnolreโ enable (or disable) loop-carried redundancy elimination. theassocoption allows expression reassociation, andnoassocdisallows expression reassociation. โจ-Mmovnt,-Mnomovntโ force (or disable) generation of nontemporal moves.-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. plot twist: 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 to be used in a subsequent compile.-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, which 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 to take advantage of instruction cache locality by keeping hot paths close together. hot girl cache behavior ๐ฅ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. using -Mprof=dwarf is useful for this mode of profiling. ๐ง
-Mpropcond(default),-Mnopropcondโ enable (or disable) propagation of constant values derived from conditional branches with equality tests.-Mquadโ align large objects on quad-word boundaries.-Msafe_lastvalโ when 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. trust the vibe ๐ซถ-Msigned-zeroes(default),-Mno-signed-zerosโ toggles whether to honor (-Msigned-zeros) or ignore (-Mno-signed-zeros) issues associated with a signed0.0during optimization.-Mstride0,-Mnostride0(default) โ generate (or don't generate) alternate code for a loop that contains an induction variable whose increment may be zero.-Munroll[=option[,option...]],-Mnounroll(default) โ invoke (or don't invoke) the loop unroller. this also sets the optimization level to a minimum of 2; see-O. the option is one of the following:c:mโ instructs 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โ instructs 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โ instructs 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.-Mnounrollโ instructs the compiler not to unroll loops. hard pass ๐ โโ๏ธ
-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. it is unsafe because there are situations where the array elements allocated to some processors are not aligned. โ ๏ธ bestie read that again.-Mvect[=option[,option,...]],-Mnovect(default) โ pass options to the internal vectorizer. this also sets the optimization level to a minimum of 2, the equivalent of-O; for more info see optimization levels under-O. if no option list is specified, then 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 to combine adjacent loops into a single loop. ๐ซprefetchโ use prefetch instructions in loops where profitable.
simd[:{128|256|512}](default) /nosimdโ bestie, this one's giving vector SIMD instructions (AVX, AVX2, AVX512). โจ The argument can limit usage to 128-bit SIMD instructions. Specifying 512-bit SIMD instructions is only possible for target processors that support AVX512. ๐uniform/nouniform(default) โ Perform the same optimizations in the vectorized and residual loops. This may affect the performance of the residual loop. ๐
โ ๏ธ These options are also supported, but are not recommended for use in new development, except by experienced users, and may be phased out in future releases:
assoc(default) /noassocโ Enable (disable) certain associativity conversions that can change the results of a computation due to floating-point roundoff error differences. A typical optimization is to change the order of additions, which is mathematically correct, but can be computationally different, due to roundoff error. ๐งฎcachesize:number(default=automatic) โ Instructs the vectorizer, when performing cache tiling optimizations, to assume a cache size ofnumber. ๐๏ธgather(default) /nogatherโ Enable (disable) vectorization of loops with indirect array references. ๐งบidiom(default) /noidiomโ Enable idiom recognition; alternate form of-Midiom. ๐ชlevels:nโ Set maximum nest level of loops to optimize. ๐ชpartialโ Enable partial loop vectorization via innermost loop distribution. ๐ฐshort/noshort(default) โ Enable (disable) recognition of short vector operations that arise from scalar code outside of loops or within the body of loops. ๐ฉณsizelimit[:number]/nosizelimit(default) โ Limit the size of loops that are vectorized; the default is to attempt to vectorize all loops. ๐tile/notile(default) โ Enable (disable) loop tiling to optimize for cache locality. ๐งฑ-Mnovectโ disables the vectorizer, and is the default at-O0and-O1. ๐-Mzerotrip(default) /-Mnozerotripโ Include (don't include) a zero-trip test for loops. Use-Mnozerotriponly when all loops are known to execute at least once. ๐ซถ-mp[=option]โ Enable OpenMP pragmas and directives to explicitly parallelize regions of code for execution by accelerator devices or multi-processor system. The options allowed are:gpuโ Compile OpenMP directives for parallel execution on the GPU. ๐ฎ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. ๐ โโ๏ธ-O[level]โ Set the optimization level. ๐๏ธ If-Ois not specified, then the default level is 1 if-gis not specified, and 0 if-gis specified. If a number is not supplied with-Othen the optimization level is set to 2. The optimization levels and their meanings are as follows:-O0โ Sets the optimization level to 0. A basic block is generated for each statement. No scheduling is done between statements. No global optimizations are performed.-O1โ Sets the optimization level to 1. Scheduling within extended basic blocks is performed. No global optimizations are performed.-Oโ Sets the optimization level to 2, with no SIMD vectorization enabled. All level 1 optimizations are performed. In addition, traditional scalar optimizations such as induction recognition and loop invariant motion are performed by the global optimizer.-O2โ All-Ooptimizations are performed. In addition, more advanced optimizations such as SIMD code generation, cache alignment and partial redundancy elimination are enabled.-O3โ All-O1and-O2optimizations are performed. In addition, this level enables more aggressive code hoisting and scalar replacement optimizations that may or may not be profitable.-Ofastโ Enables-O3,-Mfprelaxed,-Mstack_arrays,-Mno-nan,Mno-inf, and-fcx-limited-range. Note-Mstack_arrayis disabled when both command line options-Ofastand-stdparare enabled. ๐ฅ-O4โ All-O1,-O2, and-O3optimizations are performed. In addition, hoisting of guarded invariant floating-point expressions is enabled.
-pgโ Enable gprof-style sample-based profiling; implies-Mframe. ๐
๐ Debugging Options ๐
-Cโ Add array bounds checking; the same as-Mbounds. ๐จ-gโ Generate symbolic debug information. This also sets the optimization level to zero, unless a-Oswitch is present on the command line. Symbolic debugging may give confusing results if an optimization level other than zero is selected. Using-O0the generated code will be slower than code generated at other optimization levels. ๐ข-goptโ Generate symbolic debug information, without affecting optimizations. This may give confusing results when debugging with optimizations; it is intended for use with other tools that use the debug information. ๐ ๏ธ-Mbounds/-Mnobounds(default) โ Add (don't add) array bound checking.-Mchkptrโ Check for unintended de-referencing of NULL pointers. ๐ซฃ-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 is 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. ๐ค-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. ๐-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.-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 is the linker zone โ where all the pieces get stitched together and the vibe check is literally โdoes it link or does it flop?โ ๐ Every flag here is passed along or handled exactly how the compiler says, no cap. โจ
-acclibsโ link-time option that adds the accelerator libraries to the link line. ๐ซถ--as-needed,--no-as-neededโ passed to the linker. Tells 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 that adds the C++ runtime libraries, allowing mixed-language programming. ๐-cudaforlibsโ link-time option that adds 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 that adds 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; addsdirectoryto 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 precedes'lib/<arch>'). ๐-nvmallocโ use a custom host memory allocator. ๐ง-pthreadโ adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker. ๐งต-Rdirectoryโ passed to the linker; instructs the linker to hard-code the pathnamedirectoryinto the search path for generated shared object files. Note that there cannot be a space betweenRanddirectory. โ ๏ธ-rโ passed to the linker; generate a re-linkable object file. ๐-rpath directoryโ passed to the linker to add thedirectoryto 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 specifiedname. ๐ท๏ธ-staticโ passed to the linker to specify static binding. ๐งฑ-static-nvidiaโ statically link in the NVIDIA runtime libraries, while using dynamic linking for the system libraries; implies-Mnorpath. โก-unameโ passed to the linker; generate undefined reference. ๐ซ--whole-archive,--no-whole-archiveโ passed to the linker. Instructs the linker to include all objects in subsequent archive files.--no-whole-archiverestores the default behavior. ๐ฆ-Wl,option[,option]...,-Xlinker option[,option]...โ pass each comma-delimited option to the linker. ๐-YC,directoryโ look indirectoryfor the standard compiler library files. ๐-Yl,directoryโ look indirectoryfor the linker. ๐-YL,directoryโ change the standard library directory todirectory. ๐๏ธ-YS,directoryโ look indirectoryfor the standard system startup object files. ๐ฑ-YU,directoryโ passed to the linker; change library search path. ๐งญ
๐ธ Language Options ๐ธ
-asmsuffix=suffixโ bestie, this says โa file with thissuffixis an assembly language file.โ Thatโs it, thatโs the whole vibe. โจ-byteswapioโ swaps bytes from big-endian to little-endian or vice versa when doing input/output of unformatted Fortran data. Using this lets you read/write Fortran unformatted data files that are compatible with the ones produced on Sun or SGI systems. ๐-csuffix=suffixโ defines that a file with the givensuffixis a C source file.-fsuffix=suffixโ defines that a file with the givensuffixis a Fortran source file.-FSUFFIX=suffixโ also defines that a file with the givensuffixis a Fortran source file. (Yes, uppercase bestie, itโs its own little flag.)-cuda[=option[,option...]โ enables CUDA Fortran, adds CUDA include paths, and links with the CUDA runtime libraries.-cudais required on the link line. If-cudais used in compilation, it must also be used for linking. For target specific options, peep-gpu. For linking additional CUDA libraries (e.g. math libraries), peep-cudalib. Use these sub-options to tailor compilation of CUDA Fortran accelerator regions:charstringโ enables limited support for character strings in 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. For operations involving integers, use 64-bits for computations.-i8storageโ allocates 8 bytes forINTEGERandLOGICAL.-Mallocatable[=95|03]โ picks whether to use Fortran 1995 or Fortran 2003 semantics for assignments to allocatable objects and allocatable components of derived types. Fortran 1995 semantics require the user to allocate the object or component and require that an array object or component be conformant before the assignment. Fortran 2003 semantics require the compiler to add code to check whether the object or component is allocated and whether an array object is conformant before the assignment, and to allocate or reallocate if not. okay so thatโs the whole lore. ๐ซถ-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. Use of this option enables reading/writing of Fortran unformatted data files compatible with those produced on Sun or SGI systems. Same energy as-byteswapio, different spelling. ๐ซ-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.-Mnodalignmay lead to data alignment exceptions. โ ๏ธ-Mdclchk,-Mnodclchk(default) โ require / donโt require that all variables be declared.-Mdefaultunit,-Mnodefaultunit(default) โ treat / donโt treat'*'as stdout/stdin regardless of the status of units 6/5.-Mnodefaultunitcauses*to be a synonym for 5 on input and 6 on output;-Mdefaultunitcauses*to be a synonym for stdin on input and stdout on output.-Mdlines,-Mnodlines(default) โ treat / donโt treat lines beginning with D in column 1 as executable statements, ignoring the D.-Mdollar=charโ sets the character used to replace dollar signs in names to bechar. Default is an underscore (_).-Mextendโ allows 132-column source lines.-Mfixedโ processes Fortran source using fixed form specifications. The-Mfreeoptions specify free form formatting. By default files with a.for.Fextension use fixed form formatting.-Mfree,-Mfreeform,-Mnofree,-Mnofreeformโ process Fortran source using free form specifications. The-Mnofreeand-Mfixedoptions specify fixed form formatting. By default files with a.f90,.F90,.f95or.F95extension use freeform formatting.-Mi4(default),-Mnoi4โ treat / donโt treatINTEGERasINTEGER*4.-Mnoi4treatsINTEGERasINTEGER*2.-Miomutex,-Mnoiomutex(default) โ generate / donโt generate critical section calls around Fortran I/O statements.-Mlibsuffix=suffixโ defines that a file with the givensuffixis 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. Useful for using thenvfortrandriver to link programs with the main program written in C or C++ and one or more subroutines written in Fortran. ๐-Mobjsuffix=suffixโ defines that a file with the givensuffixis 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. ๐ซ-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 value65535is 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.-Msyntax-onlyโ performs only syntax checking, semantic checking, and Fortran module (.mod) file generation.-Munixlogical,-Mnounixlogical(default) โ when-Munixlogicalis in effect, a logical is considered to be.TRUE.if its value is non-zero and.FALSE.otherwise. When-Mnounixlogicalis in effect (the default), a logical is considered to be.TRUE.if its value is odd and.FALSE.if its value is even.-Mupcase,-Mnoupcase(default) โ preserve / donโt preserve case in names.-Mnoupcasecauses all names to be converted to lower case. Note that, if-Mupcaseis used, then variable name'X'is different than variable name'x', and keywords must be in lower case. ๐-module directoryโ save/search for module files indirectory.-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.-r8โ interpretsREALvariables 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 ๐ฏ
-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.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 compare CPU/GPU results. Accelerated code sections get run in redundant mode, and data gets compared whenever it would ordinarily be moved off the accelerator. Lowkey very useful for vibe-checking your GPU math ๐ccXYโ Generate code for a device with compute capabilityXY. Multiple compute capabilities can be specified, and one version will be generated for each. By default, the compiler will detect the compute capability for each installed GPU. Use-help -gputo see the valid compute capabilities for your installation.ccallโ Generate code for all compute capabilities supported for this target and by the selected CUDA Toolkit version. Itโs giving โcover all the basesโ energy โจccnativeโ Detects the visible GPUs on the system and generates codes for them. If no device is available the default compute capability will be used (cc50).ccall-majorโ Compile for all major supported compute capabilities (does not include PTX for the highest major virtual architecture, see-gpu=[no]rdcoption for that support).cudaX.Yโ Use CUDAX.YToolkit compatibility, where installed.deepcopyโ Enable Full Deepcopy support in OpenACC Fortran.fastmathโ Enable the fast math library, which includes faster, but lower precision, implementations of certain math and intrinsic functions.flushz,noflushz(default) โ Enable (disable) flush-to-zero mode on the GPU.fma,nofmaโ Generate (do not) fused multiply-add operations on the GPU. This is enabled by default at optimization level-O1.implicitsections,noimplicitsections(default) โ Change (do not change) array element references in OpenACC and OpenMP data clause to array sections references.interceptdeallocations,nointerceptdeallocationsโ Intercept (do not intercept) LIBC function calls (e.g.free) and call the corresponding CUDA memory deallocation version if address is in pinned or managed memory, regular version otherwise.keepbinโ Keep the generated CUDA binary, with a.cubinsuffix.keepgpuโ Keep the generated CUDA GPU source files, with a.gpusuffix.keepltoirโ Keep the generated GPU LTOIR files, with a.ltoirsuffix. Works only when-gpu=ltois enabled.keepptxโ Keep the generated portable assembly files, with a.ptxsuffix.lineinfo,nolineinfo(default) โ Generate debugging line information.loadcache:[L1|L2]โ Generate code to cache global memory loads in the L1 or L2 hardware cache.ltoโ Enable Device Link Ltime Optimization (Device LTO).maxregcount:nโ Set the maximum number of registers to use in the generated GPU code.managedโ Allocate any dynamically allocated data in CUDA Managed memory. This option must appear in both the compile and link lines. This option may not be used with-gpu=pinned.interceptโ Intercept LIBC function calls (e.g.free) and call their managed memory version if address is in managed memory, regular version otherwise.
nomanagedโ Do not allocate any dynamically allocated data in CUDA Managed memory. Use with-stdparto prevent that flag's implicit use of-gpu=managedwhen CUDA Managed memory capability is detected.nounifiedโ Do not compile for CUDA Unified memory capability. Use with-stdparto prevent that flag's implicit use of-gpu=unifiedwhen CUDA Unified memory capability is detected.pinnedโ Allocate any dynamically allocated data in CUDA Pinned host memory. This option must appear in both the compile and link lines. This option may not be used with-gpu=managed|unified.interceptโ Intercept LIBC function calls (e.g.free) and call their pinned memory version if address is in pinned memory, regular version otherwise.
mem:[mode]โ Select GPU memory mode from one of the following options:separate,managed,unified. This option cannot be combined with-gpu=pinned,gpu=managedor-gpu=unified.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โ Allocate 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โ Compile 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-gpu=mem:unified:[no]managedallocsubflags. This option must appear in both the compile and link lines.
mem:unified:managedalloc,mem:unified:nomanagedallocโ Allocate (do not allocate) any dynamically allocated data in CUDA Managed Memory.mem:separate:pinnedalloc,mem:separate:nopinnedallocโ Allocate (do not allocate) any dynamically allocated data in CUDA Pinned host memory.ptxinfoโ Print ptxas information.rdc(default),nordcโ Generate (do not generate) relocatable device code for separate compilation, and invoke the device linker before the host linker at the link step.redundantโ Run accelerated code redundantly on CPU. Implied byautocompare.safecacheโ Allow variable-sized array sections in cache directives; compiler assumes they fit into CUDA shared memory.sm_XYโ Generate code for a device with compute capabilityXY. Multiple compute capabilities can be specified, and one version will be generated for each. By default, the compiler will detect 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. Give an error if the total stack size of a kernel or procedure exceedslimitKBytes. The default isstacklimit:512. Okay bestie, this one is literally deprecated, so donโt get too attached ๐ญtripcount:hostโ Calculate 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โ Calculate 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โ Enable (disable) compile-time warnings when loop trip counts are calculated on the host instead of on the device.tripcount:check,tripcount:nocheckโ Insert (do 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โ Compile 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. This option may not be used with-gpu=pinned.interceptโ Intercept LIBC function calls (e.g.free) and call their unified version if address is in unified memory, regular version otherwise.
unroll,nounrollโ Automatically (do not) unroll inner loops. This is enabled by default at optimization level-O3.
Okay bestie, stepping out of the -gpu nest for a sec โ these next two are their own top-level flags ๐ซถ
-Kieee,-Knoieee(default) โ Perform 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. Accuracy vs. speed, the eternal group-chat debate ๐-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.-Ktrapis only meaningful when compiling a C/C++ main function or Fortran main program.
-Ktrap=fp is shorthand for -Ktrap=divz,inv,ovf. Iconic shorthand behavior, no cap โจ
okay so these next options are all about the processorโs floating-point exception mask bits โ yes bestie, weโre deep in the โจfloating-pointโจ of it all ๐
. 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). ๐ญ
-march=targetโ This is literally 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 โ shorthand for-Mnodaz -Mnoflushz.-mdaz-ftzis the default setting and specifies that denormal operands and results are treated as zero โ shorthand for-Mdaz -Mflushz๐.-Mdaz,-Mnodazโ Enable [disable] mode to treat denormal (subnormal) floating-point operands as zero.-Mdazis the default setting forx86_64andaarch64processors โจ.-Mflushz,-Mnoflushzโ Enable [disable] setting floating-point denormal (subnormal) results to zero;-Mflushzis the default setting forx86_64andaarch64processors ๐.-Mfpmisalign,-Mnofpmisalignโ Allow (don't allow) vector arithmetic instructions with memory operands that are not aligned on 16-byte boundaries ๐.-Mfprelaxed [=option[,option,...]],-Mnofprelaxed(default) โ Perform (don't perform) certain floating-point operations using relaxed precision when it improves speed. The options are:divโ Perform divide using relaxed precision.intrinsicโ Perform certain intrinsic functions using relaxed precision.order,noorderโ Allow (don't allow) expression reordering, including factoring such as computinga*b+a*casa*(b+c).recipโ Perform reciprocal operations using relaxed precision.rsqrtโ Perform reciprocal square root (1/sqrt) using relaxed precision.sqrtโ Perform square root using relaxed precision.
With no options, -Mfprelaxed will choose to generate relaxed precision code for those operations that generate a significant performance improvement, depending on the target processor ๐.
-Mfunc32(default),-Mnofunc32โ Align (don't align) functions on 32 byte boundaries ๐ง.-Mlongbranch,-Mnolongbranch(default) โ Enable (disable) long branches โญ.-Msecond_underscore,-Mnosecond_underscore(default) โ Add (don't add) a second underscore to the name of a Fortran global if its name already contains an underscore. This option is useful for maintaining compatibility withg77, which adds a second underscore to such symbols by default ๐.-Mvarargs,-Mnovarargs(default) โ Generate code for calls made from Fortran to C routines to use varargs calling sequence ๐ซถ.-Mwritable-stringsโ Store string constants in the writable data segment ๐ฅ.-mcmodel=small|mediumโ pick the 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 โจ.gpuโ (ISO Fortran 2018) DO-CONCURRENT is compiled for parallel execution on the GPU. This option implies-gpu=unifiedon targets with Unified memory capability and-gpu=managedotherwise.multicoreโ (ISO Fortran 2018) DO-CONCURRENT is compiled for parallel execution on the CPU.
-nostdparโ Execute (ISO Fortran 2018) DO-CONCURRENT sequentially ๐ฆ.-ta=targetโ This option has been deprecated please refer to-acc.-ta=teslaโ This option has been deprecated please refer to-acc=gpuand-gpu.-ta=multicoreโ This option has been deprecated please refer to-acc=multicore.-ta=hostโ This option has been deprecated please refer to-acc=host.
-target=optionโ Select the target for all parallel programming paradigms used (OpenACC, OpenMP, Standard Languages); possibilities are:gpuโ Globally set the target device to an NVIDIA GPU ๐.multicoreโ Globally set the target device to the host CPU ๐ธ.
-tp=targetโ Specify the type of the target processor. Issue:
nvfortran -help -tp
to display the list of recognized target processors ๐ .
๐พ FILES ๐พ
a.outโ executable output filefile.aโ library of object filesfile.fโ fixed-format Fortran source filefile.Fโ fixed-format Fortran source file that requires preprocessingfile.f90โ free-format Fortran source filefile.F90โ free-format Fortran source file that requires preprocessingfile.f95โ free-format Fortran source filefile.F95โ free-format Fortran source file that requires preprocessingfile.f03โ free-format Fortran source filefile.F03โ free-format Fortran source file that requires preprocessingfile.forโ fixed-format Fortran source filefile.fppโ fixed-format Fortran source file that requires preprocessingfile.cufโ free-format CUDA Fortran source filefile.CUFโ free-format CUDA Fortran source file that requires preprocessingfile.ipaโ InterProcedural Analyzer (IPA) filefile.ipoโ InterProcedural Analyzer (IPA) filefile.oโ object filefile.sโ assembler source file.mynvfortranrcโ You may add custom switches or make other additions tonvfortranby creating a file named.mynvfortranrcin your home directory ๐.
The installation of this version of the compiler resides in Basedir/Linux_x86_64/dev/; other versions may coexist in Basedir/Linux_x86_64/release/. Basedir is the root of the compiler installation directory, specified by the installer. The default is /opt/nvidia/hpc_sdk โจ.
The compiler installation subdirectories are:
compilers/bin/โ Compiler and tool executables and configuration files (rcfiles).compilers/include/โ Compiler include files.compilers/lib/โ Runtime libraries and object files.comm_libs/โ Communication libraries, including NCCL and NVSHMEM.math_libs/โ Math libraries, including cuBLAS, cuTENSOR, cuSPARSE, cuFFT, cuSOLVER, and cuRAND.profilers/โ Profilers, including Nsight Compute and Nsight Systems ๐.
๐ SEE ALSO ๐
nvc (1), nvc++ (1), and the NVIDIA User's Guide ๐ซถ.
๐ฉบ DIAGNOSTICS ๐ฉบ
The compiler produces information and error messages as it translates the input program. The linker and assembler may issue their own error messages ๐ญ.
๐ catch you in the terminal, bestie โ pgf95(1), September 2026 edition, signing off ๐
๐ฆ 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