Home

LF95 Linux User`s Guide - Lahey Computer Systems

image

Contents

1. Data Type Fortran c Comments one byte logical OGICAL 1 L1 char Ll 1 byte two byte logical OGICAL 2 L2 short int L2 2 bytes four byte logical OGICAL 4 L4 long int L4 4 bytes eight byte logical OGICAL 8 L8 eae meng tee 8 bytes one byte integer INTEGER 1 I1 er char 1 byte two byte integer INTEGER 2 I2 short int I2 2 bytes four byte integer INTEGER 4 I4 long int I4 4 bytes 54 Lahey Fujitsu Linux64 Fortran User s Guide Returning Function Values to C Table 7 Corresponding Data Types in Fortran and C complex Data Type Fortran c Comments 1 1 j eight byte integer INTEGER 8 I8 E eae ren 8 bytes real REAL 4 R4 float R4 4 bytes double precision REAL 8 R8 double R8 8 bytes real uadruple preci 1 1 qnac pieP REAL 16 R16 oe ts 16 bytes sion real R16 struct complex COMPLEX 4 C8 float r i 8 bytes Ce i struct double precision COMPLEX 8 C16 double r i 16 bytes complex C16 quad precision oe COMPLEX 16 C32 long double 32 bytes ey ISI Gas character fixed See examples for TYPE TAG D CHARACTER 10 S char S 10 length ae assumed length APESE struct tag ened Size in bytes i INTEGER I4 i derived type REAL 8 R8 int I4 sum of all compo SANE ee R8 nents array of pointers no
2. File Formats Formatted Sequential File Format Files controlled by formatted sequential input output statements have an undefined length record format One Fortran record corresponds to one logical record The length of the unde fined length record depends on the Fortran record to be processed The maximum length may be assigned in the OPEN statement RECL specifier A linefeed character terminates the log ical record If the edit descriptor or edit descriptor is specified for the format of the formatted sequential output statement the Fortran record does not include the linefeed Unformatted Sequential File Format Files processed using unformatted sequential input output statements have a variable length record format One Fortran record corresponds to one logical record The length of the vari able length record depends on the length of the Fortran record The length of the Fortran record includes 4 bytes added to the beginning and end of the logical record The maximum length may be assigned in the OPEN statement RECL specifier The beginning area is used when an unformatted sequential READ statement is executed The end area is used when a BACKSPACE statement is executed 124 Lahey Fujitsu Linux64 Fortran User s Guide Direct File Format Formatted Direct File Format Formatted Files processed by formatted direct input output statements have a fixed length record for mat One Fortran record corresponds to one lo
3. Files show exec Display the name of the current executable file Lahey Fujitsu Linux64 Fortran User s Guide 79 Chapter 4 Command Line Debugging with fdb 80 param execpath path Add path to the execution file search path If path is omitted the value of the search path is displayed param srcpath path Add path to the source file search path when searching for procedures variables etc If path is omitted the value of the search path is displayed Note that this search path can also be controlled via the FDB_SRC_PATH environment variable which is comprised of a list of directories separated by colons show source Display the name of the current source file show sources Display the names of all source files in the program Fortran 95 Specific breakall md Set a breakpoint in all Fortran procedures including internal procedures in module md breakall func Set a breakpoint in all internal procedures in procedure func show ffile Displays information about the files that are currently open in the Fortran program show fopt Display the runtime options specified at the start of Fortran program execution Memory Leak Detection param leak off mem all Controls level of memory leak checking where the level is determined as follows off No leak checking default mem Memory manipulation functions and statements such as ALLOCATE DEAL LOCATE malloc free and memcpy are checked all Character
4. In example above automatic parallelization and optimization control lines OCLs are in effect during compilation This program is executed using all active CPUs on the machine lfc parallel test2 f 5001 i test2 f line 2 DO loop with index i parallelized setenv PARALLEL 2 a out setenv PARALLEL 4 a out In this second example the environment variable PARALLEL is set to 2 and the program executes with two CPUs Next the environment variable PARALLEL is set to 4 and the pro gram executes with four CPUs Details of Multi Processing This section describes multi processing in more detail Targets for Automatic Parallelization Target statements of the automatic parallelization are DO loops including nested DO loops and array operations array expressions and array assignments Loop Slicing Automatic parallelization may slice a DO loop into several pieces The elapsed execution time is reduced by executing the sliced DO loops in parallel Lahey Fujitsu Linux64 Fortran User s Guide 89 Chapter 5 Multi Processing PRO version only 90 do i 1 50000 a i b i c i end do Different iterations of the DO loop can be executed on different CPUs at the same time CPU 1 do il 1 25000 a il b il c il end do CPU 2 do i2 25001 50000 a i2 b i2 c i2 end do Array Operations and Automatic Parallelization Automatic parallelization also targets statements with array operatio
5. break file procname Sets a breakpoint at the entry point of the procedure proc in the source file file If omitted file defaults to the current file Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character break addr Sets a breakpoint at address addr break Sets a breakpoint at the current line breakoff 7 Disables breakpoint number n When 7 is omitted all breakpoints are disabled The break points still exist and can be enabled using the breakon command Note that the symbol is required breakon 7 Enables breakpoint number n When n is omitted all breakpoints are enabled Note that the symbol is required Lahey Fujitsu Linux64 Fortran User s Guide Breakpoints condition n expr Associate conditional expression expr with the breakpoint whose serial number is n Note that the symbol is required condition n Remove any condition associated with the breakpoint whose serial number is n Note that the symbol is required oncebreak Sets a temporary breakpoint that is deleted after the program is stopped at the breakpoint once OnceBreak in other regards including arguments works like Break regularbreak regex Set a breakpoint at the beginning of all procedures with a name matching regular expression regex delete location Removes the breakpoint at location location as described in above sy
6. Data size is effectively limited by the available addressing space When the medium memory model is specified the shared option may not be specified Pro grams compiled with the medium model may execute more slowly than if the small model were used N no allextput Symbol table entries for EXTERNAL variables Compile only Default Nallextput The Nallextput option controls the generation of symbol table entries for names that only appear in an EXTERNAL statement and are otherwise unreferenced Specify Nnoallextput to prevent names that only appear in EXTERNAL statements from appearing in the object file symbol table Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options N no autoobjstack Allocate automatic arrays on stack Compile only Default Nnoautoobjstack The Nautoobjstack option causes automatic arrays to be allocated on the stack instead of on the heap Use of this option may cause stack faults if the local variable size is larger than the available stack Stack limits are determined by the OS shell program N no calleralloc Caller allocates array function result Compile only Default Nnocalleralloc The Ncalleralloc option controls whether array function results are allocated by the caller or the callee Usual practice is for the callee to allocate array result variable at the time it is exe cuted When Ncalleralloc is specified the result variable is preallocated by the calling prog
7. Table 10 COMPILE Place Markers Place Marker Meaning SSD expands to the name of the directory containing the source file including a trailing SSF expands to the source file name excluding the directory and exten sion oe n ia main for SD expands to source SSF to main JEON expands to the source file extension including a leading under score For example if the file to be compiled is source and SE to SOD expands to the name of the directory containing object code as spec ified using the OBJDIR command see below including a trailing yt SOE expands to the object file extension as specified using the OBJEXT command see below including a leading SID expands to the INCLUDE file search list as specified using INCLUDE see below SMO expands to the name of directory containing modules using MODULE see below as specified SRF expands to the name of a response file created by AUTOMAKE containing a list of source files If RF is present the compiler is invoked only once SEI is equivalent to 3SDSSF SE COMPILE lfc c fi mod mo COMPILE lfc c rf include id Note that with LF64 the c option should always be used in a COMPILE line TARGET Specifies the name of the program or library file which is to be built from the object code Note that you will also have to tell the
8. myprog Wl Ry li For more information on runtime options see Runtime Options on page 133 Lahey Fujitsu Linux64 Fortran User s Guide 127 Appendix A Programming Hints Limits of Operation 128 Lahey Fujitsu Linux64 Fortran User s Guide Limits of Operation Table 11 LF64 Limits of Operation Item program size small memory model Maximum 2 Gigabytes for code and static data Pointers can address 64 bit memory space program size medium memory model 2 Gigabytes for code Static data and pointers can address 64 bit memory space number of files open concurrently system dependent see 1imits command of csh subtract three for Fortran units 0 5 and 6 from the system limit Length of CHARACTER datum 2 147 418 072 bytes T O block size 2 147 483 647 bytes TO record length 2 147 483 647 bytes I O file size 9 233 372 036 854 775 807 bytes limited by avail able memory size disk size or OS limitations I O maximum number of records direct access files 9 233 372 036 854 775 807 divided by the value of the RECL specifier nesting depth of function array section array element and sub 255 string references nesting depth of DO CASE and 50 IF statements nesting depth of implied DO loops 25 nesting depth of INCLUDE files 16 number of array dimensions 7 Lahey Fujitsu Linux64 Fortran User s Guide 129 Appendix
9. Character Z 8B Specifying chk u does not check pointers for association status Undefined variables are not checked if Subscript checking s is also specified and diagnostic message 0320 w 0322 w or 1562 w is issued The variable is accessed as the target of a POINTER or is a structure variable one of whose structure components has the POINTER attribute The referenced variable has the SAVE attribute The referenced variable is an assumed shape array The referenced variable is an array section with a vector subscript The referenced variable is a dummy argument corresponding to an actual argument that is an array section The referenced variable is in a masked array assignment The referenced variable is a derived type with an ultimate component that is an allo catable array 22 Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options Example lfc myprog chk a x instructs the compiler to activate increased runtime argument checking and increased unde fined variables checking njchkglobal Global Checking Compile only Default nchkglobal Specify chkglobal to generate compiler error messages for inter program unit diagnostics and to perform full compile time and runtime checking The global checking will only be performed on the source which is compiled within one invo cation of the compiler the command line For example the checking will not occur on a USEd module which is
10. Code and keystrokes are indicated by courier font In syntax descriptions brackets enclose optional items An ellipsis following an item indicates that more items of the same form may appear Italics indicate text to be replaced by the programmer Non italic characters in syntax descriptions are to be entered exactly as they appear A vertical bar separating non italic characters enclosed in curly braces opt opt2 opt3 Y indicates a set of possible options from which only one is to be selected Lahey Fujitsu Linux64 Fortran User s Guide 3 Chapter 1 Getting Started Product Registration To all registered LF64 users Lahey provides free unlimited technical support via fax postal mail and e mail Procedures for using Lahey Support Services are documented in Appendix C Lahey Technical Support To ensure that you receive technical support product updates newsletters and new release announcements please register via mail or via our website http www lahey com If you move or transfer a Lahey product s ownership please let us know Installing Lahey Fujitsu Linux64 Fortran In order to install LF64 you must be logged in as root The install script presents a series of choices which guide the user through the installation process 1 Download the appropriate tar file 2 Login as root 3 Restore files from the tar file 4 Run install to install the software The default installation dire
11. Displaying Program Stack Information traceback n Displays subprogram entry points frames in the stack where n is the number of stack frames to be processed from the current frame frame Select stack frame number n If n is omitted the current stack frame is selected upside n Select the stack frame for the procedure n levels up the call chain down the chain if n is less than 0 The default value of n is 1 downside n Select the stack frame for the procedure n levels down the call chain up the chain if n is less than 0 The default value of n is 1 show args Display argument information for the procedure corresponding to the currently selected frame show locals Display local variables for the procedure corresponding to the currently selected frame show reg r Displays the contents of the register r in the current frame r cannot be a floating point reg ister If r is omitted the contents of all registers except floating point registers are displayed Note that the symbol is required see Registers on page 67 for register notation details show freg fr Displays the contents of the floating point register fr in the current frame If fr is omitted the contents of all floating point registers are displayed Note that the symbol is required see Registers on page 67 for register notation details Lahey Fujitsu Linux64 Fortran User s Guide Setting and Displaying Program Variables sh
12. Errors in Compilation If the compiler encounters errors or questionable code you may receive any of the following types of diagnostic messages a letter precedes each message indicating its severity U Unrecoverable error messages indicate it is not practical to continue compilation S Serious error messages indicate the compilation will continue but no object file will be generated W Warning messages indicate probable programming errors that are not serious enough to prevent execution Can be suppressed with the nwarn or swm option I Informational messages suggest possible areas for improvement in your code and give details of optimizations performed by the compiler These are normally sup pressed but can be seen by specifying the info option see njinfo on page 26 If no unrecoverable or serious errors are detected by the compiler the error return code is set to zero see Return Codes from the Driver on page 14 Unrecoverable or serious errors detected by the compiler improper syntax for example terminate the build process An object file is not created Compiler and Linker Options 16 You can control compilation and linking by using any of the following option options Options that use a single hyphen are case sensitive Some options apply only to the compi lation phase others to the linking phase and still others such as g to both phases this is indicated next to the name of the option If c
13. KIND 16 respectively If you use quad all source files including modules in a program should be compiled with quad Specifying quad will usually result in significantly slower executables Specifying quad forces dbl Specifying dbl quad will not raise single precision entities to quad precision Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options If the quad option is specified the CcdRR8 CcR4R8 CcdDR16 CcR8R16 Ccd4d8 and Cca4a8 options cannot be specified n quiet Quiet Compilation Compile only Default quiet Specifying quiet suppresses the reporting of current file and program unit being compiled Instead only errors warnings with warn and informational messages with info are displayed S Generate assembly files instead of object files Compile only Default produce object files The S option causes the compiler to generate assembly source s files rather than object files o0 and supresses the link phase njsav SAVE Local Variables Compile only Default nsav Specify sav to allocate local variables in a compiler generated SAVE area nsav allocates variables on the stack sav is equivalent to having a SAVE statement in each subprogram except that sav does not apply to local variables in a recursive function whereas the SAVE statement does Specifying sav will cause your executable to run more slowly especially if you have many rou
14. automatic parallelization because of the potential for incorrect results For that reason LF64 PRO includes optimization control lines see Optimization Control Line on page 94 and OpenMP directives see OpenMP on page 106 with which the programmer can provide the information necessary for the compiler to parallelize otherwise unparallelizable loops Other Unparallelizable Loops Some loops cannot be parallelized for other reasons discussed later in this chapter Some times recoding a loop to move a statement or group of statements outside the loop will allow that loop to be parallelized 88 Lahey Fujitsu Linux64 Fortran User s Guide Hardware for Multi Processing Hardware for Multi Processing A computer environment with two CPUs that operate independently and simultaneously is necessary to save elapsed time by multi processing A multi processing program can be exe cuted on hardware with only a single CPU however the elapsed time will not be less than the execution time for a comparable program written without multi processing features Automatic Parallelization With automatic parallelization DO loops and array operations are parallelized without the programmer making any modifications to the program This makes it easy to migrate source programs to other processing systems as long as the program conforms with the Fortran standard Examples of Compilation and Execution lfc info parallel ocl testl f a out
15. extension procedures are not recognised as intrinsic Lahey Fujitsu Linux64 Fortran User s Guide 33 Chapter 2 Developing with LF64 34 This option affects the following extension procedures AIMAX0 AJMAX0 IZMAX0 IMAX0 JMAX0 IMAX1 JMAX1 AIMINO AJMINO I2MINO IMINO JMINO IMIN1 JMIN1 FLOATI FLOATJ DFLOTI DFLOTJ HABS JIABS ABS IIDIM JIDIM I2DIM ITFIX JIFIX JFIX INT1 INT2 INT4 INT JINT ININT JNINT IDNNT I2NINT JIDNNT IIDINT JID INT IMOD JMOD I2MOD IISIGN JISIGN I2SIGN BITEST BJTEST IIBCLR JIBCLR IIBITS JIBITS IBSET JIBSET IBCHNG ISHA ISHC ISHL IIAND JIAND IIEOR JIEOR HOR JIOR INOT JNOT ISHFT JISHFT IISHFTC JISHFTC IZEXT JZEXT IZEXT 2 JZEXT2 JZEXT4 VAL N nojrecursive Create recursive procedures Compile only Default Nnorecursive When the Nrecursive option is specified the RECURSIVE attribute is applied to all subrou tines and functions OK 0 1 2 3 00 01 02 03 Optimization Level Compile only Default O To see details of steps taken by the compiler for optimization specify the info option See n info on page 26 The O0 option creates an object file without applying any optimizations O0 is forced when 6 the g chk or chkglobal option is specified See g on page 25 The O1 option applies basic optimizations The O2 option recursively applies all the optimizations from O1 plus loop optimizat
16. formatted sequential file format 124 FORT90L environment variable 132 Fortran standards 24 40 fot 121 FUnn environment variable 140 FUnnBF environment variable 141 G g runtime option 135 g debug option 25 GETCL Q command line argument vs runtime options 131 H HDRSTRIP F90 122 Heap allocation 39 41 help display command options 25 help options summary options 25 hints efficiency considerations 123 file formats 124 performance considerations 126 side effects 123 I i runtime option 135 I include path option 25 i o work area environment variables for 141 runtime option d 134 runtime option g 135 IBM370 data runtime options 134 137 in IMPLICIT NONE option 26 INDEPENDENT 101 info display informational mes sages option 26 inline apply inline expansion option 26 installation 4 interrupt processing runtime option i 135 IOINF environment variable 137 J jwe_prof runtime configuration file 132 K Karray_transform extreme array optimizations option 26 Keval optimize expression evalua tion option 26 150 Lahey Fujitsu Linux64 Fortran User s Guide Kfap storage of real and complex variable in hardware registers 27 Kfp_relaxed faster FP division and SQRT calculations 27 Kfsimple simplify floating point expressions 27 Kfuse loop fusion option 27 Kloop loop structure modification option 27 Komitfp omit frame pointer option 28 Kpacked Use SSE2 or
17. n jin Implicit None Compile only Default nin Specifying in is equivalent to including an IMPLICIT NONE statement in each program unit of your source file no implicit typing is in effect over the source file When nin is specified standard implicit typing rules are in effect njinfo Display Informational Messages Compile only Default ninfo Specify info to display informational messages including suggestions on areas of possible improvement for your code and information on steps taken by the compiler for optimization and parallelization nwarn forces ninfo inline Apply inline expansion Compile only Default no inline expansion inline takes no options and is equivalent to x See xarg on page 43 Karray_transform Perform extreme array optimizations Compile only Default do not perform optimizations Specifying the Karray_transform option allows the compiler to pad and reshape arrays in an attempt to optimize cache performance and execution speed Execution errors or incorrect results may occur if program units compiled with this option are linked with program units compiled without the option Depending on program structure execution times might be faster or slower experimentation will determine if this option is beneficial Use of this option may change the results of the UBOUND and SIZE functions These opti mizations may not apply to arrays having the SAVE or TARGET attributes named consta
18. 2048 kilobytes This option takes precedence over the environment variable THREAD_STACK_SIZE see THREAD_STACK_SIZE on page 87 threadstack requires openmp or parallel and must be specified for the file with the main program unit g chk or chkglobal cause threadstack to be ignored n trace Location and Call Traceback for Runtime Errors Compile and link Default trace The trace option causes a call traceback with routine names and line numbers to be gener ated with runtime error messages With ntrace no line numbers are generated trace might cause your program to run more slowly The trace option is disabled if the fast or Komitfp are specified Lahey Fujitsu Linux64 Fortran User s Guide 39 Chapter 2 Developing with LF64 40 njtrap Trap numeric exceptions Compile only Default nt rap The trap option causes the Fortran runtime library to publish an error message on a divide by zero or overflow exception The application then terminates If the WI i runtime option is specified see Interrupt Processing on page 135 then no trapping occurs for overflow exceptions If the WI u runtime option is specified then underflow exceptions are trapped see Underflow Interrupt Processing on page 140 U name Undefine preprocessor name Compile only Use the U option to undefine a name so that it is not recognized by the preprocessor This option is equivalent to spec
19. 6 abcdeHi abcdeEnd abcde End abcdeEnd Example Passing String Variables from C to Fortran The following Fortran function has assumed length character dummy arguments and returns an assumed length character result Lahey Fujitsu Linux64 Fortran User s Guide 61 Chapter 3 Mixed Language Programming function MYFUNC strl str2 character len strl str2 myfunc myfunc strl1 str2 char 0 return end When called by the following C program void myfunc_ char strl int i char str2 char str3 int j int k MAIN__ Leave space for NULL in character declarations char res 10 ch 4 msg 7 strcepy ch Hi strcpy msg there myfunc_ res 10 ch msg 3 6 printf Result received by C s n res The following output is generated Result received by C Hi there In the call to MyFUNC from C the first and second arguments are the value and length respec tively of the result returned by MyFUNC The last two arguments are the respective lengths of the character arguments being passed to MYFUNC Passing Data through Common Blocks The variables in a Fortran common block may be referenced as C structure members Example Named Common In the following Fortran program the variables in common block ext common ext i j i l j 2 call sub end are accessed by a C function as follows extern struct tab int Lae Jy ext_ void sub_ pri
20. A Programming Hints 130 Table 11 LF64 Limits of Operation Item Maximum T where the absolute value of T obtained by the formula below must not exceed 9223372036854775807 and the absolute value must not exceed 9223372036854775807 for any intermediate calculations n i array size T lxs 5 li x xs TEA m 2 n Array dimension number s Array element length 1 Lower bound of each dimension d Size of each dimension T Value calculated for the array declaration Lahey Fujitsu Linux64 Fortran User s Guide Runtime Options The behavior of the LF64 runtime library can be modified at execution time by a set of com mands which are submitted via the command line when invoking the executable program or via environment variables These runtime options can modify the behavior of input output operations diagnostic reporting and floating point operations Runtime options submitted on the command line are specified by using a character sequence that uniquely identifies the runtime options so that they may be distinguished from regular command line arguments utilized by the user s program In the current version of the com piler the values obtained via the GETCL GETPARMO and GETARG functions will include the runtime options as well as user defined command line arguments This can cause problems if the number of runtime options specified is always changing or is unknown to the programmer The s
21. Chapter 4 Command Line Debugging with fdb 76 u can have any of the following values b one byte h two bytes half word w four bytes word 1 eight bytes long word double word If u is omitted it defaults to w word If N is omitted it defaults to 1 Therefore the two fol lowing commands have the same result memprint addr memprint xwl addr Source File Display show source Displays the name of the current file list now Displays the current line list next Displays the next 10 lines including the current line The current line is changed to the last line displayed list previous Displays the last 10 lines except for the current line The current line is changed to the last line displayed list around Displays the last 5 lines and the next 5 lines including the current line The current line is changed to the last line displayed list sigaround Displays the last 5 lines and the next 5 lines including the line of the current file nearest the address where the signal occurred list file num Changes from the current line of the current file to the line number num of the source file file and displays the next 10 lines including the new current line If file is omitted the current file is not changed Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character Lahey Fujitsu Linux64 Fortran User s Guide Automatic Dis
22. Kpreex 28 Kpureomp 28 Kreduction 28 Ktiling 29 O 34 ocl 35 openmp 35 parallel 35 prefetch 36 threads 38 unroll 40 varstack 41 xarg 43 options AA disable alignment 17 ap arithmetic precision 18 AU case sensitivity 17 AZ null termiante string arguments 17 block blocksize 18 c suppress linking 18 Ccxxxx promote data precision 19 chk checking 20 chkglobal global checking 23 co display compiler options 23 Cpp invoke preprocessor 10 23 D define preprocessor name 10 23 dal deallocate allocatables 24 dbl double precision real variables 24 description 11 f95 Fortran 95 conformance 24 fast optimize for compiling machine 24 file specify file 24 fix fixed source form 25 g debug 25 I include path 25 in IMPLICIT NONE 26 info display informational messages 26 inline apply inline expansion 26 Karray_transform extreme array optimizations 26 Keval optimize evaluation expression 26 Keval pre evaluate invariant expressions 28 Kfap storage of real and com Lahey Fujitsu Linux64 Fortran User s Guide 151 Index plex variable in hardware registers 27 Kfp_relaxed faster FP divi sion and SQRT calculations 27 Kfsimple simplify floating point expressions 27 Kfuse loop fusion 27 Kloop loop structure modification 27 Komitfp omit frame pointer 28 Kpacked Use SSE2 or SSE3 packed instructio
23. Lahey Fortran Forum see Lahey Web Page for instructions on joining this dis cussion group Lahey Fujitsu Linux64 Fortran User s Guide 7 Chapter 1 Getting Started 8 Lahey Fujitsu Linux64 Fortran User s Guide This chapter describes how to use LF64 s driver to build Fortran applications The driver controls compilation linking and the production of archive libraries executable programs and shared libraries How the Driver Works The driver 1f c controls the two main processes compilation and linking used to create an executable program These component processes are performed by the following pro grams under control of the driver Compiler The compiler compiles source files into object files and creates files required for using Fortran modules It is this component that performs the actual compilation of the pro gram even though 1fc is commonly referred to as the compiler Linux Archive Utility ar the archive utility can be invoked from the driver or from the command prompt to create or change static libraries Linux Linker 1d is the linker The linker combines object files and libraries into a single executable program or shared library Running the LF64 Driver By default the LF64 driver program oversees compilation of any specified source files and will link them along with any specified object files and libraries into an executable program To run the driver type 1fc followed by a list
24. Linux environ ments If an extension is not supported it will most likely cause an undefined symbol error when linking If your code uses the SYSTEM subroutine you should consult your Language reference Although the basic form of the SYSTEM command is supported under both sys tems optional arguments are not supported on the Linux side Recommended Option Settings If an lfc fig file exists in the current directory examine its contents to insure that it con tains the desired options Lahey Fujitsu Linux64 Fortran User s Guide 47 Chapter 2 Developing with LF64 48 For debugging the following option settings will provide an increased level of diagnostic ability both at compile time and during execution chk g trac info The pca option may be additionally be used to check for corruption of constant arguments if the results are correct with pca but bad with npca a constant argument has been corrupted For further analysis during development consider specifying any of the following options ap chkglobal f95 lst sav wo xref Note Specifying chkglobal or chk x must be used for compilation of all files of the program or incorrect results may occur For production code we recommend the following option settings nap nchk ng 03 npca nsav ntrac For code that will be used only on the compiling machine the option fast should be used in place of 03 Note that the options that be
25. SSE3 packed instructions option 28 Kpreex pre evaluate invariant expressions option 28 Kpureomp strict adherence to OpenMP directives option 28 Kreduction reduction parallelization optimizations option 28 Kthreadprivate named commons pri vate to thread option 28 Kthreadsafe generate code that is thread safe option 29 Ktiling apply loop tiling optimiza tions option 29 L l runtime option 136 L library path option 29 l specify library option 29 Lahey extensions 30 Lahey Fortran 95 ExpressUser s Guide 6 Language Reference Manual 6 LAPACK 38 47 ld linker utility 9 lfc fig configuration file 12 li Lahey intrinsic procedures 30 librarian ar utility 9 libraries BLAS 38 47 C 51 63 creating 34 distributing LF64 applications 38 filenames 11 l option specify file 29 L option specify search path 29 LAPACK 38 47 Index LD_LIBRARY_PATH envi ronment variable 29 Linux kernel 49 63 nshared option and 37 o option and 34 OpenGL graphics 46 out option and 34 runtime 38 shared option and 37 SSL2 38 46 standard 49 63 static archive 9 staticlink option and 38 library searching rules 45 linker 9 42 rules 44 linker options see options 16 linking 44 little endian data porting files 125 runtime option T 139 Local variable allocation 41 long long integers option 30 loop reduction 93 loop slicing 89 Ist listing option 30 M M runtime option 137 m runtime
26. Table 6 Effect of ml Option on External name of Fortran Procedure MySub1 Declared as ML_EXTERNAL ml option Seen from outside as ml cdecl MySub1 ml not specified MySub1_ mysubl_ not declared as ML_EXTERNAL ro m1 has no effect Note that if MySub1 is not declared as ML_EXTERNAL then the m1 option has no effect and its external name will always be mysub1_ Fortran naming conventions can be accom modated in C by declaring the C function as lower case and adding a trailing underscore 50 Lahey Fujitsu Linux64 Fortran User s Guide Runtime initialization character thus eliminating the need for the ML_EXTERNAL statement or the m1 compiler option On the other hand if Fortran is calling a C library for which no source code is avail able then the ML_EXTERNAL statement and the m1 compiler option are required Runtime initialization If the main program is not created with Fortran control is first passed to the non Fortran por tion of the program the programmer is responsible for ensuring that the Fortran runtime package is initialized This is done by calling the runtime initialization procedure jwe_xcop with the arguments 0x703043 0 0 0 This call must be made before any Fortran proce dures are called For a C language main the exact syntax would be jwe_xcop 0x703043 0 0 0 Example Passing Control First to a C Program The followi
27. VALO intrinsic It is not possible to return character strings or structures from C Fortran calls void C functions in the same manner that it calls Fortran subroutines This concept is illustrated in the section below Passing and Receiving Arguments on page 58 Table 9 Declaring Fortran Result Types for C Function Types C Function Type Fortran Result Type Example void not applicable call my_c_func signed char INTEGER 1 result my_c_func short int INTEGER 2 result my_c_func long int es result my_c_func long long int INTEGER 8 result my_c_func float REAL 4 result my_c_func double REAL 8 result my_c_func long double REAL 16 result my_c_func char cannot be accepted not applicable structure cannot be accepted not applicable Lahey Fujitsu Linux64 Fortran User s Guide 57 Chapter 3 Mixed Language Programming 58 Passing and Receiving Arguments By default Fortran passes arguments by reference i e it passes the address of each vari able in the argument list rather than the value of the argument on the program stack however many C functions expect variables to be passed by value on the program stack This practice can be accommodated by applying the VALO intrinsic to the variable as it appears in the argument list of the Fortran reference to the functio
28. a out W1 Lb Li Service routines use eight byte integers instead of four byte integers as arguments and func tion results Example a out W1 Li Lr Service routines use eight byte reals instead of four byte reals as arguments and function results Example a out W1 Lr Lu An I O statement can read and write one Fortran record which exceeds 2G bytes Lahey Fujitsu Linux64 Fortran User s Guide Descriptions of Runtime Options Example a out W1 Lu M Mantissa Conversion Error Reporting for IBM370 data The M option specifies whether to output the diagnostic message 0147i w when bits of the mantissa are lost during conversion of IBM370 IEEE format floating point data If the M option is specified a diagnostic message is output if conversion of IBM370 IEEE format floating point data results in bits of the mantissa being lost When the M option is omitted the diagnostic message 0147i w is not output Example a out W1 M munit 0 lt unit lt 2147483647 Standard Error Output The m option connects the specified unit number unit to the standard error output file device STDERR where diagnostic messages are to be written Argument unit is an integer from 0 to 2147483647 If the m option is omitted unit number 0 the system default is connected to the standard error output file Care should be taken to avoid conflict with units specified by p and r options Also see Environment Va
29. all are removed screenoff n Deactivate automatic display number n When n is omitted all are deactivated Lahey Fujitsu Linux64 Fortran User s Guide 77 Chapter 4 Command Line Debugging with fdb 78 screenon n Activate automatic display number n When n is omitted all are activated show screen Displays a numbered list of all expressions set by the screen F expr command above Symbols show function regex Display the type and name of all functions or subroutines with a name that matches regular expression regex quotation marks required When regex is omitted all procedure names and types are displayed show variable regex Display the type and name of all variables with a name that matches regular expression regex quotation marks required When regex is omitted all variable names and types are displayed Scripts script script The commands in file script are executed Note that the apostrophes used in scripf above are the grave accent ascii 96 not the standard apostrophe character alias cmd cma str Assigns the fdb command s in cmd str quotation marks required to alias cmd alias cmd show alias cmd display the alias cmd definition When cmd is omitted all the definitions are displayed unalias cmd Remove the alias cmd definition When cmd is omitted all the definitions are removed Signals signal sig action Behavior action is set for signal sig Pleas
30. and running a Fortran program with LF64 involves three basic steps 1 Creating a source file using a text editor 2 Generating an executable program using the LF64 driver The driver automatically compiles the source file s and links the resulting object file s with the runtime library and other libraries you specify 3 Running the program The following paragraphs take you through steps two and three using the demo 90 source file included with LF64 Generating the Executable Program Compiling a source file into an object file and linking that object file with routines from the runtime library is accomplished using the LF64 driver program 1fc From the command prompt build the demo program by changing to the directory where demo 90 is installed located in examples fortran under the installation directory and entering lfc demo 90 This causes the compiler to read the source file demo 90 and compile it into the object file demo o Once demo o is created LF64 invokes the linker to combine necessary routines from the runtime library and produce the executable program a out Running the Program To run the program type its name at the command prompt and press lt Enter gt a out The demo program begins and a screen similar to the following is displayed Lahey Fujitsu Linux64 Fortran User s Guide 5 Chapter 1 Getting Started Lahey Fujitsu LF64 Compiler installation test and demonstration prog
31. b3 i j p c3 i j c3 i j d3 ti p e3 i j e3 1 4 3 i 3 p g3 i j g3 i j h3 i j p end do p end do Lahey Fujitsu Linux64 Fortran User s Guide Optimization Control Line p do a 20 p do i 1 1 l pss ASRASA loop 1 p al i j al i j b1l i j p cl i j cl i j di i j p el i j el i j f1 i j p gl i j gl i j hi i j p end do p end do donr 1 m O A loop 2 a2 i j a2 i j b2 i j C2 494 C2 Gap d2Gi 3 e2 i j e2 i j f2 i j g2 i j g2 i j h2 i j end do end do p d n Lye LO p do i 1 lt loop 3 p a3 i j a3 i j b3 i J p 63 29 63st 4 k AEA p e3 i j e3 i j f3 i Jj p g3 i j g3 i j h3 i j p end do p end do PARALLEL The PARALLEL specifier is used to reverse the effect of the SERIAL specifier and enables loop slicing Syntax OCL PARALLEL The PARALLEL specifier can be placed at the loop position or the total position The effect of PARALLEL depends on its position e At the loop position PARALLEL allows loop slicing for the DO loop and any nested loops corresponding to the OCL e At the total position PARALLEL allows loop slicing for all loops in the program containing the OCL In the following example if only loop 2 should be sliced it can be sliced by specifying PAR ALLEL together with SERIAL as shown The letter P on the left side of the source program marks the parallelized stateme
32. be incorrect if the source program a f is compiled as follows lfc parallel threads 4 a f invalid use To prevent such a mistake specify the optimization control line OCL SERIAL in the proce dure that is called from within the parallelized DO loop ocl serial subroutine sub n do i 1 10000 a i 1 b i n end do end Loop Reduction Effects When parallel is specified as a compiler option the result of execution may be different from the result of serial execution The reason for this is that as a result of loop reduction the operation order may be different between the parallel execution and the serial execution The following illustrates the loop reduction optimization sum 0 do i 1 10000 sum sum a i end do When parallelized this becomes CPU 1 suml 0 do i 1 5000 suml suml a i end do 104 Lahey Fujitsu Linux64 Fortran User s Guide Notes on Parallelization CPU 2 sum2 0 do i 5001 10000 sum2 sum2 a i end do Then the partial sums are added sum sum suml sum2 The variable SUM accumulates the values A 1 to A 10000 in order with serial execution In parallel execution SUM1 accumulates the values A 1 to A 5000 and SUM2 accumu lates the values A 5001 to A 10000 at the same time After that the sum of SUM1 and SUM2 is added to SUM Loop reduction optimization may cause a side effect a different result due to rounding in the execution r
33. because the instruction which corrects the value of T becomes unnecessary at the end of the DO loop common t locl temp t p do J T 50 p do i 1 1000 p t a i j ETD p c i j t d i j p end do p end do call sub 100 Lahey Fujitsu Linux64 Fortran User s Guide Optimization Control Line Note If a variable that is not used temporarily is described in a TEMP specifier by mistake LF64 may do an incorrect loop slicing and the program results may be incorrect INDEPENDENT The INDEPENDENT specifier is used to indicate to LF64 that parallel execution is the same as serial execution even if a procedure is called in the DO loop As a result the DO loop that contains the procedure is suitable for loop slicing Syntax OCL INDEPENDENT e e Wom Here e is a procedure name which does not inhibit loop slicing The wild card specifica tion is usable in e If the procedure name is omitted INDEPENDENT becomes effective for all procedures within the range of the DO loop See Wild Card Specification on page 102 for wild card specification Note that the procedure e must be compiled with the parallel option The INDEPENDENT specifier can be placed at the loop position or the total position The effect of INDEPENDENT depends on its position e At the loop position INDEPENDENT allows loop slicing for the DO loop and all nested loops corresponding to the OCL e At the total position INDEPE
34. containing dependency information DEBUG Causes AUTOMAKE to write debugging information to a file called automake dbg LATESCAN Delays scanning of source files until the last possible moment and can in some cases remove the need for some scans However this option is not compatible with Fortran 90 modules CHECK May be used to specify a command to be inserted after each compilation A typical applica tion would be to check for compilation errors Multi Phase Compilation Sometimes more than one compilation phase is required For example if source files are stored in more than one directory you will need a separate compilation phase for each direc tory Multiple phases are also required if you have mixed C and Fortran source or if you need special compilation options for particular source files The AND keyword may be inserted in your configuration file to add a new compilation phase You can reset the values of FILES COMPILE INCLUDE OBJUDIR OBJEXT and MOD ULE for each phase All default to the value used in the previous phase except that OBJDIR defaults to the new source directory The following example shows how this feature might be used with the LF64 compiler The same principles apply to other compilers and other platforms Lahey Fujitsu Linux64 Fortran User s Guide 117 Chapter 6 Automake PRO version only Example Configuration file for Multi Phase Compilation Compilat
35. diagnostic message when any features are encountered that are non standard in Fortran 95 njvarheap size Allocate local variables on heap Compile only Default nvarheap Specify varheap to cause local variables to be allocated on the heap rather than in the bss segment size is the minimum variable size that will be placed on the heap Variables smaller than size are not placed on the heap If size is omitted it defaults to 4096 Use the varheap option when creating programs that have large arrays If you notice that increasing the size of an array causes a segmentation fault using varheap may alleviate this condition Note that the varheap option does not apply to variables having the SAVE attribute which includes initialized variables njvarstack Allocate local variables on stack Compile only Default nvarstack The varstack option causes local variables to be allocated on the stack These variables become undefined when execution of the procedure terminates Use of this option may cause stack faults if the local variable size is larger than the available stack Stack limits are deter mined by the OS shell program Use of the openmp option forces the varstack option This behavior can be overridden by specifying nvarstack n jverbose Verbose Output Compile only Default nverbose Specify verbose to see details of commands passed to all component tools used in the cre ation of object
36. environment variable is not set the value of the argument to threads must be the same value as the number of CPUs active at run time The example below shows an invalid use of the threads compiler option when the number of active CPUs is four If an invalid value for threads is specified execution results may be incorrect In the following incorrect example the value of N and the value of PARALLEL are different setenv PARALLEL 2 lfc parallel threads 4 a f In the following example execution results may be incorrect if the number of active CPUs is not equal to two lfc parallel threads 2 a f Multi Processing of Nested DO Loops If there is a parallelized DO loop in a procedure that is called from within another parallelized DO loop a nest of parallelized DO loops is generated A program that contains such DO loops must not be compiled with the threads compiler option The following is an example in which the parallelized DO loop should be executed serially If a source program that contains such DO loops is compiled with the threads compiler option the result may be incorrect Lahey Fujitsu Linux64 Fortran User s Guide 103 Chapter 5 Multi Processing PRO version only file a f ocl independent sub do i 1 100 I lt xecuted in parallel j i call sub j end do end subroutine sub n do i 1 10000 lt should be executed serially ati Lf bi 4 n end do end The result may
37. execution times Execution errors or incorrect results may occur if program units compiled with AA are linked with program units com piled without AA The AA option can be used to force contiguous storage of data in common blocks and sequence derived types at the expense of execution speed AU Case sensitivity Compile only Default not case sensitive The AU option specifies that names are interpreted in a case sensitive fashion Use of this option causes the compiler to behave in a nonstandard way When the AU option is specified service routines must be referred to in all lower case Ref erences to intrinsic procedures must all have the same spelling Letters specified in the IMPLICIT statement are not case sensitive When debugging user defined procedure names are case sensitive but variable names are not AZ Null terminate character string arguments Compile only Default do not null terminate character string arguments The AZ option causes a null character to be appended to string arguments The LEN function will not count the null character when reporting the length of assumed length character dummy arguments Lahey Fujitsu Linux64 Fortran User s Guide 17 Chapter 2 Developing with LF64 18 njap Arithmetic Precision Compile only Default nap Specify ap to guarantee the consistency of REAL and COMPLEX calculations regardless of optimization level user variables are not assigned to registe
38. length values appear in the same order as the strings at the end of the argument list To prevent the length value from being added apply the CARGO intrinsic or combine the VAL OFFSET intrinsics so that only the pointer to the string is passed Lahey Fujitsu Linux64 Fortran User s Guide Passing Character Data In addition C requires a NULL terminator i e CHAR 0 a byte whose value is zero at the end of a character string in order to process it LF64 does not supply this hence it must be appended to a character literal or character variable before it is passed to C Furthermore Fortran pads the end of the string with blanks to fill its entire declared length If this padding is not desired then it must be removed by applying the TRIMO intrinsic and appending a NULL before the string is passed to C Example Passing Character Variables and Character Constants from Fortran to C The following Fortran program program strtest character 20 mystr mystr abcde call sub mystr call sub abcde char 0 call sub2 carg trim mystr char 0 call sub2 val offset mystr call sub2 carg abcde char 0 end and the following C subroutine void sub_ strl1 i char strl long int i printf hidden length i n i printf SsHi n strl void sub2_ strl char strl printf SsEnd n strl1 produce the following output hidden length 20 abcde Hi hidden length
39. not suitable for loop slicing in a procedure that is called in a parallelized DO loop execution of the pro gram will produce incorrect results The execution performance of the multi processing program may decrease due to the overhead of parallel execution Also the result of the I O statement may be different from the result of serial execution The following is an example in which an I O statement occurs in a procedure that is called in a parallelized DO loop file a f ocl independent sub do i 1 100 j i call sub j end do end recursive subroutine sub n print n end OpenMP 106 The compiler supports OpenMP v 2 0 directives This section describes parallelization using OpenMP Refer to the OpenMP Fortran specification included with LF64 in PDF format for non implementation specific information on OpenMP The following website includes com prehensive information on OpenMP http www openmp org Lahey Fujitsu Linux64 Fortran User s Guide Implementation Specifications It is assumed that the reader has an understanding of OpenMP LF64 s implementation of OpenMP is described below Implementation Specifications This section gives details on features that are left processor dependent by the OpenMP spec ification along with other specifications and restrictions Nesting of Parallel Regions Nesting of parallel regions is supported Dynamic Thread Adjustment Features Dynamic thread adjustment fea
40. of one or more filenames and optional com mand line options Lahey Fujitsu Linux64 Fortran User s Guide 9 Chapter 2 Developing with LF64 10 1fc options filenames options The driver searches for the various tools the compiler archive library utility and linker first in the directory the driver is located and then if not found on your path The command line options are discussed later in this chapter Filenames and Extensions Depending on the extension s of the filename s specified the driver will invoke the neces sary tools The extensions 95 90 for f F95 F90 FOR and F for example cause the compiler to be invoked The extension s causes the assembler to be invoked The extension o denoting an object file causes the linker to be invoked Please note that if the suffix for Fortran source is uppercase F 95 F90 FOR or F it will cause the C prepro cessor to be invoked before the compiler it is therefore preferable to use a lowercase extension on the filename if the file does not need to be preprocessed For lowercase suffixes the C preprocessor can be invoked using the Cpp option Prepro cessor options D define macro U un define macro and P send preprocessor output to file are also supported and behave as documented in the man pages for gcc the GNU C compiler This manual does not encourage use of the preprocessor because such activity fos ters non Fortran standard
41. process ing information The value of FLIB_PARALLEL_INFO is either 1 or 2 When the value of FLIB_PARALLEL_INFO is 1 the following information is output e Number of available CPUs e Number of threads e The specification of the environment variable FLIB_FASTOMP use high speed runtime library e FLIB_SPINWAIT control of the waiting threads SPIN MODE or SUSPEND MODE e The total size of stack for each thread and the use of Large Page Facility e Use of I O buffer parallel transfer When the value of FLIB_PARALLEL_INFO is 2 the additional information is output e The number of times of I O buffer parallel transfer occurs e The number of barriers used with automatic parallelization or OpenMP e The number of times that automatic parallelizations or OpenMP parallelizations are applied e The rate of parallelization for the master thread Parallel region execution time real time Lahey Fujitsu Linux64 Fortran User s Guide 85 Chapter 5 Multi Processing PRO version only e The rate of parallelization for all threads Parallel region execution time of all threads Parallel region execution time of all threads serial region execution time of mas ter thread e The procedure name line number address and execution time of parallel regions parallelized automatically e Cost distribution list of parallel regions I O buffer parallel transfer function is out put with a procedure name of null e The procedure name line nu
42. programming practices Please note filenames are case sensitive Filenames containing spaces are not recom mended nor are filenames beginning with a hyphen i e Also note that the extension mod is reserved for compiler generated module files Do not use this extension for your Fortran source files Source Filenames One or more source filenames may be specified either by name or using the usual Linux wild card characters Filenames must be separated by a space Filenames not matching any of the forms described below are passed directly to the linker Example Loe f90 If the files one 90 two 90 and three for were in the current directory one 90 and two 90 would be compiled and linked together and the executable file a out would be created in the current directory three for would not be compiled because its extension does not match the extension specified on the LF64 command line A source filename must be specified completely including the extension In the absence of an option specifying otherwise i e if neither fix or nfix is specified 90 F90 95 and F95 specify interpretation as Fortran 95 free source form for FOR f and F specify interpretation as Fortran 95 fixed source form Lahey Fujitsu Linux64 Fortran User s Guide Options Once again please note that an uppercase extension will cause the C preprocessor to be invoked before the Fortran compiler is inv
43. specified using OBJDIR OBJEXT May be used to specify a non standard object file extension For example to specify that object files have the extension abc specify OBJEXT abc This option may be useful for dealing with unusual compilers but more commonly to allow AUTOMAKE to deal with processes other than compilation for example you could use AUTOMAKE to ensure that all altered source files are run through a pre processor prior to compilation MODULE May be used to specify the name of the directory in which module files are stored MODULE MODS The trailing is optional If MODULE is not specified AUTOMAKE assumes that source and module files are in the same directory Note that if source and module files are not in the same directory the compiler will also have to be told where to put module files You can do this using a MO place marker which expands to the directory specified using MODULE DEP May be used to over ride the default dependency file name DEP thisprog dep causes AUTOMAKE to store dependency data in thisprog dep instead of automake dep QUITONERROR Specifies that AUTOMAKE should halt immediately if there is a compilation error Lahey Fujitsu Linux64 Fortran User s Guide Multi Phase Compilation NOQUITONERROR Specifies that AUTOMAKE should not halt if there is a compilation error MAKEMAKE Specifies that AUTOMAKE should create a text file called automake mak
44. staticlink to create an executable linked with the static LF64 Fortran runtime librar ies and the shared versions of the Linux system libraries Specifying staticlink will result in a larger executable because it does not depend on the presence of any Fortran runtime shared libraries see Distributing LF64 Applications on page 45 NJSWM msel msegf Suppress Warning Message s Compile only Default nswm To suppress a particular warning or informational message that appears during compilation specify its four digit number msg after swm Multiple messages may be specified as a comma separated list with no spaces Example swm 1040 2005 This example would suppress warning messages 1040 and 2005 To suppress all warnings and informational messages use nwarn A list of warning and error numbers is in the file RTERRMSG threads n PRO version only Number of threads Compile only Default the number of active processors on the system threads specifies the number of instances threads to be created in the range 2 lt N lt number of CPUs active at runtime If this option is specified it eliminates the need for the compiler to produce overhead code identifying how many CPUs are available at execution time It is also useful if there is a natural division of the problem into parallel segments and the number of segments is different from the number of available CPUs Lahey Fujitsu Linux64 Fortran User
45. the cur rent line of code being the first executable line of the file containing the main program Communicating with fdb 66 Variables Variables are specified in fdb in the same manner as they are specified in Fortran 95 In Fortran 95 a derived type i e structure component is specified as variablesmember In Fortran 95 an array element is specified as variable member member Note that in Fortran 95 omission of array subscripts implies a reference to the entire array Listing of array contents in Fortran 95 is limited by the printelements parameter see Miscella neous Controls on page 79 Values Numeric values can be of types integer real unsigned octal or unsigned hexadecimal Unsigned octal values must begin with a 0 and unsigned hexadecimal values must begin with Ox Values of type real can have an exponent for example 3 14e10 In a Fortran 95 program values of type complex logical and character are also allowed Val ues of type complex are represented as real part imaginary part Character data is represented as character string the string is delimited by quotation marks i e ascii 34 Values of type logical are represented as t or f Addresses Addresses can be represented as unsigned decimal numbers unsigned octal numbers which must start with 0 or unsigned hexadecimal numbers which must start with 0x or 0x The following examples show print commands with address specificati
46. 001 10000 b i b i c i end do Loop Fusion and Automatic Loop Slicing In the next example there are DO loops in sequence having the same DO loop control In this case the overhead of the DO loop control and the frequency of multi processing control can be reduced by merging those two loops into a single loop do i 1 10000 a i b i c i end do do i 1 10000 d i e i f i end do With loops fused this becomes Lahey Fujitsu Linux64 Fortran User s Guide Details of Multi Processing do i 1 10000 a i b i c i d i e i f i end do When parallelized this becomes CPU 1 do i 1 5000 a i b i c i d i e i f i end do CPU 2 do i 5001 10000 a i b i c i d i e i f i end do Loop Reduction Loop reduction slices the DO loop changing order of the operations addition and multipli cation etc Note that loop reduction may cause small differences in execution results Loop reduction optimization is applied if there is one of the following operations in the DO loop e SUM sS S A T e PRODUCT P P A I e DOT PRODUCT P P A I B I e MIN X MIN X A I e MAX Y MAX Y A I e OR N N OR A I e AND M M AND A I The next example shows loop reduction and automatic loop slicing sum 0 do i 1 10000 sum sum a i end do Parallelized becomes CPU 1 suml 0 do i 1 5000 suml suml a i end do Lahey Fujitsu L
47. 33 automatic parallelization 89 AZ null terminate string argu ments option 17 B big endian data porting files 125 runtime option T 139 binary file format 125 blank padding runtime option Q 138 BLAS 38 47 block blocksize option 18 breakpoints 69 bugs 143 C C runtime option 134 c suppress linking option 18 Case sensitivity 17 Ccxxxx promote data precision options 19 chk checking option 20 chkglobal global checking option 23 co display compiler options option 23 command files 13 command line arguments and runtime options 131 compiler 9 16 controlling 16 errors 16 compiler options see options 16 Conflicts 12 Cpp invoke preprocessor option 10 23 Create 34 D d runtime option 134 D define preprocessor name option 10 23 dal deallocate allocatables option 24 Data alignment 17 dbl double option 24 debugging with FDB 65 with GDB 65 demo f90 5 diagnostic output runtime option Rm 139 diagnostic reporting level runtime option 1 136 direct file format 125 disassembly 77 DISJOINT 98 driver configuration file 12 syntax 9 dummy argument 123 E e runtime option 135 efficiency considerations 123 endfile records 125 Environment 84 environment variables FLIB_FASTOMP use high speed runtime library 84 FLIB_IOBUFCPY use parallel T O buffers 85 FLIB_IOBUFCPY_SIZE set minimum size for parallel buffer I O to occur 85 FLIB_PARALLEL_INFO out put parallel proce
48. 6 Automatic Display 0 0 cessceeecsreeeseceeeeees 77 SVMDOMS sees pr r n iesees 78 Lahey Fujitsu Linux64 Fortran User s Guide Contents SCMPtS a Ah kee a 78 SLPNAS oeaiei hirere ereite isein ians 78 Miscellaneous Controls cccceeeseeees 79 Files AES AASEN ea 79 Fortran 95 Specific s es 80 Memory Leak Detection sssesesesseseeeeeeeee 80 Processes and Threads c cceceeseeeees 81 REStriCtiOns e eeuse rietser eE 81 Overview of Multi Processing 0 83 Creating Parallelized Programs 84 Controlling parallel program execution 84 Performance Improvement 0 87 Impediments to Improvements 87 Hardware for Multi Processing 89 Examples of Compilation and Execution 89 Details of Multi Processing 89 Optimization Control Line 94 Notes on Parallelization 0 0 103 OpenMP seiniin isinen oari ae 106 Implementation Specifications 107 Automake PRO version only 111 Tintroduction ssis sies ssi riksoriest sosmeses 111 What Does It Do oo eee eee 111 How Does It Do That oe 111 How Do I Set It Up oo eee 111 What Can Go Wrong eseese 112 Running AUTOMAKE oseese 112 The AUTOMAKE Configuration File 112 Multi Phase Compilation 0 0 0 0 117 Automake Notes 0 cece ceeesecseeeceeeeseeeeees 118 Utility ProQramS c cssessseeeeeeeeeeeees 121 LOU sasiesites bseuss nests Becta e
49. 64 Fortran User s Guide 35 Chapter 2 Developing with LF64 36 njpca Protect Constant Arguments Compile only Default npca Specify pca to prevent invoked subprograms from storing into constants The pca option will silently protect constant arguments and does not produce any warnings If pca is specified in conjunction with chk a the action of chk a is overridden by the action of pca In this case no error is generated when a dummy argument that is associated with a constant actual argument is assigned a new value in the subprogram Example call sub 5 print 5 end subroutine sub i i i 1 end This example would print 5 using pca and 6 using npca njprefetch Generate prefetch optimizations Compile only Default nprefetch The prefetch option directs the compiler to generate data prefetching instructions n private Default Module Accessibility Compile only Default nprivate Specify private to change the default accessibility of module entities from PUBLIC to PRI VATE see PUBLIC and PRIVATE statements in the Language Reference nj quad Quad Precision Compile only Default nquad Specify quad to extend all single precision REAL and single precision COMPLEX vari ables arrays constants and functions to double precision and double precision REAL and double precision COMPLEX variables arrays constants and functions to REAL KIND 16 and COMPLEX
50. 8 ocl 35 openmp 35 parallel 35 threadheap 39 threads 38 threadstack 39 parallel automatic parallelization option 35 pca protect constant arguments option 36 Precision promotion 19 pre connected units environment variables for 140 standard i o 133 Index STDIN runtime option r 139 STDOUT runtime option p 138 prefetch prefetch optimization option 36 preprocessor 10 23 35 40 42 filenames and 10 private module accessibility option 36 program size 129 programming hints 123 Q Q runtime option 138 q runtime option 138 quad quadruple precision option 36 quiet quiet compilation option 37 R rruntime option 139 Re runtime option 139 README 6 recursive procedures 34 registering 4 registers 74 requirements system 2 return codes 14 return values execution 133 Rm runtime option 139 RTERRMSG 6 runtime arguments command line 131 runtime diagnostics runtime option 1 136 runtime error handling runtime option Re 139 runtime initialization 51 Runtime Options 131 133 configuration file jwe_prof 132 environment variables for 132 syntax of 133 runtime options a force abnormal termination 134 C IBM370 data conversion 134 command line arguments and 131 d direct i o work area 134 e execution error limit 135 g sequential i o work area 135 GETCL and GETARG returned values 131 i interrupt processing 135 l diagnostic reporting level 136 M IBM370
51. CARRIAGE CONTROL FORTRAN into a form suitable for printing fot interprets the first character of each line of file as a Fortran carriage control character to be used for printing producing a file file2 in Linux format The first character of each line of file causes the following modifications blank The blank is deleted which causes the line to be printed with single spacing A line of all blanks is converted to a line with no characters 0 The character is changed to a new line character which causes the line to be printed with double spacing 1 The character is changed to the new page character which causes the line to be printed at the beginning of a new page If it is the first line of a file the character is deleted Otherwise the character is replaced by a carriage return character which causes the line to be printed over the previous one Examples l fot lt infile gt outfile 2 a out fot lpr 3 fot infile outfile Lahey Fujitsu Linux64 Fortran User s Guide 121 Chapter 7 Utility Programs 122 Diagnostics If the first character of a line is none of the above the line is unchanged Upon completion of the command a diagnostic message is displayed in the standard error file indicating the number of lines not containing a valid Fortran carriage control character For example invalid n lines carriage control conventions in filel hdrstrip f90 hdrstrip 90 is a Fortran source file that
52. CL One or more optimi zation control specifiers follow Lahey Fujitsu Linux64 Fortran User s Guide Optimization Control Line OCL i Li where each i is an optimization control specifier either SERIAL PARALLEL DISJOINT TEMP or INDEPENDENT see Optimization Control Specifier on page 94 Position of OCL The position of the OCL depends on the optimization control specifier The OCL for automatic parallelization must occur at a total position or loop position Total position and loop position are defined as follows e Total position the top of each program unit e Loop position immediately before a DO loop However more than one OCL may be specified at loop position and comment lines may be specified between the OCLs and the DO loop ocl serial lt total position subroutine sub b c n integer a n b n c n do i 1 n a i b i c i end do print fun a ocl parallel lt loop position do i 1 n a i b i c i end do print fun a end Automatic Parallelization and Optimization Control Specifiers An optimization control specifier becomes ineffective for a DO loop that is not a target of loop slicing even if the optimization control specifier for automatic parallelization is specified Optimization Control Specifiers The following optimization control specifiers are used to enhance automatic parallelization e SERIAL e PARALLEL e DISJOINT e TEMP e INDEPEN
53. DENT SERIAL The SERIAL specifier is used to inhibit DO loop slicing Lahey Fujitsu Linux64 Fortran User s Guide 95 Chapter 5 Multi Processing PRO version only 96 For instance if the programmer knows that serial execution of a DO loop is faster than par allel execution perhaps because the iteration count will always be small the programmer may specify the SERIAL specifier for the DO loop Syntax OCL SERIAL The SERIAL specifier may be specified at the loop position or the total position The effect of SERIAL depends on its position e At the loop position SERIAL inhibits loop slicing for the DO loop including any nested loops corresponding to the OCL e At the total position SERIAL inhibits loop slicing for all loops in the program unit containing the OCL In the following program if loop 2 should not be sliced loop slicing can be disabled by spec ifying SERIAL the letter p on the left side of the source program marks the parallelized statements p do j 1 10 p do 2 So Iy I fy Keen ssssssss loop 1 p al i j al i j b1 i j p c1 i j c1 i j dl i j p el i j el i j Ebt p g1 i j g1 i j h1 i j p end do p end do p do j 1 10 p do i l m e SSeS loop 2 p a2 i j a2 i j b2 i j p c2 i j c2 i j d2 i 4 p e2 i j e2 i j3 E2 p g2 1i j3 g2 i j h2 i j p end do p end do p do j 1 10 p do i 1 n E S Seo loop 3 p a3 i j a3 i j
54. F64 arguments are passed to subprograms by address and the subprograms reference those arguments as they are defined in the called subprogram Because of the way arguments are passed the following side effects can result e Declaring a dummy argument as a different numeric data type from that declared in the calling program unit can cause unpredictable results and NDP error aborts Lahey Fujitsu Linux64 Fortran User s Guide 123 Appendix A Programming Hints e Declaring a dummy argument to be larger in the called program unit than in the call ing program unit can result in other variables and program code being modified and unpredictable behavior e Ifavariable appears twice as an actual argument in a single CALL statement or func tion reference then the corresponding dummy arguments in the subprogram will refer to the same location Whenever one of those dummy arguments is modified so is the other In accordance with the Fortran standard the compiler and or runtime is not required to notice such changes this allows optimizations to be performed e g keeping the second dummy argument or elements thereof in registers e Function arguments are passed in the same manner as subroutine arguments so that modifying any dummy argument in a function will also modify the corresponding argument in the function invocation y x x The result of the preceding statement is undefined if the function modifies the dummy argument x
55. INCLUDE key word Otherwise AUTOMAKE looks in the source file directory and if it is not there in the directories specified using the INCLUDE keyword If AUTOMAKE cannot find an INCLUDE file it reports the fact to the screen and ignores the dependency relationship Lahey Fujitsu Linux64 Fortran User s Guide if OBJDIR were not set it would default to utils NOT obj Automake Notes AUTOMAKE is invoked using a script file called am There is seldom any reason to modify the script file though it is very simple to do so if required It consists of two or three operations Execute AUTOMAKE AUTOMAKE determines what needs to be done in order to update your project and writes a script file to do it The options which may be appended to the AUTOMAKE command are TO specifies the name of the output script file created by AUTOMAKE F1G specifies the name of the AUTOMAKE configuration file Execute the command file automake tmp created by AUTOMAKE Delete the command file created by AUTOMAKE This step is of course optional Lahey Fujitsu Linux64 Fortran User s Guide 119 Chapter 6 Automake PRO version only 120 Lahey Fujitsu Linux64 Fortran User s Guide Q Utility Programs This chapter documents the following utility programs EOT e hdrstrip f90 e sequnf f90 e tryblk f90 fot Usage fot filel file2 fot is a program that is used for converting files created by LF64 opened as
56. LANK specifier in an OPEN statement is set to ZERO If the x option is omitted blanks in the input field are treated as null and ignored The result is the same as if the BLANK specifier in an OPEN statement is set to NULL or if the BLANK specifier is omitted Example a out W1 x Environment Variables for Input Output 140 This section describes environment variables that control file input output operations These environment variables are lower case unless otherwise indicated fuunit filename 00 lt unit lt 2147483647 The fuunit environment variable pre connects units to files The value unit is a unit number must be at least two digits The value filename is a file to be connected to unit number unit The standard input and output files fu05 and u06 and error file fu00 must be avoided unless their values have been modified using the m p or r options in which case those new values must be avoided Lahey Fujitsu Linux64 Fortran User s Guide Environment Variables for Input Output The following example shows how to connect myfile dat to unit number 10 prior to the start of execution Example setenv ful0 myfile dat fuunitbf size 00 lt unit lt 2147483647 The fuunitbf environment variable specifies the size of the input output work area used by sequential or direct access input output statements This applies equally to both formatted and unformatted files The value unit in the fuunitbf envir
57. LF64 Equivalent to specifying the default LF64 compile and link commands COMPILE lfc c fi mod mo LINK lfc ob o ex mod mo The LF64 keyword should appear in any automake fig file that is to be used with LF64 Lahey Fujitsu Linux64 Fortran User s Guide The AUTOMAKE Configuration File FILES Specifies the names of files which are candidates for re compilation The value field should contain a single filename optionally including wild cards For example FILES 90 You can also have multiple FILES specifications separated by AND keywords FILES F90 F90 AND FILES F77 FOR AND Note that with each new FILES line the default COMPILE is used unless a new COM PILE value is specified after the FILES line and before AND Note also that if multiple FILES lines are specified then the RF place marker place markers will be explained in the next section cannot be used in any COMPILE lines COMPILE Specifies the command to be used to compile a source file The command may contain place markers which are expanded as necessary before the command is executed For example COMPILE lfc c fi Lahey Fujitsu Linux64 Fortran User s Guide 113 Chapter 6 Automake PRO version only 114 The string sfi in the above example is a place marker which expands to the full name of the file to be compiled The following table is a complete list of place markers and their meanings
58. Lahey Fujitsu Linux64 Fortran User s Guide Revision F Copyright Copyright 1995 2008 Lahey Computer Systems Inc All rights reserved worldwide Copyright 1999 2008 FUJITSU LTD All rights reserved This manual is protected by federal copyright law No part of this manual may be copied or distributed transmitted transcribed stored in a retrieval system or translated into any human or computer language in any form or by any means electronic mechanical magnetic manual or otherwise or disclosed to third parties Trademarks Names of Lahey products are trademarks of Lahey Computer Systems Inc Other brand and product names are trademarks or registered trademarks of their respective holders Disclaimer Lahey Computer Systems Inc reserves the right to revise its software and publications with no obligation of Lahey Computer Systems Inc to notify any person or any organization of such revision In no event shall Lahey Computer Systems Inc be liable for any loss of profit or any other commercial damage including but not lim ited to special consequential or other damages Lahey Computer Systems Inc 865 Tahoe Boulevard P O Box 6091 Incline Village NV 89450 6091 775 831 2500 Fax 775 831 8123 http www lahey com Technical Support support lahey com Table of Contents Getting Started ccssssessssssessensees 1 System Requirements eee eeeeeeeeeeeee 2 Manual Organization eee eeeeeeere
59. NDENT allows loop slicing for all loops in the program containing the OCL Con sider the following code do i 1 10000 jail a i fun j end do end function fun j fun sqrt real j 2 3 j 6 end In the program above because the procedure FUN is called in the DO loop the system can not determine whether the DO loop can be parallelized If the programmer knows that there is no problem even if the DO loop which contains the reference to the procedure FUN is sliced the DO loop can be sliced by using INDEPEN DENT as shown in the code below Lahey Fujitsu Linux64 Fortran User s Guide 101 Chapter 5 Multi Processing PRO version only 102 The letter P shown on the left side of the source program marks the parallelized statements ocl independent fun p do i 1 1000 p ay 2 p a i fun j p end do end function fun j fun sqrt real j 2 3 j 6 end Note If a procedure that cannot be sliced is described in an INDEPENDENT specifier by mistake LF64 may perform an incorrect loop slicing and program results may be incorrect Wild Card Specification In the operand of the following optimization control specifiers a wild card may be specified for a variable name or a procedure name e DISJOINT e TEMP e INDEPENDENT The wild card specification is a combination of the special wild card characters and alphanu meric characters The effect is the same as specifying all of the variable names an
60. THREAD_STACK_SIZE can change the stack size of each thread The compiler option threadstack takes precedence over the environment variable THREAD_STACK_SIZE Performance Improvement The effect of multi processing is to save elapsed execution time by using two or more CPUs simultaneously For instance if a DO loop can be executed in parallel by dividing it as shown above then theoretically the elapsed time taken to execute this DO loop may be cut in half In practice improving performance requires some care and some work on the part of the pro grammer as explained in the following sections Although the elapsed time usually will be decreased by multi processing the total CPU time required to execute the program will actually increase This is because the total CPU time is equal to the CPU time when the program is executed on a single processor plus the overhead time for multi processing Impediments to Improvements Speed improvements from multi processing using LF64 PRO come from splitting up loops among the available processors Impediments to performance improvements include the following Lahey Fujitsu Linux64 Fortran User s Guide 87 Chapter 5 Multi Processing PRO version only e Overhead for initiating and managing threads on secondary processors e Lack of large arrays and loops operating on them e I O intensive rather than computationally intensive programs e Potential for incorrect results e Other unparall
61. ahey Fujitsu Linux64 Fortran User s Guide Manual Organization Manual Organization This book is organized into seven chapters and three appendices e Chapter 1 Getting Started identifies system requirements describes the installation process and takes you through the steps of building your first program e Chapter 2 Developing with LF64 describes the development process and the driver program that controls compilation linking and the generation of executable pro grams or libraries e Chapter 3 Mixed Language Programming describes the creation of mixed language programs using C e Chapter 4 Command Line Debugging with fdb describes the command line debugger e Chapter 5 Multi Processing PRO version only describes how to use LF64 PRO s automatic and OpenMP parallelization capabilities e Chapter 6 Automake PRO version only describes how to use Automake LF64 PRO s automatic build tool e Chapter 7 Utility Programs describes how to use the additional utility programs e Appendix A Programming Hints offers suggestions about programming in Fortran on the PC with LF64 e Appendix B Runtime Options describes options that can be added to your execut able s command line to change program behavior e Appendix C Lahey Technical Support describes the services available from Lahey and what to do if you have trouble Notational Conventions The following conventions are used throughout this manual
62. ansferred in an unformatted input output statement The optional argument unit is a unit number valued between 0 and 2147483647 connected with an unformatted file If unit is omitted T takes effect for all unit Lahey Fujitsu Linux64 Fortran User s Guide 139 Appendix B Runtime Options numbers If both T and Tunit are specified then T takes effect for all unit numbers By default LF64 reads and writes numeric data integer logical and IEEE floating point as little endian Note that this conversion is not performed if the real variable is a component of a derived type and the whole type is being read Example a out W1 T10 u Underflow Interrupt Processing The u option controls floating point underflow interrupt processing If the u option is specified LF64 performs floating point underflow interrupt processing The system may output diagnostic message0012i e during execution If the u option is omitted the system ignores floating point underflow interrupts and continues processing The i option must not be combined with the u option Example a out W1 u X Blanks in Numeric Formatted Input The x option determines whether blanks in numeric formatted input data are ignored or treated as ZEROs If the x option is specified blanks are changed to zeros during numeric editing with formatted sequential input statements for which no OPEN statement has been executed The result is the same as when the B
63. be the last record of a sequential file Endfile records do not have a length attribute The ENDFILE statement writes an endfile record in a sequential file After at least one WRITE statement is executed an endfile record is output under the following conditions e A REWIND statement is executed A BACKSPACE statement is executed e A CLOSE statement is executed Porting Unformatted Files Unformatted files created on other platforms can be accommodated with certain runtime options Big endian numeric data integer logical and IEEE floating point can be accom modated with runtime option T Note that the big endian conversion is not performed for real variables that are elements of a derived type if the whole type is being read IBM370 format Lahey Fujitsu Linux64 Fortran User s Guide 125 Appendix A Programming Hints floating point data can be accommodated with runtime options C and M see Runtime Options on page 131 By default LF64 reads and writes numeric data in little endian format File Creation Default Names If a file is opened without specifying a filename the file is assigned the name fort unit where unit is the unit number specified in the OPEN statement If a file is opened as STATUS SCRATCH and FILE is not specified then the file is assigned a random name and is created in the system temporary directory If FILE is spec ified then the file is created in the current work
64. ble name used temporarily in a DO loop A wild card specification is usable in s If the variable name is omitted TEMP becomes effective for all scalar vari ables within the range of the DO loop See Wild Card Specification on page 102 for the wild card syntax The TEMP specifier can be placed at the loop position or the total position The effect of TEMP depends on its position Lahey Fujitsu Linux64 Fortran User s Guide 99 Chapter 5 Multi Processing PRO version only e At the loop position TEMP indicates that the variables in the DO loop corresponding to the OCL are temporary variables e At the total position TEMP indicates that the variables of all loops in the program unit containing the OCL are temporary variables In the example below because T is a common variable LF64 must assume that variable T is referenced in subroutine SUB even if T is used only in the DO loop LF64 adds code to guar antee that T has the correct value at the end of the parallelized DO loop The letter P shown on the left side of the source program marks the parallelized statements common t p do J L 50 p do i 1 1000 p t a i j b i j p c i j t d i j p end do p end do call sub If the programmer knows that the value of T at the end of the DO loop is not needed in sub routine SUB the programmer may specify the TEMP specifier with T as shown in the following code As a result the execution performance improves
65. brary 37 sse2 use SIMD level 2 extensions 37 sse3 use SIMD level 3 extensions 37 SSL2 link with BLAS LAPACK and SSL II libraries 38 static statically link runtime libraries 38 staticlink link to static runtime 38 swm suppress warning messages 38 threadheap set thread heap size 39 threads thread creation 38 threadstack set thread stack size 39 trace location and call trace back for runtime errors 39 trap trap numeric exceptions 40 U undefine preprocessor name 10 40 unroll loop unrolling 40 v9xx standard conformance 152 Lahey Fujitsu Linux64 Fortran User s Guide diagnostics 40 varheap local variable on heap 41 varstack allocate local vari ables on stack 41 verbose verbose output 41 version print version information 41 Wa pass option to assembler 12 42 warn display warning messages 42 wide wide source format 42 wisk Winteracter Starter Kit 42 WI pass option to linker 42 45 wo warn obsolescent 42 Wp pass option to preprocessor 12 42 Wtool pass option to linker 12 x inline code 43 xref cross reference listing 43 zfm zero flush mode for SSE instructions 43 out output file name option 34 output filenames 11 P p runtime option 138 P save preprocessor files option 10 35 PARALLEL environment variable 87 PARALLEL OCL Line 97 parallel processing options Kparallel 28 Kpureomp 28 Kthreadprivate 2
66. broken by that signal In this case program execution is usually interrupted later when the program is broken again at the same instruction silentcontinue count Same as Continue but if a signal breaks a program the program is notified of that signal when program execution is continued step count Executes the next count lines including the current line If omitted count defaults to 1 and only the current line is executed If a function or subroutine call is encountered execution steps into that procedure silentstep count Same as Step but if a signal breaks a program the program is notified of that signal when program execution is continued stepi count Executes the next count machine language instructions including the current instruction If omitted count defaults to 1 and only the current instruction is executed silentstepi count Same as stepi but if a signal breaks a program the program is notified of that signal when program execution is continued Lahey Fujitsu Linux64 Fortran User s Guide Controlling Program Execution next count Executes the next count lines including the current line where a function or subroutine call is considered to be a line If omitted count defaults to 1 and only the current line is executed In other words if a function or subroutine call is encountered execution steps over that procedure silentnext count Same as Next but if a si
67. cal data are inlined If the dash argument is specified no other arguments may be present Use of the x option may cause long compile times and may lead to very large executables n xref soec svall spec sval Cross Reference Listing Compile only Default nxref Specify xref to generate cross reference information in the listing file By default cross ref erence filenames consist of the basename of the source filename plus the extension 1st placed in the current working directory see nJlst spec sval spec sval on page 30 Specifying xref will override nlst See also n lst n zfm Enable zero flush mode for SSE instructions Compile only Default zfm Specify nzfm to disable zero flush mode for SSE instructions Zero flush mode is a non standard mode of operation for the floating point processor Lahey Fujitsu Linux64 Fortran User s Guide 43 Chapter 2 Developing with LF64 Note that using zfm will disable trapping for floating underflow If an underflow condition occurs during execution of an SSE instruction the affected variable is set to zero If this behavior presents a problem use the nzfm option to guarantee that the underflow exception is thrown Linking Rules 44 During the link phase the driver submits object files and object file libraries to the linker for creation of the executable or shared library output file Fortran 95 Modules If you
68. case sensitive When you create a Fortran program that references non Fortran procedure s you declare the non Fortran procedure name s with the ML_EXT ERNAL statement in your Fortran code The syntax of the ML_EXT ERNAL external name list EXT ML ERNAL statement in this case is where external name list is a comma separated list of names of procedures referenced in this scoping unit The procedures may be subroutines or functions Non Fortran functions may only return data types specified in Table 7 on page 54 program main implicit none x real My_C_Func ml_external My_C_Func name My_C_Func end program main X write x is case sensitive These codes must be compiled using LF64 s m1 target option in order to be callable by language target See ml target on page 31 EXT Note that ML ERNAL is a Statement and not an attribute In other words ML EXT ERNAL may not appear in an attribute list in an INTEGER REAL COMPLEX LOGICAL CHAR ACTER or TYPE statement For further examples refer to the directories below LF64 s examples directory Passing Data Data may be passed to or from other language systems as arguments function results exter nal COMMON variables or in files LF64 does not support arrays of pointers passed from C or pointers with more than one level of indirection LF64 s calling c
69. ccessing a Fortran array in C The reason for this is that in C the right most index varies most quickly and in Fortran the left most index varies most quickly multi dimensional In an array of arrays the columns are stored sequentially row 1 column 1 is followed by row 1 column 2 etc In a multi dimensional array the rows are stored sequentially row column 1 is followed by row 2 column 1 etc Also note that all C arrays start at 0 We do not recommend that you use a lower dimension bound other than zero 0 as your C code will have to modify the indices based on the value used We strongly recommend that you do not use negative lower and upper dimension bounds If the subscript ranges are not known at compile time they can be passed at runtime but you will have to provide the code to scale the indices to access the proper members of the array Some sample code may help explain the array differences Your Fortran code would look like subroutine test real_array real real_array 0 4 0 5 0 6 0 7 0 8 0 9 0 10 integer i j k 1 m n o0 do o 0 10 do n 0 9 do m 0 8 do 1 0 7 do k 0 6 do j 0 5 do i 0 4 real_array i j k 1l m n o 12 00 end do end do end do end do end do end do end do end subroutine test The equivalent C code would look like Lahey Fujitsu Linux64 Fortran User s Guide 59 Chapter 3 Mixed Language Programming 60 void test float real_array 10 9 8 7 6 5 4 int
70. contacting Lahey Technical Support we suggest you do the following to help us pro cess your report e Determine if the problem is specific to code you created Can you reproduce it using the demo programs we provide e If you have another machine available does the problem occur on it Information You Provide When contacting Lahey please include the information listed below e Registered user name e Registered serial number e Product title and version for example LF64 v8 1 e Patch level for example the h patch e Operating system for example Ubuntu 8 04 kernel 2 6 24 libc 2 7 10 e A short source code example This will allow us to reproduce the problem Please make sure the source code is as short as possible to allow us to analyze your issue quickly Attach the source code file to your e mail to support lahey com e Third party products used If you are using an add on library such as Winteracter provide the name and version of the product If your application is mixed language such as Fortran and C provide the name and version of the non Fortran language system e System environment settings Lahey Fujitsu Linux64 Fortran User s Guide Lahey Warranties e Step by step problem description Tell us the sequence of commands or buttons used that lead up to the problem occurring Remember if we can t reproduce it we can t fix it for you e Compiler linker or Make Automake messages e While simply typing
71. ct results may occur Do not use with 3rd party compiled modules objects or librar ies Specifically the x argument must be used to compile all USEd modules and to compile program units which set values within COMMONS Specifying the argument x will force undefined variables checking u and will increase the level of checking performed by any other specified arguments Specifying chk adds to the size of a program and causes it to run more slowly sometimes as much as an order of magnitude It forces trace and O0 chk overrides parallel Specifying chk f checks whether a file is connected with two or more devices at the same time in the input output statement Specifying chk o checks the following e Two dummy arguments are overlapped and the part of the overlap is changed e When an assumed size array with INTENT OUT attribute is referenced during exe cution checks to see if the variable is defined e When a variable with SAVE attribute is referenced during execution checks to see if the variable is defined Specifying chk o forces the a and u options automatically The chk option will not check bounds in the following conditions e The referenced variable has the POINTER attribute or is a structure one or more of whose structure components has the POINTER attribute Lahey Fujitsu Linux64 Fortran User s Guide 21 Chapter 2 Developing with LF64 The referenced variable is an assumed shape array The re
72. ctly must be specified This also applies to modules that are already compiled When creating a new module the mod file will be placed in the directory specified with M or the first directory specified by mod If the directory does not exist the compiler will attempt to create it If no directories are specified with M or mod then module files are placed in the current working directory Note that I has no effect on module placement even though it affects the order that directories are searched for existing modules Module object o files are placed in the current working directory Note that any module object files cre ated by previous compilations must be on the LF64 command line when linking Example lfc modprog f90 mod o othermod o M mods I other or lfc modprog f90 mod o othermod o mod mods other In these examples the compiler first searches for module files in mods then searches the current working directory and finally searches other All module files produced from modprog 90 are placed in the directory mods All object files produced by mod prog f90 are placed in the current working directory model small medium Memory model Compile only Default small The model option specifies which memory model will be used when compiling The small model limits code text and data to 2gb or less The medium model allows data in excess of 2gb but code and text size is still limited to 2gb
73. ctory is usr local 1 6481 however you can change it to a directory of your choice during the installation Consult the README document for more information Maintenance Updates 4 Maintenance updates are available free from Lahey s website They comprise bug fixes or enhancements or both for this version of LF64 The update program applies patches to your files to bring them up to date The maintenance update version shows as a letter after the version of your compiler This is displayed in the first line of output when you run the compiler To get the latest maintenance update for this version go to Lahey s web page http www lahey com There you will find update programs you can download as well as release notes and bug fix descriptions Once you have downloaded an update program you will no longer need an Internet connection In general if you modify the contents of any of the files installed by this product except within the Examples directory that particular file will no longer be valid for updating and the update installation program may abort with an error message Lahey Fujitsu Linux64 Fortran User s Guide Uninstalling LF64 Uninstalling LF64 The uninstall program is located in the LF64 installation directory usr local 1 6481 by default You must be logged in as root in order to uninstall LF64 Any new files created after installation will not be removed Building Your First LF64 Program Building
74. d Note that the name of the shared library must be prefixed with lip Also note that at runt ime 1ibsub so must be available on one of the directories specified in the LD_LIBRARY_PATH variable Using Archive Libraries To create an archive library use the nshared option Example lfc sub f90 out libsub a nshared lfc main f90 L lsub Using the same source files as in the example above The following takes place sub 90 is compiled to create sub o the archive utility ar is automatically invoked to create 1ibsub a from sub o Note that libsub a is an archive static library main 90 is compiled to create main o main o is statically linked with the necessary object code contained in libsub a to create an executable program Note that shared library 1ibsub so must not be present in the current directory otherwise the linker will try to reference that file instead See Linking Rules on page 44 Lahey Fujitsu Linux64 Fortran User s Guide 15 Chapter 2 Developing with LF64 Controlling Compilation During the compilation phase the driver submits specified source files to the compiler for compilation and optimization If the c compile only option is specified processing will stop after the compiler runs and objects and or modules are created if necessary See n c on page 18 Otherwise processing continues with linking and creation of the executable program or library file
75. d procedure names that agree with the wild card expression There are two wild card characters and and they match the following character strings e matches any character string of one or more alphanumeric characters e 2 matches any single alphanumeric character A wild card specification cannot contain more than one wild card character ocl temp w In this example w matches any variable beginning with w and having a length of two or more characters For example the variable names work1 w2 and work3 are included in this specification ocl disjoint a In this example a matches any two character array name which has a for the first character For example the array names a1 a2 and aa are included in this specification The array name abc is not included in this specification because its length is not two ocl independent sub Lahey Fujitsu Linux64 Fortran User s Guide Notes on Parallelization In this example sub matches any four character procedure name whose first three character are sub For example procedure names sub1 sub2 and sub9 are included in this specification Notes on Parallelization This section explains some specifics about the parallelization facility threads When the number of CPUs executed in parallel is specified by the threads compiler option the argument to threads must have the same value as the value of the PARALLEL environ ment variable If the PARALLEL
76. data conversion 137 m standard error output 137 n prompt messages stdin 137 p standard output 138 Q blank padding 138 q capitalize numeric edit output 138 r standard inputunit 139 Re runtime error handling 139 Rm diagnostic output file 139 Ry Y2K compliance 139 T big endian conversion 139 u undrflow interrupts 140 WI indicate runtime option 131 x blanks in numeric input 140 Ry runtime option 139 S S generate assembly instead of object 37 sav SAVE local variables option 37 Scientific Software Libraries 46 searching rules library 45 SEQUNEF F90 122 SERIAL 95 shared shared library option 37 side effects 123 SIMD 37 source filenames 10 sse2 use streaming SIMD level 2 extensions option 37 sse3 use SIMD level 3 extensions option 37 SSL2 46 SSL2 link with BLAS LAPACK and SSL II libraries option 38 Stack allocation 33 39 41 Standard conformance 24 40 standard input output units 133 static static runtime library option 38 staticlink static runtime option 38 STDERR runtime option m 137 STDIN prompt messages runtime option n 137 unit assignment runtime option r 139 STDIN STDERR STDOUT 133 STDOUT unit assignment runtime option p 138 step 72 support services 143 swm suppress warning message s option 38 syntax driver 9 system requirements 2 T T runtime option 139 technical support 143 TEMP 99 THREAD_STACK_ SIZE environ men
77. dditions to MODULEs and INCLUDEd files even when nested For example if you change a file which is INCLUDEd in half a dozen source files AUTOMAKE ensures that these files are re compiled In the case of Fortran 95 AUTOMAKE ensures that modules are recompiled from the bottom up taking full account of module dependencies How Does It Do That AUTOMAKE stores details of the dependencies in your program e g file A INCLUDEs file B in a dependency file usually called automake dep AUTOMAKE uses this data to deduce which files need to be compiled when you make a change Unlike conventional MAKE utilities which require the user to specify dependencies explicitly AUTOMAKE creates and maintains this data itself To do this AUTOMAKE periodically scans source files to look for INCLUDE and USE statements This is a very fast process which adds very little to the overall time taken to complete the update How Do I Set It Up The operation of AUTOMAKE is controlled by a configuration file which contains the default compiler name and options INCLUDE file search rule etc For simple situations where the source code to be compiled is in a single directory and builds into a single execut Lahey Fujitsu Linux64 Fortran User s Guide 111 Chapter 6 Automake PRO version only able it will probably be possible to use the system default configuration file In that case there is no need for any customization of AUTOMAKE just type am to upda
78. de 49 Chapter 3 Mixed Language Programming Please note that in general mixed language procedure names are case sensitive unlike the Fortran naming convention which ignores case ML_EXTERNAL is used when defining a Fortran procedure and when referencing an external procedure The type of mixed language interface is defined with the use of the m1 compiler option You cannot mix m1 options in a single invocation of LF64 If you need to reference procedures from multiple languages you can do so by putting the references in separate source files and compiling them separately The table below describes the varieties of procedures that may be found in an LF64 program along with the form taken by the procedure s default external name i e the name seen by the linker Table 5 Default External Names for Fortran Procedures Procedure Name Seen from outside as FUNCTION MyFunc myfunc_ SUBROUTINE MySub mysub_ f_procl intrinsic procedure procl or g_procl main program MAIN _ common block a a_ The external names of Fortran functions and subroutines may be modified by using the L_EXTERNAL statement along with the ml compiler option The purpose of the L_EXTERNAL statement is to modify the name decoration or name mangling that is applied to the external procedure name in accordance with the m1 compiler option and to allow case to be preserved
79. e equivalenced to any other fast Optimize code based on compiler environment Compile only Default no optimization Specify the fast option to optimize code based on the environment of the compiling machine The compiler examines the hardware configuration and applies SSE and prefetch ing optimizations accordingly Use of fast forces ntrace file filename Filename Compile and link Default not present Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options Precede the name of a file with file to ensure the driver will interpret the filename as the name of a file and not an option or an argument to an option n fix Fixed Source Form Compile only Default not present Specify fix to instruct the compiler to interpret source files as Fortran 90 fixed source form nfix instructs the compiler to interpret source files as Fortran 90 free source form Example lfc bob rsp bill f90 If the command file bob rsp contains fix then bill 90 will be interpreted as fixed source form even though it has the free source form extension 90 Specifying neither fix nor nfix will cause LF64 to interpret the source form according to the file s extension see Filenames and Extensions on page 10 LF64 will not compile files including INCLUDE files containing both fixed and free source form in the same file g Debug Compile and link Default g not present Specify g to instruc
80. e evaluated as double precision real or complex This option applies to all single precision real and complex variables constants and functions regardless of how they are declared This option is equivalent to specifying dbl Lahey Fujitsu Linux64 Fortran User s Guide 19 Chapter 2 Developing with LF64 20 If either the CcdRR8 or the CcR4R8 options are specified the REAL FLOAT SNGL and SNGLQ functions must not be used as an actual argument If either the CcdRR8 or the CcR4R8 options are specified the dbl and quad options may not be specified Double precision real and complex promotion The CcdDR16 option causes variables constants and functions of type double precision REAL and COMPLEX to be evaluated as quad precision real or complex This option does not affect a variable or function that is declared with a kind or a constant with a kind or pre cision specified The CcR8R16 option causes variables constants and functions of type double precision REAL or COMPLEX to be evaluated as quad precision real or complex This option applies to all double precision real and complex variables constants and functions regardless of how they are declared This option in combination with CcR4R8 is equivalent to specifying quad If either the CcdDR16 or the CcR8R16 option is specified the DFLOAT DBLE DBLEQ DREAL and DPROD functions must not be used as an actual argument If either the CcdDR16 or the CcR8R16 opt
81. e number corresponding to the entry point of func tion or subroutine proc plus or minus offset lines When using this syntax proc may not be a module or internal procedure e proc inproc specifies internal procedure inproc within proc e mod proc inproc_ specifies procedure proc contained in module Lahey Fujitsu Linux64 Fortran User s Guide 69 Chapter 4 Command Line Debugging with fdb 70 mod or internal procedure inproc within module procedure proc Note that a break point may be set on a module procedure without specifying the module name If there is more than on module with a procedure of a given name then you will be prompted to select from a list e addr specifies a physical address default radix is hexadecimal e If location is omitted it defaults to the current line of code The conditional expression expr can be constructed of program variables structure compo nents and constants along with the following operators Minus unary operator Plus unary operator Assignment statement Scalar relational operator lt lt gt gt LT LE EQ NE GT GE Logical operator NOT AND OR EQV NEQV break file line Sets a breakpoint at the line number line in the source file file If omitted file defaults to the current file Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character
82. e refer to signal 5 for the name that can be spec ified for sig The possible values for action are Lahey Fujitsu Linux64 Fortran User s Guide Miscellaneous Controls stop Execution stopped when signal sig encountered nostop Execution not stopped when signal sig encountered show signal sig Displays the set response for signal sig If sig is omitted the response for all signals is displayed Miscellaneous Controls param listsize num The number of lines displayed by the 1ist command is set to num The initial default value of num is 10 param prompt str str is used as a prompt character string quotation marks required The initial default value is fdb param printarray on off When the value is on the elements of arrays are displayed one element per line in response to the print command The initial default value is off which causes elements to be displayed as a comma separated list which wraps around the end of the console screen param printstructure onloff When the value is on the elements of derived types structures are displayed one element per line in response to the print command The initial default value is off param printelements num Set the number of displayed array elements to num when printing arrays The initial default value is 200 The minimum value of num is 10 Setting num to O implies no limit param prm Display the value of parameter prm
83. e same runtime option is specified more than once the last occurrence is used Example a out W1 a pl10 x Descriptions of Runtime Options a Force Abnormal Termination When the a option is specified an abend abnormal termination event is forcibly exe cuted following normal program termination This processing is executed immediately before closing external files Example a out Wl a C or C u_no Convert IBM370 Floating Point Format The C option specifies how to process an unformatted file of IBM370 format floating point data using an unformatted input output statement When the C option is specified the REAL and DOUBLE PRECISION data of an unformatted file associated with the specified unit number is regarded as IBM370 format floating point data in an unformatted input output statement The optional argument u_no specifies an integer from 0 to 2147483647 as the unit number If optional argument u_no is omitted the C option is valid for all unit numbers con nected to unformatted files When the specified unit number is connected to a formatted file the option is ignored for the file When the c option is not specified the data of an unfor matted file associated with unit number u_no is regarded as IEEE format floating point data in an unformatted input output statement Example a out W1 C10 d nhum 1 lt num lt 32767 Direct Access I O Work Area The d option determines the size of the input out
84. ed not to be a full implementation of the Fortran 95 Standard and Lahey does not fix the deviation from the standard within 60 days of your report e Lahey fails to fix a bug with the highest priority within 60 days of verifying your report All returns following the original 30 days of ownership are subject to Lahey s discretion If Lahey has provided you with a source code workaround a compiler patch a new library or a reassembled compiler within 60 days of verifying your bug report the problem is consid ered by Lahey to be solved and no product return and refund is considered justified Lahey Fujitsu Linux64 Fortran User s Guide 145 Appendix C Lahey Technical Support Return Procedure You must report the reason for the refund request to Lahey and receive an RMA number This RMA number must be clearly visible on the outside of the return shipping carton Lahey must receive the returned product within 15 days of assigning you an RMA number You must destroy the following files before returning the product for a refund e All copies of Lahey files delivered to you and all backup copies e All files created by this Lahey Language System A signed statement of compliance to the conditions listed above must be included with the returned software Copy the following example for this statement of compliance l your name in accordance with the terms specified here acknowledge that I have destroyed all backup copies of and all o
85. ed to indicate runtime options as described in Appendix B Runtime Options For further information see the man pages for 1d the GNU linker Distributing LF64 Applications When you distribute applications built with LF64 you need to be aware of the shared dynamic libraries that your application requires to run on the target platform You can use the Linux command 1dd to display the shared libraries required by your application Any shared libraries that have been created must be distributed with your application You must link with the staticlink option which will bind the LF64 Fortran static runtime libraries to the executable see n staticlink on page 38 You are not allowed to distrib ute the LF64 Fortran shared libraries so 1 residing in the 1ib subdirectory of your LF64 installation The remaining required shared libraries usually residing under the 11ib directory are the GNU C runtime libraries which will be available on any Linux system that has glibc installed Distributing these libraries is not recommended and is governed by a GNU Public License These shared libraries allow your application to use the GNU C runtime of the target Linux system whether it be newer or older Note that a program built on a system running a newer version of glibc might not execute properly on a system running an older version It is rec ommended that you build your application on the earliest version available for best portab
86. eeeee 3 Notational Conventions ec eeeeeeeeeeeeeees 3 Product Registration ceessceeeeceseeeneceeeeees 4 Installing Lahey Fujitsu Linux64 Fortran 4 Maintenance Updates 0 000 eee eee ceeenees 4 Uninstalling LFO64 000 eeeeeeeneeeee 5 Building Your First LF64 Program 5 Generating the Executable Program 5 Running the Program s es 5 What s Next e anr n sist danas 6 Other Sources of Information 6 Developing with LFG64 ccssseessee 9 How the Driver Works 0 eee cece ete eeeee 9 Running the LF64 Driver eee 9 Filenames and Extensions 0 10 OPUlODS eesssiseicesinescs aise teoesessevigees Sieeliees e8 11 Driver Configuration File lfc fig 12 Command Files eee eee eeeeeseecreessecneensees 13 Intermediate Files eee eeeeeecsecereeees 13 Return Codes from the Driver 14 Shared Libraries eee cece ceeceseeseeeeeees 14 Archive Libraries 0 00 0 cee eeeeeeeseeeecseeeeees 14 Using Shared Libraries 0 eee eens 15 Using Archive Libraries eee 15 Controlling Compilation eee 16 Errors in Compilation eee 16 Compiler and Linker Options 16 Linking Rules 0 0 eee ceeeesceeseceeeeeneeeeneeeeee 44 Fortran 95 Modules 0 0 0 cee ceeeeeeseeeeeeees 44 How the Linker Finds Libraries 44 Object File Processing Rules 44 How the Linker Selects Objects 45 Linker Options sseni
87. eis 45 Distributing LF64 Applications 45 OpenGL Graphics Programs eee 46 Scientific Software Libraries PRO Version ODN tees EE EAE EEEE 46 BLAS and LAPACK Libraries PRO Version ON N AAPA EE EA T 47 Porting Code Between Windows and Linux 47 Recommended Option Settings 47 Mixed Language Programming 49 What Is Supported 0 ee eee eeeeeee 49 Declaring Your Procedures eee 49 Runtime initialization sesser 51 Linking with non Fortran main program 51 Interfacing with Non Fortran Languages 51 Passing Datasiirto 52 Returning Function Values to C wu 55 Returning Function Values to Fortran 57 Passing and Receiving Arguments 58 Passitig ATA YS rninn ni 59 Passing Character Data 0 0 0 eee 60 Passing Data through Common Blocks 62 Calling Standard C Libraries 0 00 00 63 Command Line Debugging with fdb 65 Starting fdh neno enisi 65 Communicating with fdb eee 66 Variables sci iren 66 VAMOS error arr ar Eese 66 Addresses snnnd iin e n 66 RefistelS nen re n REE 67 NaMe Soenen E een 67 Comm nd S seseg 67 Executing and Terminating a Program 67 Help Commands 0 0 eee ee eeeeeeeeeeeeees 69 Shell Commands eee ee eee eseeeereeees 69 Breakpoints mnsine nisen 69 Controlling Program Execution 72 Displaying Program Stack Information 74 Setting and Displaying Program Variables75 Source File Display eee eeeeeeeeee 7
88. elizable loops These impediments are discussed in the sections below Overhead Time is spent whenever your program starts up or shuts down a thread a separate stream of execution on a secondary processor This time can outweigh the time gained by running part of the code on a secondary processor if the work to be done on that processor is not significant Lack of Large Arrays If your program does not spend the bulk of its time in computationally intensive loops then there is not adequate work to divide among the processors Your program will likely run at least as fast without parallelization For example if half of your program s time is spent in parallelizable loops then the best time savings you can expect by parallelization on two pro cessors is 25 If your program takes two minutes to run serially and half of its time is spent in parallelizable loops then the theoretically optimal parallel run time is one minute and thirty seconds I O Intensive Programs If your program spends much of its time reading or writing files or waiting for user input then any speed increase due to parallelization will likely be dwarfed by the time spent doing I O Your program will likely not show a significant performance improvement Potential for Incorrect Results Certain loops can be analyzed sufficiently to be parallelized by the compiler without input from the programmer However many loops have data dependencies that would prevent
89. en by specifying the out or o option with a new name and path When c is specified on the command line the argu ment to out or o must be an object filename see o name on page 34 Library Filenames The default name for a library typically has an extension of a for a static library and so for a shared dynamic library See Archive Libraries and Shared Libraries on page 14 In addition libraries will typically begin with the characters lib The prefix and extension must be omitted when referencing the library at link time For example libsub so isa shared library in the current directory that is referenced on the command line as lfc main f90 L lsub Options The driver recognizes one or more letters preceded by one or two hyphens or as a com mand line option You may not combine options after a hyphen for example x and y may not be entered as xy Lahey Fujitsu Linux64 Fortran User s Guide 11 Chapter 2 Developing with LF64 Some options take arguments in the form of filenames strings letters or numbers Please note options with double hyphens require a delimiting space between the option and its argument s however options with single hyphens may be followed immediately by the argument s with no intervening space If an option has multiple arguments spaces are not allowed between the arguments Example M MyDir IncDir delimiting space not required m
90. ents clear commandline The argument list is deleted setenv show environment All environment variables and their values are displayed setenv var show environment var Environment variable var and its value are displayed setenv var s The environment variable var is set to the value strings unsetenv var The variable var is deleted from the environment quit Ends the debugging session Lahey Fujitsu Linux64 Fortran User s Guide Help Commands Help Commands help Display the list of all commands help cmd Display help for command cmd help regex Display help for all commands corresponding to regular expression regex Note that the quo tation marks ascii 34 are required Shell Commands cd dir Change working directory to dir pwd Display the current working directory path sh cmd Execute arbitrary shell command cmd Breakpoints General Syntax break location expr Where location corresponds to an address in the program or a line number in a source file and expr corresponds to a conditional expression associated with the breakpoint The value of location may be specified by one of the following items e file line specifies line number line in the source file file If omitted file defaults to the current file Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character e proc l offset specifies the lin
91. esult because the order of adding the array elements is different between par allel execution and serial execution Invalid Usage of Optimization Control Line The following program specifies DISJOINT by mistake for array A The execution result will be incorrect when array A is sliced because the order of the data references for array A is different from the order of data references for serial execution ocl disjoint a do i 2 10000 a i a i 1 b i end do The following program specifies TEMP by mistake for variable T The correct value will not be assigned to variable last because LF64 does not guarantee a correct value of variable T at the end of the DO loop ocl temp t do i 1 1000 t a i b i c i t d i end do last t The following program specifies INDEPENDENT by mistake for procedure SUB The execu tion result may be incorrect when array A is sliced because the order of the data references for array A is different from the data references for serial execution Lahey Fujitsu Linux64 Fortran User s Guide 105 Chapter 5 Multi Processing PRO version only common a 1000 b 1000 ocl independent sub do i 2 1000 a i b i 1 0 call sub i 1 end do end subroutine sub j common a 1000 a j a j 1 0 end Multi processing I O Statements and Intrinsic Procedure References If there is an I O statement an intrinsic subroutine or function reference that is
92. etermines the specific group of runtime libraries that will be linked to the executable Searching rules for INCLUDE files and Fortran 95 modules are governed by the compiler not the linker See I dir on page 25 and M dir on page 31 for discussion Object File Processing Rules Object files are processed in the order they appear on the command line Lahey Fujitsu Linux64 Fortran User s Guide How the Linker Selects Objects How the Linker Selects Objects The 1d linker applies the following rules when searching object libraries 1 Any libraries specified using the 1 option are searched in the order in which they appear in the LF64 command string before the LF64 runtime library or any libraries appearing in directories specified by the L option or the LD_LIBRARY_PATH envi ronment variable The compiler writes the default LF64 library names into each object file it generates 2 Each library is searched until all possible external references are resolved If neces sary system libraries appearing in 1ib or usr 1ib may also be searched Linker Options In most cases LF64 passes unrecognized options on to the linker however some linker options may conflict with existing LF64 options In this case an option may be passed directly to the linker from the LF64 command line using the w1 option This option behaves as documented in the man pages for gcc the GNU C compiler coincidentally w1 is the same option us
93. ey Fujitsu Linux64 Fortran User s Guide
94. f threads to be used during execution If the threads option was used the value specified by OMP_NUM_THREADS must be the same See documentation at www openmp org for details 86 Lahey Fujitsu Linux64 Fortran User s Guide Performance Improvement OMP_SCHEDULE The OMP_SCHEDULE environment variable sets the schedule type and chunk size for DO and PARALLEL DO directives that have the schedule type RUNTIME If the schedule type is not specified it defaults to STATIC See documentation at www openmp org for details PARALLEL The PARALLEL environment variable is used to set the number of active CPUs The value of PARALLEL must be less than or equal to the number of CPUs active at run time Note If threads is specified during compilation the value of PARALLEL must be equal to the argument to threads and the number of active CPUs must be greater than or equal to the argument to threads If the environment variable PARALLEL is not set the argument to threads must be the same as the number of active CPUs THREAD_STACK_SIZE When the environment variable THREAD_STACK_SIZE is set it sets the stack size in Kilo bytes for each thread stack Local variables in DO loops and array operations are allocated on the stack You may need to extend the stack size if there are many of these local variables The default stack size for each thread is the same as that of the executable The compiler option threadstack and environment variable
95. ferenced variable is an array section with vector subscript The referenced variable is a dummy argument corresponding to an actual argument that is an array section The referenced variable is in a masked array assignment The referenced variable is a derived type variable with an ultimate component that is an allocatable array The referenced variable has the PARAMETER attribute The parent string is a scalar constant Specifying chk u checks for undefined variables by initializing them with a bit pattern If that bit pattern is detected in a variable on the right side of an assignment or in an expres sion that is not an actual argument then chances are that the variable was uninitialized Unfortunately you can get a false diagnostic if the variable holds a value that is the same as this bit pattern This behavior can be turned off by not using the u argument to the chk option The values used with chk u are One byte integer 117 Two byte integer 29813 Four byte integer 1953789045 Eight byte integer 8391460049216894069 Default real 5 37508 134e 32 Double precision real 4 696323204354320d 253 Quadruple precision real 9 08 18487627532284 1540728989642 13742q 4043 Default complex 5 37508 134e 32 5 37508 134e 32 Double precision complex 4 696323204354320d 253 4 696323204354320d 253 Quadruple precision complex 9 08 18487627532284 1540728989642 13742q 4043 90818487627532284154072898964213742q 4043
96. files executable files and libraries njversion Print Version Information Compile and link Default nversion Lahey Fujitsu Linux64 Fortran User s Guide 41 Chapter 2 Developing with LF64 42 Specify version to display product serial number copyright and version information when compiling or linking WA p I 0jarg arg Pass arguments to a tool Compile and link The W option can be used to pass arguments to a tool such as the linker or preprocessor The comma character can be passed to a tool by using a backslash as an escape character Wa arg passes arguments to the assembler Wp arg passes arguments to the preprocessor Wl arg passes arguments to the linker W0 arg passes arguments to the compiler njwarn Warn Compile only Default warn Specify warn to display warnings at compile time Note that nwarn forces ninfo njwide Wide Format Source Code Compile only Default nwide Specify wide to compile fixed format source code that extends out to column 255 This option has no effect when compiling free format source njwisk PRO version only Winteracter Starter Kit Compile and link Default nwisk compile and link Specify wisk to create an application using the Winteracter Starter Kit WiSK see the Win teracter Starter Kit Manual Note that a resource file name must be given on the command line whenever specifying wisk See the Winteracter Starter Kit manual
97. for more information nj wo Warn Obsolescent Compile only Default nwo Specify wo to display warning messages when the compiler encounters obsolescent Fortran 95 features Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options xarg Inline Code Compile only Default do not inline Specify xarg to cause user defined procedures to be inserted inline at the point they are ref erenced in the calling code This option only affects code which is in the same source file as the calling procedure Intrinsic functions module procedures and internal procedures are not inlined Note that there is no space between the option and the argument Multiple arguments are sep arated by commas At least one argument must be present The x option may only be specified once per compile session If arg is anumber any user defined procedure with total lines of executable code smaller than arg is inlined This argument may only appear once in the argument list If arg is a number with the letter capital K appended arrays which have a size less than arg kilobytes are inlined Inlining arrays can enhance the optimization abilities of the compiler This argument may only appear once in the argument list If arg is a procedure name or comma separated list of procedure names the named proce dures are inlined ee 99 If arg is the dash character all procedures having fewer than 30 lines of code and all lo
98. ger from 0 to 32767 When num is greater than or equal to 1 execution terminates when the total number of errors reaches the limit If enum is omitted or num is zero execution is not terminated based on the error limit How ever program execution still terminates if the Fortran system error limit is reached Example a out W1 e10 g num 1 lt num Sequential Access I O Work Area The g option sets the size of the input output work area used by sequential access input out put statements This size is set in units of kilobytes for all unit numbers used during execution The argument num specifies an integer with a value of one or more If the g option is omitted the size of the input output work area defaults to eight megabytes The g option improves input output performance when a large amount of data are read from or written to files by an unformatted sequential access input output statement The argument num is used as the size of the input output work area for all units To avoid using excessive memory specify the size of the input output work area for individual units by specifying the size in the environment variable fuunitof where unit is the unit number see Environment Variables for Input Output on page 140 for details When the g option is specified at the same time as the environment variable fuunitof the g option has precedence Example a out W1 g10 l Interrupt Processing The i option controls proces
99. gical record The length of the logical record must be assigned in the OPEN statement RECL specifier If the Fortran record is shorter than the logical record the remaining part is padded with blanks The length of the Fortran record must not exceed the logical record This fixed length record format is unique to Fortran Direct File Format Unformatted Files processed by unformatted direct access input output statements have a fixed length record format with no header record One Fortran record can correspond to more than one logical record The record length must be assigned in the OPEN statement RECL specifier If the Fortran record terminates within a logical record the remaining part is padded with binary zeros If the length of the Fortran record exceeds the logical record the remaining data goes into the next record Binary File Format Files opened with FORM BINARY or ACCESS TRANSPARENT are processed as a stream of bytes with no record separators While any file can be processed as binary you must know its format to process it correctly Note that even though ACCESS TRANSPAR ENT is supported by LF64 FORM BINARY is the preferred method of opening such files Note that these specifiers are not currently part of the Fortran standard and may vary from one compiler to the next however this may change in future versions of the Fortran standard Endfile Records An endfile record must
100. gin with n are the default settings They are shown to indicate that the positive version of the option should not be specified in order to achieve maximum performance If the program performs many I O operations consider tuning the blocksize with the block option Programs may be tuned with additional optimization options refer to the index under opti mization options Whereas the base optimizations will almost always result in increased performance experimentation will be required to achieve additional performance Some options to try might be x option to inline code and data or Karray_transform to apply opti mizations to code that uses arrays While dramatic performance enhancements might be seen it is also possible that performance will degrade when trying these or other options If optimization O produces radically different results or causes runtime errors try compil ing with info to see exactly which steps are being taken to optimize The info option also generates warnings on sections of code that are unstable and therefore may cause prob lems when optimized A common example of such code is an IF statement that compares floating point variables for equality When optimization seems to alter the results try using the ap option to preserve arithmetic precision while still retaining some optimization Lahey Fujitsu Linux64 Fortran User s Guide Mixed Language Programming LF64 code can call and be ca
101. gnal breaks a program the program is notified of that signal when program execution is continued nexti count Executes the next count machine language instructions including the current instruction where a procedure call is considered to be an instruction If omitted count defaults to 1 and only the current instruction is executed silentnexti count or nin count Same as Nexti but if a signal breaks a program the program is notified of that signal when program execution is continued until Continues program execution until reaching the next instruction or statement until location Continues program execution until reaching the location location The same syntax rules as for breakpoints apply until addr Continues program execution until reaching the address addr until offset Continues program execution until reaching the line forward or backward offset lines from the current line until return Continues program execution until returning to the calling line of the procedure that includes the current breakpoint goto file line Execution is restarted from the specified line line in file file Lahey Fujitsu Linux64 Fortran User s Guide 73 Chapter 4 Command Line Debugging with fdb 74 jump file line Changes the program counter jumps to the address corresponding to the specified line line in file file jump addr Changes the program counter jumps to address addr
102. h documents the use of the Winteracter Starter Kit WiSK for graphics and user interface development Lahey Fujitsu Linux64 Fortran User s Guide 1 Chapter 1 Getting Started This manual assumes that the reader possesses a working knowledge of the Linux operating system including Linux commands file manipulation file system navigation and shell scripts System Requirements 2 Hardware e An Intel 64 or AMDO 64 bit processor e 32 MB of RAM e 100 MB of available hard disk space for LF64 Linux PRO 40 MB for LF64 Linux Express Software e X Windows to use WiSK e xpdf or equivalent to view the online PDF documentation e 64 bit version of as the GNU assembler e 64 bit version of 1d the GNU linker e 64 bit versions of C startup and support object files crt1 0 crti o crtn o crt begin o and crtend o e 64bit versions of C runtime and support libraries libc libm libpthread librt libgcc libgec_eh libgcc_s and libelf e A compatible version of the Linux operating system Table 1 shows the versions of Linux that are known to be compatible with LF64 Other Linux variants might be compatible if they include kernel version 2 6 9 or later and libc version 2 3 4 or later see README for last minute updates Table 1 Supported Distributions Distribution Kernel libe Fedora 8 2 6 23 2 7 2 Ubuntu 8 04 2 6 24 2 7 10 CentOS 5 2 6 18 2 5 18 Open SUSE 10 3 2 6 22 2 6 1 L
103. h is specified for an INCLUDEd file AUTOMAKE looks first in the directory which contains the source file and after that in the directories specified using this keyword The directory names must be sep arated by semi colons For example we might have INCLUDE include include sys Note that the compiler will also have to be told where to look for INCLUDEd files You can do this using a 1D place marker which expands to the list of directories specified using INCLUDE Lahey Fujitsu Linux64 Fortran User s Guide 115 Chapter 6 Automake PRO version only 116 SYSINCLUDE May be used to specify the search list for C or C system INCLUDE files i e any enclosed in angled brackets as in include lt stat h gt If no path is specified AUTOMAKE looks in the directories specified using this keyword It does not look in the current directory for system INCLUDE files unless explicitly instructed to The directory names following SYSINCLUDE must be separated by semi colons OBJDIR May be used to specify the name of the directory in which object files are stored For example OBJDIR OBJ The trailing is optional If OBJDIR is not specified AUTOMAKE assumes that source and object files are in the same directory Note that if source and object files are not in the same directory the compiler will also have to be told where to put object files You can do this using a 0D place marker which expands to the directory
104. i j k 1 m n 0 this is what the subscripts would look like on the C sid x forto OF ove Lly ort for n 0 n lt 10 nt for m 0 m lt 9 mtt for l 0 1 lt 8 l for k 0 k lt 7 k for j 0 j lt 6 j for i 07 1 lt 5 i real_array o n m 1 k j i 12 000 return On the Fortran side of the call the array argument must not be dimensioned as an assumed shape array You should use explicit shape assumed size or adjustable arrays Passing Character Data Character arguments are passed as pointers to strings When a Fortran program unit contains character dummy arguments then any routine calling that program unit must append to the end of the argument list the length of each of the corresponding character actual arguments The length must be passed by value as a four byte integer long int to Fortran For example the Fortran subroutine subroutine example3 intl charl int2 char2 integer intl int2 character len charl character len 25 char2 end corresponds to this prototype in C void example3 long int intl char charl long int int2 char char2 long int charl_len When passing a character string from Fortran to C Fortran will by default append a hidden integer value representing the length of the string to the end of the argument list This inte ger is passed by value If more than one character string is passed the
105. ifying a name in a undef directive If U and D are specified with the same name the name becomes undefined njunroll limit Loop unrolling Compile only Default unroll Specify unroll limit to control the level of loop unrolling limit is a number in the range 2 lt limit lt 100 and denotes the maximum level of loop expansion If limit is omitted the value of limit is determined by the compiler Note that O forces unroll i e if O is specified it is not possible to pass nunroll Note that O0 causes nunroll to be sent to the compiler by default but this can be overridden by specifying O0 unroll v 900 95d 95e 950 95s Standard conformance diagnostics Compile only Default no information The v9xx options offer additional information concerning conformance with the Fortran 90 and Fortran 95 standards The v90o0 option issues a diagnostic message when any features are encountered that are obsolescent in Fortran 90 The v95d option issues a diagnostic message when any features are encountered that have been deleted in Fortran 95 The v95e option issues a diagnostic message when any features are encountered that are present in Fortran 95 but are absent in Fortran 90 Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options The v950 option issues a diagnostic message when any features are encountered that are obsolescent in Fortran 95 The v95s option issues a
106. ii 34 File names must be enclosed by the grave accent the symbol which is ascii 96 Executing and Terminating a Program run arglist Passes the arglist list of arguments to the program at execution time When arglist is omitted the program is executed using the arguments last specified If arglist contains an argument that starts with lt or gt the program is executed after the I O is redirected If single step ping or other program control is desired a breakpoint must be set before issuing the run command otherwise the program will immediately run to completion For an explanation of breakpoints see Breakpoints on page 69 A breakpoint can also be set at MAIN__ the main Fortran entry point Do not set a breakpoint at main no debug information will exist there Lahey Fujitsu Linux64 Fortran User s Guide 67 Chapter 4 Command Line Debugging with fdb 68 Run Executes the program without arguments The R should be upper case As explained above a breakpoint must be set before issuing this command if single stepping or other con trol is desired kill lt ctl c gt Forces cancellation of the program lt CTL C gt control c has the same effect as the kill command tty dev Direct standard error I O to device dev in the next run param commandline arglist Assign the program s command line argument list a new set of values param commandline Display the current list of command line argum
107. ility Lahey Fujitsu Linux64 Fortran User s Guide 45 Chapter 2 Developing with LF64 If it is necessary for you to statically link the GNU C runtime libraries with your application you must link with the static linker option Your distribution will be governed by a GNU Public License and the Lahey Software License Agreement which states Tf you distribute User Programs that statically link the Lahey Fujitsu Fortran and the GNU C runtime libraries into your program you may redistribute the Lahey Fujitsu Fortran static libraries a and the 390rt0 0o file with your programs for the sole purpose of allowing your customers to rebuild the programs you distribute provided you instruct your customers and they agree to remove the Lahey Fujitsu Fortran static libraries a and the 390rt0 0 file from their computer systems after rebuilding the programs you distribute OpenGL Graphics Programs OpenGL is a software interface for applications to generate interactive 2D and 3D computer graphics independent of operating system and hardware operations It is essentially a 2D 3D graphics library which was originally developed by Silicon Graphics with the goal of creating an efficient platform independent interface for graphical applications Note OpenGL is a trademark of Silicon Graphics Inc It is available on many Windows Linux and Unix sys tems and is strong on 3D visualization and animation 90gl is a public domain i
108. ing directory In both cases the file is deleted upon program termination even if it is closed with STATUS KEEP see Intermediate Files on page 13 Normal program termination causes all files to be closed Link Time You can reduce the link time by reducing the number of named COMMON blocks you use Instead of coding common al i common a2 j common a3 k common al000 k1000 code common a i j k k1000 Year 2000 compliance The Year 2000 problem arises when a computer program uses only two digits to represent the current year and assumes that the current century is 1900 A compiler can look for indi cations that this might be occurring in a program and issue a warning but it cannot foresee every occurrence of this problem It is ultimately the responsibility of the programmer to cor rect the situation by modifying the program The most likely source of problems for Fortran programs is the use of the obsolete DATE subroutine Even though LF64 will compile and link programs that use DATE its use is strongly discouraged the use of DATE_AND_TIME which returns a four digit date is recommended in its place 126 Lahey Fujitsu Linux64 Fortran User s Guide Year 2000 compliance LF64 can be made to issue a warning at runtime whenever a call to DATE is made This can be accomplished by running a program with the runtime options wW1 Ry li for example
109. inux64 Fortran User s Guide 93 Chapter 5 Multi Processing PRO version only 94 CPU 2 sum2 0 do i 5001 10000 sum2 sum2 a i end do The partial sums are added sum sum suml sum2 Restrictions on Loop Slicing The following types of DO loop are not targets for loop slicing 1 Loops where it is forecast that the elapsed time would not be reduced 2 The loop contains operations of a type not suitable for loop slicing 3 The loop contains a procedure reference 4 The loop is too complicated 5 The loop contains an I O statement 6 Loops where the order of data references would be different from that of serial execution Debugging Multi threaded programs cannot be debugged using fdb Optimization Control Line LF64 PRO offers an optimization control line OCL feature that helps automatic paralleliza tion The optimization control line is used by the programmer to identify constructs that may be executed in parallel Because OCLs are in Fortran comments programs with OCLs can still be standard conforming and can be compiled with other compilers that do not support OCLs The optimization control lines OCLs take effect when both parallel and ocl options are specified Optimization Control Specifier The optimization control lines OCLs have several functions depending on the optimization control specifier Syntax of OCL Columns 1 5 of an optimization control line OCL must be O
110. ion The effect of DISJOINT depends on its position Lahey Fujitsu Linux64 Fortran User s Guide Optimization Control Line e At the loop position DISJOINT promotes loop slicing for the DO loop and all nested loops corresponding to the OCL e At the total position DISJOINT promotes loop slicing for all loops in the program unit Consider the following code do j 1 1000 do i 1 1000 a i 1 j a i 1 3 b i j end do end do Because the subscript expression of array A is another array element L J the system cannot determine whether there is a problem if array A is sliced Therefore this system does not slice the outer DO loop If the programmer knows that there is no problem if array A is sliced the outer DO loop will be sliced if DISJOINT is used as shown in the example below The letter P shown on the left side of the source program marks the parallelized statements ocl disjoint a T p do j 1 1000 p do i 1 1000 p a i l1 j a i 1 j b i j p end do p end do Note If an array which cannot be sliced is marked DISJOINT by mistake LF64 may perform an incorrect loop slicing and the program results may be incorrect TEMP The TEMP specifier is used to indicate to the system that the variables listed are used tem porarily in the DO loop As a result the execution performance of the parallelized DO loop can be improved Syntax OCL TEMP s s won Here s is a varia
111. ion 1 files in current directory LF 64 INCLUDE include FILES 90 OBJDIR ob j COMPILE lfc c fi I Sid o od sf oe tp 01 AND Compilation 2 files in utils INCLUDE defaults to previous value include FILES utils 90 OBUJDIR utils obj COMPILE lfc c fi I id o Relink TARGET a out LINK lfc Sob o ex oe odssf toe sav chk Automake Notes 118 As AUTOMAKE executes it issues brief messages to explain the reasons for all compilations It also indicates when it is scanning through a file to look for INCLUDE statements If for any reason the dependency file is deleted AUTOMAKE will create a new one Execution of the first AUTOMAKE will be slower than usual because of the need to regenerate the dependency data AUTOMAKE recognizes the INCLUDE statements in all common variants of For tran and C and can be used with both languages When AUTOMAKE scans source code to see if it contains INCLUDE statements it recognizes the following generalized format Optional spaces at the beginning of the line followed by an optional compiler control character or followed by the word INCLUDE case insensitive followed by an optional colon followed by the file name optionally enclosed between apos trophes quotes or angled brackets If the file name is enclosed in angled brackets it is assumed to be in one of the directories specified using the SYS
112. ions such as unrolling nested loop optimization and loop tiling Use of the O2 option may sig nificantly impact compilation speed The O3 option applies all the optimizations of O2 plus further loop optimizations such as pipelining full unrolling and loop splitting Use of the O3 option may cause further impacts on compilation speed The O option is equivalent to O3 0 name out name Output Filename Compile Default is root name of source file with extension o Link Default is a out in current working directory Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options When not linking i e when c is specified specify o to override the default object filename and path The default path is the current working directory When linking nc specified or c not specified specify o to override the output executable or library default filename By default it is placed in the current working directory out differs from the ld option o in that LF64 uses out to determine if a library is being built o is passed directly to ld If the desired output is a library use out and specify an extension of a or so See Shared Libraries and Archive Libraries on page 14 Example lfc hello f 90 c o home mydir hello o lfc main o out maintest njocl PRO version only Process optimization control lines Compile only Default noc1 ocl causes optimization control lines OCLs t
113. ions are specified the db and quad options may not be specified Four byte to eight byte promotion The Ccd4d8 option is equivalent to specifying all the CcdII8 CcdLL8 and CcdRR8 options All restrictions for these options apply The Cca4a8 option is equivalent to specifying all the CcI4I8 CcL4L8 and CcR4R8 options All restrictions for these options apply njchk Checking Compile only Default nchk Specify chk to generate a fatal runtime error message when substring and array subscripts are out of range when non common variables are accessed before they are initialized when array expression shapes do not match or when procedure arguments do not match in type attributes size or shape Syntax nJchk fa e f sll all x Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options Note Commas are optional but are recommended for readability Table 3 chk Arguments Diagnostic Checking Class Option Argument Arguments a Array Expression Shape e File Connections f Overlapped Dummy arguments o Subscripts s Undefined variables u Increased extra x Specifying chk with no arguments is equivalent to specifying chk a e f 0 s u Specify chk with any combination of a e f o s u and x to activate the specified diagnostic checking class Specification of the argument x must be used for compilation of all files of the program or incorre
114. le option allows the compiler to simplify floating point expressions For exam ple the expression x 1 might be simplified to x Use of the Keval option forces Kfsimple K no fuse Loop fusion Compile only Default Knofuse The Kfuse option allows the compiler to perform loop fusion optimizations The Kfuse option is only valid at optimization levels 02 or 03 K nofloop Loop structure modification Compile only Default Knoloop The Kloop option allows the compiler to perform optimizations that involve modification of loop structure Lahey Fujitsu Linux64 Fortran User s Guide 27 Chapter 2 Developing with LF64 28 The Kloop option is only valid at optimization levels 02 or 03 K nojomitfp Omit frame pointer Compile only Default Knoomitfp The Komitfp option does not require that the frame pointer be stored in a register This option will cause loss of traceback information K no packed Use SSE2 or SSE3 packed instructions Compile only Default Kpacked The Kpacked option directs the compiler to use SSE2 or SSE3 packed instructions The Kpacked option is only valid at optimization levels 02 or 03 K no jpreex Pre evaluate invariant expressions Compile only Default Knopreex The Kpreex option allows the compiler to perform optimizations on invariant expressions Depending on program structure it is possible that use of this option could alter program results Use the info o
115. linker the name of the target file You can do this using a 2 EX place marker which expands to the file name specified using TARGI TARGET execs myprog Lahey Fujitsu Linux64 Fortran User s Guide ET The AUTOMAKE Configuration File If there is no TARGET keyword AUTOMAKE will update the program object code but will not attempt to re link LINK Specifies acommand which may be used to update the program or library file once the object code is up to date LINK lfc ob o ex mod mo LINK lfc rf o ex mod mo The following place markers are allowed in the command specified using LINK Table 11 LINK Place Markers Place Marker Meaning expands to the name of the directory containing object code as spec OD ified using the OBJDIR command see below including a trailing VAN ae expands to the object file extension as specified using the OBJEXT p command see below including a leading n expands to a list of object files corresponding to source files speci j fied using all FILES commands SEX expands to the executable file name as specified using TARGET Sue expands to the name of directory containing modules as specified using MODULE see below ake expands to the name of a response file created by AUTOMAKE g containing a list of object files INCLUDE May be used to specify the INCLUDE file search list If no pat
116. ll be described in the sections below Example 1 Setting the value of environment variable FORT9OL and executing the program as such setenv FORT90L W1 e99 le a out W1 m99 myopt has the same effect as the command line a out W1 e99 le m99 myopt The result is that when executing the program a out the runtime options e99 le m99 and user defined executable program argument myopt are in effect Example 2 When the following command lines are used setenv FORT90L W1 e10 a out W1 e99 the result is that a out is executed with runtime option e99 in effect overriding the option e10 set by environment variable FORT90L Note that setenv would be export in the examples above for Korn and bash shell users Runtime Configuration File jwe_prof 132 At runtime the runtime package looks for the file etc opt FISVplang jwe_prof and uses any runtime options found there Options must be specified using the W1 form See Runtime Options on page 133 Options appearing in the FORT90L environment variable or on the command line take precedence over options appearing in jwe_prof Within the file lines that begin with are taken as comment lines A single runtime option cannot extend over multiple lines Lahey Fujitsu Linux64 Fortran User s Guide Execution Return Values Execution Return Values The following table lists possible values returned to the operating system by an LF64 execu
117. lled by code written in certain other languages With LF64 one can create object and library files for use with the language systems in the table below Calls can be made from Fortran to Fortran from Fortran to another language and from another lan guage to Fortran If you are calling LF64 procedures from a language system other than LF64 it may be necessary to refer to that language system s documentation for more information What Is Supported Lahey Fujitsu Linux64 Fortran supports mixed language interfaces to the following lan guages and operating systems this list is subject to change see READ_ML for any changes Table 4 Compiler Support for Mixed Language ml option Language System see below Linux kernel and stan ml cdecl dard C libraries Gnu C ml cdecl Declaring Your Procedures In order to reference a procedure across a mixed language interface the LF64 compiler must be informed of the procedure name and told how to decorate this name as it appears in the object file These procedure names are defined with the ML_EXTERNAL statement see ML_EXTERNAL Statement in the LF64 Language Reference The DLL_EXPORT and DLL_IMPORT statements used in the LF64 Windows product are still supported but their effect is identical to ML_EXTERNAL since the calling conventions are the same for Linux static and shared libraries Lahey Fujitsu Linux64 Fortran User s Gui
118. mber address and execution time of parallel regions parallelized by OpenMP e Cost distribution list of parallel regions parallelized by OpenMP not including nested parallel regions FLIB_SPINWAIT The FLIB_SPINWAIT environment variable is used to set the wait mode for threads waiting to execute Spin wait is a waiting mode that consumes CPU time while suspended wait con sumes minimal CPU time Since spin wait is more efficient in parallel execution spin mode is suitable for reducing elapsed time in a parallel environment Suspended mode is suitable for reducing total CPU time Values for FLIB_SPINWAIT are e unlimited always use spin wait e 0 always use suspended wait e ns use spin wait for n seconds then switch to suspended wait e nms use spin wait for n milliseconds then switch to suspended wait OMP_DYNAMIC The OMP_DYNAMIC environment variable controls dynamic thread adjustment When the value of OMP_DYNAMIC is true dynamic adjustment is enabled When the value is false dynamic adjustment is disabled The default value for OMP_DYNAMIC is true See documentation at www openmp org for details OMP_NESTED The OMP_NESTED environment variable controls nested parallelism When the value of OMP_NESTED is t rue nested parallelism is enabled When the value is false nested par allelism is disabled See documentation at www openmp org for details OMP_NUM_THREADS The OMP_NUM_THREADS environment variable sets the number o
119. mplementation of the official Fortran 90 bindings for OpenGL con sisting of a set of libraries and modules that define the function interfaces A complete set of demonstration programs may be downloaded from the Lahey web site The f90gl interface was developed by William F Mitchell of the Mathematical and Computational Sciences Division National Institute of Standards and Technology Gaithersburg MD in the USA For information on f90gl see the f90g web page at http math nist gov f90gl For more information on using OpenGL and f90g1 with LF64 see the HTML help file wisk htm in the help directory provided with LF64 PRO Scientific Software Libraries PRO Version only 46 The Scientific Software Libraries SSL2 are a library of subroutines and functions designed to aid in the solution of common scientific and engineering problems For more information concerning the SSL2 libraries or specific procedures see the SSL2 PDF documents in the manuals directory of your LF64 distribution or consult the man page for the procedure in question Lahey Fujitsu Linux64 Fortran User s Guide BLAS and LAPACK Libraries PRO Version only BLAS and LAPACK Libraries PRO Version only Multithreaded versions of the BLAS and LAPACK libraries are provided These libraries provide a standardized set of procedures for solving linear algebra and matrix algebra prob lems For more information concerning the BLAS and LAPACK libraries or specific pr
120. must be called from an executable file that contains a main program If an LF64 program that uses shared libraries is distributed to other machines the shared libraries it uses must also be distributed or made available at runtime see Distributing LF64 Applications on page 45 Libraries An archive library sometimes called a static library or simply an archive is a collection of procedures in object form stored in a file that may be referenced by the linker At link time when the executable program is created the object code for procedures needed from the library by the program is incorporated into the program s executable file 14 Lahey Fujitsu Linux64 Fortran User s Guide Using Shared Libraries Using Shared Libraries To create a shared library use the shared option Example lfc sub f90 out libsub so shared lfc main f90 L lsub In this example the source file sub 90 contains subroutines or functions and the source file main 90 contains references to these procedures The following takes place 1 2 sub 90 is compiled to create object file sub o sub o is linked to create 1ibsub so a shared library Object file sub o is then deleted main 90 is compiled to create main o main o is linked with the LF64 runtime library and combined with dynamic link information referencing procedures in libsub so to create an executable pro gram Object file main o is then delete
121. n In all subsequent C code examples a declaration of int is synonymous with long int Note that any array arguments or arguments of type COMPLEX must not be passed by value to C they should always be passed by reference Character data is a special case it may be passed using either the CARG intrinsic or VAL OFFSET See the section below Pass ing Character Data on page 60 for further illustration Example Passing Arguments by Value from Fortran to C The C function void mysum_ i j k tnt lt AL Jr kK i jt k is called from Fortran as follows integer i j k j 3 k 4 call mysum i val j val k write Result jtk i Example Passing Arguments by Reference from C to Fortran Variables can be passed by reference from C using the l value operator amp The Fortran function integer function myfunc x y integer x y myfunc x y return end function is called from C as MAIN__ long int myfunc_ long int i long int j long int i j kK 1 5 A 2 k myfunc_ amp i amp j Lahey Fujitsu Linux64 Fortran User s Guide Passing Arrays Passing Arrays Because C stores multidimensional arrays in row major order and Fortran stores them in col umn major order there are some special considerations in processing a Fortran array Excluding a single dimension array which is stored the same in C as in Fortran you will need to reverse the indices when a
122. n is omitted the compiler determines the optimimum tile size The Ktiling option is only valid at optimization levels 02 or 03 lower case L name Specify Library File Link only Default none Specify a library file whose name is of the form 1ibname a or libname so Multiple library files may be specified with multiple l options Libraries are searched in the order that they appear on the command line See Linking Rules on page 44 This option and its argu ment are passed directly to the linker L path Library Search Path Link only Default LD_LIBRARY_PATH variable The L option adds path to the list of directories that the linker searches for libraries i e files beginning with 1ib and having the extension a or so Note if current direc tory is not specified in your LD_LIBRARY_PATH variable then you must specify L on the command line to search for files in the current directory This option and its argument are passed directly to the linker Example The following command line links main o with libmine a and libyours so residing in adja cent directories mylibs and yourlibs respectively lfc main o L mylibs lmine L yourlibs lyours Remember that by default the linker searches for shared libraries first Lahey Fujitsu Linux64 Fortran User s Guide 29 Chapter 2 Developing with LF64 30 mfi Recognize Lahey intrinsic procedures Compile and link Default li S
123. nded IF Clause for PARALLEL Directive When the IF clause for a PARALLEL directive is not true the PARALLEL directive is ignored Therefore no team of threads is created However the PARALLEL directive remains in effect Inline Expansion The following procedures are not inline expanded e User defined procedures that include OpenMP Fortran directives e User defined procedure that are referred to in OpenMP directives Internal Procedure Calling from Parallel Region A variable in the host procedure referenced in an internal procedure that is called in a parallel region is regarded as SHARED even if it is privatized in the parallel region i 1 this i is shared omp parallel private i BENZ i is private PLINE p L i is private call proc i is private Somp end parallel contains subroutine proc i is shared print i i is shared i is shared end subroutine DO Variable for Serial DO Loop in Parallel Region When the DO variable of a serial DO loop within a parallel region is marked as SHARED it is privatized in the scope of the DO loop 108 Lahey Fujitsu Linux64 Fortran User s Guide Implementation Specifications omp parallel shared i i 1 i is shared do i 1 n i is private i is private end do i is private PEILING y UL i is shared omp end parallel omp parallel private i i l i is private do i 1 n i is private i is private end do i is private p
124. ne machine to the next therefore if your program is moved to another machine and optimal performance is desired then blocksize should be re evaluated See also details of the runtime switch g num 1 lt num on page 135 and the environment variable fuunitbf size 00 lt unit lt 2147453647 on page 141 nje Suppress Linking Compile only Default nc or c not present Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options Specify c to create object 0 and if necessary module mod files without creating an executable This is especially useful in makefiles where it is not always desirable to perform the entire build process with one invocation of the driver Cc dil8 1418 dLL8 L4L8 dRR8 R4R8 d4d8 a4a8 dDR16 R8R16 Promote precision for given data type Compile only Default no promotion of data type The Ccxxxx options control the precision of a given data type These options allow a greater degree of selectivity than the long dbl or quad options Execution errors or incorrect results may occur if program units compiled with any of these options are linked with pro gram units compiled without the same option Integer promotion The CcdII8 option causes variables constants and functions of type default INTEGER to be evaluated as eight byte integer This option does not affect a variable or function that is declared with a kind or a constant with a kind or preci
125. ng C program calls Fortran subroutine SUB and then exits void sub_ void jwe_xcop long argl long arg2 long arg3 long arg4 MAIN_ jwe_xcop 0x703043 0 0 0 sub_ Linking with non Fortran main program If LF64 is used to link objects into an executable program the main entry point of the non Fortran procedure must be named MAIN___ it cannot be called main If LF64 is not used to link objects into an executable program then Fortran does not place any restriction on the name of the main entry point The user is responsible for supplying the Fortran runtime libraries to the linker The user must provide the path to the Fortran installa tion 1ib6 4 directory For single thread applications link with Fortran runtime libraries fj90i and fj90f and with the system library e1f Creating mixed language multithreaded applications is not recommended Interfacing with Non Fortran Languages When you create a Fortran library or object file you will usually indicate each procedure that you want made available using the ML_EXTERNAL statement The procedure may be a sub routine or a function When a Fortran function returns a value the calling language must match the value to its corresponding data type as described in Table 8 on page 56 Lahey Fujitsu Linux64 Fortran User s Guide 51 Chapter 3 Mixed Language Programming integer function half x ml_external half integer half end x x 2 Iname is
126. not compiled at the same time as the source containing the USE state ment nor will the checking occur on object files or libraries specified on the command line Because specifying chkglobal forces chk x specification of chkglobal must be used for compilation of all files of the program or incorrect results may occur Do not use with 3rd party compiled modules objects or libraries See the description of chk for more information Global checking diagnostics will not be published in the listing file Specifying chkglobal adds to the size of a program and causes it to run more slowly sometimes as much as an order of magnitude It forces chk a e f o0 s u x trace and removes optimization by forcing O0 The chkglobal option is subject to the same restrictions on checking bounds and undefined variables as applies to the chk option njco Compiler Options Compile and link Default nco Specify co to display current settings of compiler options specify nco to suppress them Cpp Invoke preprocessor Compile only Default do not invoke preprocessor When the Cpp option is specified the C preprocessor is run on the source file before com pilation The preprocessor processes C style directives When the file extension is capitalized the C preprocessor is invoked even if the Cpp option is absent D name Define preprocessor name Compile only Lahey Fujitsu Linux64 Fortran User s Guide 23 Chapte
127. ns array expressions and array assignments integer a 1000 b 1000 a atb Half of the operations are made on one CPU and half are made on the other CPU 1 a 1 500 a 1 500 b 1 500 CPU 2 a 501 1000 a 501 1000 b 501 1000 Automatic Loop Slicing by the Compiler LF64 parallelizes a DO loop if the order of data references will be the same as with serial execution LF64 assures that the result of a multi processing program is the same as if the program were processed serially The next example is a DO loop that is not amenable to loop slicing In this DO loop when the DO variable I is 5001 it is necessary to have the value of array element A 5000 do i 2 10000 a i a i 1 b i end do The following loop slicing cannot happen with the code above CPU 1 do i 2 5000 a i a i 1 b i end do Lahey Fujitsu Linux64 Fortran User s Guide Details of Multi Processing CPU 2 do i 5001 10000 a i a i 1 b i end do A 5000 is not available to CPU2 and the loop will not be sliced Loop Interchange and Automatic Loop Slicing When a nested DO loop is sliced LF64 attempts to parallelize the outermost loop if it can LF64 selects a DO loop that can be sliced and interchanges it with the outermost possible loop The purpose of this is to reduce the overhead of multi processing and improve execu tion performance The next figure shows an example of loop interchange for a nested loop It is
128. ns 28 Kpureomp strict adherence to OpenMP directives 28 Kreduction reduction paral lelization optimizations 28 Kthreadprivate named com mons private to thread 28 Kthreadsafe generate code that is thread safe 29 Ktiling apply loop tiling optimizations 29 L library search path 29 l specify library file 29 li recognise Lahey intrinsic procedures 30 long long integers 30 Ist listing 30 M module path option 31 maxfatals maximum fatal errors 31 ml mixed language 31 mldefault mixed language default 31 mod module path 31 model memory model 32 Nautoobjstack allocate automatic arrays on stack 33 Ncalleralloc caller allocates array function result 33 Nfreealloc deallocate vari ables on exit 33 Nmallocfree treat malloc and free as intrinsic procedures 33 Nobsfun extension proce dures as intrinsic 33 Nrecursive create recursive procedures 34 o output file name 34 O set optimization level 34 ocl recognise optimization con trol lines 35 openmp process OpenMP directives 35 out output file name 34 P save preprocessor files 10 35 parallel automatic parallelization 35 pca protect constant arguments 36 prefetch prefetch optimization option 36 private module accessiblity 36 quad quadruple precision 36 quiet quiet compilation 37 S generate assembly instead of object 37 sav SAVE local variables 37 shared create shared li
129. ntax description delete file line Removes the breakpoint for the line number line in the source file specified as file If omitted file defaults to the current file Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character delete file procname Removes the breakpoint for the entry point of the procedure procname in the source file file If omitted file defaults to the current file Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character delete addr Removes the breakpoint for the address addr delete n Removes breakpoint number n delete Removes all breakpoints skip n count Skips the breakpoint number n count times Lahey Fujitsu Linux64 Fortran User s Guide 71 Chapter 4 Command Line Debugging with fdb 72 onstop n cmd cmd2 cmd3 cmdn Upon encountering breakpoint n execute the specified fdb command s show break B Displays all breakpoints If using the abbreviation B the B must be upper case Controlling Program Execution continue count Continues program execution until a breakpoint s count reaches count Then execution stops If omitted count defaults to and the execution is interrupted at the next breakpoint Program execution is continued without the program being notified of a signal even if the program was
130. ntf i i j i n ext_ i ext_ j 62 Lahey Fujitsu Linux64 Fortran User s Guide Calling Standard C Libraries Example Blank Common Passing data via blank common is accomplished in the same manner as in the above example except in the C code the name ext_ is replaced by _BLNK_ Calling Standard C Libraries When calling functions in the Linux kernel and standard C libraries it is necessary to apply the ML_EXTERNAL statement to the function name and compile with the ml compiler option Example Calling a Linux Kernel Function The following Fortran program illustrates a call to the standard function usleep program callsys ml_external usleep write Going to sleep sleep for 10 seconds call usleep 10000000 write Wake up end program The above program must be compiled using the command line lfc callsys 90 ml cdecl Lahey Fujitsu Linux64 Fortran User s Guide 63 Chapter 3 Mixed Language Programming 64 Lahey Fujitsu Linux64 Fortran User s Guide Command Line Debugging with fdb fdb is a command line symbolic source level debugger for Fortran 95 and assembly programs Before debugging your program you must compile it using the g option see Compiler and Linker Options on page 16 The g option creates additional symbolic debugging infor mation within the executable code fdb is not compatible with the debug information generated by gcc the GNU C compile
131. nts Lahey Fujitsu Linux64 Fortran User s Guide 97 Chapter 5 Multi Processing PRO version only 98 ocl serial lt total position do i Lak We garin loop 1 al i j al i j bl i j cl i j cl i j dl i j el i j el i j 1 1 35 gl i j gl i j hi i j end do end do ocl parallel p do j 1 10 p do i 1 m D KSeaSsssssss loop 2 p a2 i j a2 i j B2 2539 p c2 i j c2 i j d2 i 3 p e2 i j e2 1 3 2 1 9 p g2 i j g2 i j h2 i j p end do p end do do j 1 10 do i 1 n Wy igo eesSsSS05 loop 3 a3 i j a3 i j b3 i j estirar Se3 apa FH ad3Gh 3 e3 i j e3 i 3 f3 i Jj g3 i j g3 i j h3 i j end do end do DISJOINT The DISJOINT specifier indicates that the order of data references references to arrays in the DO loop is the same whether executed serially or in parallel As a result it is possible to slice a DO loop that would not be sliced otherwise because the compiler would be unable to determine the order of data references Syntax OCL DISJOINT a a Wom Here a is the array name for which loop slicing is possible A wild card specification is usable in a If the array name is omitted DISJOINT becomes effective for all arrays within the range of the DO loop See Wild Card Specification on page 102 for the wild card syntax The DISJOINT specifier can be placed at the loop position or the total posit
132. nts derived type components pointers initialized variables or function results K no jeval Optimize expression evaluation Compile only Default Knoeval Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options The Keval option allows the compiler to apply optimizations by changing the order in which expressions are evaluated Depending on program structure it is possible that use of this option could alter program results Use the info option to determine if these optimizations were applied Use of the Kfast option forces the Keval option K no fap Storage of REAL and COMPLEX data types in hardware registers Compile only Default Knofap The Knofap option causes REAL or COMPLEX variables of any kind to be stored in hard ware registers whenever possible and applies optimizations accordingly The Kfap option does not attempt to store REAL or COMPLEX variables in hardware reg isters Optimization which assume hardware storage are not applied K no fp_relaxed Faster FP division and SQRT calculation Compile only Default Knofp_relaxed When the Kfp_relaxed option is specified the compiler generates code that speeds floating point division and SQRT calculations at the cost of greater rounding error Compared to nor mal calculation calculations made with Kfp_relaxed will differ by 1 or 2 bits K no fsimple Simplify floating point operations Compile only Default Knofsimple The Kfsimp
133. o be processed See Optimization Control Line on page 94 for more information njopenmp PRO version only Process OpenMP directives Compile and link Default nopenmp The openmp option causes the compiler to process OpenMP directives in Fortran code When the openmp option is specified the Kthreadsafe and varstack options are forced and local variables are stored on the stack This storage behavior can be overridden by specifying nvarstack after openmp in the compile command See OpenMP on page 106 for more information P Save preprocessor files Compile only Default do not save The P option causes any intermediate files that are produced by the C preprocessor to be saved The preprocessor is invoked when the Cpp option is specified or when the source file extension is capitalized If the preprocessor is run on a file of the form file ext the inter mediate file will have the name file cpp ext The intermediate file extension is all lower case regardless of the case of the original source file njparallel PRO version only Attempt automatic parallelization Compile and link Default nparallel parallel forces O full optimization Note that the parallel is ignored if the g chk or chkglobal option is specified To see the compiler s parallelization decisions specify info See Overview of Multi Processing on page 83 for more information Lahey Fujitsu Linux
134. ocedures see the BLAS LAPACK PDF document in the manuals directory of your LF64 distribution Porting Code Between Windows and Linux Standard conforming code If your code is F77 F90 or F95 standard conforming it will likely port to Linux simply by recompiling Problems may occur if code contains Windows specific path information See the section Source code changes on page 47 Winteracter and Gino GUI programs If you are using the Winteracter or Gino GUI libraries you can recompile your code and link with the Linux version of these libraries without having to make any other changes Automake If you are using Automake the basic structure of the automake fig configuration file will remain the same A symbolic link is provided that equates 1 95 with lfc so existing com pile commands will not require any changes When changes are made to add new compile commands that do not exist in 1 95 it is recommended that the LF95 keyword and 1 95 compile command be changed to LF64 and 1 fc respectively Source code changes If any code or data contains path information you will have to change the Windows directory separator to the Unix separator and make sure that pertinent files are in the indicated directories If code contains environment variables you will need to convert from Windows style var to Unix style var Service routines and extensions Many non standard extensions are supported under both the Windows and
135. od MyDir IncDir ModDir delimiting space required after mod but prohibited after If an unknown option is detected the entire text from the beginning of the unknown option to the beginning of the next option or end of the command line is passed to the linker Even though options with double hyphens are not case sensitive it is recommended that all options be treated as case sensitive to avoid confusion Certain arguments to driver options i e names of files or directories will also be case sensitive To illustrate if the argument to the M option in the above example were changed to MYDIR INCDIR then the driver would be unable to find the actual directory An option for another component tool linker assembler or preprocessor that conflicts with an LF64 option may be passed directly to that component verbatim using the w1 wa and Wp options These options behave as documented in the man pages for gcc the GNU C compiler Conflicts Between Options Command line options are processed from left to right If conflicting options are specified the last one takes precedence For example if the command line contained 1st nlst the n1st option would be used Note that some options override or force other options regardless of the order of appearance For example if chk 03 were specified O0 would be used because chk forces O0 Any overriding or forcing behavior is noted in the option descriptions To di
136. oked it is therefore preferable to use a lowercase extension on the filename if the file does not need to be preprocessed For a description of free source form and fixed source form please see the Language Reference Object Filenames The default name for an object file is the same as the source filename with extension o When an object file is created it is placed by default in the current working directory This behavior may be overridden by specifying the o or out option with a new name and path see o name on page 34 Module Filenames Files containing Fortran 95 module information will have the same name as the module defined in the source code in lowercase followed by the mod extension When a module file is created it is placed by default in the current working directory This behavior may be overridden by specifying the mod or M option see M dir on page 31 The extension mod is reserved for compiler generated module files Do not use this extension for your Fortran source files If a program contains code that USEs a module then its object file cor responding to the source file where that module was defined must be specified on the command line The search path for mod files may be specified with the mod or M option Output Filenames The default name for the executable file produced by the driver is a out If no path is spec ified the current directory will be used This may be overridd
137. olution in this case is to place the runtime options in environment variable FORT9OL see Environment Variables on page 132 Command Format Runtime options and user defined executable program options may be specified as command option arguments of an execution command The runtime options use functions supported by the LF64 runtime library Please note that these options are case sensitive The format of runtime options is as follows exe_file W1 runtime options user defined program arguments Where exe_file indicates the user s executable program file The string W1 must precede any runtime options so they may be identified as such and distinguished from user defined program arguments Note that itis W followed by a lowercase L not the number one Please note also that if an option is specified more than once with different arguments the last occur rence is used Lahey Fujitsu Linux64 Fortran User s Guide 131 Appendix B_ Runtime Options Environment Variables As an alternative to the command line the environment variable FORT90L may be used to specify runtime options Any runtime options specified in the command line are combined with those specified in FORT90L The command line arguments take precedence over the corresponding options specified in the environment variable FORT9OL The following examples show how to use the environment variable FORT9OL the actual meaning of each runtime option wi
138. ompilation and linking are performed separately i e in separate command lines then options that apply to both phases must be included in each command line Most LF64 options begin with two hyphens and are self descriptive Commonly used single hyphen options are provided 1 1 L g o O c etc for compatibility with other Linux products see descriptions below Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options Compiling and linking can be broken into separate steps using the c option Unless the c option is specified the LF64 driver will attempt to link and create an executable after the compilation phase completes Specifying c anywhere in the command line will cause the link phase to be skipped and all linker options will be ignored While linking is ultimately performed by 1d the GNU linker it is best to perform linking of LF64 objects using the LF64 driver This will help to insure that all necessary steps are taken and all necessary components are included to produce the final product Any options not rec ognized by the LF64 driver will be passed directly to 1d Remember that any options passed directly to 1d will be treated as case sensitive AA Disable alignment Compile only Default align data on processor boundaries When the AA option is specified data in common blocks and derived types are not aligned on processor boundaries Use of the AA option can adversely affect
139. onment variable instructs the runtime environment whether or not to use high speed runtime libraries If the value of FLIB_FASTOMP is true or 1 the fast libraries are used Lahey Fujitsu Linux64 Fortran User s Guide Controlling parallel program execution The high speed runtime libraries are optimized on the assumption that nested parallelism is inhibited and every thread is connected to a CPU The number of threads specified by the OMP_NUM_THREADS subroutine or with the NUM_THREADS clause of the PARALLEL directive must match the number of threads defined by the execution environment When the high speed runtime library is used nested parallel regions are always serialized Regardless of the specification of environment variable OMP_DYNAMIC and settings by subroutine OMP_SET_ DYNAMIC the number of threads cannot exceed the limit on the number of CPUs FLIB_IOBUFCPY The FLIB_IOBUFCPY environment variable instructs the runtime to use multiple threads and buffers for I O transfer The value of FLIB_IOBUFCPY must be set to MP in order for the parallel buffers to function FLIB_IOBUFCPY_SIZE The FLIB_IOBUFCPY_SIZE environment variable sets a minimum size limit on use of mul tiple threads and buffers for unformatted I O transfer The value of FLIB_IOBUFCPY is the minimum size in kilobytes before parallel buffer I O will be performed FLIB_PARALLEL_INFO The FLIB_PARALLEL INFO environment variable controls the output of parallel
140. onment variable specifies the unit number the number must have at least two digits The size argument used for sequential access input output statements is in kilobytes the size argument used for direct access input output statements is in records The size argument must be an integer with a value of or more A size argument specified for one unit does not automatically apply to other units If this environment variable and the g option are omitted the input output work area size used by sequential access input output statements defaults to eight megabytes The size argu ment for direct access input output statements is the number of Fortran records per block in fixed block format The size argument must be an integer from to 32767 that indicates the number of Fortran records per block If this environment variable and the a option are omit ted the area size is four kilobytes Example 1 Sequential Access Input Output Statements setenv ful0bf 64 When sequential access input output statements are executed for unit number 10 the state ments use an input output work area of 64 kilobytes Example 2 Direct Access Input Output Statements setenv ful0bf 50 When direct access input output statements are executed for unit number 10 the number of Fortran records included in one block is 50 The input output work area size is obtained by multiplying 50 by the value specified in the RECL specifier of the OPEN statement Lahey Fuji
141. ons memprint 1024 The content of the area addressed by 0x0400 is displayed memprint 01024 The content of the area addressed by 0x0214 is displayed memprint 0x1024 The content of the area addressed by 0x1024 is displayed Lahey Fujitsu Linux64 Fortran User s Guide Registers Registers SBP Base Pointer SP Stack Pointer SEIP Program counter SEFLAGS Processor state register ST 0 7 Floating point registers Names When communicating with fdb all procedure names must be in lower case regardless of the case used in the source file The main program name when not specified in a PROGRAM statement is main In order to prevent user names from conflicting with intrinsic or runtime library names the compiler decorates procedure and common block names by adding an underscore _ after the corresponding name specified in the Fortran source program When referencing an external or module procedure or a common block in fdb the trailing under score is optional However when referencing any internal procedures the name must be specified with the trailing underscore Commands Commands can be abbreviated by entering only the underlined letter or letters in the com mand descriptions For example ki11 can be abbreviated simply k and oncebreak can be abbreviated ob All commands should be typed in lower case unless otherwise noted Character literals must be enclosed by quotation marks the symbol which is asc
142. onventions are as follows ments by value to other languages using the All arguments are pass by address not pass by value as in C LF64 can pass argu VALO intrinsic Arrays of pointers cannot be passed from C to Fortran COMPLEX and derived type arguments can be passed as pointers to structures Because C does not have a native type for complex data it must be declared as a structure For example Fortran default COMPLEX is declared in C as 52 Lahey Fujitsu Linux64 Fortran User s Guide Passing Data struct float real float imaginary complex When passing data via a file the file must be closed prior to calling the non Fortran procedure Fortran common blocks can be accessed as an external or global structure from C For example the named common block common my_common a b c real a b c can be accessed as extern struct float a b c my_common_ my_common_ must be all lower case Blank unnamed common is treated the same way the structure is named _BLNK_ instead of my_common_ Lahey Fujitsu Linux64 Fortran User s Guide 53 Chapter 3 Mixed Language Programming Data passed between Fortran and C programs must have corresponding attributes The fol lowing table describes corresponding data types between C and Fortran Note that some of the listed data types will be unavailable on some C compilers Table 7 Corresponding Data Types in Fortran and C
143. option 137 M module path option 31 MAKE utility 111 maxfatals maximum fatals option 31 memory model option 32 mixed language programming runtime initialization 51 ml mixed language option 31 mldefault mixed language default option 31 mod filename extension 10 11 mod module path option 31 model memory model option 32 modules mod extension 10 11 N nruntime option 137 Nautoobjstack allocate auto matic arrays on stack option 33 Nealleralloc caller allocates array function result option 33 Nfreealloc deallocate variables on exit option 33 Nmallocfree treat malloc and free as intrinsic procedures option 33 Nobsfun extension procedures as intrinsic option 33 notational conventions 3 Nrecursive create recursive proce dures option 34 Null termination 17 numeric input runtime option x 140 numeric output runtime option q 138 O o output file name option 34 O set optimization level option 34 object filenames 11 OCL 94 ocl recognise optimization control line option 35 OMP_DYNAMIC environment variable 86 OMP_NESTED environment variable 86 OMP_NUM_THREADS environment variable 86 107 OMP_SCHEDULE environment variable 87 OMP_SET_NUM_THREADS service routine 107 OpenGL graphics 46 openmp process OpenMP directives 35 optimization options fast 24 Karray_transform 26 Keval 26 Kfap 27 Kfp_relaxed 27 Kfsimple 27 Kfuse 27 Kloop 27 Kpacked 28
144. or Fortran runtime can decide how many threads are required at execution time See Automatic Parallelization on page 89 Compiler options for processing OpenMP directives The openmp option instructs the compiler to parallelize a program by applying OpenMP directives embedded in the code In addition to OpenMP directives in code the compile will accept options that can affect processing of OpenMP directives when used in combination with openmp The Kpureomp option controls whether OpenMP directives are followed faithfully or if lat itude is allowed in applying optimizations The Kthreadprivate option instructs the compiler to treat named common blocks as pri vate within the thread See OpenMP on page 106 Other compiler options affecting parallelization The threadstack option is used to fix the size of the stack for each thread at compile time The threadheap option causes local variables to be stored on the threads heap rather than on the threads stack See Compiler and Linker Options on page 16 for more detailed descriptions of these com piler options Controlling parallel program execution Environment Variables OpenMP specifies a number of environment variables which are described in the OpenMP documentation at http www openmp org The following section details other environ ment variables that can be set to alter the way a parallel program executes FLIB_FASTOMP The FLIB_FASTOMP envir
145. oritized resolution system We give a bug a priority based on its severity Lahey Fujitsu Linux64 Fortran User s Guide 143 Appendix C Lahey Technical Support 144 The definition of any bug s severity is determined by whether it directly affects your ability to build and execute a program If a bug keeps you from being able to build or execute your program it receives the highest priority If you report a bug that does not keep you from cre ating a working program it receives a lower priority Also if Lahey can provide a workaround to the bug it receives a lower priority Product suggestions are not considered bugs If a registered owner of Lahey Fortran reports a bug in the current version or in the previous version within 60 days following release of a new version and that bug is verified by Lahey the bug fix will be made available as a patch or as a free update at Lahey s discretion to a newer version of the product containing the bug fix Any bug that is reported by any user will be investigated by Lahey only in the latest version of the product In recognizing that problems sometimes occur in changing software versions Lahey allows you to revert to an earlier version of the software until Lahey resolves the problem Contacting Lahey To expedite support services we prefer written communications via email E mail receives higher priority service and minimizes the chances for any mistakes in our communications Before
146. ort int result myfunc_ OGICAL 4 long int result myfunc_ OGICAL 8 long long int result myfunc_ REAL 4 float result myfunc_ REAL 8 double result myfunc_ REAL 16 long double result myfunc_ COMP LEX 4 void myfunc_ amp result COMP LEX 8 void myfunc_ amp result COMP LEX 16 void myfunc_ amp result CHARACTER LEN void myfunc_ amp result len Derived Type not applicable not applicable For example the Fortran function integer function foo i j integer i end function foo corresponds to the C prototype long int foo long int i long int j To illustrate returning an assumed length character value the Fortran function Lahey Fujitsu Linux64 Fortran User s Guide Returning Function Values to Fortran function cfun character len cfun cfun 1234567890 end function cfun is invoked from C as follows void cflun _ char str1 MAIN char mystr 10 cfun_ mystr 10 int strlen The preceding example may be a bit confusing since it runs counter to the intuitive concept of a function returning a value For further explanation see Passing Character Data on page 60 Returning Function Values to Fortran C functions are also called by Fortran as functions returning a value By default all argu ments are passed to C by reference Arguments may also be passed to C by value using LF64 s
147. ou Provide eeeeeeeeee 144 Lahey Warranties 0 cece eeeeeeeeeeee 145 Return Procedure eecescecereeesseeeeeeeeee 146 Q Getting Started Lahey Fujitsu Linux64 Fortran LF64 is a set of tools for developing optimized 64 bit For tran applications for the AMD x86 64 and Intel 64 platforms LF64 is a complete implementation of the Fortran 95 standard Lahey provides two distributions of LF64 LF64 Linux Express and LF64 Linux PRO Some chapters or feature descriptions in apply only to LF64 Linux PRO These chapters and feature descriptions are marked PRO Version Only LF64 Linux Express LF64 Express includes e an optimizing compiler e debugger on line documentation e free e mail technical support Express has two manuals the Lahey Fujitsu Linux64 Fortran User s Guide this manual which describes the compiler and tools and the Lahey Fujitsu Linux64 Fortran Language Reference which describes the Fortran 95 language and extensions LF64 Linux PRO LF64 PRO includes e an optimizing compiler e automatic parallelization and OpenMP support e debugger e AUTOMAKE an automatic build tool for Fortran and C e WiSK an X Windows based user interface and graphics toolset library e online manuals e free email technical support PRO documentation includes the Lahey Fujitsu Linux64 Fortran User s Guide the Lahey Fujitsu Linux64 Fortran Language Reference and the WiSK Reference whic
148. ow regs Displays the contents of all registers including floating point registers in the current frame show map Displays the address map Setting and Displaying Program Variables set variable value Sets variable to value set addr value Sets addr to value set reg value Sets reg to value reg must be a register or a floating point register see Registers on page 67 for register notation details print F variable value Displays the content of the program variable variable by using the edit format F If edit for mat F is omitted it is implied based on the type of variable variable can be a scalar array array element array section derived type derived type element or common block F can have any of the following values hexadecimal signed decimal unsigned decimal octal floating point character character string address of variable 9 naQAMmMOGB aK If value is specified the variable will be set to value If no arguments are specified the last print command having arguments is repeated memprint FuN addr dump FuN addr Displays the content of the memory address addr by using edit format F u indicates the dis play unit and N indicates the number of units F can have the same values as were defined for the Print command variable F If omitted f defaults to x hexadecimal see format descriptions in print command above Lahey Fujitsu Linux64 Fortran User s Guide 75
149. padding for Formatted Input The Q option suppresses padding of an input field with blanks when a formatted input state ment is used to read a Fortran record this behavior will apply to all unit numbers This option applies to cases where the field width needed in a formatted input statement is longer than the length of the Fortran record and the file was not opened with an OPEN statement The result is the same as if the PAD specifier in an OPEN statement is set to NO If the Q option is omitted the input record is padded with blanks The result is the same as when the PAD specifier in an OPEN statement is set to YES or when the PAD specifier is omitted Example a out W1 Q q Capitalize Numeric Edit Output Characters The q option specifies whether to capitalize the E EN ES D Q G L and Z numeric edit output characters produced by formatted output statements This option also specifies whether to capitalize the alphabetic characters in the character constants used by the inquiry specifier excluding the NAME specifier in the INQUIRE statement If the q option is specified the characters appear in uppercase letters If the q option is omitted the characters appear in lowercase letters Example a out W1 q Lahey Fujitsu Linux64 Fortran User s Guide Descriptions of Runtime Options runit 0 lt unit lt 2147483647 Standard Input The r option connects the unit number unit to the standard input file de
150. pecify nli to avoid recognizing Lahey s non standard intrinsic procedures njlong Long Integers Compile only Default nlong Specify long to extend all INTEGER variables arrays constants and functions to INTE GER KIND 8 If you use long all source files including modules in a program should be compiled with long to prevent conflicts in argument type If the long option is specified the INT IFIX IDINT IQINT NINT IDNINT and IQNINT must not be used as actual arguments njist soec svall soec sval Generate source listing Compile only Default nlst Specify lst to generate a listing file that contains the source program compiler options date and time of compilation and any compiler diagnostics The compiler outputs one listing file for each compile session By default listing filenames consist of the basename of the first source filename plus the extension 1st placed in the current working directory use sval suboption to override see below The page width of the listing file is 274 columns and no page breaks or additional headers are inserted into the body of the listing Note that nlst is overridden by xref Syntax n lst spec sval spec sval Where spec is f for the listing filename or i to include INCLUDE files Each suboption must be separated by acomma and space and the entire list of suboptions must be enclosed in double quotes For f sval the lis
151. play list offset Displays the line forward or backward offset lines from the current line The current line is changed to the last line displayed list file top bot Displays the source file lines between line number top and line number bot in the source file file If file is omitted it defaults to the current file The current line is changed to the last line displayed Note that the apostrophes used in file above are the grave accent ascii 96 not the standard apostrophe character list func tion procname Displays the last 5 lines and the next 5 lines of the entry point of the procedure procname disas Displays the current machine language instruction in disassembled form disas addr1 addr2 Displays the machine language instructions between address addr1 and address addr2 in dis assembled form If addr2 is omitted it defaults to the end of the current procedure that contains address addr1 disas procname Displays all instructions of the procedure procname in disassembled form Automatic Display screen F expr Displays the value of expression expr according to format F every time the program stops screen Displays the names and values of all expressions set by the screen F expr command above Refer to print F variable value on page 75 for an explanation of F unscreen n Remove automatic display number n symbol required When n is omitted
152. possible to slice the inner loop with control variable J The frequency of multi processing control can be reduced by interchanging it with the outer loop do i 2 10000 do 3 1 10 a i j a i 1 j3 b i j end do end do With loops interchanged this becomes do 3 1 10 do i 2 10000 a i j a i 1 j b i j end do end do When parallelized this becomes CPU 1 do j 1 5 do i 2 10000 a i j a i 1 j3 tbi end do end do CPU 2 do j 6 10 do i 2 10000 a i j a i 1 j b i j end do end do Lahey Fujitsu Linux64 Fortran User s Guide 91 Chapter 5 Multi Processing PRO version only 92 Loop Distribution and Automatic Loop Slicing In the next example the references to array A cannot be sliced because the order of data ref erences would be different from the data reference order in serial execution Array B can be sliced because the order of data references is the same as for serial execution For this case the statement where array A is defined and the statement where array B is defined are sepa rated into two DO loops and the DO loop where array B is defined is parallelized do i 1 10000 a i a i l c i b i b i c i end do With the loop distributed this becomes do i 1 10000 a i a i 1 c i end do do i 1 10000 b i b i c i end do The second loop is then parallelized CPU 1 do i 1 5000 i b i c i end do CPU 2 do i 5
153. ption to determine if these optimizations were applied K no pureomp Strict adherence to OpenMP directives Compile only Default Knopureomp The Kpureomp option forces strict adherence to OpenMP directives Knopureomp allows the compiler to optimize OpenMP code due to generous interpretation of OpenMP directives This option is only effective when the openmp option is present K no reduction Perform reduction parallelization optimizations Compile only Default Knoreduction The Kreduction option allows the compiler to perform reduction parallelization optimiza tions If Kreduction is specified parallel must also be specified Use of the Keval option forces use of Kreduction K no jthreadprivate Named commons private to thread Compile only Default Knothreadprivate Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options When Kthreadprivate is specified all named common blocks become private to the thread This option is only active when openmp is specified K no threadsafe Generate code that is thread safe Compile only Default Knothreadsafe Use the Kthreadsafe option to generate code that will execute safely in a multithreaded environment Ktiling n Apply loop tiling optimizations Compile only Default do not apply optimizations The Ktiling option allows the compiler to apply loop tiling optimizations n is the tile size and is a number between between 2 and 9999 If
154. put work area used by a direct access input output statement The 4d option improves input output performance when data are read from or written to files a record at a time in sequential record number order If the a option is specified the input output work area size is used for all units used during execution To specify the size of the input output work area for individual units specify the number of Fortran records in the environment variable fuunitof where unit is the unit number see Environment Variables for Input Output on page 140 for details When the a option Lahey Fujitsu Linux64 Fortran User s Guide Descriptions of Runtime Options and environment variable are specified at the same time the a option takes precedence The optional argument num specifies the number of Fortran records in fixed block format included in one block The optional argument num must be an integer from to 32767 To obtain the input output work area size multiply num by the value specified in the RECL specifier of the OPEN statement If the files are shared by several processes the number of Fortran records per block must be one If the a option is omitted the size of the input output work area is four kilobytes Example a out W1 d8 e num 0 lt num lt 32767 Execution error limit The e option controls termination based on the total number of execution errors The option argument num specifies the error limit as an inte
155. r It is however possible to debug LF64 programs using gdb GNU debugger subject to the fol lowing restrictions Fortran 90 95 specifications are not supported in gdb The contents of COMMON can only be examined in gdb by examining memory and interpreting the values there Fortran procedures must be specified as lowercase with trailing underscore _ You can step through module procedures but you cannot set a breakpoint or examine the values of variables or parameters Fortran variables must be specified in capital letters Starting fdb To start fdb type fdb exefile corefile Where exefile is the name of an executable file compiled with the g option and corefile is the name of the core file if any produced by abnormal termination of the executable If exefile is not supplied then fdb will assume the executable file is a out If corefile is not supplied then fdb will assume the core dump file is core Lahey Fujitsu Linux64 Fortran User s Guide 65 Chapter 4 Command Line Debugging with fdb If core is present in the current directory or if corefile is specified then fdb will start with the current line of code being the one that caused the abnormal termination and the current file being the one that contains that line of code If core or corefile is not a dump of exefile then there will be no debug information available Otherwise if no core file is available or corefile does not exist then fdb starts with
156. r 2 Developing with LF64 24 Use the D option to define a name that can be recognized by the preprocessor This option is equivalent to specifying a name in a define directive njdal Deallocate Allocatables Compile only Default dal Specify dal to deallocate allocated arrays not appearing in DEALLOCATE or SAVE state ments whenever a RETURN STOP or END statement is encountered in the program unit containing the allocatable array Note that ndal will suppress automatic deallocation even for Fortran 95 files automatic deallocation is standard behavior in Fortran 95 n dbl Double Compile only Default ndb1 Specify dbl to extend all single precision REAL and single precision COMPLEX vari ables arrays constants and functions to REAL KIND 8 and COMPLEX KIND 8 respectively If you use dbl all source files including modules in a program should be compiled with dbl Specifying dbl will usually result in somewhat slower executables The dbl option is cancelled by openmp If the dbl option is specified the CcdRR8 CcR4R8 CcdDR16 CcR8R16 Ccd4d8 and Cca4a8 options cannot be specified njf95 Fortran 95 Conformance Compile only Default nf95 Specify f95 to generate warnings when the compiler encounters non standard Fortran 95 code For additional comformance messages see Standard conformance diagnostics on page 40 Note that nf95 allows any intrinsic data type to b
157. r program uses Fortran modules that have already been compiled you must add the module object filenames i e the source filename with extension o to the LF64 command line when linking Compiling a Fortran module will generate an object o file and a module mod file if the source file contains executable code If the source file does not contain any executable code but does contain public entities then only a mod file will be generated How the Linker Finds Libraries The linker reads individual object files and object module libraries resolves references to external symbols and writes out a single executable file or shared library If an object file or library was specified on the command line and contains path information then it must reside at the location specified If the path was not specified the linker looks for the files in the following order 1 in any directories specified with the L option 2 in any directories specified by the LD_LIBRARY_PATH environment variable C Note the current working directory will not be searched unless it is specified by the L option or the LD_LIBRARY_PATH environment variable In each case the linker will first attempt to locate a shared library with a so file extension containing the desired symbol s If that is not found then it will seek an archive or static library with a a file extension The staticlink option does not affect this behavior this option only d
158. ram Copyright c 2006 Lahey Computer Systems Inc factorials Fahrenheit to Celsius conversion Carmichael numbers Ramanujan s series Stirling numbers of the 2nd kind chi square quantiles Pythagorean triplets date_and_time and other system calls lt stop this program gt CMOIHDUOBWNE I Please select an option by entering the associated number followed by lt return gt You ve successfully built and run the Lahey demonstration program What s Next For a more complete description of the development process and instructions for using Lahey Fujitsu Linux64 Fortran please turn to Chapter 2 Developing with LF64 Before continuing however please read the files README and ERRATA These contain important last minute information and changes to the documentation Other Sources of Information Text Files README last minute information FILELIST description of all files distributed with LF64 RTERRMSG descriptions of runtime error messages and their IOSTAT values ERRATA changes that were made after the manuals were finalized PDF Files Winteracter Starter Kit Reference PRO Version only LF64 Fortran Language Reference LF64 Fortran User s Guide this document Newsletters The Lahey Fortran Source newsletter 6 Lahey Fujitsu Linux64 Fortran User s Guide Other Sources of Information Lahey Web Page http www lahey com Discussion Groups The
159. ram if the result array has an intrinsic type and is an explicit shape array with constant upper and lower bounds If the result is of character type its length specifier must be a con stant value This can reduce the overhead if the array function is called multiple times This option must be used on all files that define or reference the array function N no freealloc Free or save allocatable variable on procedure exit Compile only Default Nfreealloc The Nfreealloc option controls whether a variable which is allocated in a procedure is deal located upon exit The normal behavior is to deallocate the variable on exit Nfreealloc When the Nnofreealloc option is specified allocated variables are not deallocated upon exit from the procedure Nnofreealloc causes the compiler to act in a nonstandard way N no mallocfree Treat malloc and free as intrinsic procedures Compile only Default Nnomallocfree Specify Nmallocfree to treat malloc and free as intrinsic procedures The malloc procedure is a function with an 8 byte integer result and takes an integer argu ment of any type The free procedure is a subroutine which takes and 8 byte integer variable argument which is the result of a call to the malloc function N no jobsfun Extension procedures as intrinsic Compile only Default Nobsfun The Nobsfun option causes the compiler to treat extension procedures as intrinsic proce dures When Nnoobsfun is specified
160. riables for Input Output on page 140 for further details Example a out W1 m10 N Prompt Messages Standard Input The n option controls whether prompt messages are sent to standard input STDIN When the n option is specified prompt messages are output when data are to be entered from stan dard input using formatted sequential READ statements including list directed and namelist statements If the n option is omitted prompt messages are not generated when data are to be entered from standard input using a formatted sequential READ statement Example a out W1 n Oi When the runtime option Oi is specified I O statistics are output to the file specified by the environment variable IOINF If the environment variable IOINF is not specified output is sent to stdout Lahey Fujitsu Linux64 Fortran User s Guide 137 Appendix B_ Runtime Options 138 Example setenv INOINF ioinf file a out W1 Oi punit 0 lt unit lt 2147483647 Standard Output The p option connects the unit number unit to the standard output file device STDOUT where unit is an integer ranging from 0 to 2147483647 If the p option is omitted unit number 6 the system default is connected to the standard output file Care should be taken to avoid conflict with units specified by m and r options Also see Environment Variables for Input Output on page 140 for further details Example a out W1 p10 Q Blank
161. rint i i is private omp end parallel Statement Function Statement A variable that appears in a statement function statement cannot have the PRIVATE FIRSTPRIVATE LASTPRIVATE REDUCTION or THREADPRIVATE attribute Namelist Group Object A variable declared as a namelist group object cannot have the PRIVATE FIRSTPRIVATE LASTPRIVATE REDUCTION or THREADPRIVATE attribute Materialization of Parallel Region Internal procedures are SCHEDULE STATIC The generated internal procedure has the name _n_ where n is a consecutive number Automatic Parallelization with OpenMP The openmp option and the parallel option may be specified at the same time The par allel option is ignored in any program unit that contains OpenMP directives Debugging Multi threaded programs cannot be debugged using fdb Lahey Fujitsu Linux64 Fortran User s Guide 109 Chapter 5 Multi Processing PRO version only 110 Lahey Fujitsu Linux64 Fortran User s Guide Automake PRO version only Introduction What Does It Do AUTOMAKE is a simple to use tool for re building a program after you have made changes to the Fortran and or C source code It examines the creation times of all the source object and module files and recompiles wherever it finds that an object or module file is non exis tent empty or out of date In doing this it takes account not only of changes or additions to the source code files but also changes or a
162. rograms Lahey Fujitsu Linux64 Fortran User s Guide 81 Chapter 4 Command Line Debugging with fdb 82 4 An array of an assumed size can be debugged only for the lower bound of the array in a Fortran program The statement label in a Fortran program cannot be debugged In a Fortran program the breakpoint you can make at the beginning of a procedure may vary in cases where the g or chk option is specified In include files that contain expressions in Fortran programs cannot be debugged If you want to set a break point in the main procedure which has no program state ment in a Fortran program the break point is set at the first executable statement or declare statement When in the Fortran program the continue statement has no instruction even if you want to set a break point at this statement the break point is set at the next executable statement Example integer i assign 10 10 continue i 1 A break point set at the continue statement will break at the next executable state ment i 1 10 The index name of the FORALL statement in a Fortran program cannot be debugged 11 In Fortran a name exceeding 2048 bytes cannot be displayed 12 In Fortran the value of floating point registers cannot be set Lahey Fujitsu Linux64 Fortran User s Guide Multi Processing PRO version only This chapter describes how to create parallelized Fortran programs using OpenMP The pro grammer can allow
163. rs Consider the following example Example X S T 2Y X U 3 Y xX U By default nap during compilation of statement 2 the compiler recognizes the value X is already in a register and does not cause the value to be reloaded from memory At statement 3 the value X may or may not already be in a register and so the value may or may not be reloaded accordingly Because the precision of the datum is greater in a register than in mem ory a difference in precision at statements 2 and 3 may occur Specify ap to choose the memory reference for non INTEGER operands that is registers are reloaded ap must be specified when testing for the equality of randomly generated values The default nap allows the compiler to take advantage of the current values in registers with possibly greater accuracy in low order bits Specifying ap will usually generate slower executables block blocksize Default I O block size Compile only Default 8 Mbytes Specify block to change the default block size on OPEN statements See BLOCKSIZE in the LF64 Language Reference blocksize must be a decimal INTEGER constant Specifying an optimal blocksize can make a significant improvement in the speed of your executable The program t ryblock 90 demonstrates how changing blocksize can affect execution speed Some experimentation with blocksize in your program is usually necessary to determine the optimal value This optimal value varies from o
164. s Guide Compiler and Linker Options Be sure that the environment variable PARALLEL is set to the specified number N at run time The executable program that is generated by specifying this option is always executed with N CPUs even if the program is moved to a machine with a different number of CPUs threads requires parallel g chk or chkglobal cause threads to be ignored threadheap size PRO version only Thread Heap Size Compile only Default 4096 bytes If the threadheap option is specified local arrays in a procedure or parallel region that are larger than size bytes are allocated on the heap except for the following arrays e equivalenced arrays e arrays that are namelist object e arrays of derived type that specify default initialization e arrays in common that have the PRIVATE attribute size must be a positive number less than 2147483648 If the size is omitted 4096 is selected for size Execution performance may degrade when threadheap is specified Use this option only when the required thread stack size exceeds 2048 bytes threadheap requires openmp or parallel g chk or chkglobal cause threadheap to be ignored threadstack n PRO version only Thread Stack Size Compile only Default the executable stack size threadstack sets the size of the stack for each thread to N kilobytes where N is between 16 and 2048 inclusive The maximum stack size for a Linux thread is
165. sing of runtime interrupts When the i option is specified the Fortran library is not used to process interrupts When the i option is not specified the Fortran library is used to process interrupts These interrupts are exponent overflow exponent under flow division check and integer overflow If runtime option i is specified no exception handling is taken The u option must not be combined with the i option Lahey Fujitsu Linux64 Fortran User s Guide 135 Appendix B Runtime Options 136 Example a out W1 i lerrlevel errlevel i w e s Diagnostic Reporting Level The 1 option lowercase L controls the output of diagnostic messages during execution The optional argument errlevel specifies the lowest error level i informational w warn ing e medium or s serious for which diagnostic messages are to be output If the 1 option is not specified diagnostic messages are output for error levels w e and s However messages beyond the print limit are not printed i The li option outputs diagnostic messages for all error levels w The lw option outputs diagnostic messages for error levels w e s and u e The le option outputs diagnostic messages for error levels e s and u sS The ls option outputs diagnostic messages for error levels s and u Example a out Wl le Lb Service routines use eight byte logicals instead of four byte logicals as arguments and func tion results Example
166. sion specified The CcI4I8 option causes variables constants and functions of type 4 byte INTEGER to be evaluated as eight byte integer This option applies to all 4 byte integers regardless of how they are declared This option is equivalent to specifying long If either the CcdII8 or the CcI4I8 options are specified the INT IFIX IDINT IQINT NINT IDNINT and IQNINT functions must not be used as actual arguments Logical promotion The CcdLL8 option causes variables constants and functions of type default LOGICAL to be evaluated as eight byte logical This option does not affect a variable or function that is declared with a kind or a constant with a kind or precision specified The CcL4L8 option causes variables constants and functions of type 4 byte LOGICAL to be evaluated as eight byte logical This option applies to all 4 byte logicals regardless of how they are declared If either the CcdLL8 or the CcL4L8 options are specified the BTEST function must not be used as an actual argument Single precision real and complex promotion The CcdRR8 option causes variables constants and functions of type default REAL and COMPLEX to be evaluated as double precision real or complex This option does not affect a variable or function that is declared with a kind or a constant with a kind or precision specified The CcR4R8 option causes variables constants and functions of type 4 byte single preci sion REAL or COMPLEX to b
167. splay the LF64 version number and a summary of valid command line options type lfc version help Driver Configuration File lfc fig 12 In addition to specifying options on the command line you may specify a default set of options in the 1fc fig file When the driver is invoked the options in the 1fc fig file are processed before those on the command line Command line options override those in the lfc fig file The driver searches for 1fc fig first in the current directory and then if not found in the directory in which the driver is located Lahey Fujitsu Linux64 Fortran User s Guide Command Files Command Files If you have too many options and files to fit on the command line you can place them in a command file Enter LF64 command line arguments in a command file in exactly the same manner as on the command line Command files may have as many lines as needed Lines beginning with an initial are comments To process a command file preface the name of the file with an character When LF64 encounters a filename that begins with on the command line it opens the file and processes the commands in it Example lfc mycmds In this example LF64 reads its commands from the file mycmds Command files may be used both with other command line options and other command files Command files may be nested Multiple command files are processed left to right in the order they are encountered on the command line In
168. ssing information 85 FLIB_SPINWAIT wait mode for waiting threads 86 FORTO9OL runtime options variable 132 FUnn pre connect file to unit 140 FUnnBF i o work area 141 IOINF specify information file name 137 OMP_DYNAMIC enable of disable dynamic thread adjustment 86 OMP_NESTED enable of dis able nested parallelism 86 OMP_NUM_THREADS set number of threads 86 OMP_SCHEDULE set schedule type and chunk size 87 PARALLEL active CPUs 87 THREAD_STACK_SIZE 87 TMPDIR 13 ERRATA 6 error limit runtime option e 135 error output runtime option m 137 errors compiler 16 extension procedures 33 Lahey Fujitsu Linux64 Fortran User s Guide 149 Index extensions 30 external procedure names 50 F f95 Fortran 95 conformance option 24 fast optimize for compiling machine 24 file formats direct 124 formatted sequential 124 transparent 124 unformatted sequential 124 file specify file option 24 FILELIST 6 filenames 10 mod extension 10 11 library file 11 object file 11 output file 11 preprocessor intermediate files 35 source file 10 files scratch temporary 126 ERRATA 6 fort nn default name 126 HDRSTRIP F90 122 lfc fig 12 README 6 SEQUNE F90 122 TRYBLK F90 122 fix fixed source form option 25 FLIB_FASTOMP environment variable 84 FLIB_IOBUFCPY environment variable 85 FLIB_IOBUFCPY_SIZE environ ment variable 85 FLIB_PARALLEL_INFO envi ronment variable 85 FLIB_SPINWAIT environment variable 86
169. string system procedures are checked in addition to those checked by the mem option Lahey Fujitsu Linux64 Fortran User s Guide Processes and Threads param leak Reports current level of leak checking show leak log error summary Displays memory leak information where the type of information displayed is as follows log Displays procedures being monitored in the order that they are called error Displays error messages summary Summary information only Processes and Threads ps pid Displays information about process id pid If pid is not specified then information is dis played for all process id s Restrictions 1 An adjustable array that is a dummy argument cannot be debugged if it appears at the beginning of a procedure or a function in a Fortran program Example subroutine sub x y i real x 5 i real y i 3 go WoW In this example adjustable arrays x and y cannot be debugged at the subroutine statement 2 The dummy argument of a main entry cannot be debugged at the sub entry in a For tran program Example subroutine sub a b entry ent b In this example the dummy argument b which is in the main entry s argument list but not in the sub entry s argument cannot be debugged at the sub entry ent How ever the dummy argument b which is passed to the sub entry ent can be debugged 3 Breakpoints cannot be set at any executable statements of an include file in Fortran p
170. t able program upon termination and exit These correspond to the levels of diagnostic output that may be set by various runtime options Table 12 Execution Return Values Return value Status 0 No error or level I information message 4 Level W error warning 8 Level E error medium 12 Level S error serious Limit exceeded for level W E S error or a level U a error Unrecoverable was detected 240 Abnormal termination Other Forcible termination Standard Input Output and Error The default unit numbers for standard input output and error output for LF64 executable programs are as follows and may be changed to different unit numbers by the appropriate runtime options Standard input Unit number 5 Standard output Unit number 6 Standard error output Unit number 0 Runtime Options Runtime options may be specified as arguments on the command line or in the FORT90L environment variable This section explains the format and functions of the runtime options Please note that all runtime options are case sensitive The runtime option format is as follows w1 option option Lahey Fujitsu Linux64 Fortran User s Guide 133 Appendix B_ Runtime Options 134 When runtime options are specified the string w1 where is lowercase L is required at the beginning of the options list and the options must be separated by commas No space is allowed after a comma If th
171. t allowed myarray 10 xhisarray Returning Function Values to C Fortran functions are called from C as functions returning a value with all arguments passed by reference Values are passed on the stack with the exception of COMPLEX and CHARAC TER data in which case the values are passed via the argument list The following table lists the data types that may be returned to C from a Fortran function In the third column of the table examples column the variable result represents the value returned by the Fortran function myfunc In the last example the variable strlen represents the length of the character value returned by myfunc Lahey Fujitsu Linux64 Fortran User s Guide 55 Chapter 3 Mixed Language Programming 56 This section does not discuss Fortran subroutines which are called from C as void func tions This concept is illustrated in a later section Passing and Receiving Arguments on page 58 Table 8 Declaring C Result Types for Fortran Function Types Fortran Function Type C Result Type Example INTEGER 1 signed char result myfunc_ INTEGER 2 short int result myfunc_ INTEGER 4 long int result myfunc_ INTEGER 8 long long int result myfunc_ OGICAL 1 unsigned char result myfunc_ OGICAL 2 sh
172. t language name decoration calling convention for all program units mldefault affects name mangling for routine names in ML_EXTERNAL statements Currently the only supported value for target is cdec1 which is needed for making calls to the system kernel See Mixed Language Programming on page 49 for more information M dir mod dirf diri dir2 Module Path Compile only Default current directory Specify M dir to instruct the compiler to search the specified directory for LF64 module moa files Multiple directories may be specified using the I option for each additional search directory The directory specified by M is searched first current working directory is searched next and the directories specified with I are searched last Specify mod dir to instruct the compiler to search the specified directory or directories for LF64 module files When using mod multiple directories may be specified using a colon separated list of directories If multiple directories are specified the first directory in the list is searched first the current working directory is searched next the remaining direc tories are then searched in order of appearance Lahey Fujitsu Linux64 Fortran User s Guide 31 Chapter 2 Developing with LF64 32 M and mod should not be used in combination on the same command line When compil ing procedures using modules the path to all modules that are used either directly or indire
173. t the compiler to generate an expanded symbol table and other informa tion for the debugger g automatically overrides any optimization or parallelization option and forces O0 nfast no optimizations so your executable will run more slowly than if opti mization were used g is required to use the debugger help Display Compiler Options and Syntax Compile or link Default not present Specifying this option alone on the command line will cause LF64 to print a summary of command line options and syntax to the standard output and then exit dir include dir dir1 dir2 Include Path Compile only Default current directory Specify I dir or include dir to instruct the compiler to search the specified directory ies for Fortran include files Multiple directories may be specified for include with a colon separated list of paths which will be searched in the order specified Note that I will also affect module searches see the Module Path option M dir on page 31 for directions on specifying module search paths The source file directory is always searched Lahey Fujitsu Linux64 Fortran User s Guide 25 Chapter 2 Developing with LF64 26 Example lfc demo f 90 include dir2 includes dir3 includes In this example the compiler first searches the source file directory then searches dir2 includes and finally dir3 includes for INCLUDE files specified in the source file demo 90
174. t variable 87 threadheap set thread heap size option 39 threads thread creation option 38 threadstack set thread stack size option 39 trace runtime error traceback option 39 transparent file format 125 trap trap numeric exceptions option 40 TRYBLK F90 122 U u runtime option 140 U undefine preprocessor name option 10 40 underflow 43 underflow interrupts runtime option u 140 unformatted sequential file format 124 Uninstalling LF64 5 unroll loop unrolling option 40 utility programs 121 Lahey Fujitsu Linux64 Fortran User s Guide 153 Index Vv v9xx standard conformance diagnostics options 40 varheap local variables on heap option 41 varstack allocate local variables on stack option 41 vax extensions 33 verbose verbose output option 41 version version info option 41 W Wa pass option to assembler option 12 42 warn warnings option 42 warranties 145 wide wide source format 42 Winteracter Starter Kit Reference 6 wisk Winteracter Starter Kit option 42 WI indicate runtime option 131 WI pass option to linker option 12 42 45 wo warn obsolescent option 42 Wp pass option to preprocessor option 12 42 X x runtime option 140 x inline code option 43 xref cross reference listing option 43 Y Y2K compliance 126 runtime option Ry 139 Z zfm zero flush mode for SSE instructions option 43 154 Lah
175. te both your pro gram and the dependency file In other cases you may wish to change the default compiler name or options add a special link command or change the INCLUDE file search rule this can be achieved by customizing a local copy of the AUTOMAKE configuration file More complex systems perhaps involv ing source code spread across several directories can also be handled in this way What Can Go Wrong Not much AUTOMAKE is very forgiving For example you can mix manual and AUTO MAKE controlled updates without any ill effects You can even delete the dependency file without causing more than a pause while AUTOMAKE regenerates the dependency data In fact this is the recommended procedure if you do manage to get into a knot Running AUTOMAKE To run AUTOMAKE simply type am If there is a configuration file AUTOMAKE FIG in the current directory AUTOMAKE reads it The AUTOMAKE Configuration File 112 The AUTOMAKE configuration file is used to specify the compile and link procedures and other details required by AUTOMAKE It consists of a series of records of the form keyword value or keyword where keyword is an alphanumeric keyword name and value is the string of characters assigned to the keyword The keyword name may be preceded by spaces if required Any record with a or as the first non blank character is treated as a comment The keywords that may be inserted in the configuration file are
176. termediate Files The LF64 driver and the components it controls may use temporary files for storing inter mediate results and passing them between components These files are automatically created in the default temporary directory using random names and then deleted This directory can be changed by specifying a value for the shell variable TMPDIR Lahey Fujitsu Linux64 Fortran User s Guide 13 Chapter 2 Developing with LF64 Return Codes from the Driver When the LF64 driver receives a failure return code it aborts the build process The driver will return an error code depending on the success of the invoked tools These return codes are listed below Table 2 Driver Return Codes Code Condition 0 Successful compilation and link 1 Compiler fatal error 2 Archive Utility error 3 Linker error 4 Driver error Shared Libraries Archive A shared library is a collection of procedures packaged together in a library that is loaded at runtime On Unix systems such libraries have been traditionally referred to as shared librar ies or shared archives The term DLL Dynamic Link Library was coined as a name for the Microsoft Windows implementation of shared libraries This manual uses the term shared library rather than DLL even though the two can be considered as interchange able A shared library cannot run on its own the functions and subroutines in a shared library
177. the compiler to completely control parallelization can direct the parallelization process with optimization control lines OCLs may exert complete control over the parallelization process by use of OpenMP directives or use a combination of these processes Overview of Multi Processing In this document multi processing means that one program is executed on two or more CPUs that can work independently and simultaneously As used here it does not mean executing two or more programs simultaneously Consider the following code do i 1 50000 a i b i c i end do Different iterations of the DO loop are executed on different CPUs at the same time CPU 1 do il 1 25000 a il b il c il end do CPU 2 do i2 25001 50000 a i2 b i2 c i2 end do Lahey Fujitsu Linux64 Fortran User s Guide 83 Chapter 5 Multi Processing PRO version only 84 Creating Parallelized Programs Compiler options for automatic parallelization To instruct the compiler to automate the parallelization process use the parallel com piler option If there are optimization control lines OCLs embedded in the code use the oc1 option to instruct the compiler to apply them OCLs will be ignored if the ocl option is absent See Optimization Control Line on page 94 for details on OCLs When automatic parallelization is applied the number of execution threads can be fixed at compile time using the threads option or the user
178. the complete error message is always an option you can save extensive messages to a text file to send to us e Exact text of error message Support is provided free to solve problems with our products and to answer questions on how to use Lahey products Support personnel are not available to teach programming debug pro grams or answer questions about the use of non Lahey products or tools such as MS Windows Linux Visual Basic etc These services are provided on a paid consulting basis Lahey Warranties Lahey s 30 Day Money Back Guarantee Lahey agrees to unconditionally refund to the purchaser the entire purchase price of the prod uct including shipping charges up to a maximum of 10 00 within 30 days of the original purchase date All refunds require a Lahey Returned Materials Authorization RMA number Lahey must receive the returned product within 15 days of assigning you an RMA number If you pur chased your Lahey product through a software dealer the return must be negotiated through that dealer Lahey s Extended Warranty Lahey agrees to refund to the purchaser the entire purchase price of the product excluding shipping at any time subject to the conditions stated below All refunds require a Lahey Returned Materials Authorization RMA number Lahey must receive the returned product in good condition within 15 days of assigning you an RMA number You may return an LF64 Language System if e Itis determin
179. ther files created with the Lahey software I no longer have in my possession any copies of the returned files or documentation Any violation of this agreement will bring legal action governed by the laws of the State of Nevada Signature Print Name Company Name Address Telephone Product Version Serial RMA Number Refund Check Payable To 146 Lahey Fujitsu Linux64 Fortran User s Guide Return Procedure Return Shipping Instructions If you received your Lahey product on physical media you must package the software with any hardcopy manuals received and write the RMA number on the outside of the shipping carton Shipping charges incurred will not be reimbursed Ship to Lahey Computer Systems Inc 865 Tahoe Blvd Suite 208 P O Box 6091 Incline Village NV 89450 6091 U S A Lahey Fujitsu Linux64 Fortran User s Guide 147 Appendix C Lahey Technical Support 148 Lahey Fujitsu Linux64 Fortran User s Guide Index Symbols 43 A a runtime option 134 AA disable alignment option 17 abnormal termination forced runt ime option a 134 Alignment 17 ap option arithmetic precision 18 ar archive utility 9 assembler 42 assembly 37 AU case sensitive option 17 AUTOMAKE 111 CHECK 117 COMPILE 113 DEBUG 117 FILES 112 LATESCAN 117 LF90 112 LINK 115 MAKEMAKE 117 NOQUITONERROR 117 OBJDIR 116 OBJEXT 116 QUITONERROR 116 SYSINCLUDE 116 TARGET 114 automatic arrays
180. tines Specifying nsav may sometimes require more program stack n shared Create Shared Library Compile and link Default nshared When shared is specified in the compile phase it causes position independant code PIC to be generated Specify shared in the link phase to create a shared library rather than an archive static library for more information see Shared Libraries on page 14 njsse 2 3 Optimize using streaming SIMD extensions Compile only Default no SIMD optimizations Specify sse2 to optimize code using level 2 streaming SIMD Single Instruction Multiple Data extensions Specify sse3 to optimize code using level 3 streaming SIMD extensions Use of either SSE option forces the zfm option This behavior can be overridden by speci fying nzfm Lahey Fujitsu Linux64 Fortran User s Guide 37 Chapter 2 Developing with LF64 38 SSL2 PRO version only Link with BLAS LAPACK and SSL II libraries Link only Default do not link with libraries Specify SSL2 to link with procedures from the BLAS LAPACK and SSL II math libraries static Static System Runtime Libraries Link only Default not present Specify static to create an executable linked only with static versions of libraries This is a GNU linker option For more information see the man or info pages for ld the GNU linker n staticlink Static Fortran Runtime Libraries Link only Default nstaticlink Specify
181. ting filename sval specifies the listing filename to use instead of the default If a file with this name already exists it is overwritten If the user specifies a listing filename and more than one source file then the driver diagnoses the error and aborts For i sval sval is one of the characters of the set YyNn where y and y indicate that include files should be included in the listing and N and n indicate that they should not By default include files are not included in the listing Example lfc myprog f90 lst i y creates the listing file myprog Ist and lists the include files Lahey Fujitsu Linux64 Fortran User s Guide Compiler and Linker Options See also n xref n maxfatals n Maximum Number of Fatal Errors Compile only Default maxfatals 50 Specify maxfatals to limit the number of fatal errors LF64 will generate before aborting M target Mixed Language Compile only Default not present The ml option is sometimes needed if your code calls or is called by code written in another language The value of target will only affect procedures declared with the ML_EXTERNAL statement Currently the only supported value for target is cdecl which is needed for making calls to the system kernel See Mixed Language Programming on page 49 for more information mlidefault target Mixed Language Default Compile only Default midefault Specify the mldefault options to set the default targe
182. tsu Linux64 Fortran User s Guide 141 Appendix B Runtime Options 142 Lahey Fujitsu Linux64 Fortran User s Guide Lahey Computer Systems takes pride in the relationships we have with our customers We maintain these relationships by providing quality technical support an informative website newsletters product brochures and new release announcements In addition we listen care fully to your comments and suggestions The World Wide Web site has product patch files new Lahey product announcements lists of Lahey compatible software vendors and infor mation about downloading other Fortran related software We Have Several Ways for You to Communicate with Us e E MAIL support lahey com e FAX 775 831 8123 e ADDRESS 865 Tahoe Blvd P O Box 6091 Incline Village NV 89450 6091 U S A e WEB http www lahey com Technical Support Services Lahey provides free technical support on current product releases to registered users Free support will continue to be available for previous versions of a product for 60 days after the release of a newer version This support includes assistance in the use of our software and in investigating bug reports It does not include tutoring in how to program in Fortran or how to use any host operating system How Lahey Fixes Bugs Lahey s technical support goal is to make sure you can create working executables using Lahey Fortran Towards this end Lahey maintains a bug reporting and pri
183. tsy 121 hdrstrip f90 oo eee eeceseeseeeeecreeseeeseeeaes 122 Sequnt f90 nena ie se anne 122 tEVDIKL9O enpi oeseri seisseen 122 ii Lahey Fujitsu Linux64 Fortran User s Guide Programming Hints 0ccsssseeeeeee 123 Efficiency Considerations 0 0 0 123 Side Effects casseria ohteni aa ea 123 Fil Form tg eeneioe na ness 124 Formatted Sequential File Format 124 Unformatted Sequential File Format 124 Direct File Format Formatted 125 Direct File Format Unformatted 125 Binary File Format ee eee 125 Endfile Records ceeceesseceeeecseeeeeeeeees 125 Porting Unformatted Files 0 0 125 File Creation Default Names 00 126 Tank Times peers nietin 126 Year 2000 compliance eee eee 126 Limits of Operation eee eeeeeeeseeeeee 128 Runtime Options cccseseseeeeesees 131 Command Format esceeecesseeesteceeeeeees 131 Environment Variables cesceeeeesseeeeees 132 Runtime Configuration File jwe_prof 132 Execution Return Values eeeeseeeeees 133 Standard Input Output and Error 133 Runtime Options 0 0 cece eeeeeeeeseeeeeeees 133 Descriptions of Runtime Options 134 Environment Variables for Input Output 140 Lahey Technical Suppott 5 143 Technical Support Services eee 143 How Lahey Fixes Bugs 143 Contacting Lahey eee ee eeeeeeeeeee 144 Information Y
184. tures are supported and are on by default Number of Threads The number of threads for OpenMP is decided with the following priority 1 OMP_SET_NUM_THREADS service routine 2 Environment variable OMP_NUM_THREADS 3 Environment variable PARALLEL 4 One thread Scheduling If the schedule type for DO and PARALLEL DO directives is not specified by the SCHED ULE clause or the OMP_SCHEDULE environment variable it defaults to STATIC ASSIGN and Assigned GO TO Statements An ASSIGN statement within an OpenMP block cannot refer to a statement label that is out side of the OpenMP directive block Also a statement label in an OpenMP directive block cannot be referred to by an ASSIGN statement that is outside of the OpenMP directive block Jumping into or out of a directive block area using an assigned GO TO statement is not supported Additional Functions and Operators in ATOMIC directive and REDUCTION Clause The following intrinsic functions and operators can be specified in an ATOMIC directive or REDUCTION clause Intrinsic functions AND OR Operators XOR EOR Lahey Fujitsu Linux64 Fortran User s Guide 107 Chapter 5 Multi Processing PRO version only FORALL construct In a FORALL construct OpenMP directives cannot be used THREADPRIVATE When using the THREADPRIVATE directive a given common block must be defined the same in all program units A common block specified as THREADPRIVATE cannot have its size exte
185. vice STDIN during execution where unit is an integer ranging from 0 to 2147483647 If the r option is omitted unit number 5 the system default is connected to the standard input file Care should be taken to avoid conflict with units specified by m and p options Also see Environment Variables for Input Output on page 140 for further details Example a out W1 r10 Re Runtime Error Handling Disables the runtime error handler Traceback error summaries user control of errors by ser vice routines ERRSET and ERRSAV and execution of user code for error correction are suppressed If possible the standard correction will be performed when an error occurs Example a out W1 Re Rm filename Runtime Diagnostic Output to File The Rm option saves the following output items to the file specified by the filename argument e Messages issued by PAUSE or STOP statements e Runtime library diagnostic messages e Traceback map e Error summary Example a out W1 Rm errors txt Ry Y2K Year 2000 Compliance Diagnostics Encourages Y2K compliance at runtime by generating an i level information diagnostic whenever code is encountered which may cause problems after the year 2000 A D Must be used in conjunction with the 1i option in order to view diagnostic output Example a out W1 Ry li T or T unit Big endian Data Conversion Big endian data integer logical and IEEE floating point is tr
186. you can compile link and execute with LF64 It converts LF90 direct access files to LF64 style sequnf f90 sequnf 90 is a Fortran source file that you can compile link and execute with LF64 It converts LF90 unformatted sequential files to LF64 style tryblk f90 tryblk 90 is a Fortran source file you can build with LF64 It tries a range of BLOCK SIZEs and displays an elapsed time for each You can use the results to determine an optimum value for your system to specify in your programs Note that a particular BLOCK SIZE may not perform as well on other systems Lahey Fujitsu Linux64 Fortran User s Guide QO Programming Hints This appendix contains information that may help you create better LF64 programs Efficiency Considerations In the majority of cases the most efficient solution to a programming problem is one that is straightforward and natural It is seldom worth sacrificing clarity or elegance to make a pro gram more efficient The following observations which may not apply to other implementations should be con sidered in cases where program efficiency is critical e One dimensional arrays are more efficient than two two are more efficient than three etc e Make a direct file record length a power of two e Unformatted input output is faster for numbers e Formatted CHARACTER input output is faster using CHARAC than CHARAC Side Effects ER 256 C ER 1 C 256 L

Download Pdf Manuals

image

Related Search

Related Contents

User Manual - Enhancing Accessibility for FOSS Desktops  Toshiba Satellite C55-A5126  1 芯双方向 WDM FO ポートデュアルレイトメディアコンバータ 取扱説明書  Pioneer PDA-5003 User's Manual  "取扱説明書"  Indesit DIS 04  Whirlpool ET8GTKXKT02 User's Manual  はじめに 取扱説明書 インターフェースコンバータ  Xenoblade Chronicles 3D 1 Informations importantes Informations  Philips DC291  

Copyright © All rights reserved.
Failed to retrieve file