HP UX Fortran Software manual Name=def, +DAmodel, +DDdatamodel, Datamodelare, +dfname

Page 25

 

Note that this option does not pass source files to the C preprocessor. To do that, you

 

must also specify the +cpp=yes option.

-D name[=def]

-Ddefines a symbol name (name)to the C preprocessor. If you do not provide a

 

definition (def) for the symbol name, name is defined as 1. This option applies only

 

to files that are passed to the C preprocessor.

+DAmodel

+DA generates object code for a particular version of the PA-RISC architecture. By

 

default, the compiler generates code for the machine model you are compiling on.

 

With this option, you can override the default, causing the compiler to generate code

 

for the machine on which the program will execute rather than for the machine on

 

which it is compiled.

 

modelcan be one of the following:

 

A PA-RISC version number (1.1or2.0™)

 

A model number (for example, 750or870)

 

One of the PA-RISC processor names (for example, PA7000, PA7100, or PA8000)

 

The word portable, which causes the compiler to generate code that is compatible

 

across all PA-RISC 1.1 and 2.0 systems

 

For best performance, use +DA with the model number or architecture of the machine

 

on which you plan to execute the program.

 

The +DA option also specifies the appropriate search path for HP-UX math libraries.

 

If your program calls mathematical functions,+DA2.0 links in the PA2.0 version of

 

the math library, while +DA1.1 links in the PA1.1 library version. (For more information

 

about using math libraries, see the HP-UXFloating-Point Guide.)

 

With +DA2.0W, memory addresses are 64-bit values. This allows common blocks

 

and dynamically allocated memory to exceed 32-bit address limits. This feature is

 

restricted by the available virtual memory on the system where the application is run.

 

NOTE:

You must specify +DA2.OW to generate 64-bit code. At PA64, all data types

 

remain the same size as at PA32 except for pointers. Fortran pointers are hidden

 

from the user and cannot be directly manipulated

+DA2.OW

Changes the default size of a Cray pointer. It will become the large of a default-sized

 

integer and a C pointer (8-bytes), rather than the 4-byte default.

+DC

Specifies cache values to the compiler. The syntax is +DC <a>:<b>:<c>:

 

where <a> is the total cache size in bytes where <b> is the cache line size in

 

bytes; and <c> cache associativity.

+DC7200

+DC7200performs memory hierarchy optimizations for the PA7200 processor.

+DDdatamodel

Generate code using either the ILP32or LP64data model. Defined values for

 

datamodelare:

 

32

Use the ILP32data model. The sizes of the int, long, and

 

 

pointer data types are 32-bits.

 

64

Use the LP64data model. The size of the int data type is

 

 

32-bits, and the sizes of the long and pointer data types are

 

 

64-bits. Defines LP64 to the preprocessor.

 

The default is +DD32.

+[no]demand_load

+demand_load causes the output file from the linker to be marked demand load.

 

When a process is marked demand load, its pages are brought into physical memory

 

only when they are accessed. The default, +nodemand_ load, causes the output file

 

from the linker not to be marked demand load. The -qoption performs the same

 

function as +demand_load, and the -Qoption performs the same function as

 

+nodemand_load.

+dfname

Specify profile database file name for profile-based optimizations.

+dfrequires the specification of +P.

This option is a synonym for +Oprofile=use: filename.

This option is only valid on the Itanium® processor family architecture.

The default is flow.dataif a name is not specified.

Command-line options 25

Image 25
Contents Abstract HP Fortran Programmer GuidePage Contents Controlling data storage Using the on statementDebugging Performance and optimizationWriting HP-UX applications 107 Using Fortran directives 123Calling C routines from HP Fortran 110 Migrating to HP Fortran 131Porting to HP Fortran 141 Fortran 2003 Features 151Documentation Feedback 153 Glossary 154 Index 159 HP secure development lifecycle HP Fortran compiler environment An overview of HP FortranAn overview of HP Fortran Options for controlling the f90 driver Driver+dryrun +preinclude= fileOptions for controlling the C preprocessor PreprocessorOptions for controlling the front end Front-end+moddir=directory Options for controlling optimization Back-end+Onooptimization Options for controlling code generationOptimization +DAmodelOptions for controlling the Linker LinkerLdirectory +FPflagsOoutfile HP-UX operating system ToolsWl ,options F90 command syntax Compiling with the f90 commandCompiling and linking $ f90 hello.f90F90 command syntax Command-line optionsCommand-line options Example 2 hello.f90Commonly-used options Command-line options by categoryCommonly-used options +saveOptions listed by category Option descriptionsDo I+1, N Example 3 Example+allowunaligned 14164 Data type sizes and +autodbl4+autodbl +autodbl4 Boption+charlit77 +cpp=default+check=bounds +nocfc+DAmodel Name=def+DDdatamodel DatamodelareItanium BlendedItanium2 NativeValues for the +FP option Gformat77 Signals recognized by the +fpexception option+hugecommon Example 4 % f90 +hugecommon=results pcvals.f90 +indirectcommonlist=file /usr/include directory +noimplicitnone+initheapcomplex=rvalival +initheapinteger=ivalIpo +io77+nocheckuf +nolibsRequires concurrent use of the +Oprofile=use option Levels of optimizationWith different values of optlevel +noobjdebug+pa1 +nodemandload the default +demandload option. The default is +nodemandload+r8 +realconstant=singleTp,/usr/ccs/lbin/cpp Tx,pathF90com End.oWx,arg1,arg2,...,argN Bdefault=symbol,symbol Symbol binding optionsBextern =symbol ,symbol Bhidden =symbol ,symbolReviewing general optimization options Using optimization optionsF90 +O3 +Osize myprog.f90 +Onoall +Oconservative+Onoautopar +Oautopar and omit +OparallelF90 +O3 +Onomoveflops +Ofltacc myprog.f90 Fine-tuning optimization optionsDefault is +Odataprefetch Default is +Onocxlimitedrange+Ocachepadcommon option +Onocxlimitedrange+Onofastaccess +Onofenvaccess+Onoentrysched +OnofailsafeOptimizations performed by +Onofltacc +Onoinline +Oinlinebudget=n +Oinlinebudget enables+Onoinlinefilename +Onoinline=function1,function2Millicode versions of intrinsic functions Values for the +Oinlinebudget option+Onoloopunroll=factor +inlinelevel num+Oloopunroll=4 +Onoloopunrolljam+Oparallelintrinsics Default is+Onoparmsoverlap+Onoparmsoverlap +Onopipeline+Onorecovery Default is +OnopromoteindirectcallsDefault is +Oshortdata=8 For +Oprofile=collectarc,strideFilenames recognized by f90 FilenamesLinking with f90 vs. ld Linking HP Fortran programsLibraries linked by default on Itanium Libraries linked by default on PA-RISCLinking to libraries $ f90 -c hello.f90 # compileLinking HP Fortran 90 routines Linking to nondefault librariesLinking to shared libraries Additional HP Fortran librariesOpt/fortran90/lib/pa2064/ -lF90 -lisamstub Compiling programs with modules Special-purpose compilationsLibrary search rules $ f90 -Wl,-a,archive prog.f90 -lmSpecial-purpose compilations Example ExamplesExample 6 Example 2-2 main.f90 Example 7 Example 2-3 code.f90Example 8 Example 2-4 data.f90 Compiling with make$ f90 -o dostats data.f90 code.f90 main.f90 $ dostatsManaging .mod files Compiling for different PA-RISC machinesExample 9 Example 2-5 makefile $ makeCompiling with +pic Creating shared librariesLinking with -b Using the C preprocessorProcessing cpp directives Using the C preprocessorExample 13 Example 2-9 cppdirect.f90 $ f90 +cpp=yes -D Debug cppdirect.f90Creating shared executables Creating demand-loadable executablesSaving the cpp output file Using environment variables Compiling in 64-bit mode$ f90 +noshared prog.f90 HP Fortran environment variablesSTF90COM64 environment variable F90ROOT environment variableHPF90OPTS environment variable $ f90 +list hello.f90Floating installation Floating installationLpath environment variable Mpnumberofthreads environment variableAlternate-path/opt/fortran90.3.6.1 Setting up floating installationDisabling implicit typing Controlling data storageAutomatic and static variables Disabling implicit typingControlling data storage ContainsIncreasing the precision of constants Increasing default data sizes Increasing default data sizesIncreasing default data sizes Usr/lib/libpthread.sl Sharing data among programsWhich creates multiple threads Sharing data among programs $ gotosleep$ wakeup Modules vs. common blocksIm up Modules vs. common blocks Debugging Using the HP WDB debuggerStripping debugging information Signal Signals recognized by +fpexceptionHandling runtime exceptions Floating-point exceptionsFloating-point exceptions Bus error exception= 1.0/0.0 Segmentation violation exception Illegal instruction exceptionBad argument exception Using debugging linesExceptions handled by the on statement Using the on statementOn REAL8 DIV 0 Call divzerotrap Exceptions handled by the on statementOn Double Precision DIV 0 Call divzerotrap Actions specified by onExceptions handled by the on statement Terminating program execution Ignoring errorsExample 14 Example5-1 abort.f90 Example 15 Example5-2 ignore.f90Trapping floating-point exceptions Calling a trap procedureTrapping integer overflow exceptions On Double Precision Overflow Call trapAllowing core dumps Trapping +Ctrl-C trap interruptsExample 17 Example5-4 callitrap.f90 On Real Overflow Ignore Example 18 Example 5-5 allowcore.f90Using profilers Using profilersPerformance and optimization HP CaliperOpt/ansic/bin/cc -Aa +O3 -o program +Oprofile=collect Comparing Program PerformanceProgram.c ProgramprogramargumentsGprof Using Options to Control Data CollectionSpecifying PBO file names and locations $ gprof prog gprof.outUsing +O to set optimization levels Using options to control optimizationProf $ f90 +O4 file.f90+O2, -O Using the optimization options+O3 +O4$ f90 +02 +Oaggressive +Osize prog.f90 Fine-tuning optimization options$ f90 +O4 +Oaggressive +Ofltacc prog.f90 Packaged optimization options+Ofastaccess at level Is +Onofastaccess at+O2 +Ofltacc=relaxedFast +Ofltacc=relaxed . This+Onoinitcheck +Onolibcalls +Oinlinelevel num+Olibcalls +Onoloopunroll=n+Opipeline +Onoparminit+Orecovery +Onoreturn +Oregreassoc+Oshortdata=8 +Ovectorize option on+Onowholeprogrammode Conservative vs. aggressive optimization+Owholeprogrammode Parallelizing HP Fortran programs Conservative, aggressive, and default optimizationsCompiling for parallel execution F90 +O3 +Oparallel -c x.f90 y.f90 F90 +O3 -c z.f90Profiling parallelized programs Performance and parallelizationConditions inhibiting loop parallelization Calling routines with side effects parallellizationData dependences Indeterminate iteration countsVectorization Using the +Ovectorize optionF90 +O3 +Ovectorize prog.f90 Vector routines called by +OvectorizeSaxpy Controlling vectorization locallySdot VecdmultaddExample 19 Example 6-1 axpy.f90 Calling Blas library routinesREAL, External sdot Industry-wide standard VectorizationControlling code generation for performance Writing HP-UX applications Accessing command-line arguments$ fprog arg1 another arg Example 20 Example 7-1 getargs.f90Stream I/O using Fstream Using HP-UX file I/OPerforming I/O using HP-UX system calls Calling HP-UX system and library routinesObtaining an HP-UX file descriptor Using HP-UX file I/OData types Calling C routines from HP FortranData type correspondence for HP Fortran and C Logicals Unsigned integersSize differences between HP Fortran and C data types Size differences after compiling with +autodblComplex sqrcomplexCOMPLEX cmxval Complex numbersExample 21 Example 8-1 passcomplex.f90 Derived types Argument-passing conventionsPointers Example 22 Example 8-2 sqrcomplex.cCase sensitivity Integer ptr INTEGER, DIMENSION100 iarrayVoid fooint *ptr, int iarray100, int Call foo%REFptr, %REFiarray, %VALi$HP$ Alias bubblesort = BubbleSort%REF,%VAL Example 23 Example 8-3 sortem.cExample 24 Example 8-4 testsort.f90 Case sensitivityREAL, DIMENSION2,3,4 Memory layout of a two-dimensional array in Fortran and CArrays IntExample 26 Example 8-6 getarray.c Example 25 Example 8-5 passarray.f90Null-terminated string StringsFortran hidden length argument Passing a stringStrings Following are example C and Fortran programsExample 27 Example 8-7 passchars.f90 File handlingExample 28 Example 8-8 getstring.c File handling Example 29 Example 8-9 fnumtest.f90Int somedata Sharing dataExtern int somedata Extern int globals100Using HP Fortran directives Using Fortran directivesDirective syntax HP Fortran directivesDescription and restrictions Syntax$HP$ Alias name = external-name arg-pass-mode-list NameCase sensitivity Local and global usageArgument-passing conventions For more information StringsExample 31 Example 9-1 prstr.c Example 32 Example 9-2 passstr.f90Specified on the command line Disables the inclusion of source lines in the listing fileExample 33 Example Listing fileControlling vectorization Compatibility directivesCompatibility directives recognized by HP Fortran Vendor Directive CrayControlling dependence checks Controlling parallelizationControlling checks for side effects Compatibility directivesUsing Fortran directives Migrating to HP Fortran Command-line options not supportedIncompatibilities with HP Fortran Compiler limitsFloating-point constants Format field widthsIntrinsic functions Double Precision x =Data types and constants Procedure calls and definitionsDirectives Input/outputFoo**REALbar, 8 ! foo**bar KEY=Source code issues Migration issuesMigration issues MiscellaneousHP Fortran 77 directives supported by f90 options DirectivesIntrinsic functions Command-line option issuesConflicting intrinsics and libU77 routine names F77 options supported by f90Data file issues Object code issuesHP-supplied migration tools Approaches to migration$ fid +800 file.f $ fid +es program.f Compatibility extensions Porting to HP FortranCompatibility statements END structure definitionCompatibility directives Compiler directivesPointer Cray-style +Oparallel orNonstandard intrinsic procedures in HP Fortran Intrinsic proceduresDirective prefixes recognized by HP Fortran +Oparallel or +OvectorizeUninitialized variables Using porting optionsLarge word size Using porting optionsOne-trip do loops $ f90 testloop.f90Example 34 Example 11-1 clash.f90 Name conflictsExternal int1 Source formats Names with appended underscoresEscape sequences Porting from Tru64 to HP Fortran+cfc New options EnhancementsNof66alternate for +noonetrip Porting from Tru64 to HP Fortran+nopadsrc Altparam Check noboundsoptions for example, -nocheckboundsInteroperability with C Fortran 2003 FeaturesInput/output enhancements Miscellaneous enhancementsFortran 2003 Features Object orientation featuresData enhancements 153 Documentation FeedbackGlossary Glossary155 So on. See also row-major orderAlso filename extension 157 Memory faultSee ttv Index Symbols159