Home

Intel(R) Fortran Compiler for Linux* User's Guide Vol I

image

Contents

1. Reference Information FORT BUFFERED Lets you request that buffered I O should be used at run time for output of all Fortran I O units except those with output to the terminal This provides a run time mechanism to support the assume buffered io compiler option FORT_CONVERTn Lets you specify the data format for an unformatted file associated with a particular unit number n See Methods of Specifying the Data Format Overview and Environment Variable FORT CONVERTn Method FORT_CONVERT ext and FORT_CONVERT_ext Lets you specify the data format for unformatted files with a particular file extension suffix ext See Methods of Specifying the Data Format Overview and Environment Variable FORT _CONVERT ext or FORT_CONVERT_ext Method FORTn Lets you specify the file name for a particular unit number n when a file name is not specified in the OPEN statement or an implicit OPEN is used and the compiler option fpscomp filesfromcmd was not specified Preconnected files attached to units 0 5 and 6 are by default associated with system standard I O files NLSPATH The path for the Intel Fortran run time error message catalog TBK_ENABLE_VERBOSE_STACK_TRACE This variable displays more detailed call stack information in the event of an error The default brief output is usually sufficient to determine where an error occurred Brief outp
2. Filename Interpretation Action filename a Object library Passed to 1d filename f Fortran fixed Compiled by the Intel Fortran filename ftn form source compiler filename for filename i filename fpp Fortran fixed Must be preprocessed by the Intel filename F form source Fortran preprocessor fpp before l being compiled by the Intel Fortran filename FOR compiler filename FTN PIER filename FPP filename F90 Fortran free form Must be preprocessed by the Intel source Fortran preprocessor fpp before being compiled by the Intel Fortran compiler filename f90 Fortran free form Compiled by the Intel Fortran compiler filename i90 source filename s Assembly file Passed to the assembler IA 32 compiler or the Intel Itanium assembler Itanium based compiler filename o Compiled object Passed to 1d file You can use the compiler configuration file to specify default directories for input libraries To specify additional directories for input files temporary files libraries and for the files used by the assembler and the linker use compiler options that specify output file and directory names File Specifications A complete file specification consists of a file name optionally preceded by a pathname that specifies a directory The pathname can be in one of two forms e An absolute pathname where the directory is specified relative to the root directory The first characte
3. 77 i386 preprocessor symbol 38 IA64 preprocessor symbol 38 jas assembler 20 22 jas lle ES GE De neren 252 IBM keyword iese ee ee ee 141 icrt internal map file 242 icrt link le vu 242 idb debugger See debugging ese sesse 107 IEEE S_ floating format 141 IEEE T_ floating format 141 IEEE X floating format 141 ENG ES eed ce Se EE 252 ifc cfg file eke RE Ee ee 252 ifcore msg cat file iss see 242 ifort command examples Of ese ee 30 SY MAK AA drekk 29 using multiple esse ee ee 49 291 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I HOE TG RE EE 252 OM EIE Weer Rene ae EE 28 ifort cfg l Ee RE tye 35 252 ifortbin file ER EG news 252 IFORTCFG environment variable 28 35 249 ifortyars del esse ee ER ar 28 ifortvars csh file esse ese 28 252 HONVAKS SU N OE ui one 28 ifortvars sh file 28 252 ifportlib a library ooonnnrnnnnnrr 243 implicitnone compiler option 79 implied OPEN esse 164 167 include files searching TOR RR eb ge 34 indirect command files See response files 35 information retrieval routines 244 inline debug info compiler option 79 input and output routines 244 input files Se N eneee 23 input record transfer iese 179 INQUIRE statement 156 171 inquiry by file name
4. 0 0 52 NLSPATH environment variable 231 249 no_cpprt compiler option 77 noalign compiler option 62 296 noauto compiler option 62 noautomatic compiler option 62 nobss_init compiler option 79 NODECLARE compiler directive 51 nodefaultlibs compiler option 77 nofor_main compiler option 79 227 NOFREEFORM compiler directive 51 noinclude compiler option 79 nolib_inline compiler option 86 nomixed_str_len_arg compiler Option PET 68 199 223 nonadvancing VO see 178 nonadvancing record VO 178 nonnative data PONG Eee 154 nosave compiler option 62 nostartfiles compiler option 79 nostdinc compiler option 79 nostdlib complier option 77 NOSTRICT compiler directive 51 notation conventions 17 Nso assembler option 22 numeric conversion limitations Of ee 145 numeric data types handling a ss ceases 215 numeric formats NAG EE EE SR SE ai 141 NONMAUVE te 141 numeric values and conversion FOULINGS see GEKEER RE N 244 nus compiler option ssxxrnnne 68 O O compiler option 86 99 obtaining file information See INQUIRE statement 171 octal conversions ee ee 254 onetrip compiler option 52 OPEN MAE 164 OPEN statement
5. af a b res UTES C PYTHAGORAS UTES REFERENCE res float c RENCE because its individual attribute ne s C attribute F attribute by default because C attribute 229 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I END MODULE The Fortran code to call this routine using the module CPROG Fortran 95 90 Module including procedure USE CPROC CALL PYTHAGORAS 3 0 4 0 X TYPE X END Calling C Procedures from an Intel Fortran Program Naming Conventions By default the Fortran compiler converts function and subprogram names to upper case The C compiler never performs case conversion C procedure called from a Fortran program must therefore be named using the appropriate case For example consider the following calls CALL PROCNAME The C procedure must be named PROCNAME X FNNAME The C procedure must be named FNNAME In the first call any value returned by PROCNAME is ignored In the second call to a function FNNAME must return a value Passing Arguments Between Fortran and C Procedures By default Fortran subprograms pass arguments by reference that is they pass a pointer to each actual argument rather than the value of the argument C programs however pass arguments by value Consider the following e When a Fortran program calls a C function the C function s formal arguments must be declared as pointers to the appropriate data t
6. 006 171 292 inquiry by output item list 171 inquiry by URE caves ttre 171 installing shared libraries eeeee 43 INTEGER compiler directive 51 integer data representation INTEGER KIND 1 132 INTEGER KIND 2 132 INTEGER KIND 4 132 INTEGER KIND 8 132 OVEIVIOW ee ee eee ee ee 131 integer pointer ese 117 218 INTEGER IKIND 8 data representatiON ees sesse 132 INTEGER KIND 1 data representatiON iese ees see 132 INTEGER KIND 2 data representatiON iese ees see 132 INTEGER KIND 4 data representatiON ies sees see 132 integer size compiler option 62 INTERFACE an 217 INTERFACE statement 206 internal Miles EE RS 160 intrinsic data tyDeS iese ee 129 IOSTAT specifier 1onnnnnnnnn 235 ip compiler option 86 ip_no_inlining compiler option 86 ip no pinlining compiler option 86 IPF fit eval method0 compiler pal os RO EE IN AT TEN 69 IPF fltacc compiler option 69 IPF fma compiler option 69 IPF fp relaxed compiler option 69 IPF fp speculation compiler option EE EE 69 ipo n compiler option 86 ipo_c compiler option 86 ipo_obj compiler option 86 ipo_S compiler option 86 ipo separate compiler option 86
7. REAL KIND 4 IEEE S floating COMPLEX KIND 4 REAL KIND 8 IEEE T floating COMPLEX KIND 8 REAL KIND 16 IEEE X floating COMPLEX KIND 16 If your program needs to read or write unformatted data files containing a floating point format that differs from the format in memory for that data size you can request that the unformatted data be converted Data storage in different computers uses a convention of either little endian or big endian storage The storage convention generally applies to numeric values that span multiple bytes as follows Little endian storage occurs when O O O The least significant bit LSB value is in the byte with the lowest address The most significant bit MSB value is in the byte with the highest address The address of the numeric value is the byte containing the LSB Subsequent bytes with higher addresses contain more significant bits Big endian storage occurs when O O O The least significant bit LSB value is in the byte with the highest address The most significant bit MSB value is in the byte with the lowest address The address of the numeric value is the byte containing the MSB Subsequent bytes with higher addresses contain less significant bits The following figure shows the difference between the two byte ordering schemes Little and Big Endian Storage of an INTEGER Value 142 Data and VO M L 2 5 E E Byte Order 2
8. oonnnnnnnn 241 SE dei OE es 242 crtxn o file SR EE eae rere 242 cxxlib icc compiler option 77 D D compiler option 00 101 d lines compiler option 74 data unaligned 10 55 EE ET EG 126 data alignment compiler options for 4 62 data format specifying compiler option convert method N 153 environment variable F UFMTENDIAN method 149 environment variable FORT CONVERT ext method AE NER EN AEE 148 environment variable FORT CONVERT ed method ee ee 148 environment variable FORT CONVERTn method ME ER OO ON 147 OPEN statement CONVERT method ee 152 OPTIONS statement method152 speellyings ss SEE 145 data Options ee ee ee ee Re 62 data prefetching iese ee 19 data representation character ee 140 COMPLEX ee 136 GOMPLEX TG ss Re sees 137 GOMPLEX A ee Gr geskiede GOMPLE 8 ees Wee gs ie COMPLEX KIND 16 COMPLEX KIND 4 COMPLEX KIND 8 COMPLEX1G esse sesse ee GOMPLEX 32 ee de van se dees GOMPLE Bi ee de Des DOUBLE COMPLEX DOUBLE PRECISION EXTENDED PRECISION Hollemtha sarte een eee MEE EEE LOGICAL EEE native IEEE floating point representation iese OVETVIEW EE ee ee REAL KIND 16 ie sie REAL KIND 4 ees esse se ee REAL KIND 8 Sies penis se datdstorade saa data type converting unformatted files 281 Intel amp For
9. 169 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e STATUS or TYPE indicates whether to create a new file overwrite an existing file open an existing file or use a scratch file e STATUS or DISPOSE specifies the file existence status after CLOSE Specifiers for File and Record Characteristics These specifiers identify file and record characteristics e ORGANIZATION indicates the file organization Sequential or relative e RECORDTYPE indicates which record type to use e FORM indicates whether records are formatted or unformatted e CARRIAGECONTROL indicates the terminal control type e RECL or RECORDSIZE specifies the record size Specifier for Special File Open Routine USEROPEN names the routine that will open the file to establish special context that changes the effect of subsequent Intel Fortran VO statements Specifiers for File Access Processing and Position These specifiers identify file access processing and position e ACCESS indicates the access mode direct or sequential e SHARED indicates that other users can access the same file and activates record locking Ignored in the current version of Intel Fortran e POSITION indicates whether to position the file at the beginning of file before the end of file record or leave it as is unchanged e ACTION or READONLY indicates whether statements will be used to only read records only write records or both read and write records e MAX
10. A 4 A 4 END IIG subprogram void Ptr Sub float p pIa 23 57 On Itanium based systems the declaration for p in the INTERFACE block should be INTEGER 8 p When the main Fortran program and C function are built and executed the following output appears A 4 23 50000 Receiving Pointers 218 Programming with Mixed Languages When receiving a pointer from a routine written in another language e The argument should be declared in the non Fortran routine as a pointer of the appropriate data type and passed as usual e The argument received by the Fortran routine should be declared as an integer pointer name and the POINTER statement should associate it with a pointee of the appropriate data type matching the data type of the passing routine When inside the Fortran routine use the pointee to set and access what the pointer points to For example Fortran subroutine SUBROUTINE Iptr_Sub p IDECS ATTRIBUTES C ALIAS Iptr_Sub Iptr Sub nteger VAR 10 OINTER p VAR D PEN 8 FILE STAT DAT EAD 8 VAR 4 Read from file and store the fourth element of VAR DOuUr END SUBROUTINE Iptr_Sub C main program extern void Iptr_Sub int p main void int a 10 Iptr_Sub amp a 0 printf a 3 i n a 3 When the main C program and Fortran subroutine are built and executed the following output appears if the STAT DAT f
11. At8 The limits and underflow characteristics for REAL 8 apply to the two separate real and imaginary parts of a COMPLEX 8 number Like REAL 8 numbers the sign bit representation is 0 zero for positive numbers and 1 for negative numbers COMPLEX KIND 16 Representation COMPLEX 16 same as COMPLEX KIND 16 or COMPLEX 32 data is 32 contiguous bytes containing a pair of REAL 16 values stored in IEEE style X_floating format The low order 16 bytes contain REAL 16 data that represents the real part of the complex data The high order 16 bytes contain REAL 8 data that represents the imaginary part of the complex data as shown below 127 126 112 111 0 REAL I EXPONENT FRACTION A PART G MAGINARY I EXPONENT FRACTION A 16 PART G LJ 06690 The limits and underflow characteristics for REAL 16 apply to the two separate real and imaginary parts of a COMPLEX 16 number Like REAL 16 numbers the sign bit representation is 0 zero for positive numbers and 1 for negative numbers 137 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I File fordef for and Its Usage The parameter file opt intel_fc_80 include fordef for contains symbols and INTEGER 4 values corresponding to the classes of floating point representations Some of these classes are exceptional ones such as bit patterns that represent positive denormalized numbers With this file of symbols and with the FP_CLASS intrinsic function y
12. assume byterecl compiler option 62 assume cc omp compiler option 79 assume dummy aliases compiler OPUN RR ER 62 assume minus0 compiler option 69 assume none compiler option 79 assume protect constants compiler 8 og 0 PRE EE ER 62 assume source include compiler OB HOMES EE EE 101 assume underscore compiler option REG AE AN OG 68 ATTRIBUTES properties and mixed language programming EE TE MEE 199 effect on character strings 223 ATTRIBUTES properties 205 217 auto compiler option xxxx0 62 auto ilp32 compiler option 86 auto scalar compiler option 62 automatic compiler option 62 automatic vectorizer rrre0en 19 ax compiler option srnnnnrnrre 86 B BACKSPACE statement 156 174 DASH profile ESE N NE 28 bash profile file see ee 28 big endian storage sesse 141 BIG ENDIAN keyword 141 binary conversions esse 254 breakpoints SOWING ER n es 109 breakpoints esse ee Ee 109 building applications SEE WE RR LES DEE 27 by reference argument passing 207 by value argument passing 207 C c output files compiler option 99 C property eee 199 205 C run time compiler option 103 C source files COMPING N OE nenene 30 C structures using in mixed language DrOOramMMING sesse ese ee 209 C variables using in mixed language progr
13. iese 252 command line output Ke elle dale EE ts 40 commands debugger expressions IN ees 124 summary O ede see 111 debuggeruanssrassdene 109 common block variable 117 common blocks allOCalING sensei twenties 46 passing the address 0f 209 using in mixed language programming 209 common external data structures 209 common_args compiler option 62 compatibility with Microsoft Fortran PowerStation rrrrrnnnnnnn 190 compatibility OptionS 0 52 compatibility with previous versions E EA AE ine 255 compilation diagnostics options 57 compilation phases sxxrnnn 20 compilation process PEN tol EERS eases etn a8 27 compiler COMPONENMIS Of Ee es 13 default behavior O esse 23 VORIGE ER ESE Se 29 oe 19 0 sa neies 1 compiler directives rrrrrrnnnrrr 51 compiler Ims uante 253 compiler option convert method 153 compiler options code generation cccc 51 compatibility oorrnnnnnnnnnnnnr 52 compilation diagnostics 57 0 gt LE EEE ok 62 details EER GR 49 external procedures sees 68 gettind help EE ESE Ek 49 raleld ei EE 74 libraries ee nine 77 miscellaneous rsnnnnnnnnnnnnr 79 opiimizatonsasavrvessesdendt 86 output TES Trana arkene 99 OVEIVIGW ende 49 DreprOCESSOF esse ee es 101 rUN IME esse ee dee ee ee ee 103 SPES OER EE ES Se ERA Ee EK ERG
14. 2 146 Check for an environment variable FORT_CONVERTn for the specified unit number applies to any file opened on a particular unit Check for an environment variable FORT CONVERT ext is checked before FORT CONVERT ex for the specified file name extension applies to all files opened with the specified file name extension Check for an environment variable F UFMTENDIAN for the specified unit number or for all units Check the OPEN statement CONVERT qualifier Check whether an OPTIONS statement with a CONVERT keyword qualifier was present when the program was compiled Check whether the compiler option convert keyword was present when the program was compiled Data and VO Environment Variable FORT CONVERTn Method You can use this method to specify a non native numeric format for each specified unit number You specify the numeric format at run time by setting the appropriate environment variable before an implicit or explicit OPEN to that unit number When the appropriate environment variable is set when you open the file the environment variable is always used because this method takes precedence over the other methods For instance you might use this method to specify that a unit number will use a particular format instead of the format specified in the program perhaps for a one time file conversion For example assume you have a previously compiled program that reads numeric data from unit 2
15. INTEGER 1 char INTEGER 2 short INTEGER 4 int long INTEGER 8 _int 4 REAL 4 float REAL 8 double REAL 16 CHARACTER 1 unsigned char CHARACTER See Handling Character Strings COMPLE X 4 struct complex4 float real imag li COMPLE X 8 struct complex8 double real imag li COMPLEX 16 Er All LOGICAL types Use integer types for C See these topics Handling Numeric Complex and Logical Data Types Handling Fortran Array Pointers and Allocatable Arrays 214 Programming with Mixed Languages Handling Intel Fortran Pointers Handling Arrays and Fortran Array Descriptors Handling Character Strings Handling User Defined Types Handling Numeric Complex and Logical Data Types Normally passing numeric data does not present a problem If a C program passes an unsigned data type to a Fortran routine the routine can accept the argument as the equivalent signed data type but you should be careful that the range of the signed type is not exceeded The table of Equivalent Data Types summarizes equivalent numeric data types for Fortran and C C C and C do not directly implement the Fortran types COMPLE X 4 COMPLE X 8 and COMPLEX 16 However you can write structures that are equivalent The type COMPLEX 4 has two fields both of which are 4 byte floating point numbers the first contains the real number component and the second contains the imaginary number compone
16. Intel amp Fortran Compiler for Linux Systems User s Guide Vol I vms compiler option 2 52 WwW w90 compiler option 0 57 w95 compiler option 0 57 warn compiler option 57 what compiler option 79 WI compiler option 00 79 Wp compiler option 101 WRITE statement ADVANCE specifier 178 WRITE statement 156 157 164 174 306 X x compiler OPHON ee 79 86 MUA TNS ccs EE E EEE 252 Xilda TG aid DE GR ad 252 Xlinker option ees ee ee ee 79 Y y compiler OPHON ese ee 79 Z zero compiler option 0 62 Zp compiler option 62
17. Intel Fortran Compiler for Linux Systems User s Guide Volume I Building Applications Document Number 253259 002 Disclaimer and Legal Information Information in this document is provided in connection with Intel products No license express or implied by estoppel or otherwise to any intellectual property rights is granted by this document EXCEPT AS PROVIDED IN INTEL S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE MERCHANTABILITY OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT Intel products are not intended for use in medical life saving or life sustaining applications This Intel amp Fortran Compiler for Linux Systems User s Guide Volume I Building Applications as well as the software described in it is furnished under license and may only be used or copied in accordance with the terms of the license The information in this manual is furnished for informational use only is subject to change without notice and should not be construed as a commitment by Intel Corporation Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this document or any software that may be provided in association with this document Designers must
18. NONE and contain character or binary data that is read or written only to the extent of the variables specified on the input or output statement The figure below shows the layout of a Stream file E User Data 0 F 2K 9522 GE Stream_CR and Stream_LF Records A Stream CR or Stream_LF record is a variable length record whose length is indicated by explicit record terminators embedded in the data not by a count These terminators are automatically added when you write records to a stream type file and are removed when you read records Each variety uses a different 1 byte record terminator e Stream CR files use only a carriage return as the terminator so Stream_CR files must not contain embedded carriage return characters 189 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e Stream LF files use only a line feed new line as the terminator so Stream LF files must not contain embedded line feed new line characters This is the usual operating system text file record type The figure below shows the layout of Stream CR and Stream LF records ee E Record length REC Lewalue y 1 2K 9825 GE Microsoft Fortran PowerStation Compatible Files When using the fpscomp options for Microsoft Fortran PowerStation compatibility the following types of files are possible Formatted Sequential Formatted Direct Unformatted Sequential Unformatted Direct For
19. No Len String 1 1 For string arguments the length of the string is not available to the called procedure For string arguments the first character is converted to INTEGER 4 as in ICHAR string 1 1 and pushed on the stack by value Error Produces a compiler error Descriptor Size dependent On IA 32 systems the 4 byte address of the array descriptor On Itanium based systems the 8 byte address of the array descriptor On IA 32 systems derived type arguments specified by value are passed as follows e Arguments from 1 to 4 bytes are passed by value e Arguments from 5 to 8 bytes are passed by value in two registers two arguments e Arniiments more than amp hvtes nrovide valie emantirs hv 201 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I passing a temporary storage address by reference The following table shows another Fortran ATTRIBUTES property that matches another language calling convention Other Language Calling Matching ATTRIBUTES Property Convention C C cdecl default C The ALIAS property can be used with any other Fortran calling convention property to preserve mixed case names You can also use the DECORATE property in combination with the ALIAS property to specify that the external name specified in ALIAS should have the correct prefix and postfix decorations for the calling mechanism in effect Adjusting Naming
20. See these topics Logical VO Units Types of I O Statements Forms of VO Statements 154 Data and VO Files and File Characteristics Overview Accessing and Assigning Files Default Pathnames and File Names Using Preconnected Standard VO Files Opening Files OPEN Statement Obtaining File Information INQUIRE Statement Closing a File CLOSE Statement Record Operations Overview User Supplied OPEN Procedures USEROPEN Specifier Format of Record Types Microsoft Fortran PowerStation Compatible Files Logical I O Units In Intel Fortran a logical unit is a channel through which data transfer occurs between the program and a device or file You identify each logical unit with a logical unit number which can be any nonnegative integer from 0 to a maximum value of 2 147 483 647 2 31 1 For example READ 2 100 I X Y This READ statement specifies that data is to be entered from the device or file corresponding to logical unit 2 in the format specified by the FORMAT statement labeled 100 When opening a file use the UNIT specifier to indicate the unit number Fortran programs are inherently device independent The association between the logical unit number and the physical file can occur at run time Instead of changing the logical unit numbers specified in the source program you can change this association at run time to match the needs of the program and the available resources For example before running t
21. Specifying Alternative Tool Locations and Options Predefined Preprocessor Symbols Redirecting Command Line Output to Files Creating Running and Debugging an Executable Program Creating Shared Libraries Allocating Common Blocks Controlling the Compilation Process To customize the environment used during compilation you can specify variables options and files as follows e Environment variables to specify paths where the compiler searches for special files such as libraries and include files e Configuration files to specify the options used for every compilation and response files to specify the options and files used for individual projects 27 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Setting and Viewing Environment Variables You can use the SET command to view or set environment variables one at a time You can also set environment variables by using the ifortvars csh and ifortvars sh files to set several at a time The files are found in this directory opt intel fc 80 bin See Running the Shell Script to Set Up the Environment Variables within the C Shell use the setenv command to set an environment variable setenv FORT8 usr users smith test dat To remove the association of an environment variable and its value within the C shell use the unsetenv command unsetenv FORTS8 Within the Bourne shell sh the Korn shell ksh and the bash shell use the export command and assignment
22. To use the ALIAS option place the name in quotation marks exactly as it is to appear in the o file The following is an example for referring to the C function My_Proc IDECS ATTRIBUTES ALIAS My Proc My Proc Programming with Mixed Languages Fortran Module Names and ATTRIBUTES Fortran module entities data and procedures have external names that differ from other external entities Module names use the convention MODULENAME_mp_ENTITY_ MODULENAME Is the name of the module and ENTITY is the name of the module procedure or module data contained within MODULENAME _mp_ is the separator between the module and entity names and is always lowercase For example MODULE mymod INTEGER a CONTAINS SUBROUTINE b INTEGER END SUBROU END MODULE H H u Z J This results in the following symbols being defined in the compiled o file mymod_mp_a_ mymod_mp_b_ Compiler options can affect the naming of module data and procedures F Note Except for ALIAS ATTRIBUTES properties do not affect the module name The following table shows how each ATTRIBUTES property affects the subroutine in the previous example module Effect of ATTRIBUTES Options on Fortran Module Names ATTRIBUTES Property Given to Procedure Name in o file Routine b None mymod_mp_b_ C mymod_mp_b_ ALIAS Overrides all others name as given in the alias 205
23. a 10 10 integer pointer p p gt a 9 1 2 1 9 3 call f p The descriptor for actual argument p would contain the following values e The first longword bytes 0 to 3 contain the base address assigned at run time e The second longword bytes 4 to 7 is set to 4 size of a single element e The third longword bytes 8 to 11 contain the offset assigned at run time e The fourth longword bytes 12 to 15 contains 1 low bit is set e The fifth longword bytes 16 to 19 contains 2 rank e The sixth longword is reserved 222 Programming with Mixed Languages e The seventh eighth and ninth longwords bytes 24 to 35 contain information for the first dimension as follows o 5 extent o 8 distance between elements o 9 the lower bound e For the second dimension the tenth eleventh and twelfth longwords bytes 36 to 47 contain o 3 extent o 120 distance between elements o 1 the lower bound e Byte 47 is the last byte for this example Fag Note The format for the descriptor on Itanium based systems is identical to that on IA 32 systems except that all fields are 8 bytes long instead of 4 bytes Handling Character Strings By default Intel Fortran passes a hidden length argument for strings The hidden length argument consists of an unsigned 4 byte integer IA 32 systems or unsigned 8 byte integer Itanium based systems always passed by value added to the end of the argument list
24. result open file name open flags create mode return result return file descriptor or error End of routine uopen_ End of file uopen_ c Source Code for the Calling Intel Fortran Program The following example shows the Fortran program that calls the uopen_ C function and then performs VO Program EX1 opens a file using USEROPEN and writes SEE to DES It closes and re opens the file without USEROPEN and ke 10 records PROGRAM EX1 EXTERNAL UOPEN The USEROPEN function INTEGER ERRNUM CTR I 1 FORMAT I ERRNUM 0 WRITE 6 EX1 Access data using formatted I 0 WRITE 6 EX1 Open file with USEROPEN and put some data in it OPEN UNIT 1 FILE exl dat STATUS NEW USEROPEN UOPEN ERR 9 IOSTAT errnum DO CTR 1 10 WRITE 1 1 CTR END DO WRITE 6 EX1 Close and re open without USEROPEN CLOSE UNIT 1 OPEN UNIT 1 FILE exl dat STATUS OLD FORM FORMATTED ERR 99 IOSTAT errnum WRITE 6 EX1 Read and display what is in file DO CTR 1 10 READ 1 1 i WRITE 6 i END DO WRITE 6 EX1 Successful if 10 records shown CLOSE UNIT 1 STATUS DELETE STOP 9 WRITE 6 EX1 Error on USEROPEN is errnum STOP 185 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I 99 WRITE 6 EX1 Error on 2nd op
25. Check the following Whether the correct file was specified Whether the record layout matches the format Intel Fortran is expecting The ranges for the data being used Whether the correct nonnative floating point data format was 267 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I EEN Blinfo 96 F_UFMTENDIAN environment variable was ignored erroneous syntax FOR IOS_UFMTENDIAN Syntax for specifying whether little endian or big endian conversion is performed for a given Fortran unit was incorrect Even though the program will run the results might not be correct if you do not change the value of F UFMTENDIAN For correct syntax see Environment Variable F_UFMTENDIAN Method 1Q08 severe 108 Cannot stat file FOR IOS_CANSTAFIL Attempted stat operation on the indicated file failed Make sure correct file and unit were specified 120 severe 120 Operation requires seek ability FOR IOS OPEREQSEE Attempted an operation on a file that requires the ability to perform seek operations on that file Make sure the correct unit directory path and file were specified 138 Vsevere 138 Array index out of bounds SIGILL FOR IOS_BRK_RANGE Break exception generated a SIGTRAP signal described in signal 3 Core dump file created The cause is an array subscript that is outside the dimensioned boundaries of that array Either recompile with the check bounds option perhaps with the decfort_du
26. Determine source of this interrupt signal described in signal 3 severe 70 Integer overflow FORS IOS INTOVF During an arithmetic operation an integer value exceeded byte word or longword range The result of the operation was the correct low order part Consider specifying a larger integer data size modify source program or for an INTEGER declaration possibly use the 90 option integer size nn 71 severe 71 Integer divide by zero FOR IOS_INTDIV During an integer arithmetic operation an attempt was made to divide by zero The result of the operation was set to the dividend which is equivalent to division by 1 error 72 Floating overflow FOR IOS_FLTOVF During an arithmetic operation a floating point value exceeded the largest representable value for that data type error 73 Floating divide by zero FOR IOS_FLTDIV During a floating point arithmetic operation an attempt was made to divide by zero 74 Verror 74 Floating underflow FORS IOS FLTUND During an arithmetic operation a floating point value became less than the smallest finite value for that data type Depending on the values of the fpe n option the underflowed result was either set to zero or allowed to gradually underflow error 75 Floating point exception FORS IOS SIGFPE A floating point exception occurred Core dump file created Possible causes include e Division by zero e Overflow 266 Reference Information e Inv
27. FALSE has an integer value of 0 The default fpscomp nologicals is compatible with Compaq Fortran Intel Fortran versions prior to 8 0 used the representation specified by fpscomp logicals The internal representation of LOGICAL values is not specified by the Fortran standard Programs which use integer values in LOGICAL contexts or which pass LOGICAL values to procedures written in other languages are non portable 55 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I and may not execute correctly Intel recommends that you avoid coding practices that depend on the internal representation of LOGICAL values prof format 32 IA 32 and Itanium based systems only Default Off Produces profile data with 32 bit counters The default is to produce profile data with 64 bit counters to handle large numbers of events This option allows compatibility with earlier compilers vms Default Off Causes the run time system to behave like HP Fortran on OpenVMS Alpha systems and VAX systems VAX FORTRAN in the following ways e Certain defaults In the absence of other options vms sets the defaults as check format and check output_conversion e Alignment The vms option does not affect the alignment of fields in records or items in common blocks Use align norecords to pack fields of records on the next byte boundary for compatibility with HP Fortran on OpenVMS systems e Carriage control default If vms
28. Once a direct access record has been written you cannot delete it but you can rewrite it During output to a formatted direct file if data does not completely fill a record the compiler pads the remaining portion of the record with blank spaces The blanks ensure that the file contains only completely filled records all of the same length During input the compiler by default also adds filler bytes blanks to the input record if the input list and format require more data than the record contains You can override the default blank padding on input by setting PAD NO in the OPEN statement for the file If PAD NO the input record must contain the amount of data indicated by the input list and format specification Otherwise an error occurs PAD NO has no effect on output An example of a program writing two records record one and record three toa formatted direct file is given below The result is shown in the following figure E 3 FILE FDIR FORM FORMATTED ACCESS DIRECT RECL 10 WRITE 3 A10 REC 1 RECORD ONE WRITE 3 I5 REC 3 30303 CLOSE 3 END Formatted Direct File 191 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I 10 bytes data 2 bytes CR LF separator 12 bytes undefined data 5 bytes data D bytes padding blank Pike bytes CR LF separator 10 11 1213 2 T 2529 L ae keel Bel e Re eA keel Bel EA JE 30 Re mm Ed BA L Recor
29. Specifies Microsoft Fortran PowerStation semantic conventions and record formats for list directed formatted VO and unformatted VO fpscomp no ldio_spacing Default fpscomp noldio spacing For list directed output controls whether a blank is inserted at run time after a numeric value before a character value undelimited character string The default is fpscomp noldio_spacing which conforms to the Fortran 95 standard by inserting a blank after a numeric value before a character value To request non standard behavior for compatibility with Fortran PowerStation and Intel Fortran releases before Version 8 0 either specify fpscomp ldio spacing or specify fpscomp general which sets fpscomp ldio spacing fpscomp no libs Default fpscomp libs Specifies that the PowerStation portability library should be passed to the linker fpscomp no logicals Default fpscomp nologicals Specifies the internal binary representation of LOGICAL values and how they are used If nologicals is specified integers with an odd value low bit one are treated as true integers with an even value low bit zero are treated as false The literal constant TRUE has an integer value of 1 and the literal constant FALSE has an integer value of 0 If logicals is specified integers with a non zero value are treated as true integers with a zero value are treated as false The literal constant TRUE has an integer value of 1 and the literal constant
30. This linking arrangement allows the GNU users to have all functions available when using ifort with Intel optimized versions available when supported libimf a is linked in before 1ibm a If you link in 1ibm a first it will change the versions of the math functions that are used It is recommended that you place 1ibimf a in the first directory specified in the LD_LIBRARY_PATH variable The libimf aand libm a libraries are always linked with Fortran programs 247 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I For example if you place a library in directory perform set the LD LIBRARY PATH variable to specify a list of directories containing all other libraries separated by semicolons libimf a on the IA 32 Compiler For the IA 32 compiler 1ibimf a contains both generic math routines and versions of the math routines optimized for special use with the Intel Pentium 4 and Intel Xeon TM processors libimf a on the Itanium Based Compiler For the Itanium based compiler 1ibimf a is optimized for use with the Itanium architecture The compiler provides inlined versions of math library primitives and schedules the generated code with surrounding instructions This can improve the performance of typical floating point applications 248 Reference Information Compile Time Environment Variables The compile time environment variables are e FPATH The path for include and module files e
31. an object of type real cannot be accessed as an integer For complete information on the rules for data types and data type constants see Data Types Constants and Variables in the Language Reference The option directs the compiler to assume the following e Arrays are not accessed out of arrays bounds e Pointers are not cast to non pointer types and vice versa e References to objects of two different scalar types cannot alias For example an object of type integer cannot alias with an object of type real or an object of type real cannot alias with an object of tyoe double precision If your program satisfies the above conditions setting the ansi alias option will help the compiler optimize the program However if your program might not satisfy any of the above conditions you must disable this option with ansi_alias as it might cause the compiler to generate incorrect code assume cc omp Default depends on whether openmp is specified Enables conditional compilation as defined by the OpenMP Fortran API When Sspace appears in free form source or S spaces appears in column 1 of fixed form source the rest of the line is accepted as a Fortran line If openmp is specified the default is assume cc_omp otherwise the default is assume nocc_omp assume none Turns off all the assume options nobss init 79 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Default Off Disables placeme
32. defines data format in the files that are connected to the units from the EXCEPTION list This value overrides MODE value for the units listed The EXCEPTION keyword and the colon can be omitted The default when the keyword is omitted is big e Each list member U is a simple unit number or a number of units The number of list members is limited to 64 decimal is a non negative decimal number less than 2 The command line for the variable setting in the shell is Sh export F UFMTENDIAN MODE EXCEPTION E Note The environment variable value should be enclosed in quotes if the semicolon is present Another Possible Environment Variable Setting The environment variable can also have the following syntax F_UFMTENDIAN u u The command line for the variable setting in the shell is Sh export F_UFMTENDIAN u u Usage Examples 1 F_UFMTENDIAN big All input output operations perform conversion from big endian to little endian on READ and from little endian to big endian on WRITE 2 F_UFMTENDIAN little big 10 20 or F_UFMTENDIAN big 10 20 or F_UFMTENDIAN 10 20 In this case only on unit numbers 10 and 20 the input output operations perform big little endian conversion 3 F UFMTENDIAN big little 8 In this case on unit number 8 no conversion operation occurs On all other units the input output operations perform big little endian conversion 150 Data and V
33. idb whatis xp 1 int xp idb s stopped at ptr 7 0x120001880 7 xp gt x idb s stopped at ptr 9 0x120001954 9 print xe SM gt idb s x 1 2 5 stopped at ptr 10 0x1200019c8 idb s xp 1 2 3 stopped at point 12 0x120001ad8 12 end idb S xp al 2 3 120 Debugging Using idb idb whatis xp 2 int xp 1 3 idb print xp 1 I 1 For the first whatis xp command xp has not yet been assigned to point to variable x and is a generic pointer 2 Since xp has been assigned to point to variable x for the second whatis xp command xp takes the same size shape and values as x Integer Pointers Like Fortran 95 90 pointers integer pointers also known as Cray style pointers display the target data in their corresponding source form with a print command idb stop at 14 1 stop at dfpoint f90 14 idb run 1 stopped at dfpoint 14 0x1200017e4 idb list 1 14 program dfpoint real 1 5 pointer p i n 5 p malloc sizeof i 1 n do j 1 5 i j 10 j end do b G Mu HAH O000I1MNUTRRUON KE gt idb whatis p float 1 5 pointer p idb print p 0x140003060 1 10 2 20 3 30 end Array Variables 121 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I For array variables put subscripts within parentheses as with Fortran 95 90 source statements For example idb assign arrayc 1 1 You can print out all elements of an
34. int nm 228 char info 30 examp mp mydata r Programming with Mixed Languages When the C code resides in a cpp file C Semantics are applied to external names often resulting in linker errors In this case use the extern C syntax see C C Naming Conventions C code accessing module data in float examp_mp_a 3 extern extern extern extern Hew wo mean MEN int examp mp il char examp_mp_line 80 struct int n char info 30 examp mp mydata r cpp file examp mp i2 You can also define a module procedure in C and make that routine part of a Fortran module by using the ALIAS directive The C code is C procedure void pythagoras ao float a float b float sqrt a a b b float c Using the same example when the C code resides in a cpp file use the extern C syntax see C C Naming Conventions C procedure extern C void pythagoras KG float sgrt a a b b float a float b The Fortran code to define the module CPROC Fortran MODULE INTERFACE res is passed by REFE overrides the subrouti a and b the subrouti END SUBROUTINE END INTERFACE ad 95 90 Module including procedure CPROC SUBROUTINE PYTHAGORAS IDECS ATTRIB IDECS ATTRIB REAL a b have the VALU ne has the res
35. or namelist I O statements is referred to as formatted data data written using unformatted VO statements is referred to as unformatted data When reading data from a file you should use the same I O statement form that was used to write the data to the file For instance if data was written to a file with a formatted VO statement you should read data from that file with a formatted VO statement Although VO statement form is usually the same for reading and writing data ina file a program can read a file containing unformatted data using unformatted input and write it to a separate file containing formatted data using formatted output Similarly a program can read a file containing formatted data and write it to a different file containing unformatted data You can access records in any sequential or relative file using sequential access For relative files and certain fixed length sequential files you can also access records using direct access The table below shows the main record VO statements by category that can be used in Intel Fortran programs 158 Data and VO File Type Access and VO Available Statements Form External file sequential access Formatted READ WRITE PRINT ACCEPT TYPE REWRITE List directed READ WRITE PRINT ACCEPT TYPE Namelist READ WRITE PRINT ACCEPT TYPE Unformatted READ WRITE REWRITE External file direct access Formatted READ W
36. the create system call might be used in place of open see create 2 You can usually use other appropriate system calls or library routines within the USEROPEN function In most cases the USEROPEN function modifies the open flags argument passed by the Intel Fortran RTL or uses a new value before the open or create system call After the function opens the file it must return control to the RTL If the USEROPEN function is written in Fortran declare it as a FUNCTION with an INTEGER KIND 4 result perhaps with an interface block In any case the called function must return the file descriptor as a 4 byte integer to the RTL If your application requires that you use C to perform the file open and close as well as all record operations call the appropriate C procedure from the Intel Fortran program without using the Fortran OPEN statement Restrictions of Called USEROPEN Functions The Intel Fortran RTL uses exactly one file descriptor per logical unit which must be returned by the called function Because of this only certain system calls or library routines can be used to open the file System calls and library routines that do not return a file descriptor include mknod see mknod 2 and fopen See fopen 3 For example the fopen routine returns a file pointer instead of a file descriptor Example USEROPEN Program and Function The following Intel Fortran code calls the USEROPEN function named UOPEN EXTERNAL UOPEN INTEGER
37. usr local bin yourpath Then you can compile as make f yourmakefile where f is the make command option to specify a particular makefile Examples of the ifort Command Compiling and Linking Multiple Files The following ifort command compiles the Fortran free format source files aaa f 90 bbb 90 and ccc 90 The command invokes the 1d linker and passes the temporary object files to the linker which it uses to produce the executable file a out ifort aaa f90 bbb f90 ccc 90 The following ifort command compiles all file names that end with as Fortran fixed format source The linker produces the a out file ifort f Preventing Linking The following ifort command compiles but does not link the free format source file typedefs_1 90 which contains a MODULE TYPEDEFS 1 The command creates files typedefs_1 mod and typedefs_1 o The object file is retained automatically Specifying the c option prevents linking 30 Building Applications ifort c typedefs 1 90 Renaming the Output File The following ifort command compiles the free format Fortran source files circle calc f90 and sub f90 together ifort c circle calc 90 sub f90 The default optimization level 02 applies to both source files during compilation Because the c option is specified the object files are not passed to the linker In this case the named output files are the object files Like the previous command the follo
38. 138 Data and VO FOR K FP NEG ZERO Negative zero Another example of using file fordef for and intrinsic function FP CLASS follows The goals of this program are to quickly read any 32 bit pattern into a REAL 4 number from an unformatted file with no exception reporting and to replace denormalized numbers with true zero include fordef for real 4 a 100 integer 4 class of bits open an unformatted file as unit 1 read 1 a do i 1 100 class_of_bits fp_class a i if class of bits eg for k fp pos denorm or amp class of bits eg for k fp neg denorm then a i 0 0 end if end do close 1 end You can compile this program with any value of fpen Intrinsic function FP_CLASS helps to find and replace denormalized numbers with zeroes before the program can attempt to perform calculations on the denormalized numbers On the other hand if this program did not replace denormalized numbers read from unit 1 with zeroes and the program was compiled with fpeo then the first attempted calculation on a denormalized number would result in a floating point exception File fordef for and intrinsic function FP CLASS can work together to identify NaNs A variation of the previous example would contain the symbols for_k_fp_snan and for_k_fp_gqnan in the IF statement A faster way to do this is based on the intrinsic function ISNAN One modification of the previous example using ISNAN follows The ISNAN funct
39. 223 372 036 854 775 807 REAL 4 4 bytes Single precision real floating point values in IEEE S floating REAL 32 bits format ranging from 1 17549435E 38 to 3 40282347E38 Values between 1 17549429E 38 and 1 40129846E 45 are denormalized subnormal REAL 8 8 bytes Double precision real floating point values in IEEE T floating DOUBLE 64 bits format ranging from 2 2250738585072013D 308 to PRECISION 1 7976931348623158D308 Values between 2 2250738585072008D 308 and 4 94065645841246544D 324 are denormalized subnormal REAL 16 16 bytes Extended precision real floating point values in IEEE style EXTENDED 128 bits X floating format ranging from PRECISION 6 4751751 194380251 109244389582276465524996Q 4966 to 1 18973149535723 1765085759326628007016196477Q4932 COMPLEX 4 8 bytes Single precision complex floating point values in a pair of COMPLEX 64 bits IEEE S floating format parts real and imaginary The real and imaginary parts each range from 1 17549435E 38 to 3 40282347E38 Values between 1 17549429E 38 and 1 40129846E 45 are denormalized subnormal REAL 16 16 bytes Extended precision real floating point values in IEEE style EXTENDED 128 bits X_floating format ranging from PRECISION 6 4751751 194380251 109244389582276465524996Q 4966 to 1 18973149535723 1 765085759326628007016196477Q4932 COMPLEX 8 16 bytes Double precision complex floating point values in a pair of DOUBLE 128 bits IEEE T_floating format parts real and imaginary The
40. 49 compiler OptiONS ees ee 69 compile time environment variables AR ER DE 249 compiling 279 Intel Fortran Compiler for Linux Systems User s Guide Vol C Fortran mixed language DFodFamMS ss ER Ek bed eke 227 COMPLEX data representation 136 complex data types jn el ae EE 215 complex variable iese sede ee 117 COMPLE X 16 data representation SE ee cvs NN 137 COMPLE X 4 data representation bad Wankel EEE 136 COMPLE X 8 data representation EE AE EE 137 COMPLE X KIND 16 data representatiON iese 137 COMPLEX KIND 4 data representation wrrnnnnnnnnre 136 COMPLE X KIND 8 data representatiON esse 137 COMPLE X 16 data representation RE GEE 137 COMPLE X 32 data representation PE O S 137 COMPLEX 8 data representation 136 complex_limited_range compiler ODNOM MERE ee Ge DE 86 components of compiler 13 configuration fles ee ee 35 controlling 280 compilation process 0 27 conventions documentation cccceceeeee 17 conversions hexadecimal binary octal decimal EE ARE AE PEN 254 convert compiler option 52 153 converting unformatted data OVEIVIOW Lura aadnk 141 cpp compiler option 0 101 CRAY keyword eeeeeereees 141 Cray style pointer 117 218 creating executable program 41 shared libraries rrrrrnnrrrnnnrrr 43 creating libraries
41. 6 ccencceceesceeeerseaseneanee 257 FORS IOS FLOOVFEXC error MESSAGE Lende 257 FORS IOS FLOUNDEXC error MESSAGE EE ress 257 FORS IOS FLTDIV error message KNIE AR NE 257 FORS IOS FLTINE error message EA MT DE 257 FORS IOS FLTINV error message REM ED GE PE 257 FORS IOS FLTOVF error message PES TE WAGTE TE 257 FORS IOS FLTUND error message N EA othe 257 FORS IOS FMTIO UNF error MESSAGE Ads 257 FORS IOS FMTSYN error message ME RE teeta 257 FORS IOS FORVARMIS error MESSAGE EE Mescecsetteta aces 257 FORS IOS INCFILORG error MESSage ese REK RR AK Ke 257 FOR IOS_INCOPECLO error MESSAGE As ee kane 257 FORS IOS INCRECLEN error MESSage ese inienn 257 FOR IOS_INCRECTYP error MESSAGE Ro EE ed 257 FOR IOS INFFORLOO error Message eke KERR 257 FOR IOS_INPCONERR error MESSAGES ie 257 FOR IOS_INPRECTOO error MESSage ee eunana 257 Index FOR IOS_INPSTAREQ error MESSAGE Header 257 FORS IOS INSVIRMEM error MESSAGE ee Ke KAR Ra EE 257 FOR IOS_INTDIV error message EE IE eee een ae 257 FORS IOS INTOVF error message ETTE OO NE ETE 257 FOR IOS_INVARGFOR error MEsSage is dene EK SERE ek 257 FOR IOS_INVDEALLOC error MESSJJG Lian da 257 FORSIOS INVDEALLOC2 error MESSage see EK Re ee 257 FOR IOS_INVLOGUNI error MESSAGE oe ee EE 257 FOR IOS_INVREALLOC error MESSage ese RR EK RAAR EG 257 FORS IOS INVREFVAR error MESSAGE Pe OE ei EE 257 FORS IOS KEYVALERR error EET RE inanin 257 FORSIOS LISIO SYN
42. 68 Compiler Options Appends an underscore character to external user defined names the main program name named COMMON BLOCK DATA global data names in MODULEs and names implicitly or explicitly declared EXTERNAL The name of blank COMMON remains BLNK and Fortran intrinsic names are not affected no mixed_str_len_arg Default nomixed_str_len_arg Tells the compiler that the hidden length passed for a character argument is to be placed immediately after its corresponding character argument in the argument list The default value places the hidden lengths in sequential order at the end of the argument list When porting mixed language programs that pass character arguments either this option must be specified correctly or the order of hidden length arguments changed in the source code See also Programming with Mixed Languages Overview and related sections names keyword Default names lowercase Controls how the case sensitivity of letters in source code identifiers and external names is handled This naming convention applies whether names are being defined or referenced This option is useful in mixed language programming keyword is one of the following e uppercase Causes the compiler to ignore case differences in identifiers and to convert external names touppercase Alternate syntax uppercase e lowercase Causes the compiler to ignore case differences in identifiers and to convert external names to lowercase
43. C routines that use different calling conventions the error is not apparent until the bad call is made at run time During execution the bad call causes indeterminate results and or a fatal error often somewhere in the program that has no apparent relation to the actual cause memory stack corruption due to calling errors Therefore you should check carefully the calling conventions for each mixed language call The discussion of calling conventions between languages applies only to external procedures You cannot call internal procedures from outside the program unit that contains them A calling convention affects programming in four ways 1 The caller routine uses a calling convention to determine the order in which to pass arguments to another routine the called routine uses a calling convention to determine the order in which to receive the arguments passed to it In Fortran you can specify these conventions in a mixed language interface with the INTERFACE statement or in a data or function declaration C C and Fortran both pass arguments in order from left to right 2 The caller routine and the called routine use a calling convention to select the option of passing a variable number of arguments 3 The caller routine and the called routine use a calling convention to pass arguments by value values passed or by reference addresses passed Individual Fortran arguments can also be designated with ATTRIBUTES option VALUE or REFE
44. Control the execution of individual source lines in a program e Set stops breakpoints at specific source lines or under various conditions e Change the value of variables in your program e Refer to program locations by their symbolic names using the debugger s knowledge of the Intel Fortran language to determine the proper scoping rules and how the values should be evaluated and displayed e Print the values of variables and set a tracepoint trace to notify you when the value of a variable changes Another term for a tracepoint is a watchpoint e Perform other functions such as examining core files examining the call stack or displaying registers The idb debugger has two modes 107 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e dbx default mode e gdb optional mode All examples in this guide are shown in dbx mode E Note For complete information about idb see the idb man page or the online Intel Debugger IDB Manual Debugging Options To use the debugger you should specify the ifort command and the g command line option Traceback information and symbol table information are both necessary for debugging If you specify g the compiler provides the symbol table and traceback information needed for symbolic debugging The not raceback option cancels the traceback information Likely uses of these options at the various stages of program development are as follows During
45. Default Off Produces enhanced source position information for inlined code This leads to greater accuracy when reporting the source location of any instruction It also provides enhanced debug information useful for function call traceback The Intel amp Debugger idb uses this information to show simulated call frames for inlined functions To use this option for debugging you must also specify g no logo Default 1ogo startup banner is displayed Displays the startup banner 82 Compiler Options This option can be placed anywhere on the command line The startup banner displays the following information e ID unique identification number for the compiler e x y z version of the compiler e years years for which the software is copyrighted nofor_main Default Off Specifies that the main program is not written in Fortran For example if the main program is written in C and calls an Intel Fortran subprogram specify nofor_main when compiling the program with the ifort command Specifying nofor main prevents linking for main o into programs This is a link time switch If you omit nofor main the main program must be a Fortran program noinclude Default Off Prevents the compiler from searching in usr include for files specified in an INCLUDE statement You can specify the Idir option along with this option This option does not affect cpp 1 behavior and is not related to the Fortran 95
46. For each error the table provides the error number the severity code error message text condition symbol name and a detailed description of the errors To define the condition symbol values PARAMETER statements in your program include the following file opt intel_fc_80 include for_iosdef f As described in the table the severity of the message determines which of the following occurs program execution continues with info and warning the results might be incorrect with error and program execution stops unless a recovery method is specified with severe In the last case to prevent program termination you must include either an appropriate I O error handling specifier and recompile or for certain errors change the default action of a signal before you run the program again The first column lists error numbers returned to IOSTAT variables when an VO error is detected The first line of the second column provides the message as it is displayed following forrt1 including the severity level message number and the message text The following lines of the second column contain the status condition symbol such as FOR IOS_INCRECTYP and an explanation of the message 257 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Severity Level Number and Message Text Condition Symbol and Explanation None linfo Fortran error message number is nnn The Intel Fortran message catalog file was not found on t
47. ISNAN intrinsic function 138 ivdep parallel compiler option 86 K key files DE RE EE De 252 tanium based sees 252 L L compiler OPHON ee ee 77 language OptiONS ese ee 74 ld See linker ee ese ee 22 ld 20 LD LIBRARY PATH environment variable 43 247 249 legal intormation sees EE EE 2 libcprts a Ne anden 242 libepris so ille ss EES 242 libcprts so 5 file EE EER ets 242 bog ae unne 242 libcxa so file ee ee 242 libcxa so 5 file is cpa 242 libcxaguard a file see 242 libcxaguard so file ee 242 libcxaguard so 5 file see 242 libguide a file ees ee 242 libguide so file ees dee ee 242 libguide stats a file issie 242 libguide stats so file 242 libifcore a file ees ee 242 libifcore so file ees see 242 libifcore so 5 file ee 242 libifcoremt a file ssnnnnnnnn 242 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I libifcoremt so file ee 242 libifcoremt so 5 file ee 242 libifport a t ESE 242 libifport a library UMN 243 libifport so file esse ee 242 libifport so 5 file EER EE se 242 libimf a file esse ee 242 libimf a library 247 libimf so Ouse 242 BEEN ee 242 libm a library ees eek ee 247 libompstub a file esse see 242 libraries ChE GMPC arenaen 241 creating shared s ececee 43 using OVEIVICW ee ee ee ee 241 ed Ee 242 libraries options rrrnnn
48. Intel amp Fortran Compiler for Linux Systems User s Guide Vol I VARYING No effect on name You can write code to call Fortran modules or access module data from other languages As with other naming and calling conventions the module name must match between the two languages Generally this means using the C convention in Fortran and if defining a module in another language using the ALIAS property to match the name within Fortran For examples see Using Modules in Fortran C Mixed Language Programming Prototyping a Procedure in Fortran You define a prototype interface block in your Fortran source code to tell the Fortran compiler which language conventions you want to use for an external reference The interface block is introduced by the INTERFACE statement See Program Units and Procedures in the Language Reference for a description of the INTERFACE statement The general form for the INTERFACE statement is INTERFACE routine statement routine ATTRIBUTE options argument ATTRIBUTE options formal argument declarations END routine name END INTERFACE The routine statement defines either a FUNCTION or a SUBROUTINE where the choice depends on whether a value is returned or not respectively The optional routine ATTRIBUTE options such as C determine the calling naming and argument passing conventions for the routine in the prototype statement The optional argument ATTRIBUTE options suc
49. Reference The following sections discuss the intrinsic data types in more detail e Integer Data Representations e Logical Data Representations e Native IEEE Floating Point Representations e Character Representation e Hollerith Representation Integer Data Representations Integer Data Representations Overview Integer data lengths can be 1 2 4 or 8 bytes in length The default data size used for an INTEGER data declaration is INTEGER 4 same as INTEGER KIND 4 unless the integer size 16 or the integer size 64 option was specified Integer data is signed with the sign bit being 0 zero for positive numbers and 1 for negative numbers The following sections discuss integer data 131 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e INTEGER KIND 1 Representation e INTEGER KIND 2 Representation e INTEGER KIND 4 Representation e INTEGER KIND 8 Representation INTEGER KIND 1 Representation INTEGER 1 values range from 128 to 127 and are stored in 1 byte as shown below T 6 a BINARY HUMBER ZK 9814 GE Integers are stored in a two s complement representation For example 22 7 16 hex F9 hex INTEGER KIND 2 Representation INTEGER 2 values range from 32 768 to 32 767 and are stored in 2 contiguous bytes as shown below 15 14 a BINARY HUMBER ZK 0758 GE Integers are stored in a two s complement representation For example 22 7 0016 hex FFF9 hex INTEGE
50. Then create the shared library making sure that you specify the file containing that routine either during recompilation or when creating the shared library You can specify an object file wnen recompiling with the ifort command or when creating the shared library with the 1a command When creating shared libraries all symbols must be defined resolved Because all symbols must be defined to 14 when you create a shared library you must specify the shared libraries on the 1a command line including all standard Intel Fortran libraries unless you use the Qoption command The list of standard Intel Fortran libraries might be specified by using the 1string option Installing Shared Libraries Once the shared library is created it must be installed for private or system wide use before you run a program that refers to it 45 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e To install a private shared library when you are testing for example set the environment variable LD_LIBRARY_PATH as described in 1d 1 e To install a system wide shared library place the shared library file in one of the standard directory paths used by 1a See 1d 1 Allocating Common Blocks You can use the dyncom dynamic common option to control the allocation of common blocks at run time This option designates a common block to be dynamic The space for its data is allocated at run time rather than compile time On entry to ea
51. UOPEN OPEN UNIT 1 FILE exl dat STATUS NEW USEROPEN UOPEN ERR 9 IOSTAT errnum If the default ifort options are used the external name is passed using lowercase letters with an appended trailing underscore _ In the preceding 182 Data and VO example the external function UOPEN would be known as uopen to the linker and must be declared in C as uopen_ Compiling and Linking the C and Intel Fortran Programs Use the icc command to compile the called uopen C function uopen_ c and the ifort command to compile the Intel Fortran calling program ex1 f The same ifort command also links both object files by using the appropriate libraries to create the file a out file as follows icc c uopen_ c ifort exl f uopen_ o Source Code for the C Function and Header File The following example shows the C language function called uopen_ and its associated header file File uopen h header file for uopen_ c ii ifndef UOPEN define UOPEN 1 En Function Prototypes ae int uopen_ char file_ name access read name of the file to open int open flags access read READ WRITE see file h or open 2 int create mode access read set if new file to be created int lun access read logical unit file opened on int file length access read number of characters in file name endif End of file uopen h Fil
52. above to the end of your file For example f set up environment for Intel compiler source opt intel fc 80 bin ifortvars sh Invoking the Intel Fortran Compiler You can invoke the Intel Fortran Compiler in either of two ways e Using the ifort command e Using the make command to specify a makefile Using the ifort Command The syntax is ifort options input_file s An option is specified by one or more letters preceded by a hyphen Some options take arguments in the form of filenames strings letters or numbers Except where otherwise noted you can enter a space between the option and its argument s or you can combine them See Compiler Options Overview You can specify more than one input_file using a space as a delimiter See Input Files and Filename Extensions E Note 29 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Options on the command line apply to all files For example in the following command line the c and nowarn options apply to both files x f and Vet ifort c x f nowarn y f Using the make Command To compile a number of files with various paths and to save this information for multiple compilations you can use a makefile to invoke the Intel Fortran Compiler To use a makefile to compile your input files make sure that usr bin and usr local bin are in your path If you use the C shell you can edit your cshrc file and add the following setenv PATH usr bin
53. address of the first variable in the block that is pass the first variable by reference The receiving C or C module should expect to receive a structure by reference In the following example the C function initcb receives the address of a common block with the first variable named n which it considers to be a pointer to a structure with three fields Fortran source code INTERFACE SUBROUTINE initcb BLOCK IDECS ATTRIBUTES C initcb IDECS ATTRIBUTES REFERENCE BLOCK INTEGER BLOCK END SUBROUTINE END INTERFACE INTEGER n REAL 8 x y COMMON CBLOCK n x y CALL initcb n C source code pragma pack 2 struct block_type int n double x double y VG pragma pack void initcb struct block_type block_hed block_hed gt n 1 block_hed gt x 10 0 block_hed gt y 20 0 Handling Data Types in Mixed Language Programming 213 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Handling Data Types in Mixed Language Programming Overview Even when you have reconciled calling conventions naming conventions and methods of data exchange you must still be concerned with data types because each language handles them differently The following table lists the equivalent data types between Fortran and C Equivalent Data Types Fortran Data Type C Data Type
54. array using its name For example idb print arrayc 1 1 Avoid displaying all elements of a large array Instead display specific array elements or array sections For example to print array element arrayc 2 idb print arrayc 2 2 0 Array Sections An array section is a portion of an array that is an array itself An array section can use subscript triplet notation consisting of a three parts a starting element an ending element and a stride Consider the following array declarations NTEGER DIMENSION 0 99 Ss arr NTEGER DIMENSION 0 4 0 4 FiveByFive Assume that each array has been initialized to have the value of the index in each position for example FiveByFive 4 4 44 arr 43 43 The following examples are array expressions that will be accepted by the debugger idb print arr 2 idb print arr 0 9 2 OndFNO idb print FiveByFive 3 0 3 3 WwW md wN WW w Debugging Using idb The only operations permissible on array sections are whatis and print Assignment to Arrays Assignment to array elements are supported by idb For information about assigning values to whole arrays and array sections see the Fortran chapter in the online Intel Debugger IDB Manual Complex Variables idb supports COMPLEX or COMPLEX 8 COMPLE X 16 and COMPLE X 32 variables and constants in expressions Consider the following Fortran program PROGRAM complextest C
55. but do not like the default value for the ACCESS specifier you can close the file and then reopen it explicitly specifying the ACCESS desired There usually is no need to close preconnected units Internal files are neither opened nor closed Record Operations Record Operations Overview See these topics Record VO Statement Specifiers Record Access File Sharing Specifying the Initial Record Position Advancing and Nonadvancing Record I O Record Transfer Record I O Statement Specifiers After you open a file or use a preconnected file you can use the following statements e READ WRITE ACCEPT and PRINT to perform record VO e BACKSPACE ENDFILE and REWIND to set record position within the file 174 Data and VO e DELETE REWRITE TYPE and FIND to perform various operations The record VO statement must use the appropriate record I O form formatted list directed namelist or unformatted You can use the following specifiers with the READ and WRITE record VO statements e UNIT specifies the unit number to or from which input or output will occur e END specifies a label to branch to if end of file occurs only applies to input statements on sequential files e ERR specifies a label to branch to if an error occurs e lOSTAT specifies an integer variable to contain the error number if an error occurs e FMT specifies a label of a FORMAT statement or character data specifying a FORMAT e NML specifies the
56. control transfers to the statement at label 999 Using the IOSTAT Specifier You can use the IOSTAT specifier to continue program execution after an I O error and to return information about I O operations Certain errors are not returned in IOSTAT The IOSTAT specifier can supplement or replace the END EOR and ERR branch transfers Execution of an VO statement containing the IOSTAT specifier suppresses the display of an error message and defines the specified integer variable array element or scalar field reference as one of the following e A value of 2 if an end of record condition occurs with nonadvancing reads e A value of 1 if an end of file condition occurs e A value of 0 for normal completion not an error condition end of file or end of record condition e A positive integer value if an error condition occurs This value is one of the Fortran specific IOSTAT numbers listed in the run time error message See Run Time Error Messages 236 Error Handling Following the execution of the I O statement and assignment of an IOSTAT value control transfers to the END EOR or ERR statement label if any If there is no control transfer normal execution continues You can include opt intel_fc_80 include for_iosdef for in your program to obtain symbolic definitions for the values of IOSTAT The following example uses the IOSTAT specifier and the for iosdef for file to handle an OPEN statement error in the FILE speci
57. data representation EE EG GR E EAEE 135 REAL KIND 8 data representation EE OE 135 RECL specifier in OPEN statement 163 164 REC vale nike eae 159 reconciling case Of NAMES eee 204 record aCcCesS rannrrannnnnnnnnnnr 175 record characteristics OPEN statement specifiers for 169 record VO AOVANCING EE ER EER GESE 178 nonadvancing sees ee 178 record Oras ee 178 record VO statement specifiers 174 record length 164 record IDEKING Las sunnere 177 record operations VEME anse 174 record overhead sesse 163 record position CHANGING var net 177 specifying initial xxxnnn 177 record SIZ sager 179 record transfer rrrnnnnnnnnnnnr 179 Index record transfer characteristics OPEN statement specifiers for 169 record type CHOOSING Luisa Saa 161 record type esse ee 161 175 record types TONAL AR AE EE 186 record typeS iese se ee ee ee 186 record variable esse esse ee dee ee 117 recursive compiler option 51 redirecting command line output x 40 reentrancy compiler option 51 REFERENCE property 199 relative file organization 159 relative pathname c 24 renaming an output file 30 representation routines 244 response fil S ce ee 35 restrictions in creating shared libraries 43 return values
58. ee 15 How to Use This DOCUINGIN Es EKEN ER GE n GE De DE EE Ee EE Gee 17 Additional Documentation su KO ER EE ER ee Dee Ee BR oe Re oe 17 Notation GOMVEIIIONS ap EE GE REEDE EE ee Ee GE GOS Ge ee ee Ea 17 CHING SAME si EK De ES AN dene 19 Getting Started Overview RR EE SE Ee ee DE GE NE cae 19 How You Can Use the Intel Fortran Compiler iese es see ee ee ee ee ee 19 Compilation Phases AE OE OR EE EE 20 Preprocess HP ase SA ARE EE ME ED ED AR GE 21 Assetbietsatdinkep 2 22 PSOE EE EE EA HO EE N 22 By EE OD HE OE OIE 23 Default Behavior of the Intel Fortran Compiler rrrnrnrnnnnnrrrrnnnnrnrnnnnnnnnnnene 23 Input Files nd Filename EXensionS us ESE RE SE ee EDE WER Ge SE ee 23 EileSpeeiliealiofis sn ED Ee De Lecce eae em alhataatat 24 Q tp t FileS ss ar SE ie ED ee Ee drepes oase 25 Temporary Files Created by the Compiler or Linker see see ea ee ee Ee 26 Building Applications IE EE EE EG RE SG 27 Table Of Contents Building Applications OverVi W esse ee ee ee RR ER ee ee ee Re ee ee ee AR ee ee ee ee 27 Controlling the Compilation Proces ees ss ee ee ee Re Ee AA ee ee Re ee dk ee ee 27 Setting and Viewing Environment Variables isi ee ese se se ee de ee ee ER ee ee ee ee 28 Configuration File Environment VariableS iese se se ee ee ee de RE ee ee ede ge ee 28 Running the Shell Script to Set Up the Environment Variables 0 28 Invoking the Intel Fortran Compiler iis see
59. ee de ee ee ER AA ek ee Ge ee 249 Key IA 32 Compiler Files SummarY iese sedes ee ee Ee Ee ee ee ee ee RR Ee ee ee ee ee ee 252 Key Itanium Based Compiler Files Summary issie ese ee ee ee ee ee 252 Compler Mile RE ER RO ET 253 Hexadecimal Binary Octal Decimal Conversions iese ees see ee ee ee RR ee 254 Compatibility with Previous Versions of Intel Fortran esse ese ee see 255 Differences Between Intel Fortran Version 7 1 and Intel Fortran Version 8 x EEE NE EE Oe ED DR ERE NNN REN ER JE 255 Documentation Information ees ese ee ee Re EA ee ee AA ee ee 256 Version 7 1 Features Not Available in Intel Fortran Version BOX esse 257 Run Time Error Messages iss ed eed se ee dk ee ee Ee ee ee ee ER AA ee ee ee ee 257 Me EE LE EE OE VR EE ANA 275 xii About the Intel Fortran Compiler The Intel Fortran Compiler compiles code targeted for the IA 32 Intel architecture and Intel ltanium architecture The Intel Fortran Compiler product includes the following components for the development environment e Intel Fortran Compiler for 32 bit Applications e Intel Fortran Compiler for Itanium based Applications e Intel Debugger idb The Intel Fortran Compiler for Itanium based applications includes the Intel Itanium Assembler and Intel Itanium Linker For information on IA 32 systems with Intel Extended Memory 64 Technology Intel EM64T see the Intel Fortran Compiler 8 1 Extended Memory 6
60. errors occur This is useful when running many test programs in batch mode to prevent a failure from stopping execution of the entire test stream FOR PRINT Neither the PRINT statement nor a WRITE statement with an asterisk in place of a unit number includes an explicit logical unit number Instead both use an implicit internal logical unit number and the FOR PRINT environment variable If FOR PRINT is not defined the code PRINT f iolist Of WRITE f iolist writes to stdout standard output If FOR_PRINT is defined as a filename optionally containing a path the specified file would be written to FOR_READ A READ statement that uses an asterisk in place of a unit number does not include an explicit logical unit number Instead it uses an implicit internal logical unit number and the FOR_READ environment variable If FOR READ is not defined the code READ f iolist Of READ f iolist reads from stdin standard input If FOR_READ is defined as a filename optionally containing a path the specified file would be read FOR_TYPE The TYPE statement does not include an explicit logical unit number Instead it uses an implicit internal logical unit number and the FOR_TYPE environment variable If FOR TYPE is not defined the code TYPE f iolist writes to stdout standard output If FOR_TYPE is defined as a filename optionally containing a path the specified file would be written to
61. exchange is discussed in the following sections e Accessing Common Blocks and C Structures Directly e Passing the Address of a Common Block Accessing Common Blocks and C Structures Directly You can access Fortran common blocks directly from C by defining an external C structure with the appropriate fields and making sure that alignment and padding between Fortran and C are compatible The C and ALIAS ATTRIBUTES options can be used with a common block to allow mixed case names As an example suppose your Fortran code has a common block named really as shown IDECS ATTRIBUTES ALIAS Really Really REAL 4 x y Z 6 REAL 8 ydbl COMMON Really x y z 6 ydbl You can access this data structure from your C code with the following external data structure pragma pack 2 extern struct float x y z 6 double ydbl Really pragma pack You can also access C structures from Fortran by creating common blocks that correspond to those structures This is the reverse case from that just described However the implementation is the same because after common blocks and structures have been defined and given a common address name and assuming the alignment in memory has been dealt with both languages share the same memory locations for the variables Passing the Address of a Common Block 212 Programming with Mixed Languages To pass the address of a common block simply pass the
62. file Default Source file name with extension dyn and dpi Specifies the file name for the profiling summary file See also these topics in Volume II Advanced PGO Options Specific Coding Guidelines for IA 32 Architecture prof gen Default Off Instruments a program for profiling to get the execution count of each basic block See also these topics in Volume Il Basic PGO Options Example of Profile Guided Optimization 96 Compiler Options prof_use Default Off Enables use of profiling information including function splitting and function grouping during optimization Instructs the compiler to produce a profile optimized executable and merges available profiling output files into a pgopti dpi file If you use this option it automatically enables fnsplit Note that there is no way to turn off function grouping if you enable it using this option See also these topics in Volume II Basic PGO Options Example of Profile Guided Optimization scalar_rep IA 32 systems only Default scalar rep on Enables scalar replacement performed during loop transformation Requires 03 tppn Default value for IA 32 and Intel EM64T systems tpp7 Default value for Itanium based systems tpp2 Optimizes for a particular Intel processor The executable will run on other processors but is optimized for processors noted below Possible choices for n are e 1 Optimize for Itanium processors tanium based
63. first and last bytes in an unformatted sequential file are reserved the first contains a value of 75 and the last holds a value of 130 Fortran uses these bytes for error checking and end of file references The following program creates the unformatted sequential file shown in the following figure Note The file is sequential by default 1 is FF FF FF FF hexadecimal CHARACTER xyz 3 INTEGER 4 idata 35 DATA idata 35 1 xyz x y z Open the file and write out a 140 byte record 128 bytes block 12 bytes 140 for IDATA then 3 bytes for XYZ OPEN 3 FILE UFSEQ FORM UNFORMATTED WRITE 3 idata WRITE 3 xyz CLOSE 3 END Unformatted Sequential File agg ea as oe bytes data L i EET EOF 3 130 131 132 133 144 145 148 147 149 150 151 Ur es Dec Aten Dec Dec 45CII Dec Dec AAS Ja At nag Gs abe OIEESGD EER ate 3 XYZ 3 1138 L Logical record 1 L Logical record 2 BOF Beginning of file byte 75 decimal L Physical block length byte 0 lt L lt 129 EOF End of file byte 130 decimal Unformatted Direct Files An unformatted direct file is a series of unformatted records You can write or read the records in any order you choose All records have the same length given by the RECL specifier in an OPEN statement No delimiting bytes separate records or otherwise indicate record structure You can write a partial record to an unf
64. for accessibility according to mode It tests a file for read write or execute permission as well as checking to see if the file exists It works on the file attributes as they exist on disk not as a program s OPEN statement specifies them Instead of ACCESS you can use the INQUIRE statement with the ACTION parameter to check for similar information The ACCESS function always returns 0 for read permission on FAT files meaning that all files have read permission Date and Time Routines Various date and time routines are available to determine system time or convert it to local time Greenwich Mean Time arrays of date and time elements or an ASCII character string DATE and TIME are available as either a function or subroutine Because of the name duplication if your programs do not include the USE IFPORT statement each separately compiled program unit can use only one of these versions For example if a program calls the subroutine TIME once it cannot also use TIME as a function Standard Fortran 95 90 includes date and time intrinsic subroutines Error Handling Routines Error handling routines detect and report errors IERRNO error codes are analogous to errno on UNIX systems The IFPORT module provides parameter definitions for many of UNIX s errno names found typically in errno h on UNIX systems 246 Creating and Using Libraries IERRNO is updated only when an error occurs For example if a call to the GETC functi
65. global symbols fvisibility keyword or specifies the visibility for symbols that are in a file fvisibility keyword file This second form overrides the first form The keyword specifies what the visibility is set to Visibility can be set to any of the following 81 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e default Other components can reference the symbol and the symbol definition can be overridden preempted by a definition of the same name in another component e extern The symbol is treated as though it is defined in another component It also means that the symbol can be overridden by a definition of the same name in another component e hidden Other components cannot directly reference the symbol However its address might be passed to other components indirectly e internal The symbol cannot be referenced outside its defining component either directly or indirectly e protected Other components can reference the symbol but it cannot be overridden by a definition of the same name in another component The file is the pathname of a file containing the list of symbols whose visibility you want to set The symbols are separated by whitespace spaces tabs or newlines g Default Off Generates symbolic debugging information and line numbers in the object file for use by debuggers help Displays brief information about all the command line options inline debug info
66. in Mixed Language Programming Passing Arguments in Mixed Language Programming You can pass data between Fortran C and C through calling argument lists just as you can within each language for example the argument list a b and c in CALL MYSUB a b c There are two ways to pass individual arguments e By value which passes the argument s value e By reference which passes the address of the arguments On IA 32 systems Fortran C and C use 4 byte addresses On Itanium based systems these languages use 8 byte addresses You need to make sure that for every call the calling program and the called routine agree on how each argument is passed Otherwise the called routine receives bad data 207 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The Fortran technique for passing arguments changes depending on the calling convention specified By default Fortran passes all data by reference except the hidden length argument of strings which is passed by value If the ATTRIBUTES C option is used the default changes to passing all data by value except arrays If the procedure has the REFERENCE option as well as the C option all arguments by default are passed by reference In Fortran in addition to establishing argument passing with the calling convention option C you can specify argument options VALUE and REFERENCE to pass arguments by value or by reference In mixed language programming it is a goo
67. information on tilde pathname substitution see csh 1 167 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Rules for Applying Default Pathnames and File Names Intel Fortran determines file name and the directory path based on certain rules It determines a file name string as follows e lf the FILE specifier is present its value is used e lf the FILE specifier is not present Intel Fortran examines the corresponding environment variable If the corresponding environment variable is set that value is used If the corresponding environment variable is not set a file name in the form fort nis used Once Intel Fortran determines the resulting file name string it determines the directory which optionally precedes the file name as follows e f the resulting file name string contains an absolute pathname it is used and the DEFAULTFILE specifier environment variable and current directory values are ignored e If the resulting file name string does not contain an absolute pathname Intel Fortran examines the DEFAULTFILE specifier and current directory value If the corresponding environment variable is set and specifies an absolute pathname that value is used Otherwise the DEFAULTFILE specifier value if present is used If the DEFAULTFILE specifier is not present Intel Fortran uses the current directory as an absolute pathname Using Preconnected Standard I O Files If you do not use an OPEN statement
68. libcxa compiler option 77 shell script REDE ee Ct cease 28 sigaction routine Calngusassaasorestesddn 237 signal debugging a program 125 description Ole oe 237 signal handINig ese ee 237 signal routine Pale SE ee 237 size of executable programs 253 size_lp64 compiler option 79 So egene 164 SOX compiler option 51 special file open routine OPEN statement specifier for 169 specifications il EA IE 24 specifying data tomat EE EE 145 filename TEE AE 167 SQUARES example program 113 stand compiler option 57 stand90 compiler option 57 stand95 compiler option 57 statement INTERFACE vedaene 206 static compiler option 77 static liDrari s danna beinet 241 Static libcxa compiler option 77 STATUS specifier in OPEN statement 160 std compiler option 00 57 std90 comnpiler option 57 std95 compiler option 57 storage big ks 6 Ip EE 141 little endian naa 141 stream Tiler coc ence EE EE ened ene 186 stream record type 161 163 Stream CR record 0608 186 Stream CR record type 161 163 Stream LF record 0608 186 Stream LF record type 161 163 Streaming SIMD Extensions SSE 303 Intel amp Fortran Compiler for Linux Systems User s
69. memory or a machine register Intel Debugger idb is able to process location lists and display local variable values with greater accuracy at run time dryrun Default Off 80 Compiler Options Specifies that driver tool commands should be shown but not executed See also V dynamic linkerfile Default Off Specifies a dynamic linker file instead of the default fpic or fPIC Default Off fpic Specifies that position independent code should be generated Required for building shared objects on Itanium based systems Specifies full symbol preemption Global symbol definitions as well as global symbol references get default that is preemptable visibility unless explicitly specified otherwise See also Creating Shared Libraries fminshared Default Off Specifies that the compilation unit will be part of a main program component and will not be linked as part of a shareable object Since symbols defined in the main program cannot be preempted this allows the compiler to treat symbols declared with default visibility as though they have protected visibility i e fminshared implies fvisibility protected Also the compiler need not generate position independent code for the main program It can use absolute addressing which may reduce the size of the global offset table GOT and may reduce memory traffic fvisibility keyword and fvisibility keyword file Specifies the default visibility for
70. more MODULE statements e A shareable library such as mylib so if you use the shared option You control the production of these files by specifying the appropriate options on the command line The compiler generates a temporary object file for each source file unless you specify the c option The linker is then invoked to link the object files into one executable program file and the temporary object files are deleted If you specify the c option the object files are created and retained in the current working directory You must link the object files later by using a separate ifort command This allows incremental compilation of a large application perhaps by means of a makefile processed by the make command If fatal errors are encountered during compilation or if you specify certain options such as c linking does not occur Note To compile all objects over the entire program use the ipo option To specify a file name for the executable program file other than a out use the o output option where output specifies the file name The following command requests a file name of prog1 out for the source file test1 f 25 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I ifort o progl out testl f If you specify the c option with the o output option you rename the object file not the executable program file If you specify lt and omit the o output option the compiler names the object f
71. name of a NAMELIST e REC specifies a record number for direct access When using nonadvancing VO use the ADVANCE EOR and SIZE specifiers When using the REWRITE statement you can use the UNIT FMT ERR and IOSTAT specifiers Record Access Record access refers to how records will be read from or written to a file regardless of the file s organization Record access is specified each time you open a file it can be different each time The type of record access permitted is determined by the combination of file organization and record type For instance you can e Add records to a sequential file with ORGANIZATION SEQUENTIAL and POSITION APPEND or use ACCESS APPEND e Add records sequentially by using multiple WRITE statements close the file and then open it again with ORGANIZATION SEQUENTIAL and ACCESS SEQUENTIAL or ACCESS DIRECT if the sequential file has fixed length records Sequential Access Sequential access transfers records sequentially to or from files or I O devices such as terminals You can use sequential I O with any type of supported file organization and record type 175 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I If you select sequential access mode for files with sequential or relative organization records are written to or read from the file starting at the beginning of the file and continuing through it one record after another A particular r
72. names or to override the automatic conversion of names to all lowercase by Fortran C uses the same calling convention and argument passing techniques as C but naming conventions differ because of C decoration of external symbols When the C code resides in a cpp file created when you select C C file from the integrated development environment C name decoration semantics are applied to external names often resulting in linker errors The extern C syntax makes it possible for a C module to share data and routines with other languages by causing C to drop name decoration The following example declares prn as an external function using the C naming convention This declaration appears in C source code extern C void prn To call functions written in Fortran declare the function as you would in C and use a C linkage specification For example to call the Fortran function FACT from C declare it as follows extern C int FACT int n The extern C syntax can be used to adjust a call from C to other languages or to change the naming convention of C routines called from other languages However extern C can only be used from within C If the C code does not use extern C and cannot be changed you can call C routines only by determining the name decoration and generating it from the other language Such an approach should only be used as a last resort because the decoration scheme is
73. not rely on the absence or characteristics of any features or instructions marked reserved or undefined Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them The Intel Fortran Compiler product may contain software defects which may cause the product to deviate from published specifications Current characterized software defects are available on request Intel SoeedStep Intel Thread Checker Celeron Dialogic i386 i486 iCOMP Intel Intel logo Intel386 Intel486 Intel740 IntelDX2 IntelDX4 IntelSX2 Intel Inside Intel Inside logo Intel NetBurst Intel NetStructure Intel Xeon Intel XScale Itanium MMX MMX logo Pentium Pentium II Xeon Pentium Ill Xeon Pentium M and VTune are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries Other names and brands may be claimed as the property of others Copyright O Intel Corporation 2003 2004 Portions O Copyright 2001 Hewlett Packard Development Company L P Table Of Contents About the Intel Fortran Compiler iis see eed ee AA ee ee Ge Ee ee ee RR ee 13 What s New in This Release is see ee AA ee ee EE EA ee ee RA ee ee Re ee ee 15 Improvements and New Features in Version B 1 ee ee ee ee se ee ER ER ee ee ee 15 Improvements and New Features in Version 8 0 esse ee ee ee ee ER ER ER ee
74. occurs e With fixed length records RECORDTYPE FIXED all records are the same size If the size of an VO record being written is less than the record length RECL extra bytes are added padding in the form of spaces for a formatted record or zeros for an unformatted record e With other record types the fields present are written and those omitted are not written might result in a short record If the output statement specifies more data than the record can contain an error occurs as follows e With formatted or unformatted output using fixed length records if the items in the output statement and its associated format specifier result in a number of bytes that exceeds the maximum record length RECL an error occurs e With formatted or unformatted output not using fixed length records if the items in the output statement and its associated format specifier result in a number of bytes that exceeds the maximum record length RECL the Intel Fortran RTL attempts to increase the RECL value and write the longer record To obtain the RECL value use an INQUIRE statement e For list directed output and namelist output if the data specified exceeds the maximum record length RECL another record is written User Supplied OPEN Procedures USEROPEN Specifier You can use the USEROPEN specifier in an Intel Fortran OPEN statement to pass control to a routine that directly opens a file The called routine can use system call
75. of data from internal binary form within a 157 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I program to external readable character form in the records or vice versa e List directed and namelist VO statements are similar to formatted statements in function However they use different mechanisms to control the translation of data formatted I O statements use explicit format specifiers and list directed and namelist VO statements use data types e Unformatted VO statements do not contain format specifiers and therefore do not translate the data being transferred important when writing data that will be read later Formatted list directed and namelist VO forms require translation of data from internal binary form within a program to external readable character form in the records Consider using unformatted I O for the following reasons e Unformatted data avoids the translation process so I O tends to be faster e Unformatted data avoids the loss of precision in floating point numbers when the output data will subsequently be used as input data e Unformatted data conserves file storage space stored in binary form To write data to a file using formatted list directed or namelist I O statements specify FORM FORMATTED when opening the file To write data to a file using unformatted VO statements specify FORM UNFORMATTED when opening the file Data written using formatted list directed
76. or a PAUSE statement A value of zero is returned to the shell e The program stops because of a signal that is caught but does not allow the program to continue A value of 1 is returned to the shell e The program stops because of a severe run time error The error number for that run time error is returned to the shell e The program stops with a CALL EXIT statement The value passed to EXIT is returned to the shell Forcing a Core Dump for Severe Errors You can force a core dump for severe errors that do not usually cause a core file to be created Before running the program set the decfort_dump_flag environment variable to any of the common TRUE values Y y Yes yEs True and so forth to cause severe errors to create a core file For instance the following C shell command sets the decfort_dump_flag environment variable setenv decfort dump flag y The core file is written to the current directory and can be examined using a debugger E Note If you requested a core file to be created on severe errors and you don t get one when expected the problem might be that your process limit for the allowable size of a core file is set too low or to zero See the man page for your shell for information on setting process limits For example the C shell command limit with no arguments will report your current settings and 234 Error Handling limit coredumpsize unlimited will raise the allowable limit to your current system max
77. other operating systems such as big endian unformatted data files OpenVMS systems run time behavior and Microsoft Fortran PowerStation See Also Data Options 52 Compiler Options Language Options Descriptions of Compatibility Options 1 Default Off Alternate syntax onetrip Specifies that the compiler should execute DO loops at least once See also no f66 assume no bscc Default assume nobscc Alternate syntax nbs is the same as assume nobscc Tells the compiler to treat the backslash character N as a C style control escape character in character literals The default assume nobscc assume no BackSlashControlCharacters tells the compiler to treat the backslash character as anormal character instead of a control character in character literals This option is useful when transferring programs from non UNIX environments such as Open VMS convert Default convert native Specifies the format of unformatted files containing numeric data Possible values are convert big endian convert cray convert ibm convert little endian convert native convert vaxg convert vaxd See Supported Native and Nonnative Numeric Formats no f77rtl 53 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Default nof77rtl Specifies the use of FORTRAN 77 run time behavior If you use the default value nof77rt1 Intel Fortran run time behavior is used Specifying this opt
78. placement in argument list 215 223 301 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I returning character data types 223 REWIND statement 156 174 REWRITE statement 156 157 174 rules for default file names 167 for default pathnames 167 run time environment variables 249 run time checking 103 run time error messages 80 EEE EE 257 run time errors handle RS org 235 Run Time Library RTL AMO NOD EE 125 Run Time Library RTL default error DOCESSING ude 231 Run Time Library RTL default exception handler 0 239 run time Options eee 103 S S compiler option ee ee 99 S Option eo dg episke 22 302 safe cray ptr compiler option 62 save compiler option 0 62 scalar_rep compiler option 86 seratehiles Lara don 160 searching for include files ee ee 34 for module mod files 34 segmented record type 161 163 segmented records esse 186 sequential access TOP POCONOS DE eee 175 sequential file organization 159 setenv command 28 setting breakpoints rnnnnnnnnnnnnrn 109 shared compiler option 77 shared libraries creating ees ee ee 43 WAS PAIN varene 43 restrictions ae 43 shared librarieS iese ees 241 shared file checKing sesse 177 shared
79. prior to the final link stage leaving an optimized assembly file The default listing name is ipo out s See also this topic in Volume II Capturing Intermediate Outputs of IPO ipo separate Default Off Creates one object file per source file This option overrides any value that was set with ipo n ivdep parallel Itanium based systems only Default Off 92 Compiler Options Specifies that there is no loop carried memory dependency in the loop where an IVDEP directive is specified This technique is useful for some sparse matrix applications See also this topic in Volume Il Memory Dependency with the IVDEP Directive nolib_inline Default On Disables inline expansion of intrinsic functions On Default 02 unless you specify debug in which case the default is 00 Specifies the code optimization for application types Possible values are e 00 Disables all optimizations This is the default if you specify debug with no keyword Specifying this option causes certain warn options to be ignored e O1 Alternate syntax on IA 32 systems 02 or 0O Maximize speed disables some optimizations that increase code size for a small speed benefit This option enables global optimization This includes data flow analysis code motion strength reduction and test replacement split lifetime analysis and instruction scheduling Specifying 02 includes the optimizations performed by 01 Note that on IA 32 syst
80. record type 161 163 fixed length records 186 floating point options ese 69 floating point representations 138 fltconsistency compiler option 69 fminshared compiler option 79 fnsplit compiler option 86 FOR IOS_ARRSIZEOVF error MESSAGE EERS ER AE ED 257 FORS IOS ASSERTERR error MESSAGE ads 257 FOR IOS_ATTACCNON error MESSage ese Rek Rea Ke 257 FORS IOS BACERR error message ME EO NE 257 FORS IOS BRK RANGE error MESSage ese aka RR Ke EK Ak Ee 257 FORS IOS BRK RANGE 2 error MESSAGE RM iek EE ee 257 FORS IOS BUG CHECK error MESSAGE ER EE GES EER RES NEE 257 FORS IOS CANSTAFIL error MESSAGE ees eke ERA Ke 257 FORS IOS CAOVEEXI error MESSJJOE ae ask 257 FOR IOS_CLOERR error message een eee 257 FORS IOS DELERR error message OE EE 257 FORSIOS DIV error message 257 FOR IOS DUPFILSPE error MESSage sees ERA Ke ke 257 FORS IOS ENDDURREA error MESSAGE He ef 257 FORS IOS ENDFILERR error MESSage sesse ER AR EE 257 FOR IOS ENDRECDUR error MESSAGE ke 257 FOR IOS ERRDURREA error MESSAGE ee EKKE KA Ee 257 FORS IOS ERRDURWRI error MESSAGE ER RGN N 257 FORS IOS FILNAMSPE error MESSage Re Rek RA AE 257 FORS IOS FILNOTFOU error MESSAGE Re ol igk ek 257 FORS IOS FINERR error message RE EE EDE 257 FORS IOS FLOCONFAI error MESSAGE Lee 257 FORS IOS FLODIVOEXC error Message eae ane 257 FORS IOS FLOINVEXC error MESSAGE
81. report to stderr See also this topic in Volume II Optimizer Report Generation opt_report_file file Default Off Generates an optimization report and specifies the file name for the report You do not need to specify opt_report if you use this option See also this topic in Volume II Optimizer Report Generation opt_report_help Default Off Displays the optimization phases available for reporting See also this topic in Volume II Optimizer Report Generation opt report level min med max Default opt report level min Specifies the detail level of the optimization report See also this topic in Volume II Optimizer Report Generation 94 Compiler Options opt report phase phase Default Off Specifies the optimization phase to generate the report for Can be specified multiple times on the command line for multiple optimizations See also this topic in Volume II Optimizer Report Generation opt report routine routine Default Off Generates reports from all routines with names containing routine as part of their name If the optional routine is not specified reports from all routines are generated See also this topic in Volume II Optimizer Report Generation par_threshold n Default par threshold100 Sets a threshold for the auto parallelization of loops based on the probability of profitable parallel execution n can be from 0 through 100 n 0 loops get auto parallelized regardless o
82. s Guide Vol I You can use the module path option to specify the directory where to create the module files This path is also used to locate module files If you don t use this option module files are created in the current directory You need to make sure that the module files are created before they are referenced by another program or subprogram Compiling Programs with Modules If a file being compiled has one or more modules defined in it the compiler generates one or more mod files For example a file a 90 contains modules defined as follows module test integer a contains subroutine f end subroutine end module test module payroll end module payroll This compiler command ifort c a 90 generates the following files e test mod e test o e payroll mod e payroll o The mod files contain the necessary information regarding the modules that have been defined in the program a 90 If the program does not contain a module no mod file is generated For example test2 90 does not contain any modules This compiler command ifort c test2 90 produces just an object file test2 0 32 Building Applications For another example assume that file1 f90 contains one or more modules and file2 90 contains one or more program units that access these modules with the USE statement The sources can be compiled and linked by this command ifort filel f90 file2 90 Working with Mul
83. systems only e 2 Optimize for Itanium 2 processors tanium based systems only e 5 Optimize for Intel Pentium and Pentium with MMX technology processors IA 32 systems only e 6 Optimize for Intel Pentium Pro Pentium Il and Pentium III processors IA 32 systems only e 7 Optimize for Intel Pentium 4 Intel Xeon Intel Pentium M processors and Intel Pentium 4 processors with Streaming SIMD Extensions 3 SSE3 instruction support IA 32 systems only For Intel EM64T systems the only available option is tpp7 97 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I unroll n Default unro11 lets the compiler decide Specifies the maximum number of times to unroll a loop Possible values are e unroll Lets the compiler decide e unrollO Disables loop unrolling Note This is the only value allowed on Itanium based systems all other values are ignored e unrolln Sets nas the maximum number of times a loop can be unrolled x K W N B P IA 32 and Intel EM64T systems only Default None Lets you target your program to run on a specific Intel processor The resulting code might contain unconditional use of features that are not supported on other processors Possible values and the processors the code is optimized for are e xK Intel Pentium Ill and compatible Intel processors e xW Intel Pentium 4 and compatible Intel processors e xN Intel Pentium 4 and c
84. that standard libraries and startup files should be used when linking This option exists for GNU compatibility reasons There is no stdlib option shared Default Off Specifies that the compiler should build a dynamic shared object DSO instead of an executable See also Creating Shared Libraries shared libcxa Links the Intel provided libcxa C library dynamically By default the 1ibcxa library is linked dynamically All C related libraries supplied by Intel are linked in dynamically by default This option is useful when you are using the static option and you want to override the effect of the static option for the libcxa library This option has the opposite effect of static libcxa static libcxa Links the Intel provided libcxa C library statically By default the 1ibcxa library is linked dynamically All C related libraries supplied by Intel are linked in dynamically by default Use this option to link libcxa statically while still allowing the standard libraries to be linked in by the default behavior See also shared libcxa option static Default Of Alternative syntax non shared 78 Compiler Options Prevents linking with shared libraries so files Miscellaneous Options These options are described in alphabetical order ansi alias Default ansi alias Enables the compiler to assume that the program adheres to the Fortran 95 Standard type aliasability rules For example
85. the Intel Fortran run time library RTL does You can use the idb commands catch and ignore to control whether idb catches signals or ignores them e When idb catches a sigOnal an ido message is displayed and execution stops at that statement line The error handling routines provided by the RTL are not called At this point you can examine variables and determine where in the program the signal has occurred e When idb ignores a signal the signal is passed to the RTL This allows the handling and display of run time signal messages in the manner requested during compilation To obtain the appropriate run time error message when debugging a program that generates a signal especially one that allows program continuation you might need to use the ignore command before running the program For instance use the following command to tell the debugger to ignore floating point signals and pass them through to the RTL idb ignore fpe In cases where you need to locate the part of the program causing a signal consider using the where command Locating Unaligned Data Unaligned data can slow program execution You should determine the cause of the unaligned data fix the source code if necessary and recompile and relink the program If your program encounters unaligned data at run time to make it easier to debug the program you should recompile and relink with the fpen option to control the handling of exceptions To determine t
86. the random number generator based on the algorithm of Park and Miller which is the generator used by Compaq Fortran Version 7 used the Marsaglia random number generator Both of these random number generators are compatible with the Fortran 90 standard In addition Version 8 x uses different algorithms for the RANDOM NUMBER and RANDOM SEED intrinsics compared to Version 7 and different algorithms are used for these intrinsics on IA32 and Itanium based systems Documentation Information Some documentation has been moved In particular e The Intel Fortran User s Guide now has separate parts for Building Applications and Optimizing Applications 256 Reference Information e Intel Fortran language information previously described in the Intel Fortran Programmer s Reference including intrinsics procedures and directives is now described in the online Language Reference e All Intel Fortran language elements and library routines are described in this online help file allowing easy lookup of reference information Version 7 1 Features Not Available in Intel Fortran Version 8 x The following Intel Fortran Version 7 1 features are not available in Intel Fortran Version 8 x e IMPLICIT AUTOMATIC STATIC statements e The Intel Fortran 8 x run time library system s ability to work with the Itanium processor simulator Run Time Error Messages The table below lists the errors processed by the Intel Fortran run time library RTL
87. to Fortran Run Time Library FOR IOS_INVARGFOR The compiler passed an invalid or improperly coded argument to the Intel Fortran RTL This can occur if the compiler is newer than the RTL in use severe 51 Inconsistent file organization FOR IOS_INCFILORG The file organization specified in an OPEN statement did not match the organization of the existing file severe 53 No current record FOR IOS NO CURREC Attempted to execute a REWRITE statement b to rewrite a record when the current record was undefined To define the current record execute a successful READ statement You can optionally perform an INQUIRE statement on the logical unit after the READ statement and before the REWRITE statement No other operations on the logical unit may be performed between the READ and REWRITE statements severe 55 DELETE error FOR IOS_DELERR An error condition was detected by the Intel Fortran RTL VO system during execution of a DELETE statement severe 57 FIND error FOR IOS_FINERR The Intel Fortran RTL VO system detected an error condition during execution of a FIND statement info 58 Format syntax error at or near XX FOR IOS_FMTSYN Check the statement containing xx a character substring from the format string for a format syntax error For information about FORMAT statements see the Intel Fortran Language Reference Manual Olsevere 59 List directed I O syntax error FOR IOS_LISIO_SYN The d
88. to access any external file It returns the length of a record for a list of variables that would be used for unformatted WRITE READ and REWRITE statements The following INQUIRE statement returns the maximum record length of the variable list in variable RECLENGTH This variable is then used to specify the RECL value in the OPEN statement NOUIRE IOLENGTH I RECLENGTH A B H OPEN FILE test dat FORM UNFORMATTED RECL I_RECLENGTH UNIT 9 For an unformatted file the IOLENGTH value is returned using 4 byte units unless you specify the assume byterec1 option to request 1 byte units Closing a File CLOSE Statement Usually any external file opened should be closed by the same program before it completes The CLOSE statement disconnects the unit and its external file You must specify the unit number UNIT specifier to be closed 173 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I You can also specify e Whether the file should be deleted or kept STATUS specifier e Error handling information ERR and IOSTAT specifiers To delete a file when closing it e Inthe OPEN statement specify the ACTION keyword such as ACTION READ Avoid using the READONLY keyword because a file opened using the READONLY keyword cannot be deleted when it is closed e Inthe CLOSE statement specify the keyword STATUS DELETE If you opened an external file and did an inquire by unit
89. uses the standard stack trace support in the Intel Fortran run time system to produce the same output that the run time system produces for unhandled errors 239 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I and exceptions severe error message The TRACEBACKQQ subroutine generates a stack trace showing the program call stack as it was leading up to the point of the call to TRACEBACKQQ The error message string normally included from the run time support is replaced with the user supplied message text or omitted if no user string is specified Traceback output is directed to the target destination appropriate for the application type just as it is when traceback is initiated internally by the run time support In the most simple case a user can generate a stack trace by coding the call to TRACEBACKQQ with no arguments CALL TRACEBACKQQ This call causes the run time library to generate a traceback report with no leading header message from wherever the call site is and terminate execution You can specify arguments that generate a stack trace with the user supplied string as the header and instead of terminating execution return control to the caller to continue execution of the application For example CALL TRACEBACKQQ STRING Done with pass 1 USER_EXIT_CODE 1 By specifying a user exit code of 1 control returns to the calling program Specifying a user exit code with a positive val
90. values 4 3 2 5 and 2 The first number indicates the number of data items that follow 2 Enters a loop in which it copies the square of each nonzero integer into another array OUTARR 3 Prints the number of nonzero elements in the original sequence and the square of each such element This example assumes that the program was executed without array bounds checking set by the check bounds command line option When executed with array bounds checking a run time error message appears When you run SQUARES it produces the following output regardless of the number of nonzero elements in the data file squares Number of nonzero elements is 0 The logic error occurs because variable K which keeps track of the current index into OUTARR is not incremented in the loop on lines 9 through 13 The statement K K 1 should be inserted just before line 11 The following example shows how to start the debugging session and how to use the character cell interface to idb to find the error in the sample program shown earlier Comments keyed to the callouts at the right follow the example ifort g o squares squares f90 1 114 Debugging Using idb idb squares 2 Linux Application Debugger for xx bit applications Version x x Build xxxx object file name squares reading symbolic informat
91. 0 1 when squares 12 0x120001lae0 2 1 when squares 12 0x120001lae0 3 1 when squares 12 O0x120001ae0 4 Number of nonzero elements is 4 Element 1 has value 9 Element 2 has value 4 Element 3 has value 25 Element 4 has value 4 Process has exited with status 0 idb 9 o LPG 116 quit 18 On the command line the g option directs the compiler to write the symbol information associated with SQUARES into the object file for the debugger It also disables most optimizations done by the compiler to ensure that the executable code matches the source code of the program The shell command idb squares runs the debugger which displays its banner and the debugger prompt idb This command specifies the executable program as a file named squares You can now enter debugger commands After the idb squares command execution is initially paused before the start of the main program unit before program SQUARES in this example The list 1 9 command prints lines 1 through 9 The command stop at 8 sets a breakpoint 1 at line 8 The run command begins program execution The program stops at the first breakpoint line 8 allowing you to examine variables N and K before program completion The step advances the program to line 9 The step command ignores source lines that do not result in executable code also by default the debugger identifies the source line at which execution is paused To
92. 0 ifort c test1 f 90 test2 0 ml mod test2 f90 ifort c test2 f90 test3 0 ml mod test3 f90 ifort c test3 f90 Searching for Include and mod Files Include files are brought into a program with the include preprocessor directive or a Fortran INCLUDE statement Directories are searched for include files in this order 1 Directory of the source file that contains the include 2 Directories specified by the Idir options 3 Current working directory 4 Directories specified with the FPATH environment variable The locations of directories to be searched are known as the include file path More than one directory can be specified in the include file path 34 Building Applications A module mod file is specified in a program by a USE statement Module files can be located in multiple directories Directories are searched for mod files in this order Directory of the source file that contains the USE statement Directories specified by the module path option Directories specified by the Idir option Current working directory Directories specified with the FPATH environment variable oie Specifying and Removing an Include File Path You can use the Idir option to indicate the location of include files and module files To prevent the compiler from searching the default path specified by the FPATH environment variable use the X option You can spe
93. 0 ifort c calc aver f90 ifort c main f90 ifort o calc main o array calc o calc aver o In this sequence of commands e The c option prevents linking and retains the o files e The first command creates the files array calculator mod and array_calc o the name in the MODULE statement determines the name of module file array_calculator mod Module files are written into the current working directory e The second command creates the file calc_aver o e The third command creates the file main o and uses the module file array_calculator mod e The last command links all object files into the executable program named calc To link files use the ifort command instead of the 1a command The order in which the file names are specified is significant This ifort command 42 Building Applications e Compiles the file array calc f90 Which contains the module definition and creates its object file and the file array calculator mod e Compiles the file calc_aver 90 which contains the external function CALC_AVERAGE e Compiles the file main 90 main program The USE statement references the module file array_calculator mod e Uses id to link the main program and all object files into an executable program file named calc Running the Sample Program If your path definition includes the directory containing calc you can run the program by simply entering its name calc When running the sample program the PRINT and R
94. 00rourtfenorenorfovnrennrfrroronnn Byte Order OT 1003 1002 1001 1000 di L 5 B B Bue Order C 010011 0o0reoorfovnroonrfrarnonn Byte Order OOOO TIOoOo tooo EE EES EEN EE EE EN EE 1000 1001 1002 1003 ZK 66544 GE Moving unformatted data files between big endian and little endian computers requires that the data be converted Intel Fortran provides the capability for programs to read and write unformatted data originally written using unformatted I O statements in several nonnative floating point formats and in big endian INTEGER or floating point format Supported nonnative floating point formats include VAX little endian floating point formats supported by VAX FORTRAN standard IEEE big endian floating point format found on most Sun Microsystems systems and IBM RISC System 6000 systems IBM floating point formats associated with the IBM s System 370 and similar systems and CRAY floating point formats Converting unformatted data instead of formatted data is generally faster and is less likely to lose precision of floating point numbers The native memory format includes little endian integers and little endian IEEE floating point formats S_floating for REAL KIND 4 and COMPLEX KIND 4 declarations T_floating for REAL KIND 8 and COMPLEX KIND 8 declarations and IEEE X_floating for REAL KIND 16 and COMPLEX KIND 16 declarations The keywords for supported nonnative unformatted file formats and their data types are l
95. 1 2 3 4 5 idb To display the entire object use the print command with the object name For example idb print Z Record Variables To display the value of a field in a record structure enter the variable name as the record name a delimiter either a period or a percent sign and the field name To view all fields in a record structure enter the name of the record structure such as REC instead of REC CHR or REC CHR in the previous example Pointer Variables Intel Fortran supports two types of pointers e Fortran 95 90 pointers standard conforming 119 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e Integer pointers extension to the Fortran 95 90 standards Fortran 95 90 Pointers Fortran 95 90 pointers display their corresponding target data with a print command Comments keyed to the callouts at the right follow the example ifort g point f90 idb a out Linux Application Debugger for xx bit applications Version X X Build xxxx object file name a out Reading symbolic information done idb stop in ptr 1 stop in ptr idb list 1 13 1 program ptr 2 3 integer target x 3 4 integer pointer xp 5 6 x 1 2 3 7 xp gt x 8 9 print x x 10 print RD Xp Ed 12 end idb run 1 stopped at ptr 6 0x120001838 6 x 1l 2 3 idb whatis x int x 1 3
96. 1 The first subrecord that makes up a record has a trailing length field with a sign bit value of 0 If the value of the sign bit is 1 the length of the record is stored in twos complement notation The figure below shows the record layout of variable length records that are greater than 2 gigabytes 187 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Trailing Subrecord 1 User Data Sign bit 0 Trailing L ngth Subrecords 2 to N 1 User Data Field Sign bite Trailing Subrecord N User Data Sign bit 1 4 _ _ Subrecord length from length field 4 Files written with variable length records by Intel Fortran programs usually cannot be accessed as text files Instead use the Stream_LF record format for text files with records of varying length Segmented Records A segmented record is a single logical record consisting of one or more variable length unformatted records in a sequentially organized disk file Unformatted data written to sequentially organized files using sequential access is stored as segmented records by default Segmented records are useful when you want to write exceptionally long records but cannot or do not wish to define one long variable length record perhaps because virtual memory limitations can prevent program execution By using smaller segmented records you reduce the chance of problems caused by virtual memory limitations on systems on which the p
97. 1A 32 Compiler Files Summary The following table shows files that are installed for use by the IA 32 compiler in opt intel fc 80 bin File Description o For a list of the files installed in 1ib see Libraries Provided by Intel Fortran Key Itanium Based Compiler Files Summary The following table shows files that are installed for use by the Itanium based compiler in opt intel_fc_80 bin File Description Executable for the Code coverage tool efc For compatibility with previous releases For compatibility with previous releases For compatibility with previous releases Executable used by the compiler 252 Reference Information profdcg Utility used for Profile Guided Optimizations profmerge Utility used for Profile Guided Optimizations proforder Utility used for Profile Guided Optimizations tselect Test prioritization tool uninstall sh Uninstall utility xiar Tool used for Interprocedural lg Optimizations xild Tool used for Interprocedural id Optimizations For a list of files installed in 1ib see Libraries Provided by Intel Fortran Compiler Limits The amount of data storage the size of arrays and the total size of executable programs are limited only by the amount of process virtual address space available as determined by system parameters The table below shows the limits to the size and complexity of a single Intel Fortran program unit and to individual statements
98. 4 Technology Edition for Linux Release Notes See also How to Use This Document What s New in This Release Improvements and New Features in Version 8 1 This release contains several improvements and new features including the new predefined preprocessor symbol INTEL COMPILER BUILD DATE anda number of new compiler options For a complete list of new options in this release see New Compiler Options in the Intel Fortran Compiler Options Quick Reference Guide This release does not require you to recompile object and mod files that were compiled with Intel Fortran Compiler 8 0 Z Note Please refer to the Release Notes for the most current information about features implemented in this release Improvements and New Features in Version 8 0 The 8 0 release contains a number of improvements and new features including e Numerous new compiler options and associated features providing more complete compatibility with Compaq Visual Fortran e Fortran 2000 Allocatable Components of Derived Types extension e Traceback option providing source correlation to the cause of severe run time errors e Test prioritization tool for test selection based on prior execution profiles of an application e Code coverage tool for visual highlighting of application coverage of a particular workload e Intel Debugger IDB support for Itanium based systems Z Note Please refer to the Release Notes for the most current information about features
99. 8 and writes it to unit 29 using unformatted VO statements You want the program to read nonnative big endian IEEE floating point format from unit 28 and write that data in native little endian format to unit 29 In this case the data is converted from big endian IEEE format to native little endian IEEE memory format when read from unit 28 and then written without conversion in native little endian IEEE format to unit 29 Without requiring source code modification or recompilation of this program the following command sequence sets the appropriate environment variables before running the program usr users leslie convieee setenv FORT CONVERT28 BIG ENDIAN setenv FORT CONVERT29 NATIVE usr users leslie convieee The following figure shows the data formats used on disk and in memory when the example file usr users leslie convieee is run after the environment variables are set Sample Unformatted File Conversion Native Memory Formats Little Endian Integers and Little Endian IEEE 5 float and T float Formats Unit 28 Read Big Endian IEEE and Convert ta Native Formats Unit 29 Da Not Convert Write Native Memory Formats Little Endian IEEE Unformatted Data Files om Disk ZE BS2EA GE 147 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I This method takes precedence over other methods Environment Variable FORT CONVERT ext or FORT CONVERT ext Method You can use t
100. AA ee ee ee ee 232 Values Returned to the Shell at Program Termination iese ee ee ee 234 Forcing a Core Dump for Severe Errors iese eed ee ee ee se see ee ee ee ke ee ee ee ee 234 Handling Run Time ENOS SE 235 Using the END EOR and ERR Branch Specifiers sesse sees se ee ese 235 Using the IOSTAT Specifier iese ee ee se AA ek ee ee Re EA ee ee Re AA ee ee 236 signalHandind ER EE RE GE GE AD RD T 237 Overriding the Default Run Time Library Exception Handler iese 239 Obtaining Traceback Information with TRACEBACKOO esse sesse 239 Creating and Using Libraries vas EE EER SEE GE a DEE eg ees 241 Creating and Using Libraries OverVvieW sees ee ee ee AA ee ee Re EE ee ee ee 241 Creating IOAN Sica es tees NR RE EE Ne 241 Static Libraries iss ee de EE ee ee RA RE Ee ee ee AR Re ee ee ee RR ER ee ee ee ee ee ee 241 shared LiDraries EI GAR 241 Libraries Provided by Intel Fortran iese ee ee se se ee ee AA ee ee ee ee 242 Portability LID tahy sich ie EE DE Seals der 243 Portability Library OVErVle Wis SESDE EE GE GE DE GE DE Ee De GE 243 Using the Portability Library libifport a iese ee ee ee ER Ee ee ee de ER Ee ee ee ee 243 xi Table Of Contents Portability FROUTINGS varselet 244 Math 9 EEE EE EE EE 247 Reference Information aa NES 249 Compile Time Environment VariableS iese ss ee ee ee ER Re ee ee ee Re ee ee ee 249 Run Time Environment Variables iese sesse ee ee ee Ee
101. Alternate syntax lowercase e as is Causes the compiler to distinguish case differences in identifiers and to preserve the case of external names Instead of using this option consider using the ALIAS directive for the specific name needed Floating Point Options The floating point options let you specify how you want floating point data to be treated 69 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I See also Optimization Options Descriptions of Floating Point Options assume no minusO Default assume nominus0 Tells the compiler to use Fortran 95 standard semantics for the treatment of the IEEE floating point value 0 0 in the SIGN intrinsic if the processor is capable of distinguishing the difference between 0 0 and 0 0 and to write a value of 0 0 with a negative sign on formatted output The default assume nominus0 tells the compiler to use Fortran 90 77 standard semantics in the SIGN intrinsic to treat 0 0 and 0 0 as 0 0 and to write a value of 0 0 with no sign on formatted output no fltconsistency Default nofltconsistency Alternate syntax mp Enables improved floating point consistency during calculations fltconsistency disables inlining of math library functions This option limits floating point optimizations and maintains declared precision Floating point operations are not reordered and the result of each floating point operation is stored into the target vari
102. Cand C function void function There are some important differences in the way languages implement routines Argument passing naming conventions and other interface issues must be thoughtfully and consistently reconciled between any two languages to prevent program failure and indeterminate results However the advantages of mixed language programming often make the extra effort worthwhile A summary of a few mixed language advantages and restrictions follows e Fortran Assembly Language Assembly language routines are small and execute very quickly because they do not require initialization as do high level languages like Fortran and C Also they allow access to hardware instructions unavailable to the high level language user In a Fortran assembly language program compiling the main routine in Fortran gives the assembly code access to Fortran high level procedures and library functions yet allows freedom to tune the assembly language routines for maximum speed and efficiency The main program can also be an assembly language program e Fortran C or C Generally Fortran C programs are mixed to allow one to use existing code written in the other language Either Fortran or C can call the other so the main routine can be in either language This section provides an explanation of the keywords attributes and techniques you can use to reconcile differences between Fortran and other languages Adjusting calling conventio
103. Conventions in Mixed Language Programming Adjusting Naming Conventions in Mixed Language Programming Overview The ATTRIBUTES option C determines naming conventions as well as calling conventions Calling conventions specify how arguments are moved and stored naming conventions specify how symbol names are altered when placed in a o file Names are an issue for external data symbols shared among parts of the same program as well as among external routines Symbol names such as the name of a subroutine identify a memory location that must be consistent among all calling routines Parameter names names given in a procedure definition to variables that are passed to it are never affected Names are altered because of case sensitivity in C lack of case sensitivity in Fortran name decoration in C or other issues If naming conventions are not reconciled the program cannot successfully link and you will receive an unresolved external error See these topics C C Naming Conventions 202 Programming with Mixed Languages Naming Conventions for Fortran C and C Reconciling the Case of Names Fortran Module Names and ATTRIBUTES C C Naming Conventions C and C preserve case sensitivity in their symbol tables while Fortran by default does not a difference that requires attention Fortunately you can use the Fortran directive ATTRIBUTES ALIAS option to resolve discrepancies between names to preserve mixed case
104. D EE Ee Ee 118 Common Block variables ss EE N averted eter ee ES 118 Derived Type Variables iese se see ee dee ee RR Ee ee ee ee Re ee ee ee ee de ER ee ee ee ee 119 Record Vania DIGS ss ES EE Ee EE NE SE ee ates EN cette sl EG N 119 Pointer Variablees RE SR wees ee Se BE exec Ee Ge De ee Ee AE OE 119 Array Varlables vein nites ein iene Re Ga kerk 121 COMPIG lt NaNdbBesu seer 123 Data IV BGS ER KS EE N EG rea ovens Da ed Ge ED Re EO 124 vii Table Of Contents Expressions in Debugger CommandS sees esse es see dee ee ee RR ee ee ee ee ee ee 124 Fortran Operators ES EE IS GR EE aaa se AE ee ast 124 Procedures ape 124 Debugging Mixed Language Programs rrnrrnnnnnrnrrnnnenvnnnnnrnnrnnnrrennnnnnnnn 125 Debugging a Program that Generates a Signal ccc cseeeceeeeeeeeeeeeeeeees 125 Locating Unaligned Data EE tela tee elt eae tele BE De 126 Data NANO SNE 129 Data Representation EE EE RD EE eat fa 129 Data Representation Overview ie ee ee ee ee Re AA ee ee ed ee 129 HittitisieData PES 129 Integer Data Representations esse ee ee RE ee ee RR AA ee ee ee 131 Logical Data Representations iis ee ee ee RR ER Ee ee AR ER Ee ee ee ee 133 Native IEEE Floating Point RepresentationS iese ss see ede ee ees se ee eed ee ee 134 Character Representation vaar avregnet 140 Hollerith Representation is un RE amt ee tie ears ecto eet ee 140 Converting Unformatted Data EE REEKS ER talent ERGE GE ae k
105. D SUBROUTINE MY SUB END INTERFACE This code declares a subroutine named my sus with the C property and the external name my sub set with the ALIAS property For another example the following declaration assumes the subroutine is called with the C calling convention SUBROUTINE CALLED_FROM_C A IDECS ATTRIBUTES C CALLED_FROM_C INTEGER A The following table summarizes the effect of the most common Fortran calling convention directives Calling Conventions for ATTRIBUTES Properties Argument Default C C REFERENCE 199 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Scalar Reference Value Reference Scalar value Value Value Value Scalar Reference Reference Reference reference String Reference either String 1 1 Reference either Len End or Len End or Len Mixed Len Mixed String value Error String 1 1 String 1 1 String Reference either No Reference No Reference No Len reference Len or Len Mixed Len Array Reference Reference Reference Array value Error Error Error Array Reference Reference Reference reference Derived Type Reference Value size Reference dependent Derived Type Value size Value size Value size dependent value dependent dependent Derived Type Reference Reference Reference reference F90 Pointer
106. Descriptor Descriptor Descriptor F90 Pointer Error Error Error value F90 Pointer Descriptor Descriptor Descriptor reference The procedure name is all lowercase for all the calling conventions The terms in the above table mean the following value Argument assigned the VALUE attribute reference Argument assigned the REFERENCE attribute Value The argument value is pushed on the stack All values are padded to the next 4 byte boundary 200 Programming with Mixed Languages Reference On IA 32 systems the 4 byte argument address is pushed on the stack On ltanium based systems the 8 byte argument address is pushed on the stack Len End or Len Mixed For certain string arguments e Len End applies when nomixed str len argis set The length of the string is pushed by value on the stack after all of the other arguments This is the default e Len Mixed applies when mixed str len argis set The length of the string is pushed by value on the stack immediately after the address of the beginning of the string No Len or Len Mixed For certain string arguments e No Len applies when nomixed str len argis set The length of the string is not available to the called procedure This is the default e Len Mixed applies when mixed str len argis set The length of the string is pushed by value on the stack immediately after the address of the beginning of the string
107. E 126 unformatted data order of precedence 145 unformatted direct files and Microsoft Fortran PowerSation compatibility 190 unformatted VO statement 157 unformatted sequential files and Microsoft Fortran PowerSation compatibility 190 Unicode characters IM Es si 23 tifinstel SE EE oa ae 252 uninstall sh file ese ee ee 252 unit 1906 11 DY SEE EE BR EE Ee 171 unit information OPEN statement specifiers for 169 unix preprocessor symbol 38 UNLOCK statement sees 156 unlocking a file see ee 156 unroll compiler option 86 unset command see ee 28 unsetenv command 28 USE IFPORT statement 243 use_asm compiler option 99 Index user defined types handlind EE 226 USEROPEN routine 2 164 USEROPEN specifier in OPEN statement 180 user s guide ROW TOUS ESE ence EE EE 17 user supplied OPEN procedures 180 using user s guide ee 17 V v compiler option xxorxnrnnnnnnn 79 VALUE property iis ese ses 199 variable length record type 161 163 variable length records 186 variables displaying in debugget 117 VARYING property 199 205 VAXD Keywords is seeks degie 141 VAXG keyWord ees sees see 141 vec report compiler option 57 versions of the compiler differences between 255 305
108. E EE ESE NES 156 file access OPEN statement specifiers for 169 file characteristics OPEN statement specifiers for 169 OVErVI W ee ees ss ek ee dee 159 file close action OPEN statement specifier for 169 file information OPEN statement specifiers for 169 file locations coding in an OPEN statement 169 file name inquiry DY sca EERS ER De Ke Me ee 171 file names default rules for applying iese 167 file organization sesse 159 175 file position OPEN statement specifiers for 169 file processing OPEN statement specifiers for 169 file sharing ae EN edes 177 file specificati0n sesse see 167 file specificatiOnS ees ee ee 24 Index FILE specifier in OPEN statement 164 167 filename extensiONS ee ee 23 files ACCESSING EE SR de 164 sela AE RE 164 Mena ee ER EE EE 160 multiple compiling and linking 30 OPENING vaser 169 UP 25 OVErVI W ee ee eee ee ee ee 159 preconnected ees see 164 record overhead 163 record type ss merece 161 Serate iver 160 TEMPOMANY esse EE Ge eks EER Wie 26 FIND statement iese 156 174 FIORT CONVERTn environment variable mesni sk cous ee is 147 fixed compiler option 0 74 fixed format compiler option for 00 74 fixed form files ee 23 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I FIXEDFORMLINESIZE compiler directive VR Ms EE ltd eke ee 51 fixed length
109. EAD statements in the main program result in the following dialogue between user and program Type five numbers 55 5 Average of the five numbers is 15 70000 Debugging the Sample Program To debug a program with the debugger compile the source files with the g option to request additional symbol table information for source line debugging in the object and executable program files The following ifort command also uses the o option to name the executable program file calc_debug ifort g o calc_debug array calc f90 calc aver f90 main f90 See also Debugging Overview and related sections Creating Shared Libraries To create a shared library from a Fortran source file process the files using the ifort command e You must specify the sharea option to create the so file e You can specify the o output option to name the output file e If you omit the c option you will create a shared library so file directly from the command line in a single step 43 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I If you also omit the o output option the file name of the first Fortran file on the command line is used to create the file name of the so file You can specify additional options associated with shared library creation e If you specify the c option you will create an object file o file that you can name with the o option To create a shared library process the o file with 1a specifying c
110. ER ee ee ee ee 195 Programming with Mixed Languages OvervieW iese ee ee ee ee RR ee ee 195 Calling Subprograms from the Main Program iese ses see ee ee ese Re ee ee ee ee 196 Calls from the Main Program iese ees se ee ee ee Re ee ee ee ee Re ee ee ede ge ee 196 Calls 10 thessubProoian isi EE ves i su REEN OE Ee Ee ik Ses Wed ee eb et N 196 Summary of Mixed Language ISSUES ees ee ee ee RE ee ee ee ee RR ee ee ee ede 196 Adjusting Calling Conventions in Mixed Language Programming 198 Adjusting Calling Conventions in Mixed Language Programming Overview EE OO EE OSE 198 Table Of Contents Adjusting Naming Conventions in Mixed Language Programming 202 Adjusting Naming Conventions in Mixed Language Programming Overview Abd ate cee oh ee Daal ER EE EN AO DEE ED PS 202 C C Naming GONVERUGNSS ES EE cote cect teen EA SE RE AS Re Dee ee Ds Ee 203 Procedure Names in Fortran C and CHEF sees es ee ee ee de Re Ee ee ee ee 204 Reconciling the Case of Names is ee ee EE ee ee RR ER ee ee ee ee ee 204 Fortran Module Names and ATTRIBUTES ees ee se see ee ee ee ge ee ee eed ee 205 Prototyping a Procedure in FOrtran iese sesse sedes ese se ee ee dd ee ee RE ee ke ee Ge ee 206 Exchanging and Accessing Data in Mixed Language Programming 207 Exchanging and Accessing Data in Mixed Language Programming Overview RE EE AE E OE 207 Passing Arguments in Mixed Language Programm
111. ER size one two or four bytes and big endian IBM proprietary System 370 and similar floating point format for REAL and COMPLEX single and double precision numbers LITTLE_ENDIAN Native little endian integers of the appropriate INTEGER size one two four or eight bytes and the following native little endian IEEE floating point formats e S float for REAL KIND 4 and COMPLEX KIND 4 e T float for REAL KIND 8 and COMPLEX KIND 8 IEEE style X float for REAL KIND 16 and COMPLEX KIND 16 NATIVE No conversion occurs between memory and disk This is the default for unformatted files VAXD Native little endian integers of the appropriate INTEGER size one two four or eight bytes and the following little endian VAX proprietary floating point formats e VAX F_float for REAL KIND 4 and COMPLEX KIND 4 144 Data and VO e VAX D_float for REAL KIND 8 and COMPLEX KIND 8 e VAXH float for REAL KIND 16 and COMPLEX KIND 16 VAXG Native little endian integers of the appropriate INTEGER size one two four or eight bytes and the following little endian VAX proprietary floating point formats e VAX F_float for REAL KIND 4 and COMPLEX KIND 4 e VAXG float for REAL KIND 8 and COMPLEX KIND 8 e VAXH float for REAL KIND 16 and COMPLEX KIND 16 When reading a nonnative format the nonnative format on disk is converted to native format in memory If a conv
112. FILE usr users smith test dat STATUS OLD The file test dat in directory usr users smith is opened on logical unit 4 No defaults are applied because both the directory and file name were specified The value of the FILE specifier can be a character constant variable or expression In the following interactive example the user supplies the file name and the DEFAULTFILE specifier supplies the default values for the full pathname string The file to be opened is in usr users smith and is concatenated with the file name typed by the user into the variable DOC CHARACTER LEN 9 DOC WRITE 6 Type file name READ 5 DOC OPEN UNIT 2 FILE DOC DEFAULTFILE usr users smith STATUS OLD A slash is appended to the end of the default file string if it does not have one Obtaining File Information INQUIRE Statement The INQUIRE statement returns information about a file and has three forms e Inquiry by unit 171 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e Inquiry by file name e Inquiry by output item list Inquiry by Unit An inquiry by unit is usually done for an opened connected file An inquiry by unit causes the Intel Fortran RTL to check whether the specified unit is connected or not One of the following occurs depending on whether the unit is connected or not If the unit is connected e The EXIST and OPENED specifier v
113. Fortran Compiler for Linux Systems User s Guide Vol I The file was not a sequential organization file with variable length records The file was not opened for sequential or append access An unformatted file did not contain segmented records The Intel Fortran RTL VO system detected an error during execution of an ENDFILE statement B4jsevere 34 Unit already open FORS IOS UNIALROPE A DEFINE FILE statement specified a logical unit that was already opened severe 35 Segmented record format error FOR IOS SEGRECFOR An invalid segmented record control data word was detected in an unformatted sequential file The file was probably either created with RECORDTYPE FIXED or VARIABLE in effect or was created by a program written in a language other than Fortran severe 36 Attempt to access non existent record FOR IOS_ATTACCNON A direct access READ or FIND statement attempted to access beyond the end of a relative file or a sequential file on disk with fixed length records or access a record that was previously deleted in a relative file 37lsevere 37 Inconsistent record length FOR IOS_INCRECLEN An attempt was made to open a direct access file without specifying a record length Qisevere 38 Error during write FOR IOS ERRDURWRI The Intel Fortran RTL VO system detected an error condition during execution of a WRITE statement 39lsevere 39 Error during read FOR IOS ERRDURREA The Intel Fortran R
114. GIOT error message EEE EE 257 FOR IOS_SIGQUIT error message EE eet Beet hase ce ke 257 FORS IOS SIGSEGV error message EG Ne ke 257 FORS IOS SIGTERM error message gral Ane OE 257 FORS IOS STKOVF error message EE EE 257 FORS IOS STRLENERR error MESSJGE ae 257 FORS IOS SUBRNG error message EN ED 257 FORS IOS SUBSTRERR error MESSAGE Lana kede 257 FORS IOS SYNERRFOR error MESSage see kke RR Ke EK Ke Ee 257 FORS IOS SYNERRNAM error MESSAGE ese KERE Rea Ke 257 FORS IOS TOOMANREC error MESSIJE rader 257 FORS IOS TOOMANVAL error MESSAGE ee ska ERA Ke 257 FORS IOS UFMTENDIAN error MESSAGE sn ae Aides 257 FORS IOS UNFIO FMT error MESSAGE N EE 257 FORS IOS UNIALROPE error MESSAGE apene 257 FORS IOS UNINOTCON error MESSage eek KRAAK Ke 257 FORS IOS WRIREAFIL error MESSAGE Ri Se 257 FOR ACCEPT environment variable FOR DIAGNOSTIC LOG FILE environment variable 249 FOR DISABLE DIAGNOSTIG DIS PLAY environment variable 249 FOR DISABLE STACK TRACE environment variable 249 FOR IGNORE EXCEPTIONS environment variable 249 Index FOR K FP NEG DENORM symbol NER ae 138 FOR K FP NEG INF symbol 138 FOR K FP NEG NORM symbol FOR K FP NEG ZERO symbol 138 FOR K FP POS DENORM symbol Sindh tints soln SE 138 FOR_K_FP_POS_INF symbol 138 FOR_K_FP_POS_NORM symbol FOR_K_FP_POS_ZERO symbol 138 FOR_K_FP_QNAN symbol 138 FOR_K
115. Guide Vol I Streaming SIMD Extensions 2 ES an SE EEE 19 STRICT compiler directive 51 subprograms calling from the main program 196 summary of mixed language issues 196 summary of new features 15 symbol predefined preprocessor 38 symbol table information 107 syntax compiler option 79 syntax_only compiler option 79 system drive or directory control and inquiry routines 244 T T compiler option ees ee 79 TBK ENABLE VERBOSE STACK _ TRACE environment variable 249 TBK FULL SRC FILE SPEC environment variable 249 tcheck compiler option 79 TEMP environment variable 26 249 Tf compiler option 79 threads compiler option 77 304 TMP environment variable 26 249 TMPDIR environment variable 26 249 tool locations sn 37 tools passing options to 006 37 tpp compiler Option 06 86 traceback compiler option 103 traceback information ODIAINING sac gt kitty eneee 239 traceback information 107 TRACEBACKQQ routine 239 BUE tee AO eeees 252 tselect file eects 252 TYPE statement 156 157 164 174 types VO statements sessie eke ee 156 user defined ese ee 226 U u compiler option 79 101 unaligned data lOCAUING AE E
116. IFORTCFG The configuration file to use instead of the default configuration file e LD_LIBRARY_PATH The path for shared so library files e PATH The path for compiler executable files e TMP TMPDIR TEMP Specifies the directory in which to store temporary files See Temporary Files Created by the Compiler or Linker Run Time Environment Variables The Intel Fortran run time system recognizes several environment variables These variables can be used to customize run time diagnostic error reporting for example The run time environment variables are e decfort_dump_flag If this variable is set to Y or y a core dump will be taken when any severe Intel Fortran run time error occurs e F_UFMTENDIAN This variable specifies the numbers of the units to be used for little endian to big endian conversion purposes See Environment Variable F_UFMTENDIAN Method e FOR ACCEPT The ACCEPT statement does not include an explicit logical unit number Instead it uses an implicit internal logical unit number and the FOR ACCEPT environment variable If FOR ACCEPT is not defined the code accEPT f iolist reads from stdin standard input If FOR ACCEPT is defined as a file name optionally containing a path the specified file would be read e FOR DIAGNOSTIC LOG FILE If this variable is set to the name of a file diagnostic output is written to the specified file The Fortran run time system attempts to open that file appen
117. IOS PERACCFIL Check the mode protection of the specified file Make sure the correct file was being accessed Change the protection specified file or process used before rerunning program 1 1 severe 10 Cannot overwrite existing file FOR IOS_CAOVEEXI Specified file xxx already exists when OPEN statement specified STATUS NEW create new file using VO unit x Make sure correct file name directory path unit and so forth were 258 Reference Information specified in the source program Decide whether to e Rename or remove the existing file before rerunning the program e Modify the source file to specify different file specification VO unit or OPEN statement STATUS If appropriate use an OPEN statement to explicitly open the file connect the file to the unit number 17lsevere 17 Syntax error in NAMELIST input FOR IOS_SYNERRNAM The syntax of input to a namelist directed 11linfo 11 Unit not connected FOR IOS_UNINOTCON The specified unit was not open at the time of the attempted VO operation Check if correct unit number was specified READ statement was incorrect 18 severe 18 Too many values for NAMELIST variable FOR IOS_TOOMANVAL An attempt was made to assign too many values to a variable during a namelist READ statement 10severe 19 Invalid reference to variable in NAMELIST input FOR IOS_INVREFVAR One of the following conditions occurred The variable was not a me
118. KSPACE statement can only be used for sequential files opened for sequential access 266 error 266 Fortran abort routine called FOR IOS_PROABOUSE The program called abort to terminate the program severe 268 End of record during read FOR IOS_ENDRECDUR An end of record condition was encountered during execution of a nonadvancing I O READ statement that did not specify the EOR branch specifier 297 info 297 nn floating invalid traps FOR IOS_FLOINVEXC The total number of floating point invalid data traps encountered during program execution was nn This message appears at program completion 298 info 298 nnfloating overflow traps FOR IOS_FLOOVFEXC The total number of floating point overflow traps encountered during program execution was nn This message appears at program completion 299 linfo 299 nnfloating divide by zero traps FOR IOS_FLODIVOEXC The total number of floating point divide by zero traps encountered during program execution was nn This message appears at program completion 300 linfo 300 nnfloating underflow traps FOR IOS_FLOUNDEXC The total number of floating point underflow traps encountered during program execution was nn This message appears at program completion Footnotes 1 Identifies errors not returned by IOSTAT 2 The ERR transfer is taken after completion of the I O statement for error numbers 59 272 Reference Information 61 63 64 and 68 The resultin
119. MPLE X KIND 8 Double Precision Representation COMPLE X KIND 16 Representation For information on reading or writing floating point data other than native IEEE little endian data see Converting Unformatted Numeric Data See also File fordef for and Its Usage REAL KIND 4 REAL Representation REAL 4 same as REAL KIND 4 data occupies 4 contiguous bytes stored in IEEE S _ floating format Bits are labeled from the right 0 through 31 as shown below a1 30 23 22 a EXPONENT FRAGTION A N ZK 981 GE The form of REAL 4 data is sign magnitude with bit 31 the sign bit 0 for positive numbers 1 for negative numbers bits 30 23 a binary exponent in excess 127 notation and bits 22 0 a normalized 24 bit fraction including the redundant most significant fraction bit not represented The value of data is in the approximate range 1 17549435E 38 normalized to 3 40282347E38 The IEEE denormalized subnormal limit is 1 40129846E 45 The precision is approximately one part in 2 23 typically 7 decimal digits REAL KIND 8 DOUBLE PRECISION Representation REAL 8 same as REAL KIND 8 data occupies 8 contiguous bytes stored in IEEE T_floating format Bits are labeled from the right 0 through 63 as shown below G Ge w al a EXPONENT FRAGTION A H ZK 5816 GE The form of REAL 8 data is sign magnitude with bit 63 the sign bit 0 for positive numbers 1 for negative numbers bits 62 52 a binary exponent in excess 1023 not
120. N or INQUIRE statement was not acceptable to the Intel Fortran RTL VO system Adlsevere 44 Inconsistent record type 4 FOR IOS_INCRECTYP The RECORDTYPE value in an OPEN statement did not match the record type attribute of the existing file that was opened severe 45 Keyword value error in OPEN statement FOR IOS_KEYVALERR An improper value was specified for an OPEN or CLOSE statement specifier requiring a value AGsevere 46 Inconsistent OPEN CLOSE parameters FOR IOS_INCOPECLO Specifications in an OPEN or CLOSE statement were inconsistent Some invalid combinations follow READONLY or ACTION READ with STATUS NEW or STATUS SCRATCH READONLY with STATUS REPLACE ACTION WRITE or ACTION READWRITE ACCESS APPEND with READONLY ACTION READ STATUS NEW or STATUS SCRATCH DISPOSE SAVE PRINT or SUBMIT with STATUS SCRATCH DISPOSE DELETE with READONLY 263 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I CLOSE statement STATUS DELETE with OPEN statement READONLY ACCESS APPEND with STATUS REPLACE ACCESS DIRECT or KEYED with POSITION APPEND ASIS or REWIND severe 47 Write to READONLY file FOR IOS_WRIREAFIL A write operation was attempted to a file that was declared ACTION READ or READONLY in the OPEN statement that is currently in effect severe 48 Invalid argument
121. Nso suppresses the sign on message p32 enables defining 32 bit elements as relocatable data elements This option is available for backward compatibility o file o indicates the output object filename Linker The compiler calls the system linker 1d 1 to produce an executable file from the object files Default Behavior of the Intel Fortran Compiler The compiler generates one or more output files of one or more input files By default it performs the following actions Searches for all files including library files in the current directory Passes options designated for linking to the linker Passes user defined libraries to the linker Displays error and warning messages Performs default settings and optimizations unless these options are overridden by specific options settings e For lA 32 applications uses the tpp7 option to optimize the code for the Intel Pentium 4 and Intel Xeon TM processor e For ltanium based applications uses the tpp2 option to optimize the code for the Intel Itanium 2 processor fF Note On operating systems that support characters in Unicode multi byte format the compiler will process file names containing Unicode characters Input Files and Filename Extensions The Intel Fortran Compiler interprets the type of each input file by its filename extension such as a f for o and soon 23 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I
122. O 4 F_UFMTENDIAN 1 0 20 Define 10 11 12 19 20 units for conversion purposes on these units the input output operations perform big little endian conversion 5 Assume you set F_UFMTENDIAN 10 100 and run the following program integer 4 cc4 integer 8 cc8 integer 4 c4 integer 8 c8 c4 456 c8 789 C prepare little endian representation of data open 11 file lit tmp form unformatted write 11 c8 write 11 c4 close 11 C prepare big endian representation of data open 10 file big tmp form unformatted write 10 c8 write 10 c4 close 10 C read big endian data and operate with them on C little endian machine open 100 file big tmp form unformatted read 100 cc8 read 100 cc4 G Any operation with data which have been read C get close 100 stop end Now compare 1it tmp and big tmp files with the help of od utility gt od t x4 lit tmp 0000000 00000008 00000315 00000000 00000008 0000020 00000004 000001c8 00000004 0000034 gt od t x4 big tmp 151 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I 0000000 08000000 00000000 15030000 08000000 0000020 04000000 c8010000 04000000 0000034 You can see that the byte order is different in these files OPEN Statement CONVERT Method You can use this method to specify a non native numeric format for each specified unit number This metho
123. OMPLEX 8 C8 2 0 8 0 COMPLEX 16 C16 1 23 4 56 REAL 4 R4 2 0 REAL 8 R8 2 0 REAL 16 R16 2 0 TYPE C8 C8 TYPE N Cl6 y C16 END PROGRAM idb supports the display and assignment of COMPLEX variables and constants as well as basic arithmetic operators For example Welcome to the idb Debugger Version x x xx object file name complex Reading symbolic information done idb stop in complextest 1 stop in complextest idb run 1 stopped at complextest 15 0x1200017b4 15 TYPE Jy MOBT C8 idb whatis c8 complex c8 idb whatis c16 double complex c16 idb print c8 2 8 idb print c16 1 23 4 56 idb assign cl6 2 3E 10 4 5e 2 idb print c16 23000000512 0 04500000178813 934 123 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I idb Data Types The table below shows the Intel Fortran data types and their equivalent built in debugger names Fortran 95 90 data type declaration Debugger equivalent CHARACTER character INTEGER INTEGER KIND n integer integer n LOGICAL LOGICAL KIND n logical logical n REAL REAL KIND 4 real DOUBLE PRECISION REAL KIND 8 real 8 REAL KIND 16 real 16 COMPLEX COMPLE X KIND 4 complex DOUBLE COMPLEX COMPLEX KIND 8 double complex COMPLE X KIND 16 COMPLE X 32 long double complex Expressions in Debugger Commands Expressions in debugger comm
124. PEN statement the uopen_ function receives control The function opens the file may perform other operations and subsequently returns control with the file descriptor to the RTL lf the USEROPEN function is written in C declare it as a C function that returns a 4 byte integer int result to contain the file descriptor For example int uopen_ 1 char file name 2 int open flags 3 Int create mode 4 int lun 5 int file length 6 The function definition and the arguments passed from the Intel Fortran RTL are as follows 1 The function must be declared as a 4 byte integer int 2 The first argument is the pathname includes the file name to be opened 3 The open flags are described in the header file usr include sys file horopen 2 4 The create mode protection needed when creating a file is described in open 2 5 The fourth argument is the logical unit number 6 The fifth last argument is the pathname length hidden length argument of the pathname 181 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Of the arguments the open system call see open 2 requires the passed pathname the open flags that define the type access needed whether the file exists and so on and the create mode The logical unit number specified in the OPEN statement is passed in case the USEROPEN function needs it The hidden length of the pathname is also passed When creating a new file
125. PLEX declarations functions and intrinsics as COMPLEX 32 dyncom bik1 blk2 Enables dynamic allocation of the specified common blocks at run time Example For common blocks A B and C use this syntax dyncom a b c integer_size 16 32 64 Default integer size 32 Alternate syntax i 2 4 8 where 2 4 and 8 stand for the KIND of integer and logical variables Specifies the default size in bits of integer and logical declarations constants functions and intrinsics where n is 16 32 or 64 e nis 16 Makes the default integer and logical variables 2 bytes long INTEGER and LOGICAL declarations are treated as KIND 2 Alternate syntax i2 See also INTEGER KIND 2 Representation e nis 32 Makes the default integer and logical variables 4 bytes long INTEGER and LOGICAL declarations are treated as KIND 4 Alternate syntax i4 See also INTEGER KIND 4 Representation e nis 64 Makes the default integer and logical variables 8 bytes long INTEGER and LOGICAL declarations are treated as KIND 8 Alternate syntax i8 See also INTEGER KIND 8 Representation Pg Default Off Compiles and links for function profiling with gprof 1 This is the same as specifying p or ap 66 Compiler Options real size 32 64 128 Default real size 32 alternate syntax r 8 16 where 8 and 16 stand for the KIND of real variables Specifies the default size in bits of real and complex declarations cons
126. R KIND 4 Representation INTEGER 4 values range from 2 147 483 648 to 2 147 483 647 and are stored in 4 contiguous bytes as shown below a1 20 a BINARY HUMBER A N ZK 0796 GE Integers are stored in a two s complement representation INTEGER KIND 8 Representation 132 Data and VO INTEGER 8 values range from 9 223 372 036 854 775 808 to 9 223 372 036 854 775 807 and are stored in 8 contiguous bytes as shown below Ga Fe Q H Zk s2594 5E Integers are stored in a two s complement representation Logical Data Representations Logical data lengths can be 1 2 4 or 8 bytes in length The default data size used for a LOGICAL data declaration is LOGICAL 4 same as LOGICAL KIND 4 unless the integer size 16 OF integer size 64 option was specified To improve performance on Itanium based systems use LOGICAL 4 or LOGICAL 8 rather than LOGICAL 2 or LOGICAL 1 LOGICAL KIND 1 values are stored in 1 byte In addition to having logical values TRUE and FALSE LOGICAL 1 data can also have values in the range 128 to 127 Logical variables can also be interpreted as integer data In addition to LOGICAL 1 logical values can also be stored in 2 LOGICAL 2 4 LOGICAL 4 or 8 LOGICAL 8 contiguous bytes starting on an arbitrary byte boundary If the fpscomp nological compiler option is set the default the low order bit determines whether the logical value is true or false Specify fpscomp logical f
127. REC specifies the maximum record number for direct access e ASSOCIATEVARIABLE specifies the variable containing the next record number for direct access Specifiers for Record Transfer Characteristics These specifiers identify record transfer characteristics e BLANK indicates whether to ignore blanks in numeric fields e DELIM specifies the delimiter character for character constants in list directed or namelist output e PAD when reading formatted records indicates whether padding characters should be added if the item list and format specification require more data than the record contains e BLOCKSIZE specifies the block physical VO buffer size e BUFFERCOUNT specifies the number of physical VO buffers e CONVERT specifies the format of unformatted numeric data 170 Data and VO Specifiers for Error Handling Capabilities These specifiers are used for error handling e ERR specifies a label to branch to if an error occurs e lOSTAT specifies the integer variable to receive the error IOSTAT number if an error occurs Specifier for File Close Action DISPOSE identifies the action to take when the file is closed Coding File Locations in an OPEN Statement You can use the FILE and DEFAULTFILE specifiers of the OPEN statement to specify the complete definition of a particular file to be opened on a logical unit The Language Reference Manual describes the OPEN statement in greater detail For example OPEN UNIT 4
128. RENCE 4 The caller routine and the called routine use a calling convention to establish naming conventions for procedure names You can establish any procedure name you want regardless of its Fortran name with the ALIAS 198 Programming with Mixed Languages directive or ATTRIBUTES option ALIAS This is useful because C is case sensitive while Fortran is not See also ATTRIBUTES Properties and Calling Conventions ATTRIBUTES Properties and Calling Conventions The ATTRIBUTES properties also known as options C REFERENCE VALUE and VARYING all affect the calling convention of routines You can specify the e C REFERENCE and VARYING properties for an entire routine e VALUE and REFERENCE properties for individual arguments By default Fortran passes all data by reference except the hidden length argument of strings which is passed by value If the C property is used the default changes to passing almost all data except arrays by value However in addition to the calling convention property C you can specify argument properties VALUE and REFERENCE to pass arguments by value or by reference regardless of the calling convention property Arrays can only be passed by reference Different Fortran calling conventions can be specified by declaring the Fortran procedure to have certain attributes Assume this example INTERFACE SUBROUTINE MY SUB I IDECS ATTRIBUTES C ALIAS My Sub MY SUB ia32 systems INTEGER I EN
129. RITE REWRITE Unformatted READ WRITE REWRITE Internal file Formatted READ WRITE List directed READ WRITE Unformatted None Enote You can use the REWRITE statement only for relative files using direct access Files and File Characteristics Files and File Characteristics Overview See these topics File Organization Internal Files and Scratch Files Record Types Record Overhead Record Length File Organization File organization refers to the way records are physically arranged on a storage device Intel Fortran supports two kinds of file organization 159 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e Sequential e Relative The default file organization is always ORGANIZATION SEQUENTIAL for an OPEN statement The organization of a file is specified by means of the ORGANIZATION specifier in the OPEN statement You can store sequential files on magnetic tape or disk devices and can use other peripheral devices such as terminals pipes and line printers as sequential files You must store relative files on a disk device Sequential Organization A sequentially organized file consists of records arranged in the sequence in which they are written to the file the first record written is the first record in the file the second record written is the second record in the file and so on As a result records can be added only at the end of the file Sequential files are usually read seque
130. S_STRLENERR During a string operation an integer value appears in a context where the value of the integer is outside the permissible string length range Either recompile with the check bounds option perhaps with the decfort_dump_flag environment variable set or examine the core file to determine the source code causing the error severe 149 Substring error FOR IOS SUBSTRERR An array subscript is outside the dimensioned boundaries of an array Either recompile with the check bounds option perhaps with the decfort_dump_flag environment variable set or examine the core file to determine the source code causing the error severe 150 Range error FOR IOS RANGEERR An integer value appears in a context where the value of the integer is outside the permissible range severe 151 Allocatable array is already allocated FOR IOS_INVREALLOC An allocatable array must not already be allocated when you attempt to allocate it You must deallocate the array before it can again be allocated severe 152 Unresolved contention for Intel Fortran RTL global resource FOR IOS_RESACQFAI Failed to acquire a Intel Fortran RTL global 269 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I resource for a reentrant routine For a multithreaded program the requested global resource is held by a different thread in your program For a program using asynchronous handlers the requested global resource is held by th
131. TACK TRACE IS set no stack trace information is produced See the following example of stack trace information The program generates an error at line 12 program ovf real 4 x 5 y 5 integer 4 i x 1 1e32 x 2 1e38 x 3 12638 x 4 12638 x 5 36 0 do i 1 5 y i 100 0 x i print N y x t X 100 0 y i end do end gt ifort 00 fpe0 traceback ovf f90 o ovf exe gt ovf exe x 1 0000000E 32 x 100 0 1 0000000E 34 1 forrtl error 72 floating overflow Image PC Routine Line Source ovf exe 08049E4A MAIN 14 ovf 90 ovf exe 08049F08 Unknown Unknown Unknown ovf exe 400B3507 Unknown Unknown Unknown ovf exe 08049C51 Unknown Unknown Unknown Abort gt setenv FOR DISABLE STACK TRACE true gt ovf exe x 1 0000000EB 32 x 100 0 1 0000000E 34 233 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I forrtl error 72 floating overflow 2 Abort The following information corresponds to the numbers at the right of the example 1 Stack trace information when the traceback information is present 2 No stack trace information because the FOR DISABLE STACK TRACE environment variable is set Values Returned to the Shell at Program Termination An Intel Fortran program can terminate in one of several ways e The program runs to normal completion A value of zero is returned to the shell e The program stops with a STOP
132. TL VO system detected an error condition during execution of a READ statement AQisevere 40 Recursive I O operation FOR IOS_RECIO_OPE While processing an VO statement for a logical unit another I O operation on the same logical unit was attempted such as a function subprogram that performs VO to the same logical unit that was referenced in an expression in an VO list or variable format expression 4j severe Insufficient virtual memory FORS IOS INSVIRMEM The Intel Fortran RTL attempted to exceed its 262 Reference Information available virtual memory while dynamically allocating space To overcome this problem increase the per process data limit by using the limit C shell or ulimit Bourne and Korn and bash shell commands before you run this program again To determine whether the maximum per process data size is already allocated check the value of the maxdsiz parameter in the sysconfigtab or system configuration file If necessary increase its value Changes to do not take effect until the system has been rebooted you do not need to rebuild the kernel if you modify sysconfigtab Before you try to run this program again wait until the new system resources take effect om 42 No such device FOR IOS NO SUCDEV A pathname included an invalid or unknown device name when an OPEN operation was attempted severe 43 File name specification error 4 FORS IOS FILNAMSPE A pathname or file name given to an OPE
133. When using the step command if you step into a subprogram that does not require further investigation use the return command to continue execution of the current function until it returns to its caller If you include the name of a routine with the return command execution continues until control is returned to that routine The rout ine name is the name of the routine usually named by a PROGRAM SUBROUTINE or FUNCTION statement If there is no PROGRAM statement the debugger refers to the main program with a prefix of mains followed by the file name S n more progout f90 Executes the shell command more to display file progout 90 then returns to the debugger environment S how thread Lists all threads known to the debugger status Displays breakpoints and tracepoints with their event numbers See also delete step Steps one source statement including stepping into calls of a subprogram For Intel Fortran VO statements intrinsic procedures library routines or other subprograms use the next command instead of step to step over the subprogram call Compare with next see also return top in foo Stops execution breakpoint at the beginning of routine foo S X top at 100 topi at XXXXXX Stops execution at line 100 breakpoint of the current source file Stops execution at address xxxxxxx of the current executable program t hread n Identifies or sets the curren
134. You can alter the default way strings are passed by using attributes The following table shows the effect of various attributes on passed strings Effect of ATTRIBUTES Properties on Character Strings Passed as Arguments Passed by First character Passed by reference reference converted to along with length along with INTEGER 4 and length passed by value String with First character First character VALUE option converted to converted to INTEGER 4 and INTEGER 4 and passed by value passed by value String with Passed by Passed by Passed by reference REFERENCE reference reference no length no length option possibly along 223 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The important things to note about the above table are e Character strings without the VALUE or REFERENCE attribute that are passed to C routines are not passed by reference Instead only the first character is passed and it is passed by value e Character strings with the VALUE option passed to C routines are not passed by reference Instead only the value of the first character is passed e For string arguments with default ATTRIBUTES ATTRIBUTES C or REFERENCE o When nomixed str len argis set the length of the string is pushed by value on the stack after all of the other arguments This is the default o When mixed str len argis set the length of the string is pushed by value on the stack immediately after the add
135. _FP_SNAN symbol 138 for_main o file rrronrrrrrnnrnnnrr 242 FOR_NOERROR_DIALOGS environment variable 249 FOR_PRINT environment variable sivas seerne senter 249 FOR READ environment variable NE RENNE 249 FOR TYPE environment variable TE haan 249 forde TOR M eis st EER 138 FORM specifier in OPEN statement 157 164 format 289 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Of record types 186 FORMAT statement and preprocessing 06 21 formatted direct files and Microsoft Fortran PowerSation compatibility 190 formatted VO statement 157 formatted sequential files and Microsoft Fortran PowerSation compatibility 190 FORT BUFFERED environment variaDle tlds oc casts cates Vans yond 249 FORT CONVERT ext environment variable ccenn 148 249 FORT CONVERT ext method 148 FORT CONVERT ext environment variable SE SE Ee 148 249 FORT CONVERT ext method 148 FORT CONVERTn environment variable eie EE EE De 249 FORT CONVERTn method 147 FOr COM iii Aion satan 20 252 Fortran Operators added 124 Fortran 95 90 pointer 117 Fortran VO 290 OVErVieW ee ee ee 154 Fortran PowerStation compatibility ea Beye pinged 190 Fortran C mixed language programs OVEVIEW eie ee ee ee ee Ke Ee 227 FORTRAN 66 interpretations 74 fp compiler option ee 86 FP_CLASS intri
136. _TIME intrinsic was shorter than the required length You must increase the number of characters passed in for this argument to be at least 8 characters in length Verify that the TIME and ZONE arguments also meet their minimum lengths severe 176 TIME argument to DATE_AND_TIME is too short Reference Information LEN n required LEN 10 FORS IOS SHORTTIMEARG The number of characters associated with the TIME argument to the DATE AND TIME intrinsic was shorter than the required length You must increase the number of characters passed in for this argument to be at least 10 characters in length Verify that the DATE and ZONE arguments also meet their minimum lengths severe 177 ZONE argument to DATE AND TIME is too short LEN n required LEN 5 FOR IOS SHORTZONEARG The number of characters associated with the ZONE argument to the DATE AND TIME intrinsic was shorter than the required length You must increase the number of characters passed in for this argument to be at least 5 characters in length Verify that the DATE and TIME arguments also meet their minimum lengths 178 severe 178 Divide by zero FORS IOS DIV A floating point or integer divide by zero exception occurred severe 179 Cannot allocate array overflow on array size calculation FOR IOS_ARRSIZEOVF An attempt to dynamically allocate storage for an array failed because the required storage size exceeds addres
137. a to be in native little endian order in which the least significant right most zero bit bit 0 or byte has a lower address than the most significant left most bit or byte For information on using nonnative big endian and VAX floating point formats see Converting Unformatted Numeric Data The symbol A in any figure specifies the address of the byte containing bit 0 which is the starting address of the represented data element The following table lists the intrinsic data types used by Intel Fortran the storage required and valid ranges For example the declaration INTEGER 4 is the same as INTEGER KIND 4 and INTEGER 4 Data Type Storage Description BYTE 1 byte A BYTE declaration is a signed integer data type equivalent to INTEGER 1 8 bits INTEGER 1 INTEGER See Signed integer either INTEGER 2 INTEGER 4 or INTEGER 2 INTEGER 8 The size is controlled by the integer size nn INTEGER 4 compiler option The default is integer size 32 and INTEGER 4 INTEGER 8 129 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I INTEGER 1 1 byte Signed integer value from 128 to 127 8 bits INTEGER 2 2 bytes Signed integer value from 32 768 to 32 767 16 bits INTEGER 4 4 bytes Signed integer value from 2 147 483 648 to 2 147 483 647 32 bits INTEGER 8 8 bytes Signed integer value from 9 223 372 036 854 775 808 to 64 bits 9
138. able rather than being kept in the floating point processor for use in a subsequent calculation For example the compiler can change floating point division computations into multiplication by the reciprocal of the denominator This change can alter the results of floating point division computations slightly When the fltconsistency option is in use floating point intermediate results are kept in full 10 byte internal precision Additionally all spills reloads of the X87 floating point registers are done using the internal formats this prevents accidental loss of precision due to spill reload behavior over which you have no control This option causes performance degradation relative to using default floating point optimization flags An alternative is to use the mp1 option which should provide better than default floating point precision while still delivering good floating point performance 70 Compiler Options The default value nofltconsistency provides good accuracy and run time performance at the expense of less consistent floating point results This option might slightly reduce execution speed See also Improving Restricting FP Arithmetic Precision in Volume II Optimizing Applications fp_port IA 32 systems only Default Off Rounds floating point results after floating point operations so rounding to user declared precision happens at assignments and type conversions this has some impact on speed T
139. aces and a vertical bar indicate a choice among two or more items You must choose one of the items unless all of the items are also enclosed in square brackets A horizontal ellipsis three dots following an item indicates that the item preceding the ellipsis can be repeated In code examples a horizontal ellipsis means that not all of the statements are shown Linux systems An asterisk at the end of a word or name indicates it is a third party product trademark 18 Getting Started Getting Started Overview See these topics How You Can Use the Intel Fortran Compiler Compilation Phases Preprocess Phase Assemblers and Linker Default Behavior of the Intel Fortran Compiler Input Files and Filename Extensions File Specifications Output Files Temporary Files Created by the Compiler or Linker How You Can Use the Intel Fortran Compiler The Intel Fortran Compiler has the following variations e The Intel Fortran Compiler for 32 bit Applications is designed for IA 32 systems The IA 32 compilations run on any IA 32 Intel processor and produce applications that run on IA 32 systems This compiler can be optimized specifically for one or more Intel IA 32 processors such as Pentium M Pentium 4 and Xeon e The Intel Fortran Itanium Compiler for ltanium based Applications or native compiler is designed for Itanium architecture systems This compiler runs on Itanium based systems and pr
140. alid operation such as subtraction of infinite values multiplication of zero by infinity without signs division of zero b zero or infinity by infinity Conversion of floating point to fixed point format when an overflow prevents conversion error 76 IOT trap signal FOR IOS_SIGIOT Core dump file created Examine core dump for possible cause of this IOT signal severe 77 Subscript out of range FOR IOS_SUBRNG An array reference was detected outside the declared array bounds error 78 Process killed SIGTERM FORS IOS SIGTERM The process received the signal SIGTERM Determine source of this software termination signal described in signal 3 7 llerror 79 Process quit SIGQUIT FORS IOS SIGQUIT The process received the signal SIGQUIT Core dump file created Determine source of this quit signal described in signal 3 info 95 Floating point conversion failed FOR IOS FLOCONFAI The attempted unformatted read or write of nonnative floating point data failed because the floating point value Exceeded the allowable maximum value for the equivalent native format and was set equal to infinity plus or minus Was infinity plus or minus and was set to infinity plus or minus Was invalid and was set to not a number NaN Very small numbers are set to zero 0 This error could be caused by the specified nonnative floating point format not matching the floating point format found in the specified file
141. allowed Alternate syntax no dps Allows alternate syntax without parentheses for PARAMETER statements The alternate syntax for PARAMETER statements is PARAMETER parl expl par2 exp2 This form does not have parentheses around the assignment of the constant to the parameter name With this form the type of the parameter is determined by the type of the expression being assigned to it and not by any implicit typing no d_lines Default nod lines Alternate syntax DD Specifies that lines in fixed format files that contain a D in column 1 should be treated as source code not comment lines No extend source size Default noextend source which implies 72 characters if extend source is specified without a size the default becomes extend source 132 Alternate syntax 72 801 132 Specifies the column number used to end the statement field in fixed form source files 72 80 or 132 When a size is specified that will be the last column parsed as part of the statement field Any columns after that will be treated as comments This option is valid only for fixed form files no f66 Default nof66 use current Fortran standards semantics Alternate syntax 66 Specifies that the compiler should select FORTRAN 66 interpretations in cases of incompatibility Differences include the following 75 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e DO loops are always executed a
142. amming 209 C C naming conventions 203 C Fortran mixed language programs calling C procedures 230 277 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I OMPIlINE 2 ESE EE EE 227 MIE RR 227 naming conventions 230 OVErVI W ees ee se ek ee ee 227 passing arguments esse 230 calling C procedures from a Fortran program 230 calling convention description Of ese ee 195 calling conventions and ATTRIBUTES properties 199 and mixed language programming TOL OE EDE 199 calling subprograms from main DrOOraM ss ase NGK HE 196 carriage control ccdefault compiler option 79 CB compiler option 103 ccdefault compiler option 79 GDEGS piele sels Ee 51 cDIR peksa ED ER 51 Cell number EE EE ek sd Ee 159 character array ees ees ee ee ee 160 character array element 160 278 character array section 160 character data representation 140 character data types retUrNINg REE 223 character strings RANGING OE RE 223 character substring 0008 160 character variable 008 160 check compiler option 103 checking HANE ak ee ei haters iat 103 CLOSE statement 156 173 closing a file See CLOSE statement 173 code generation options 51 codecov ii AE ER N 252 Code coverage tool
143. an input field or the input value overflowed the range representable in the input variable The value of the variable was set to zero 65 Floating invalid FOR IOS_FLTINV During an arithmetic operation the floating point values used in a calculation were invalid for the type of operation requested or invalid exceptional values For example when requesting a log of the floating point values 0 0 or a negative number For certain arithmetic expressions specifying the check nopower option can suppress this message severe 66 Output statement overflows record FOR IOS OUTSTAOVE An output statement attempted to transfer more data than would fit in the maximum record size severe 67 Input statement requires too much data FOR IOS_INPSTAREQ Attempted to read more data than exists in a 265 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I record with an unformatted READ statement or with a formatted sequential READ statement from a file opened with a PAD specifier value of NO Alsevere 68 Variable format expression value error FOR IOS_VFEVALERR The value of a variable format expression was not within the range acceptable for its intended use for example a field width was less than or equal to zero A value of 1 was assumed except for a P edit descriptor for which a value of zero was assumed error 69 Process interrupted SIGINT FOR IOS_SIGINT The process received the signal SIGINT
144. and 90 USE statement openmp profile Default Off Enables analysis of OpenMP applications To use this option you must have previously installed Thread Profiler which is one of the Intel Threading Tools If this threading tool is not installed this option has no effect For more information about Thread Profiler including how to obtain an evaluation copy open the page associated with threading tools at www intel com software products no pad Default nopad Enables the changing of the variable and array memory layout 83 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The paa option is effectively not different from align when applied to structures and derived types However the scope of pad is greater because it applies also to common blocks derived types sequence types and structures prec_div IA 32 and Intel EM64T systems only Default Off Enables improved precision of floating point divides Has a slight impact on speed rcd IA 32 systems only Default Off Enables changing of rounding mode for float to integer conversions resulting in faster float to integer conversions size 1p64 Itanium based systems only Default Off Specifies that 64 bit size for long and pointer types should be assumed nostartfiles Default Off Specifies that standard startup files should be used when linking There is no startfiles option syntax only Default Off Alternate syntax
145. and file sharing iese see 177 DEFAULTFILE specifier 167 FILE specifier i s are 167 for preconnected files 168 FORM specifier 157 164 ORGANIZATION specifier 159 POSITION specifier 177 RECL specifier 163 164 specifiers Linn ee 169 STATUS specifier 0 160 supplying a file name 164 USEROPEN specifier 180 OPEN statement 156 164 OPEN statement CONVERT method KR EE 152 opening ME ae 169 174 openmp compiler option 74 openmp profile compiler option 79 openmp report compiler option 57 openmp_stubs compiler option 74 operators Fornes es ges 124 opt intel fc 80 bin directory 28 opt intel fc 80 bin ifortvars csh file28 opt intel fc 80 bin ifortvars sh file 28 opt report compiler option 86 opt report file compiler option 86 opt report help compiler option 86 opt report level compiler option 86 opt report phase compiler option 86 297 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I opt report routine compiler option FE OE ER 86 optimization options xxxnn0e 86 OPTIONS statement 005 49 OPTIONS statement method 152 ORGANIZATION specifier in OPEN statement 159 output redirecting iese ee ee dee ee 40 output file enaMING EE Ee EE 30 ou
146. and value An array name in C is equated to its starting address because arrays are 208 Programming with Mixed Languages normally passed by reference You can assign the REFERENCE property to a procedure as well as to individual arguments Passing Arguments by Reference and Value Language ATTRIBUTE Argument To Pass by To Pass by Type Reference Value Fortran Default Scalars and Default VALUE option derived types C option Scalars and REFERENCE Default derived types option Default Arrays Default Cannot pass by value C option Arrays Default Cannot pass by value Non arrays Pointer Default argument name Arrays Default Struct type array_name This table does not describe argument passing of strings and Fortran 95 90 pointer arguments in Intel Fortran which are constructed differently than other arguments By default Fortran passes strings by reference along with the string length String length placement depends on whether the compiler option mixed_str_len_arg immediately after the address of the beginning of the string or nomixed str len arg after all arguments is set The default setting is nomixed str len arg Fortran 95 90 array pointers and assumed shape arrays are passed by passing the address of the array descriptor For a discussion of the effect of attributes on passing Fortran 95 90 pointers and strings see Handling Fortran 90 Pointers and Allocatable Arrays and Handling Character Strings Using Co
147. ands use Fortran 95 90 source language syntax for operators and expressions Enclose debugger command expressions between curly braces For example the expression print k in the following statement is enclosed between curly braces idb when at 12 print k Fortran Operators The Intel Fortran operators include the following e Relational operators such as less than LT or lt and equal to EQ or e Logical operators such as logical conjunction AND and logical disjunction OR e Arithmetic operators including addition subtraction multiplication and division For a complete list of operators see the Intel Fortran Language Reference Manual Procedures 124 Debugging Using idb The idb debugger supports invocation of user defined specific procedures using Fortran 95 90 source language syntax See Also Intel Fortran Language Reference Manual Online Intel amp Debugger IDB Manual Debugging Mixed Language Programs The idb debugger lets you debug mixed language programs Program flow of control across subprograms written in different languages is transparent The debugger automatically identifies the language of the current subprogram or code segment on the basis of information embedded in the executable file For example if program execution is suspended in a subprogram in Fortran the current language is Fortran If the debugger stops the program in a C function the current
148. ariables indicate a true value e The pathname and file name are returned in the NAME specifier variable if the file is named e Other information requested on the previously connected file is returned e Default values are usually returned for the INQUIRE specifiers also associated with the OPEN statement e The RECL value unit for connected formatted files is always 1 byte units For unformatted files the RECL unit is 4 byte units unless you specify the assume byterecl option to request 1 byte units If the unit is not connected e The OPENED specifier indicates a false value e The unit NUMBER specifier variable is returned as a value of 1 e Any other information returned will be undefined or default values for the various specifiers For example the following INQUIRE statement shows whether unit 3 has a file connected OPENED specifier in logical variable OPENED the name case sensitive in character variable NAME and whether the file is opened for READ WRITE or READWRITE access in character variable ACTION NOUIRE 3 OPENED I OPENED NAME I NAME ACTION I ACTION Inquiry by File Name An inquiry by name causes the Intel Fortran RTL to scan its list of open files for a matching file name One of the following occurs depending on whether a match occurs or not If a match occurs e The EXIST and OPENED specifier variables indicate a true value e The pathname and fil
149. arlier versions of Intel Fortran used a command name of ifc or efc For Intel Fortran 8 x these command names will still be accepted but in some future Intel Fortran release only the ifort command name will be accepted e The default configuration file name is now ifort cfg instead of ifl cfgorefl cfg e The predefined symbol name for the Intel Fortran compiler is __INTEL_COMPILER and it has a value of 800 for Intel Fortran Version 8 0 and 810 for Intel Fortran Version 8 1 e The record length RECL specifier for unformatted files is now 32 bit words To get the record length in bytes use the assume byterecl option e The backslash character is not treated as an escape character for control sequences in character literals To force the backslash to start escape sequences use the assume bscc option e Intel Fortran Version 8 x by default uses the integer 1 for the value of TRUE whereas Version 7 uses the integer 1 for the value of TRUE If you use the fpscomp logicals option with Version 8 x the compiler will use the integer 1 for the value of TRUE Version 8 x always uses the integer 0 as the value of FALSE as did Version 7 User written routines in Fortran or other languages for example C need to insure that they use values for TRUE and FALSE consistent with the compiler s choice e The random number generator used in Version 8 x is different from the random number generator used in Version 7 Version 8 uses
150. ata in a list directed input record had an 264 5 5 5 5 5 Reference Information invalid format or the type of the constant was incompatible with the corresponding variable The value of the variable was unchanged severe 60 Infinite format loop FOR IOS_INFFORLOO The format associated with an VO statement that included an VO list had no field descriptors to use in transferring those values Gilsevere or info 61 Format variable type mismatch FOR IOS FORVARMIS An attempt was made either to read or write a real variable with an integer field descriptor I L O Z B or to read or write an integer or logical variable with a real field descriptor D E or F severe 62 Syntax error in format FOR IOS SYNERRFOR A syntax error was encountered while the RTL was processing a format stored in an array or character variable B3lerror or info 63 Output conversion error FOR IOS OUTCONERR During a formatted output operation the value of a particular number could not be output in the specified field length without loss of significant digits When this situation is encountered the overflowed field is filled with asterisks to indicate the error in the output record If no ERR address has been defined for this error the program continues after the error message is displayed Alsevere 64 Input conversion error FORS IOS INPCONERR During a formatted input operation an invalid character was detected in
151. ation and bits 51 0 a normalized 53 bit fraction including the redundant most significant fraction bit not represented 135 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The value of data is in the approximate range 2 2250738585072013D 308 normalized to 1 7976931348623158D308 The IEEE denormalized subnormal limit is 4 94065645841246544D 324 The precision is approximately one part in 2 52 typically 15 decimal digits REAL KIND 16 EXTENDED PRECISION Representation REAL 16 same as REAL KIND 16 data occupies 16 contiguous bytes stored in IEEE style X_floating format Bits are labeled from the right 0 through 127 as shown below 127 128 112 111 a a ESPON ENT FRACTION uh ZE TLFBA GE The form of REAL 16 data is sign magnitude with bit 127 the sign bit 0 for positive numbers 1 for negative numbers bits 126 112 a binary exponent in excess 16383 notation and bits 111 0 a normalized 113 bit fraction including the redundant most significant fraction bit not represented The value of data is in the approximate range 6 4751 751 194380251 109244389582276465524996Q 4966 to 1 189731495357231 765085 759326628007 016196477Q4932 Unlike other floating point formats there is little if any performance penalty from using denormalized extended precision numbers This is because accessing denormalized REAL KIND 16 numbers does not result in an arithmetic trap the extended precision format is emulat
152. ation containing length fields The trailing length field allows a BACKSPACE request to skip back over records efficiently The 4 byte integer value stored in each length field indicates the number of data bytes excluding overhead bytes in that particular variable length record The character count field of a variable length record is available when you read the record by issuing a READ statement with a Q format descriptor You can then use the count field information to determine how many bytes should be in an VO list Variable Length Records Less Than 2 Gigabytes The figure below shows the record layout of variable length records that are less than 2 gigabytes Trailing User Data Length Field Variable Length Records Greater Than 2 Gigabytes For a record length greater than 2 147 483 639 bytes the record is divided into subrecords The subrecord can be of any length from 1 to 2 147 483 639 inclusive The sign bit of the leading length field indicates whether the record is continued or not The sign bit of the trailing length field indicates the presence of a preceding subrecord The position of the sign bit is determined by the endian format of the file A subrecord that is continued has a leading length field with a sign bit value of 1 The last subrecord that makes up a record has a leading length field with a sign bit value of 0 A subrecord that has a preceding subrecord has a trailing length field with a sign bit value of
153. attribute will be packed regardless of whatever alignment rules are currently in use 63 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I If your command line includes the stana option then the compiler ignores align sequence assume no byterecl Default assume nobyterecl Specifies the use of byte units for unformatted files This option e Specifies that the units for an explicit OPEN statement RECL specifier value are in bytes e Forces the record length value returned by an INQUIRE by output list to be in byte units The default value assume nobyterecl specifies that the units for RECL values with unformatted files are in four byte longword units assume no dummy_aliases Default assume nodummy_aliases Alternate syntax common args Requires that the compiler assume that dummy formal arguments to procedures share memory locations with other dummy arguments or with variables shared through use association host association or common block use You only need to compile the called subprogram with as sume dummy_aliases The program semantics involved with dummy aliasing do not strictly obey the Fortran standard and they slow performance Therefore using the default value assume nodummy_aliases will give the compiler better run time performance However if a program depends on dummy aliasing and you do not specify assume dummy_aliases the run time behavior of the program will be unpred
154. avoid stepping into a subprogram use the next command instead of step The command print n k displays the current values of variables N and K Their values are correct at this point in the execution of the program The two step commands continue executing the program into the loop lines 9 to 11 that copies and squares all nonzero elements of INARR into Debugging Using idb OUTARR Certain commands can be abbreviated In this example the s command is an abbreviation of the step command 9 The command print i k displays the current values of variables I and K Variable I has the expected value 1 But variable K has the value 0 instead of the expected value 1 To fix this error K Should be incremented in the loop just before it is used in line 11 10 The assign command assigns K the value 1 11 The watch variable k command sets a watchpoint that is triggered every time the value of variable K changes In the original version of the program this watchpoint is never triggered indicating that the value of variable K never changes a programming error 12 To test the patch the cont command an abbreviation of continue resumes execution from the current location The program output shows that the patched program works properly but only for the first array element Because the watchpoint watch variable k command does not occur the value of K did not change and there is a problem The idb message Process has exited with status 0 sh
155. ccdefault default is specified carriage control defaults to FORTRAN if the file is formatted and the unit is connected to a terminal e INCLUDE qualifiers LIST and NOLIST are recognized at the end of the file name in an INCLUDE statement at compile time If the file name in the INCLUDE statement does not specify the complete path the path used is the current directory Note that if vms is not specified the path used is the directory where the file that contains the INCLUDE statement resides e Quotation mark character A quotation mark character is recognized as starting an octal constant 0 7 instead of a character literal e Deleted records in relative files When a record in a relative file is deleted the first byte of that record is set to a known character currently Attempts to read that record later result in ATTACCNON errors The rest of the record the whole record if vms is not specified is set to nulls for unformatted files and spaces for formatted files 56 Compiler Options ENDFILE records When an ENDFILE is performed on a sequential unit an actual 1 byte record containing a Ctrl Z is written to the file If vms is not specified an internal ENDFILE flag is set and the file is truncated The vms option does not affect ENDFILE on relative files these files are truncated Implied logical unit numbers The vms option enables Intel Fortran to recognize certain environment variables at run t
156. ccess Avoid the segmented record type when the application requires that the same file be used for programs written in languages other than Fortran and for non Intel platforms See also Sesgmented Records Stream Record Type A stream file is not grouped into records and uses no record delimiters 162 Data and VO Stream files contain character or binary data that is read or written to the extent of the variables specified Specify CARRIAGECONTROL NONE for stream files See also Stream Files Stream LF and Stream CR Record Type Records are of varying length where the line feed LF or the carriage return CR character serve as record delimiters LF for Stream LF files and CR for Stream CR files Stream LF files must not contain embedded LF characters or use CARRIAGECONTROL LIST Instead specify CARRIAGECONTROL NONE Stream CR files must not contain embedded CR characters The Stream_LF record type is the usual record type for text files See also Stream_LF and Stream_CR Records Choosing a Record Type Before you choose a record type consider whether your application will use formatted or unformatted data If you are using formatted data you can choose any record type except segmented If you are using unformatted data avoid the Stream Stream_CR and Stream_LF record types The segmented record type can only be used for unformatted sequential access with sequential files You should not use segmented r
157. cess relative file and connects the unit number to the file similar to an OPEN statement Provided for compatibility with compilers older than FORTRAN 77 INQUIRE Returns information about a named file a connection to a unit or the length of an output item list Record position BACKSPACE Moves the record position to the beginning of the previous record Sequential access only DELETE Marks a record at the current record position in a relative file as deleted direct access only ENDFILE Writes an end of file marker after the current record sequential access only FIND Changes the record position in a direct access file Provided for compatibility with compilers older than FORTRAN 77 REWIND Sets the record position to the beginning of the file sequential access only Record input READ Transfers data from an external file record or an internal file to internal storage UNLOCK Frees a record in a relative or sequential file that was 156 Data and VO locked by a previous READ statement ACCEPT Reads input from stdin Unlike READ ACCEPT only provides formatted sequential input and does not specify a unit number Record output WRITE Transfers data from internal storage to an external file record or to an internal file REWRITE Transfers data from internal storage to an external file record at the current record position direct access relativ
158. ch routine containing a declaration of the dynamic common block a check is made of whether space for the common block has been allocated If the dynamic common block is not yet allocated space is allocated at the check time The following command line example specifies the dynamic common option with the names of the common blocks to be allocated dynamically at run time ifort dyncom blkl blk2 blk3 test f where Dik1 b1k2 and b1k3 are the names of the common blocks to be made dynamic Guidelines for Using the dyncom Option The following are some limitations that you should be aware of when using the dyncom option e An entity in a dynamic common cannot be initialized in a DATA statement e Only named common blocks can be designated as dynamic COMMON e An entity in a dynamic common block must not be used in an EQUIVALENCE expression with an entity in a static common block or a DATA initialized variable Why Use a Dynamic Common Block A main reason for using dynamic common blocks is to enable you to control the common block allocation by supplying your own allocation routine To use your own allocation routine you should link it ahead of the Fortran run time library This routine must be written in the C language to generate the correct routine name The routine prototype is void _FTN_ALLOC void mem int size char name 46 Building Applications where e mem is the location of the base pointer of the c
159. cify these options in the configuration file ifort cfg or on the command line For example to direct the compiler to search the path alt include instead of the default path use the following command line ifort X I alt include newmain f Configuration Files and Response Files Configuration files and response files are similar in that both eliminate the need to enter the same commands again and again Response files are also known as indirect command files The following describes each type of file Configuration Files You can use a configuration cfg file to e Decrease the time you spend entering command line options e Ensure consistency of often used commands You can insert any valid command line options into a configuration file The compiler processes options in the configuration file in the order in which they appear followed by the command line options that you specify when you invoke the compiler 35 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I A Note Options placed in the configuration file will be included each time you run the compiler If you have varying option requirements for different projects use response files By default a configuration file named ifort cfg is used This file resides in the same directory where the compiler executable resides However if you want the compiler to use another configuration file in a different location you can use the IFORTCFG environ
160. ck use and for argument passing among routines written in different languages These rules as a whole are the calling convention A calling convention includes e Stack consideration Does a routine receive a varying or fixed number of arguments e Naming conventions o Is lowercase or uppercase significant or not significant o Are external names altered e Argument passing protocol o Are arguments passed by value or by reference o What are the equivalent data types and data structures among languages This section provides information on the calling conventions available when writing routines written in Fortran C C and assembly language See these topics Calling Subprograms from the Main Program Summary of Mixed Language Issues Adjusting Calling Conventions in Mixed Language Programming Overview Adjusting Naming Conventions in Mixed Language Programming Overview Protoyping a Procedure in Fortran Exchanging and Accessing Data in Mixed Language Programming Overview 195 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Handling Data Types in Mixed Language Programming Overview Intel Fortran C Mixed Language Programs Overview Calling Subprograms from the Main Program Calls from the Main Program The Intel Fortran main program can call Intel Fortran subprograms including subprograms in static and shared libraries For mixed language applications the Intel Fortran main program can call subprogra
161. command to set the environment variable export FORT8 FORT8 usr users smith test dat To remove the association of an environment variable and its value within the Bourne shell the Korn shell or the bash shell use the unset command unset FORT8 Configuration File Environment Variables By default the compiler picks up the default configuration file i fort cfg from the same directory where the compiler executable resides However if you want the compiler to use another configuration file in a different location you can use the IFORTCFG environment variable to assign the directory and filename for the other configuration file See Also Compile Time Environment Variables Run Time Environment Variables Running the Shell Script to Set Up the Environment Variables 28 Building Applications Before you first invoke the compiler you need to set the environment variables to specify locations for the various components The Intel Fortran Compiler installation includes a shell script that you can use to set environment variables Use the source command to execute the shell script from the command line For example to execute this script file for the bash shell source opt intel fc 80 bin ifortvars sh If you use the C shell use the csh version of this script file source opt intel fc 80 bin ifortvars csh If you want ifortvars sh to run automatically when you start Linux edit your bash profi le file and add the line
162. contained within it Language Element Limit Actual number of arguments per CALL Limited only by memory constraints or function reference Arguments in a function reference 255 in a specification expression Array dimensions 7 Array construction nesting 20 Array elements per dimension 9 223 372 036 854 775 807 2 31 1 on IA 32 systems 2 63 1 Itanium based systems plus limited by current memory 253 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I configuration Constants character and Hollerith 7198 characters Constants characters read in list 2048 characters directed VO Continuation lines 511 Data and VO implied DO nesting 7 DO and block IF statement nesting 128 combined DO loop index variable 9 223 372 036 854 775 807 2 63 1 Format group nesting 8 Format statement length 2048 characters Fortran source line length fixed form 72 or 132 if extend source is in effect characters free form 7200 characters INCLUDE file nesting 20 levels Labels in computed or assigned GOTO list Limited only by memory constraints Lexical tokens per statement 20000 Named common blocks Limited only by memory constraints Nesting of array constructor implied DOs 7 Nesting of input output implied DOs 7 Nesting of interface blocks Limited only by memory constraints Ne
163. cpp and accepts the cpp style directives cpp and thus fpp prohibit the use of a string constant value in an if expression You can use the Preprocessor Options on the command line to direct the operations of the preprocessor A caution Using a preprocessor that does not support Fortran can damage your Fortran code especially with FORMAT statements For example FORMAT NN 14 changes the meaning of the program because the backslash N indicates end of record Assemblers and Linker The assemblers and linker you can use are summarized in this table Tool Default Provided with Intel Fortran Compiler IA 32 assembler Linux assembler as No tanium Intel Itanium Yes assembler assembler ias Linker System linker 1d 1 No You can specify alternate tool locations and options for preprocessing compilation assembly and linking See also Libraries Provided by Intel Fortran Assemblers For 32 bit applications Linux supplies its own assembler as For Itanium based applications use the Itanium assembler ias For example to link some specific input file to the Fortran project object file do the following 22 Getting Started 1 Issue a command using the S option to generate an assembly code file file s ifort S c file f 2 To assemble the file s file call the Itanium assembler with this command ias Nso p32 o file o file s where the following assembler options are used
164. criptor on IA 32 systems are as follows 221 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e The first longword bytes 0 to 3 contains the base address The base address plus the offset defines the first memory location start of the array e The second longword bytes 4 to 7 contains the size of a single element of the array e The third longword bytes 8 to 11 contains the offset The offset is added to the base address to define the start of the array e The fourth longword bytes 12 to 15 contains the low order bit set if the array has been defined storage allocated Other bits may also be set by the compiler within this longword for example to indicate a contiguous array e The fifth longword bytes 16 to 19 contains the number of dimensions rank of the array e The sixth longword bytes 20 to 23 is reserved e The remaining longwords bytes 24 up to 107 contain information about each dimension up to seven Each dimension is described by three additional longwords o The number of elements extent o The distance between the starting address of two successive elements in this dimension in bytes o The lower bound An array of rank one requires three additional longwords for a total of nine longwords 6 3 1 and ends at byte 35 An array of rank seven is described in a total of 27 longwords 6 3 7 and ends at byte 107 For example consider the following declaration integer target
165. d The FORT CONVERTn method takes precedence over this method When the appropriate environment variable is set when you open the file the FORT CONVERT ext or FORT CONVERT ext environment variable is used if a FORT CONVERTnN environment variable is not set for the unit number The FORT CONVERTn and the FORT CONVERT ext or FORT CONVERT ext environment variable methods take precedence over the other methods For instance you might use this method to specify that a unit number will use a particular format instead of the format specified in the program perhaps for a one time file conversion You can set the appropriate environment variable using the format FORT_CONVERT ext or FORT CONVERT ext Consider using the FORT CONVERT ext form because a dot cannot be used for environment variable names on certain Linux command shells If you do define both 148 Data and VO FORT_CONVERT ext and FORT CONVERT ext for the same extension ext the file defined by FORT CONVERT ext is used Environment Variable F UFMTENDIAN Method This little endian to big endian conversion feature is intended for Fortran unformatted input output operations It enables the development and processing of files with big endian data organization The feature also enables processing of the files developed on processors that accept big endian data format and producing the files for such processors on IA 32 based little endian systems This little endian
166. d 1 L Record 3 Unformatted Sequential Files Unformatted sequential files are organized slightly differently on different platforms This section describes unformatted sequential files created by Intel Fortran when the fpscomp option Such as fpscomp ioformat was specified If you are accessing files from another platform that organizes them differently see Converting Unformatted Data Overview The records in an unformatted sequential file can vary in length Unformatted sequential files are organized in chunks of 130 bytes or less called physical blocks Each physical block consists of the data you send to the file up to 128 bytes plus two 1 byte length bytes inserted by the compiler The length bytes indicate where each record begins and ends A logical record refers to an unformatted record that contains one or more physical blocks See the following figure Logical records can be as big as you want the compiler will use as many physical blocks as necessary When you create a logical record consisting of more than one physical block the compiler sets the length byte to 129 to indicate that the data in the current physical block continues on into the next physical block For example if you write 140 bytes of data the logical record has the structure shown in the following figure Logical Record in Unformatted Sequential File CD bytes data AG ni bytes data pe Ee we 12 L One logical record 192 Data and VO The
167. d idea to specify the passing technique explicitly rather than relying on defaults E Note In addition to ATTRIBUTES the no mixed str len arg compiler option also establishes some default argument passing conventions such as for hidden length of strings Examples of passing by reference and value for C follow All are interfaces to the example Fortran subroutine TEstpRoc below The definition of TESTPRoc declares how each argument is passed The REFERENCE option is not strictly necessary in this example but using it makes the argument s passing convention conspicuous SUBROUTINE TESTPROC VALPARM REFPARM IDECS ATTRIBUTES VALUE VALPARM IDECS ATTRIBUTES REFERENCE REFPARM INTEGER VALPAR INTEGER REFPAR END SUBROUTINE In C and C all arguments are passed by value except arrays which are passed by reference to the address of the first member of the array Unlike Fortran C and C do not have calling convention directives to affect the way individual arguments are passed To pass non array C data by reference you must pass a pointer to it To pass a C array by value you must declare it as a member of a structure and pass the structure The following C declaration sets up a call to the example Fortran testproc subroutine extern void testproc int ValParm int RefParm The following table summarizes how to pass arguments by reference
168. d output and write the error information ASCII text to the file 249 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I 250 The setting of FOR DIAGNOSTIC LOG FILE is independent of FOR DISABLE DIAGNOSTIC DISPLAY SO you can disable the screen display of information but still capture the error information in a file The text string you assign for the file name is used literally so you must specify the full name If the file open fails no error is reported and the run time system continues diagnostic processing FOR DISABLE DIAGNOSTIC DISPLAY Disables the display of all error information This variable is helpful if you just want to test the error status of your program and do not want the Fortran run time system to display any information about an abnormal program termination FOR DISABLE STACK TRACE This variable disables the call stack trace information that follows the displayed severe error message text The Fortran run time error message is displayed whether or not FOR DISABLE STACK TRACE is set to true FOR IGNORE EXCEPTIONS This variable disables the default run time exception handling for example to allow just in time debugging The run time system exception handler returns EXCEPTION CONTINUE SEARCH to the operating system which looks for other handlers to service the exception FOR NOERROR DIALOGS This variable disables the display of dialog boxes when certain exceptions or
169. d requires an explicit file OPEN statement to specify the numeric format of the file for that unit number This method takes precedence over the OPTIONS statement and the compiler option convert keyword method but has a lower precedence than the environment variable methods For example the following source code shows how the OPEN statement would be coded to read unformatted VAXD numeric data from unit 15 which might be processed and possibly written in native little endian format to unit 20 The absence of the CONVERT keyword or environment variables FORT CONVERT20 FORT CONVERT dat FORT CONVERT dat Of F UFMTENDIAN indicates native litte endian data for unit 20 OPEN CONVERT VAXD FILE graph3 dat FORM UNFORMATTED UNIT 15 OPEN FILE graph3 t dat FORM UNFORMATTED UNIT 20 A hard coded OPEN statement CONVERT keyword value cannot be changed after compile time However to allow selection of a particular format at run time equate the CONVERT keyword to a variable and provide the user with a menu that allows selection of the appropriate format menu choice sets the variable before the OPEN occurs You can also select a particular format at run time for a unit number by using one of the environment variable methods FORT CONVERTn FORT_CONVERT ext FORT CONVERT ext or F UFMTENDIAN which take precedence over the OPEN statement CONVERT keyword method OPTIONS Statement Method You can
170. d the processors the code is optimized for are e axK Intel Pentium Ill and compatible Intel processors e axW Intel Pentium 4 and compatible Intel processors e axN Intel Pentium 4 and compatible Intel processors Programs compiled with this option will detect non compatible processors and generate an error message during execution This option also enables new optimizations in addition to Intel processor specific optimizations e axB Intel Pentium M and compatible Intel processors Programs compiled with this option will detect non compatible processors and generate an error message during execution This option also enables new optimizations in addition to Intel processor specific optimizations 88 Compiler Options e axP Intel Pentium 4 processors with Streaming SIMD Extensions 3 SSE3 instruction support Programs compiled with this option will detect non compatible processors and generate an error message during execution This option also enables new optimizations in addition to Intel processor specific optimizations On Intel EM64T systems axW and axP are the only valid options complex limited rangef Default Off complex limited range Enables the use of basic algebraic expansions of some arithmetic operations involving data of type COMPLEX This can result in performance improvements in programs that use a lot of COMPLEX arithmetic However values at the extremes of the exponent range might not compute corr
171. ds and components of derived types on the smaller of the size boundary specified n can be 1 2 4 8 or 16 or the boundary that will naturally align them Specifying align recnbyte does not affect whether common blocks are naturally aligned or packed This option Is the same as this option Zp align records or align recl byte Zp1 align norecords or align reclbyte Zp2 align rec2byte Zp4 align rec4byte Zp8 align rec8byte Zp16 align recl byte or align records align none noalign align all specifies all of the following align nocommons align dcommons align records align nosequence align No records Default align records Requests that components of derived types and fields of records be aligned on natural boundaries up to 8 bytes for derived types with the SEQUENCE statement by adding padding See align sequence The align norecords option requests that components and fields be aligned on arbitrary byte boundaries instead of on natural boundaries up to 8 bytes with no padding align no sequence Default align nosequence Tells the compiler that components of derived types with the SEQUENCE attribute will obey whatever alignment rules are currently in use The default alignment rules align unsequenced components on natural boundaries The default value of align nosequence means that components of derived types with the SEQUENCE
172. e files only TYPE Writes record output to stdout same as PRINT PRINT Transfers data from internal storage to stdout Unlike WRITE PRINT only provides formatted sequential output and does not specify a unit number In addition to the READ WRITE REWRITE TYPE and PRINT statements other I O record related statements are limited to a specific file organization For instance e The DELETE statement only applies to relative files Detecting deleted records is only available if the vms option was specified when the program was compiled e The BACKSPACE statement only applies to sequential files open for sequential access e The REWIND statement only applies to sequential files open for sequential access and to direct access files e The ENDFILE statement only applies to certain types of sequential files open for sequential access and to direct access files e The UNLOCK statement only applies to records in relative or sequential files The file related statements OPEN INQUIRE and CLOSE apply to any relative or sequential file Forms of VO Statements Each type of record VO statement can be coded in a variety of forms The form you select depends on the nature of your data and how you want it treated When opening a file specify the form using the FORM specifier The following are the forms of I O statements e Formatted VO statements contain explicit format specifiers that are used to control the translation
173. e uopen_ c 183 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I This routine opens a file using data passed by Intel Fortran RTL KX INCLUDE FILES a include lt sys types h gt include lt sys stat h gt include lt sys file h gt include uopen h Include file for this module int uopen_ file_name open_flags create_mode lun file_length Open a file using the parameters passed by the calling Intel ER Fortran program xx Formal Parameters char file name access read name of the file to open int open flags access read READ WRITE see file h int create mode access read set if new file to be created int lun access read logical unit number file opened on int file length access read number of characters in file name Function Value Completion Code Whatever is returned by open is immediately returned to the Fortran OPEN The returned value is the following KR value gt 0 is a valid fd KN value lt 0 is an error xx Modify open flags logical OR to specify the file be opened for xx write access only with records appended at the end such as xx writing to a shared log file ey int result Function result value xopen_flags O_CREAT 184 Data and VO O WRONLY O APPEND
174. e 141 Converting Unformatted Data Overview iese ee ee ee ee ee 141 Supported Native and Nonnative Numeric Formats iese ees see ee 141 Limitations of Numeric ConversiON iese ss ed ee ee ee AA ee ee ee ee 145 Methods of Specifying the Data Format esse se se ee ee de ER Ee ee ee ee 145 Porting Nonnative Data EE SEE Ee GE at ee 154 ao AS EE EE arene ole 154 Fortran O OvervieW 5 ss os Red DEE OES GEROER SS ES ES be ek OO Re ee OE 154 viii Table Of Contents Logical VO UNS apart 155 Types of VO Statements ce Seed nd dd 156 Forms of VO Stale MOIS ua 157 Files and File Characteristics ccccccsceeeeeeeeeeceeeeeeeeeeeeeaeaaaeeeeeeeeeea 159 Accessing and Assigning Files ccceeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeaeaeneeeees 164 Default Pathnames and File Names iese sedes ee ee ER Re ee ee de ER Ee ee ee ee 167 Using Preconnected Standard VO Files sesse se ie ee ke ee ee ee eke ee 168 Opening Files OPEN Statement esse eed ee ese se ke ee dee ee ee Ee Ak ee ee ee ee 169 Obtaining File Information INQUIRE Statement sesse ee ee ee ee ee ee 171 Closing a File CLOSE slalemen sr DEI EN EERS EE DE AE Gee 173 Record OPEN RE es ed Ae ED EE eR hs tas 174 User Supplied OPEN Procedures USEROPEN Specifier 006 180 Format of R cord Types 186 Microsoft Fortran PowerStation Compatible Files sees es ee ee ee 190 Programming with Mixed Language ee se ee ee ee ER Ee ee ee de
175. e When input is ready at the terminal Some signals terminate the receiving process if no action is taken optionally creating a core file while others are simply ignored unless the process has requested otherwise Except for certain signals calling the signal OF sigaction routine allows specified signals to be ignored or causes an interrupt transfer of control to the location of a user written signal handler You can establish one of the following actions for a signal with a call to signal e Ignore the specified signal identified by number e Use the default action for the specified signal which can reset a previously established action e Transfer control from the specified signal to a procedure to receive the signal specified by name Calling the signal routine lets you change the action for a signal such as intercepting an operating system signal and preventing the process from being stopped The table below shows the signals that the Intel Fortran RTL arranges to catch when aprogram is started Signal Intel Fortran RTL message SIGFPE Floating point exception number 75 SIGINT Process interrupted number 69 SIGIOT IOT trap signal number 76 SIGQUIT Process quit number 79 SIGSEGV Segmentation fault number 174 SIGTERM Process killed number 78 Calling the signal routine specifying the numbers for these signals results in overwriting the signal handling facility set u
176. e arguments with commas The following example directs the linker to link with an alternative library ifort Ooption link lmylib progl f Predefined Preprocessor Symbols Preprocessor symbols macros let you substitute values in a program before it is compiled The substitution is performed in the preprocessing phase Some preprocessor symbols are predefined by the compiler system and are available to compiler directives and fpp If you want to use others you need to specify them on the command line See also Preprocessor Options The predefined preprocessor symbols available for the Intel Fortran compiler are described in the table below The Default column describes whether the preprocessor symbol is enabled on or disabled off by default Symbol Name Default 1A 32 or Description ltanium based __INTEL_COMPILER n On Both Identifies the n 810 Intel Fortran Compiler 38 Building Applications INTEL COMPILER BUILD DATE Both Identifies the YYYYMMDD Intel Fortran Compiler N buiddate linux Both Defined at linux the start of gnu linux compilation linux unix unix unix BEE EE ERA EO iei IA 32 1386 1386 _ia64__ tanium __1a64 ia64 _OPENMP n n 200011 Both This preprocessor symbol has the form YYYYMM where YYYY is the year and MMis the month of the OpenMP Fortran specification supported This pre
177. e as the Intel Fortran RTL e severity identifies the severity level severe error warning Or info e nnn identifies the message number also the IOSTAT value for I O statements e message text explains the event that caused the message The severity levels are described in order of greatest to least severity e A severe message must be corrected The program s execution is terminated when the error is encountered unless the program s I O statements use the END EOR or ERR branch specifiers to transfer control perhaps to a routine that uses the IOSTAT specifier e Anerror message should be corrected The program might continue execution but the output from this execution may be incorrect 232 Error Handling e Awarning message should be investigated The program continues execution but output from this execution may be incorrect e An info message is for informational purposes only The program continues For severe errors stack trace information is produced by default unless the environment variable FOR DISABLE STACK TRACE is Set If the command line option t raceback is set the stack trace information contains program counters set to symbolic information Otherwise the information contains merely hexadecimal program counter information In some cases stack trace information is also produced by the compiled code at run time to provide details about the creation of array temporaries If FOR DISABLE S
178. e calling part of the program such as main program and your asynchronous handler attempted to acquire the same global resource severe 153 Allocatable array or pointer is not allocated FOR IOS_INVDEALLOC A Fortran 90 allocatable array or pointer must already be allocated when you attempt to deallocate it You must allocate the array or pointer before it can again be deallocated severe 173 A pointer passed to DEALLOCATE points to an array that cannot be deallocated FOR IOS_INVDEALLOC2 A pointer that was passed to DEALLOCATE pointed to an explicit array an array slice or some other type of memory that could not be deallocated in a DEALLOCATE statement Only whole arrays previous allocated with an ALLOCATE statement can be validly passed to DEALLOCATE severe 174 SIGSEGV message text FORS IOS SIGSEGV One of two possible messages occurs for this error number severe 174 SIGSEGV segmentation fault occurred This message indicates that the program attempted an invalid memory reference Check the program for possible errors severe 174 SIGSEGV possible program stack overflow occurred The following explanatory text also appears Program requirements exceed current stacksize resource limit severe 175 DATE argument to DATE_AND_TIME is too short LEN n required LEN 8 FOR IOS_SHORTDATEARG The number of characters associated with the DATE argument to the DATE_AND
179. e ee ee ee ee 38 Defining Preprocessor Symbols iese de ee ee EA ee ee EE AA ee ee ae ee 40 Suppressing Preprocessor Symbols ie ee Ee AR ee ee Ee ee ea ER ee ee 40 Redirecting Command Line Output to Files iis ee ee ee Ee ee ee RR ee ee 40 Creating Running and Debugging an Executable Program sesse sesse se ee 41 Commands to Create a Sample Program cceceeeeeeceeeeeeeeeeeeeeaeeeeeeeees 42 Running the Sample Program errnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnannnnnnnnnnnnnenenen 43 Debugging the Sample Program iese ed ee ee AA ee ee EE Ak ee ee Ge ee 43 Creating Shared Lb nes sa EE EE GEK ee 43 Creating a Shared Library with a Single ifort Command iese esse see 44 Creating a Shared Library with ifort and Id Commands 0eeeeeee 44 Shared Library Fi striclionS ti SR EI GE tice Ee OE N 45 Installing Shared Libraries EE GESEENDE ee DE De Es 45 Allocating Common BlOCKS sx er see Ro DEE 46 Guidelines for Using the dyncom Option eceeceeeeeeeeeeeeeeeeeeeeeeeees 46 Why Use a Dynamic Common Block rrnnnnnnrnnnrrnnnnnrnrrnnnennnnnnnnrnrnnnnrenenen 46 Allocating Memory to Dynamic Common BlockS iese see ee se RE ee ee 47 Compiler ODUONSE ss Mes EE a EER EE EE GE eee 49 Compiler Options OVENEN Lamer see ee 49 Compiler Options Details ek este he tera eee cade 49 Styles of Compiler Options st ESE eee 49 Using Multiple ifort Commands ees ee ee ee ee ER
180. e interprocedural optimizations or multifile IPO When you specify this option the compiler performs inline function expansion for calls to functions defined in separate files Optionally you can specify an n value an integer greater than or equal to 0 which indicates the number of object files that the compiler should create If n is equal to 0 the compiler decides whether to create one or more object files based on an estimate of the size of the object file It generates one object file for small applications and two or more object files for large applications 91 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The default value for nis 1 generate a single object file See Also See also these topics in Volume Il IPO Compilation Model Creating a Multifile IPO Executable with xilink Using ip with Qoption Specifiers ipo_c Default Off Optimizes across files and produces a multifile object file Stops prior to the final link stage leaving an optimized object file See also this topic in Volume Il Capturing Intermediate Outputs of IPO ipo obj Default Off Forces the generation of real object files Requires ipo n Specifying ipo obj ipo2 creates ipo obj o and ipo_obj1 o See also this topic in Volume If Compilation with Real Object Files ipo S Default Off Optimizes across files and produces multifile assembly files Performs the same optimizations as ipo n but stops
181. e name are returned in the NAME specifier variable 172 Data and VO e The UNIT number is returned in the NUMBER specifier variable e Other information requested on the previously connected file is returned e Default values are usually returned for the INQUIRE specifiers also associated with the OPEN statement e The RECL value unit for connected formatted files is always 1 byte units For unformatted files the RECL unit is 4 byte units unless you specify the assume byterecl option to request 1 byte units If no match occurs e The OPENED specifier variable indicates a false value e The unit NUMBER specifier variable is returned as a value of 1 e The EXIST specifier variable indicates true or false whether the named file exists on the device or not e If the file does exist the NAME specifier variable contains the pathname and file name e Any other information returned will be default values for the various specifiers based on any information specified when calling INQUIRE The following INQUIRE statement returns whether the file named log_file is connected in logical variable OPEN whether the file exists in logical variable EXIST and the unit number in integer variable NUMBER NQUIRE FILE log_file OPENED I_OPEN EXIST I_EXIST NUMBER I NUMBER Inquiry by Output Item List Unlike inquiry by unit or inquiry by name inquiry by output item list does not attempt
182. e nonadvancing I O might not read an entire record it also supports an EOR specifier to branch to a specified label when the end of the record is read If you omit the EOR and the IOSTAT specifiers when using nonadvancing I O an error results when the end of record is read When using nonadvancing input you can use the SIZE specifier to return the number of characters read For example in the following READ statement 178 Data and VO SIZE X where variable X is an integer returns the number of characters read in X and an end of record condition causes a branch to label 700 150 FORMAT F10 2 F10 2 I6 READ UNIT 20 FMT 150 SIZE X ADVANCE NO EOR 700 AE I Record Transfer VO statements transfer all data as records The amount of data that a record can contain depends on the following circumstances e With formatted I O except for fixed length records the number of items in the VO statement and its associated format specifier jointly determine the amount of data to be transferred e With namelist and list directed output the items listed in the NAMELIST statement or I O statement list in conjunction with the NAMELIST or list directed formatting rules determine the amount of data to be transferred e With unformatted VO except for fixed length records the VO statement alone specifies the amount of data to be transferred e When you specify fixed length records RECORDTYPE FIXED all reco
183. e the compilation is taking place 3 If specified the directory or directories listed in the Idir option The order of searching multiple directories occurs within the specified list from left to right 4 The directories indicated in the compile time environment variable FPATH See also noinclude preprocess only Default Off 102 Compiler Options Alternate syntax P and F Runs the Fortran preprocessor fpp and puts the result for each source file in a corresponding i or i90 file The i or i90 file does not have line numbers in it The source file is not compiled You need to specify fpp with this option U name Default Off Undefines any definition currently in effect for the symbol specified by name Wp option 1 option2 Default Off Passes options specified by option1 opt ion2 and so forth to the preprocessor This option is the same as fpp except that fpp also invokes fpp Run Time Options The run time options let you specify error checking to be performed at run time not compile time Descriptions of Run Time Options no check all or nNo check none Default Custom options are specified individually Alternate syntax C is equivalent to check all Specifies all or no checking for run time failures Individual run time check options shown below are not available if check all or check none is specified nocheck is equivalent to check none check is equiva
184. early stages of program development use the g option to create unoptimized code optimization level 00 This option also might be chosen later to debug reported problems from later stages Traceback and symbol table information result in a larger object file During the later stages of program development use g0 or g1 to minimize the object file size and as a result the memory needed for program execution usually with optimized code The g0 option eliminates the traceback information When you have finished debugging your program you can recompile and relink to create an optimized executable program or remove traceback and symbol table information with the strip command See strip 1 See the debug keyword option to learn more about settings that enhance debugging Fig Note Debugging of optimized code is not fully supported on Intel platforms Preparing Your Program for Debugging 108 Debugging Using idb Use the ifort command with certain options to create an executable program for debugging To invoke the debugger enter the debugger shell command and the name of the executable program The following commands create compile and link the executable program and invoke the interface to the debugger ifort g o squares squares f90 idb squares Linux Application Debugger for xx bit applications Version X X Build xxxx object file name squares reading symbolic information done idb In this e
185. ecord can be retrieved only after all of the records preceding it have been read new records can be written only at the end of the file Direct Access Direct access transfers records selected by record number to and from either sequential files stored on disk with a fixed length record type or relative organization files If you select direct access mode you can determine the order in which records are read or written Each READ or WRITE statement must include the relative record number indicating the record to be read or written You can directly access a sequential disk file only if it contains fixed length records Because direct access uses cell numbers to find records you can enter successive READ or WRITE statements requesting records that either precede or follow previously requested records For example the first of the following statements reads record 24 the second reads record 10 REAI REAI 12 REC 24 12 REC 10 J D D Limitations of Record Access by File Organization and Record Type You can use both access modes on sequential and relative files However direct access to a sequential organization file can only be done if the file resides on disk and contains fixed length records The table below summarizes the types of access permitted for the various combinations of file organizations and record types Record Sequential Direct Type Access Access Sequ
186. ecords for files that are read by programs written in languages other than Intel Fortran The Stream Stream_CR Stream_LF and segmented record types can be used only with sequential files The default record type RECORDTYPE depends on the values for the ACCESS and FORM specifiers for the OPEN statement The record type of the file is not maintained as an attribute of the file The results of using a record type other than the one used to create the file are indeterminate An VO record is a collection of fields data items that are logically related and are usually processed as a unit Unless you specify nonadvancing VO ADVANCE specifier each Intel Fortran VO statement transfers at least one record Record Overhead 163 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Record overhead refers to bytes associated with each record that are used internally by the file system and are not available when a record is read or written Knowing the record overhead helps when estimating the storage requirements for an application Although the overhead bytes exist on the storage media do not include them when specifying the record length with the RECL specifier in an OPEN statement The various record types each require a different number of bytes for record overhead as described in the table below Record File Record Overhead Type Organization Fixed length Sequential None F
187. ectly f no Jalias Default falias Specifies that aliasing should be assumed in the program See also f no fnalias f no fnalias Default ffnalias Specifies that aliasing should be assumed within functions The fno fnalias option specifies that aliasiing should not be assumed within functions but should be assumed across calls See also f no alias fast Default Off Provides a shortcut method to enable several optimizations for run time performance On ltanium based systems the fast option sets the following options to improve performance e 03 optimizes for maximum speed and high level optimizations 89 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e ipo enables interprocedural optimizations across files e static prevents linking with shared libraries On IA 32 and Intel EM64T systems fast also sets xP Therefore fast sets O3 ipo static xP Setting xP on IA 32 and Intel EM64T systems causes the compiler to detect non compatible processors and generate an error message during execution To get the best possible performance you might need to use the option in conjunction with an architecture specific option such as xN To override one of the options set by fast specify that option after the fast option on the command line E Note The several options set by the fast option may change from release to release fnsplit Itanium based systems o
188. ed in software The smallest normalized number is 3 3621031431 1209350626267781 7321 753Q 4932 The precision is approximately one part in 2 112 or typically 33 decimal digits COMPLEX KIND 4 COMPLEX Representation COMPLE X 4 same as COMPLEX KIND 4 and COMPLEX 8 data is 8 contiguous bytes containing a pair of REAL 4 values stored in IEEE S_floating format The low order 4 bytes contain REAL 4 data that represents the real part of the complex number The high order 4 bytes contain REAL 4 data that represents the imaginary part of the complex number as shown below ad aa 2 op G REAL l PAET EXPONENT FRACTION IMAGINARY PART EXPONENT FRACTION ZK 981 7 GE Ad 136 Data and VO The limits and underflow characteristics for REAL 4 apply to the two separate real and imaginary parts of aCOMPLEX 4 number Like REAL 4 numbers the sign bit representation is 0 zero for positive numbers and 1 for negative numbers COMPLEX KIND 8 DOUBLE COMPLEX Representation COMPLE X 8 same as COMPLEX KIND 8 and COMPLEX 16 data is 16 contiguous bytes containing a pair of REAL 8 values stored in IEEE T_floating format The low order 8 bytes contain REAL 8 data that represents the real part of the complex data The high order 8 bytes contain REAL 8 data that represents the imaginary part of the complex data as shown below Ga amp a il D EXPONENT FRACTION IMAGINARY PART EXPONENT FRACTION ZK 9818 GE REAL PART
189. ed with status 0 idb quit In this example e The stop at 4 command sets a breakpoint at line 4 To set a breakpoint at the start of a subprogram such as calc use the stop in command such aS stop in calc e The run command begins program execution and stops at the first breakpoint The program is now active allowing you to view the values of variables with print commands and perform related functions e The cont command resumes continues program execution In addition to the cont command you can also use the step next run Of rerun commands to resume execution e The delete 1 command shows how to delete a previously set breakpoint with event number 1 For instance you might need to delete a previously set breakpoint before you use the rerun command e The rerun command runs the program again Since there are no breakpoints the program runs to completion e The quit command exits the debugger and returns to the shell Other Debugger Commands Other debugger commands include the following e To get help on debugger commands enter the help command e Todisplay previously typed debugger commands enter the history command e To examine the contents of a location use the print or dump commands e To execute a shell command use the sh command followed by the desired shell command For instance if you cannot recall the name of a FUNCTION statement the following grep shell command displays the li
190. ee 51 disclaimer ee 2 displaying variables in debuggiNg esse ee 117 documentation additional ne De 17 documentation conventions 17 DOUBLE COMPLEX data representation c0ccccceeees 137 DOUBLE PRECISION data representation c0ccccceeees 135 double_size compiler option 62 dps compiler option 0 74 dryrun compiler option 79 dynamic common block allocating memory tO 46 guidelines for USING sesse 46 dynamic linker compiler option 79 dyncom compiler option 46 62 E e90 compiler option 0 57 e95 compiler option 0 57 EDO ssel OE 86 efc ME EA IE 252 siele EE 252 2 6 iN ED 252 END branch specifier 235 ENDFILE statement 156 174 environment variable F UFMTENDIAN method 149 environment variable FORT CONVERT ext method 148 environment variable FORT CONVERT ex method 148 environment variable FORT CONVERTn nethod 147 environment variables Compile time sees ee 249 running shell script to set up 28 401 Io EE 249 SOWING uansett 28 WIG WING Heen 28 EOR branch specifier 235 ERR branch specifier 235 error handling SEE bs eu ae ee DEI sees 231 FUN AIME ees see se ee RR 235 error handling iese ee ese 231 error handling capabilities 283 Intel amp Fort
191. ee ee ee de Re ee 50 Table Of Contents vi Using the OPTIONS Statement to Override Options rrrrnnnrnrnnnnrnrvnnnnn 50 Getting Help on Options Aase seas sea ee gear eee dace mame baie te 50 Compiler Directives Related to Options iese se ee ee Re ee AR ER Ee ee ee ee 51 Gode Generation ODIHORS sn DE ei ee ate 51 Descriptions of Code Generation Options ee ee ee AR ER ee ee 51 Compatibility Options sa eset aie chee A oe leet De ie DE Lederer 52 Descriptions of Compatibility Options cceceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaea 53 Compilation Diagnostics OptionS cccecceeeeeeeeeeeeeeeeeeeeeeeeeeeeaeeeeeeeeeeeeaea 57 Descriptions of Compilation Diagnostics Options eeeeeeeeeeeeeeeeeeeeee 57 BEERS oe EEE RE A EE EN 62 Descriptions of Data Options ees ee EE ee ER EA ee ee Re AA ee ee 62 External Procedures Options rnnnnnnnnnnnnnnnnnnnonnnnnnnnnnnnonnnnnnnnnnnnnnnnnnnnnnneee 68 Descriptions of External Procedures OptONS esse see ee ede ee ee Re ee ee ee 68 Floating Pont PO ae eee NSG 69 Descriptions of Floating Point Options ccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaea 70 g 9 01 6 80 og 18 ge ER DE RE Ee EE AG GEE Ek 74 Descriptions of Language Options ES EE eee Ne 74 Libraries OptONS ee ee RR RE ee ee AR ER Ee ee ee RA ER Ee ee ee ee de Re ER ee ee ee ee Re ee ee 77 Descriptions of Libraries Options EE MERE EI Ee Ge Se ER Hess kann 77 Miscellane
192. efile2 F Note An at sign must precede the name of the response file on the command line Specifying Alternative Tool Locations and Options The Intel Fortran compiler lets you specify alternative tool locations and tool options to be used instead of default tools for preprocessing compilation assembly and linking You can use command line options to do this Using Qlocation to Specify an Alternative Location for a Tool Qlocation lets you specify the pathname location of a tool This option s syntax is Qlocation tool path where tool is e fpp Intel Fortran preprocessor fpp e f Intel Fortran compiler fortcom e as Assembler e linkorid Linker e crt The crt o files linked into executables to contain the place to start execution and pathis the location of the tool Example ifort Qlocation fpp usr preproc myprog f 37 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Using Qoption to Pass Options to Tools Qopt ion lets you pass options to the preprocessor compiler assembler or linker This option s syntax is Qoption tool options where tool Is e fpp Intel Fortran preprocessor fpp Intel Fortran compiler fortcom e as Assembler e link Linker and options is one or more valid argument strings for the designated tool If the argument contains a space or tab character you must enclose the entire argument in quotation marks You must separate multipl
193. ems 01 and 02 are equivalent e 02 Alternate syntax on Itanium based systems 0O Minimizes size optimizes for speed but disables some optimizations that increase code size for a small speed benefit for the Itanium compiler O1 turns off software pipelining to reduce code size This option enables local optimizations within the source program unit recognition of common subexpressions and expansion of integer multiplication and division using shifts e 03 Maximize speed plus use higher level optimizations optimizations include loop transformation software pipelining and IA 32 only prefetching this option may not improve performance for some programs Specifying 03 includes the optimizations performed by 02 This option enables additional global optimizations that improve speed at the cost of extra code size These optimizations include o Loop unrolling including instruction scheduling o Code replication to eliminate branches 93 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I o Padding the size of certain power of two arrays to allow more efficient cache use See also this topic in Volume II Using Arrays Efficiently Setting 03 sets fp On IA 32 systems 01 02 and 0 are equivalent On Itanium based systems 02 and 0 are equivalent E Note The last On option specified on the command line takes precedence over any others opt_report Default Off Generates an optimization
194. en is errnum END PROGRAM EX1 Format of Record Types Fixed Length Records When you specify fixed length records all records in the file contain the same number of bytes When you open a file that is to contain fixed length records you must specify the record size by using the RECL specifier A sequentially organized file opened for direct access must contain fixed length records to allow the record position in the file to be computed correctly For relative files the layout and overhead of fixed length records depend on whether or not the program accessing the file was compiled with the vms option For relative files where the vms option was omitted the default each record has no control information For relative files where the vms option was specified each record has one byte of control information at the beginning of the record The figure below shows the record layout of fixed length records For all sequential files and for relative files where the vms option was omitted HE Record length RECL value For relative files where the vms option was specified fee 1 Record length RECL value ZK 4 amp 14 GE Variable Length Records Variable length records can contain any number of bytes up to a specified maximum record length and apply only to seguential files 186 Data and VO Variable length records are prefixed and suffixed by 4 bytes of control inform
195. ential file organization Fixed Yes Yes Variable Yes No Segmented Yes No Stream Yes No Stream CR Yes No Stream LF Yes No Relative file organization Fixed Yes Yes 176 Data and VO F Note Direct access and relative files require that the file resides on a disk device File Sharing Depending on the value specified by the ACTION or READONLY specifier in the OPEN statement the file will be opened by your program for reading writing or both reading and writing records This simply checks that the program itself executes the type of statements intended For performance reasons record locking and shared file checking are not supported by Intel Fortran When you open the file access is always granted regardless of whether e The OPEN statement SHARED specifier was specified e Other processes have already opened the file You might open a file for writing records or reading and writing records and know another process might simultaneously have the file open and be writing records In this case you need to coordinate access times among those processes to handle the possibility of simultaneous WRITE and REWRITE statements on the same record positions Specifying the Initial Record Position When you open a disk file you can use the OPEN statement POSITION specifier to request one of the following initial record positions within the file e The initial position before the first record POSITION REWIND A sequen
196. eprocessor compiler assembler and linker For syntax and details see Using Qlocation to Specify an Alternate Location for a Tool Qoption tool options Default Off Passes options to tools specifically the preprocessor compiler assembler and linker For syntax and details see Using Qoption to Pass Options to Tools S Default Off Specifies that the compiler should compile to assembly s file only and not link 100 Compiler Options use_asm Default Off Specifies that objects should be produced through the assembler Preprocessor Options The preprocessor options let you specify how the compiler preprocesses files as an optional first phase of the compilation and where it looks for source directories See Also Preprocessing Phase Predefined Preprocessor Symbols Descriptions of Preprocessor Options assume no source include Default assume source include Specifies the directory searched for module files specified by a USE statement or source files specified by an INCLUDE statement Possible values are e assume source include Search in source file directory e assume nosource include Search in current directory Note that you can use this option whether or not you use the fpp option Dnamef value Default Off Specifies one or more definitions for use with conditional compilation directives or the Fortran preprocessor fpp If you have more than one use separate D options T
197. error MESSAGE and 257 FOR IOS_MIXFILACC error MESSage sees KERE RR Ke 257 FORS IOS NO CURREC error MESSAGE EE Ge 257 FORS IOS NO SUCDEV error MESSAGE ee EKKE RR re 257 287 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I FORS IOS NOTFORSPE error MESSAGE 257 FORS IOS NULPTRERR error MESSage seek RR EK Ke Ee 257 FOR IOS OPEDEFREO error MESSAGE KERR ennan 257 FORS IOS OPEFAI error message FEE SEE OR DA 257 FORS IOS OPEREOSEE error MESSAGE ee seke ERA Ke 257 FOR IOS OPEREQSEQ error MESSAGE kk EE EE 257 FORS IOS OPERREODIS error MESSAGE ER Ee ER ENE ER RU EN 257 FORS IOS OUTCONERR error MESSAGE 257 FORS IOS OUTSTAOVE error MESSage ese Re nunnan 257 FORS IOS PERACCFIL error MESSAGE SE Pe ann 257 FORS IOS PROABOUSE error MESSAGE ese REK RR RR EK Ke Ee 257 FORS IOS RANGEERR error MESSAGE ii hirden 257 FORS IOS RECIO OPE error MESSAGE EE KERSE KERE RU EKS Ee 257 FORS IOS RECNUMOUT error MEsSade LA 257 FORS IOS RESACOFAI error MESSAGE ke KRAAK RR 257 288 FOR IOS_REWERR error message DEE ETE Ie ER ete 257 FORS IOS ROPRAND error MESSAGE Ke KAR Re EE 257 FORS IOS SEGRECFOR error Message ERK RA 257 FORS IOS SHORTDATEARG error MESSAGE LU ee Des else AE in 257 FORS IOS SHORTTIMEARG error MESSage seek Re ai 257 FORS IOS SHORTZONEARG error MESSAGE hi af 257 FORS IOS SIGFPE error message EE EE 257 FORS IOS SIGINT error message NE 257 FORS IOS SI
198. ertain options associated with shared library creation e When building shared libraries on Itanium based systems you must specify the fpic option for the compilation of each object file included in the shared library If this option is not used the linker will probably issue an error message like gprel relocation against dynamic symbol Creating a Shared Library with a Single ifort Command You can create a shared library so file with a single ifort command ifort shared octagon f90 The shared option is required to create a shared library The name of the source file is octagon f90 You can specify multiple source files and object files The o option was omitted so the name of the shared library file is octagon so Since you omitted the c option you do not need to specify the standard list of Fortran libraries Creating a Shared Library with ifort and Id Commands You first must create the o file such as octagon o in the following example ifort c octagon f90 The file octagon o is then used as input to the 1a command to create the shared library named octagon so ld shared octagon o lifport lifcoremt limf lm lcxa N lpthread lirc lunwind lc lirc s Note the following e The shared option is required to create a shared library e The name of the object file is octagon o You can specify multiple object o files 44 Building Applications The 1ifport option and subsequent options are the standard
199. erted nonnative value is outside the range of the native data type a run time message is displayed Limitations of Numeric Conversion The Intel Fortran floating point conversion solution is not expected to fulfill all floating point conversion needs For instance data fields in record structure variables specified in a STRUCTURE statement and data components of derived types TYPE statement are not converted When they are later examined as separate fields by the program they will remain in the binary format they were stored in on disk unless the program is modified With EQUIVALENCE statements the data type of the variable named in the I O statement is used If a program reads an VO record containing multiple format floating point fields into a single variable Such as an array instead of their respective variables the fields will not be converted When they are later examined as separate fields by the program they will remain in the binary format they were stored in on disk unless the program is modified Methods of Specifying the Data Format Methods of Specifying the Data Format Overview There are six methods of specifying a nonnative numeric format for unformatted data 145 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Setting an environment variable for a specific unit number before the file is opened The environment variable is named FORT CONVERTn where n is the unit number See Environment Var
200. es use the Ldir option to indicate where your library is located ifort L for libs main f90 my lib a Shared Libraries 241 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Shared libraries also referred to as dynamic libraries or Dynamic Shared Objects DSO are linked differently than static libraries At compile time the linker insures that all the necessary symbols are either linked into the executable or can be linked at runtime from the shared library Executables compiled from shared libraries are smaller but the shared libraries must be included with the executable to function correctly When multiple programs use the same shared library only one copy of the library is required in memory To build a shared library 1 Use the fPIC and c options to generate object files from the source files ifort fPIC c my sourcel f90 my source2 f90 my source3 f90 2 Use the shared option to create the library file from the object files ifort shared my lib so my sourcel o my source2 0 my source3 0 3 Compile and link your project with your new library ifort main f90 my lib so See also Creating Shared Libraries Libraries Provided by Intel Fortran Intel Fortran provides different types of libraries such as static or DLL single threaded or multi threaded for certain libraries The table below shows the libraries provided by the compiler File Description crtxi o C initia
201. es flush denormal results to zero This option has effect only when compiling the main program On Itanium based systems optimization level 03 automatically sets the ft z option IPF flt eval method0 Itanium based systems only Default Off Directs the compiler to evaluate the expressions involving floating point operands in the precision indicated by the variable types declared in the program By default intermediate floating point expressions are maintained in higher precision See also Floating Point Arithmetic Options for Itanium Based Systems in Volume II Optimizing Applications IPF_fltacc Itanium based systems only Default Off Disables optimizations that affect floating point accuracy If the default setting is used IPF_fltacc the compiler might apply optimizations that reduce floating point accuracy You can use IPF_fltacc or fltconsistency to improve floating point accuracy but at the cost of disabling some optimizations See also Floating Point Arithmetic Options for Itanium Based Systems in Volume II Optimizing Applications IPF fmal Itanium based systems only Default Off Enables the combining of floating point multiply and add subtract operations into a single operation IPF fp relaxed Itanium based systems only Default IPF fp relaxed Enables use of faster but slightly less accurate code sequences for math functions such as divide and sqrt Compared
202. es that result from the compilation Descriptions of Output Files Options C Default Off Specifies that the compiler should compile to object file o file only and not link fcode asm Default Off Specifies that the compiler should produce an assembly file with optional code annotations This option requires the use of the s option fsource asm Default Off Specifies that the compiler should produce an assembly file with optional source annotations This option requires the use of the s option f no verbose asm Default On when s is specified Specifies that the compiler should produce an assembly file with compiler comments including options and version information This option requires the use of the s option module path 99 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Specifies the directory path where module files file extension mod are placed See also Searching for Include and mod Files ofilename Default Off Specifies the name of the output file If c is specified o specifies the name of the object file If s is specified o specifies the name of the assembly listing file If neither c nor s is specified o specifies the name of the executable file Qinstall dir Default Off Specifies dir as the root directory for the compiler installation Qlocation tool path Default Off Specifies the directory location of supporting tools for example the pr
203. f computation work volume that is always n 100 loops get auto parallelized only if profitable parallel execution is almost certain See also these topics in Volume II Auto Parallelization Threshold Control and Diagnostics Auto Parallelization Overview Auto Parallelization Enabling Options Directives and Environment Variables parallel Default Off Enables the auto parallelizer to generate multithreaded code for loops that can be safely executed in parallel To use this option you must also specify 02 or 03 95 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I See also these topics in Volume II Auto Parallelization Overview Auto Parallelization Enabling Options Directives and Environment Variables prefetch IA 32 systems only Default prefetch on Enables prefetch insertion optimization The goal of prefetching is to reduce cache misses by providing hints to the processor about when data should be loaded into the cache Note that 03 must be specified for this option to work To disable the prefetch insertion optimization use prefetch prof dir dir Default The directory where the program is compiled Specifies the directory in which you intend to place the profiling output files dyn and dpi to be created The specified directory must already exist See also these topics in Volume II Advanced PGO Options Specific Coding Guidelines for IA 32 Architecture prof file
204. fier CHARACTER LEN 40 FILNM INCLUDE for_iosdef for PO T 1 4 FILNM pa WRITE 6 Type file name READ 5 FILNM OPEN UNIT 1 FILE FILNM STATUS OLD IOSTAT IERR ERR 100 WRITE 6 Opening file FILNM process the input file CLOSE UNIT 1 STOP 100 F IERR EQ FORSIOS FILNOTFOU THEN WRITE 6 File FILNM does not exist ELSE IF IERR EO FORSIOS FILNAMSPE THEN WRITE 6 File FILNM was bad enter new file name ELSE PRINT Unrecoverabl rror code TERR STOP END IF END DO WRITE 6 File not found Type ls to find file and run again END PROGRAM Another way to obtain information about an error is the ERRSNS subroutine which allows you to obtain the last VO system error code associated with an Intel Fortran RTL error see the Intel Fortran Language Reference Signal Handling A signal is an abnormal event generated by one of various sources such as e A user of a terminal e Program or hardware error e Request of another program e When a process is stopped to allow access to the control terminal 237 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I You can optionally set certain events to issue signals for example e When a process resumes after being stopped e When the status of a child process changes
205. file o or a library a or shared library so The compiler handles all types of input files correctly Thus you can use it to invoke any phase of compilation Preprocess Phase Preprocessing performs such tasks as preprocessor symbol macro substitution conditional compilation and file inclusion The compiler preprocesses files as an optional first phase of the compilation Source files that have a filename extension of fpp F F90 FOR FTN or FPP are automatically preprocessed by the compiler For example the following command preprocesses a source file that contains standard Fortran preprocessor directives then passes the preprocessed file to the compiler and linker ifort source fpp If you want to preprocess files that have another extension you have to explicitly specify the preprocessor You do not usually need to specify preprocessing for Fortran source programs The preprocessor is necessary only if your program uses C style preprocessing commands such as if define and so forth 21 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I If you choose to preprocess your source programs you must use the preprocessor fpp which is the preprocessor supplied with the Intel Fortran Compiler or the preprocessing capability of a Fortran compiler It is recommended that you use fpp If you want to use another preprocessor you must invoke it before you invoke the compiler fpp conforms to
206. fying a number and is disabled by setting n equal to 0 id Note If there are enabling and disabling versions of options on the command line or two versions of the same option the last one takes precedence Using Multiple ifort Commands If you compile parts of your program by using multiple ifort commands options that affect the execution of the program should be used consistently for all compilations especially if data is shared or passed between procedures For example The same data alignment needs to be used for data passed or shared by module definition such as user defined structures or common block Use the same version of the align option for all compilations e The program might contain INTEGER LOGICAL REAL COMPLEX or DOUBLE PRECISION declarations without a kind parameter or size specifier that is passed or shared by module definition or common block You must consistently use the options that control the size of such numeric data declarations Using the OPTIONS Statement to Override Options You can override some options specified on the command line by using the OPTIONS statement in your Fortran source program The options specified by the OPTIONS statement affect only the program unit where the statement occurs Getting Help on Options 50 Compiler Options For help enter help on the command line which displays brief information about all the command line options Compiler Directives Related to Opt
207. g file status and record position are the same as if no error had occurred However other I O errors take the ERR transfer as soon as the error is detected so file status and record position are undefined 3 For errors 61 and 63 the severity depends on the check options used during compilation 4 Identifies errors that can be returned by STAT in an ALLOCATE statement 273 IDECS prefix ese ee ee ee ee ee 51 IMSS Dress vas Mn N REEN GR 51 DEGS prefix ss Ke ks ees 51 DIR prefix ss EE ei 51 OMNES RE EN 252 opt intel fc 80 include fordef for file EE 138 __ELF__ preprocessor symbol 38 gnu linux preprocessor symbol AE ET EO Ti 38 1386 preprocessor symbol 38 1386 preprocessor symbol 38 __ia64 preprocessor symbol 38 __ia64__ preprocessor symbol 38 __INTEL_COMPILER preprocessor BY DG AE EE EK 38 INTEL COMPILER BUILD DATE preprocessor symbol 38 linux preprocessor symbol 38 __linux__ preprocessor symbol 38 __unix__ preprocessor symbol 38 _FTN_ALLOC library routine 46 _OPENMP preprocessor symbol 38 1 1 compiler option ee 52 132 compiler option 00 74 6 66 compiler option 0 74 7 72 compiler option 0 74 8 80 compiler option 0 74 A absolute pathname rernnnnnrrnr 24 ACCEPT statement 156 157 164 174 accessing data in mixed language pro
208. ges from the compiler Use warn nogeneral of nowarn or WO or w to suppress all warnings warn no ignore loc Default warn noignore_loc 60 Compiler Options Issues warning messages when LOC is stripped from an argument warn no stderrors Default warn nostderrors Treats warnings about Fortran standards violations as errors not warnings Specifying warn stderrors sets stand 95 If you want to make Fortran 90 standards violations become errors set this option as well as stand f90 warn no truncated source Default warn notruncated source Issues warning messages when reading a source line with a statement field that exceeds the maximum column width in fixed format source files The maximum column width for fixed format files is 72 80 or 132 depending on the setting of the extend source option The warn truncated source option has no effect on truncation lines that exceed the maximum column width are always truncated The warn truncated source option does not apply to free format source files warn no uncalled Default warn uncalled Issues warning messages when a statement function is never called warn no unused Default warn nounused Issues warning messages for variables that are declared but never used warn no usage Default warn usage Alternate syntax cm which is equivalent to warn nousage Suppresses messages about questionable programming practices 61 Intel amp F
209. gram optimization Improved performance between modules in larger applications Profile guided optimization Improved performance based on profiling the frequently used procedures Processor dispatch Use of the latest Intel architecture features while maintaining object code compatibility with previous generations of Intel Pentium processors Compilation Phases The compiler processes Fortran language source and generates object files You decide the input and output by setting options when you run the compiler 20 Getting Started When invoked the compiler determines which compilation phases to perform based on the extension of the source filename and on the compilation options specified in the command line The compilation phases and the software that controls each phase are shown below Compilaton Controlling 1A 32 or Itanium based applications phase software Preprocess optional HEP Both Compile fortcom Both Assemble si pees as for IA 32 applications i as for Itanium optional based applications Link ld 1 Both By default the compiler generates an object file directly without calling the assembler However if you need to use specific assembly input files and then link them with the rest of your project you can use an assembler for these files The compiler passes object files and any unrecognized filename to the linker The linker then determines whether the file is an object
210. gramming EE AE ON 207 accessing files ee see 164 ACTION specifier in OPEN statement 177 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I address of a common block passing 209 adjusting calling conventions mixed language programming 198 ADVANCE specifier in READ statement 178 in WRITE statement 178 advancing VO esse se ee ee 178 ALIAS property iese 199 205 align all compiler option 62 align compiler option 62 align none compiler option 62 alignment compiler options for 0 62 allocatable arrays handling see 217 allocating Common blocks 46 alternative tool locations Specifying nen 37 altparam compiler option 74 ansi alias compiler option 79 arch compiler option 86 276 array assignment sesse ese 117 array declaratiOnS iese ese ee 219 array descriptor handling ss tole 219 array descriptor format description Of ee 219 array pointers handling EE SEE De 217 array Section si Ee EE ek ee 117 array SIZE es EER RE Re a 253 array variable eorrrrrrnnrrrrvvnnnnr 117 arrays C 219 Forde 219 had 1 g giera annii 219 as assembler 20 22 assemblers La 22 assigning files iese ee 164 assignment to arrays sees 117 assume no bscc compiler option 52 assume buffered io compiler option
211. h as VALUE and REFERENCE are properties attached to individual arguments The formal argument declarations are Fortran data type declarations Note that the same INTERFACE block can specify more than one procedure For example suppose you are calling a C function that has the following prototype extern void My_Proc int i The Fortran call to this function should be declared with the following INTERFACE block INTERFACE SUBROUTINE my Proc I 206 Programming with Mixed Languages IDECS ATTRIBUTES C ALIAS My Proc my Proc INTEGER I END SUBROUTINE my Proc END INTERFACE Note that except in the ALIAS string the case of My Proc in the Fortran program does not matter Exchanging and Accessing Data in Mixed Language Programming Exchanging and Accessing Data in Mixed Language Programming Overview You can use several approaches to sharing data between mixed language routines which can be used within the individual languages as well Generally if you have a large number of parameters to work with or you have a large variety of parameter types you should consider using modules or external data declarations This is true when using any given language and to an even greater extent when using mixed languages See also Using Modules in Fortran C Mixed Language Programming See these topics Passing Arguments in Mixed Language Programming Using Common External Data
212. he cause of the unaligned data when using idb follow these steps 1 Run the debugger specifying the program with the unaligned data shown as testprog in the following example idb testprog 2 Before you run the program enter the catch unaligned command idb catch unaligned 3 Run the program idb run Unaligned access pid 28413 lt testprog gt va 140000154 pc 3f 80805d60 ra 1200017e8 type stl 126 Debugging Using idb Thread received signal BUS stopped at oops 13 0x120001834 13 end Enter a list command to display the source code at line 12 idb list 12 12 re gt 1413 end Enter the where command to find the location of the unaligned access idb where Use any other appropriate debugger commands needed to isolate the cause of the unaligned data such as up list and down Repeat these steps for other areas where unaligned data is reported Use the rerun command to run the program again instead of exiting the debugger and running it from the shell prompt After fixing the causes of the unaligned data compile and link the program again 127 Data and I O Data Representation Data Representation Overview See these topics Intrinsic Data Types Integer Data Representations Overview Logical Data Representations Native IEEE Floating Point Representations Overview Character Representation Hollerith Representation Intrinsic Data Types Intel Fortran expects numeric dat
213. he default is to keep results of floating point operations in higher precision this provides better performance but less consistent floating point results See also Floating Point Arithmetic Precision for IA 32 Systems in Volume Il Optimizing Applications no fpconstant Default nofpconstant Requests that a single precision constant assigned to a double precision variable be evaluated in double precision instead of single precision The Fortran standard requires that the constant be evaluated in single precision Certain programs created for FORTRAN 77 compilers may show different floating point results because they rely on single precision constants assigned to a double precision variable to be evaluated in double precision In the following example if you specify fpconstant identical values are assigned to D1 and D2 If you omit fpconstant the compiler will obey the standard and assign a less precise value to D1 REAL KIND 8 D1 D2 DATA D1 2 71828182846182 REAL KIND 4 value expanded to double DATA D2 2 71828182846182D0 Double value assigned to double fpen Default fpe3 71 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Specifies floating point exception handling at run time for the main program This includes whether exceptional floating point values are allowed and how precisely run time exceptions are reported This option control
214. he module name and another opening quote before the variable name For example with a variable named J defined in a module named modfile statement MODULE MODFILE enter the following command to display its value idb list 5 9 5 USE MODFILE 6 INTEGER 4 J 7 CHARACTER 1 CHR 8 J 2 8 idb print MODFILE J 256 Common Block Variables You can display the values of variables in a Fortran common block by using debugger commands such as print Or whatis To display the entire common block use the common block name To display a specific variable in a common block use the variable name For example idb list 1 11 1 PROGRAM EXAMPLE 2 3 NTEGER 4 INT4 4 CHARACTER 1 CHR 5 COMMON COM_STRA INT4 CHR 6 7 CHR L 8 9 END idb print COM STRA COMMON INT4 0 CHR I TY idb idb print CHR ET 118 Debugging Using idb If the name of a data item in a common block has the same name as the common block itself the data item is accessed Derived Type Variables Variables in a Fortran 95 90 derived type TYPE statement are represented in idb commands such as print or whatis using Fortran 95 90 syntax form For derived type structures use the derived type variable name a percent sign and the member name For example idb list 3 11 3 TYPE X 4 INTEGER A 5 5 END TYPE X 6 7 TYPE X Z 8 9 Z A 1 10 11 PRINT ZS SA idb print Z A 1
215. he program a script file can set the appropriate environment variable or allow the terminal user to type a directory path file name or both Use the same logical unit number specified in the OPEN statement for other VO statements to be applied to the opened file such as READ and WRITE 155 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The OPEN statement connects a unit number with an external file and allows you to explicitly specify file attributes and run time options using OPEN statement specifiers all files except internal files are called external files Certain unit numbers are preconnected to standard devices Unit number 5 is associated with stdin unit 6 with stdout and unit 0 with stderr At runtime if units 5 and 6 are specified by a record VO statement such as READ or WRITE without having been explicitly opened by an OPEN statement Intel Fortran implicitly opens units 5 6 and 0 and associates them with their respective operating system standard I O files if the corresponding FORTn environment variable is not set Types of VO Statements The table below lists the Intel Fortran VO statements Category and Description statement name File connection OPEN Connects a unit number with an external file and specifies file connection characteristics CLOSE Disconnects a unit number from an external file File inquiry DEFINE FILE Specifies file characteristics for a direct ac
216. he requested number of bytes and returns 47 Compiler Options Compiler Options Overview See these topics Compiler Options Details Compiler Directives Related to Options Code Generation Options Compatibility Options Compilation Diagnostics Options Data Options External Procedures Options Floating Point Options Language Options Libraries Options Miscellaneous Options Optimization Options Output Files Options Preprocessor Options Run Time Options Compiler Options Details Options to the ifort command affect how the compiler processes a file in conjunction with the file name suffix The simplest form of the ifort command is often sufficient Styles of Compiler Options 49 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Some options consist of two words separated by a space while others may have words joined by an underscore _ Most options can be abbreviated usually to four characters or more For example you can abbreviate check output_conversionto check out Intel Fortran has four styles of compiler options e The phrase no precedes the option to disable it This style was used in Compaq Fortran Example logo and nologo e A hyphen following the option disables it This style was used in previous Intel Fortran compilers Example prefetch and prefetch e Anoor no in the middle of the option disables it Example falias and fno alias e The option has an n parameter speci
217. he value can be acharacter or integer value If value not specified 1 is assumed to be the value for name For an example see Defining Preprocessor Symbols 101 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I F Note Do not use D for name because it will conflict with the DD option alternate syntax for d lines However you can use the Dname n syntax such as DD 1 no fpp Default nofpp Alternate syntax no cpp also fop 0 is equivalent to nofpp also fpp n where n is any number greater than 0 is equivalent to fpp Invokes the FPP Preprocessor fpp prior to compilation enabling preprocessor directives cpp is the same as fpp runs fpp not the C preprocessor Idir Default Include path Specifies one or more directories to add to the include path which is searched for module files USE statement and include files INCLUDE statement Use a semicolon delimiter for more than one directory To request that the compiler search first in the directory where the source file resides instead of the current directory specify assume source include For all USE statements and for those INCLUDE statements whose file name does not begin with a device or directory name the directories searched are as follows in this order 1 The directory containing the first source file if assume source include was specified which is the default 2 The current default directory wher
218. help text history 5 Displays the last five debugger commands ignore Displays the signals the debugger is currently set to ignore The ignored signals are allowed to pass directly to the Intel Fortran RTL See also catch ignore fpe Tells the debugger to ignore the fpe signal or the signal specified This allows the specified signal to pass directly to the Intel Fortran RTL allowing message display ignore Tells the debugger to ignore the unaligned signal the unaligned default kill Terminates the program process leaving the debugger running and its breakpoints and tracepoints intact for when the program is rerun list Displays source program lines To list a range of lines add 111 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I the starting line number a comma and the ending line number such as list 1 9 print k printregs Displays the value of the specified variable such as K Displays all registers and their contents next Steps one source statement but does not step into calls to subprograms Compare with step quit Ends the debugging session run Runs the program being debugged You can specify program arguments and redirection rerun Runs the program being debugged again You can specify program arguments and redirection return routine name Continues execution of the function until it returns to its caller
219. his method to specify a non native numeric format for each specified file name extension suffix You specify the numeric format at run time by setting the appropriate environment variable before an implicit or explicit OPEN to one or more unformatted files You can use the format FORT_CONVERT ext or FORT CONVERT ext where ext is the file extension or suffix The FORT CONVERT ext environment variable is checked before FORT CONVERT ext environment variable if ext is the same For example assume you have a previously compiled program that reads numeric data from one file and writes to another file using unformatted VO statements You want the program to read nonnative big endian IEEE floating point format from a file with a dat file extension extension and write that data in native little endian format to a file with a extension of data In this case the data is converted from big endian IEEE format to native little endian IEEE memory format S_float and T_float when read from file dat and then written without conversion in native little endian IEEE format to the file with a suffix of data assuming that environment variables FORT CONVERT DATA and FORT CONVERTn for that unit number are not defined Without requiring source code modification or recompilation of this program the following command sequence sets the appropriate environment variables before running the program setenv FORT CONVERT DAT BIG ENDIAN usr users proj2 cvbigen
220. his system This error has no condition symbol None warning Could not open message catalog for msg cat The Intel Fortran message catalog file was not found on this system This error has no condition symbol None info Check environment variable NLSPATH and protection of pathname for msg cat The Intel Fortran message catalog file was not found This error has no condition symbol None Insufficient memory to open Fortran RTL catalog message 41 The Intel Fortran message catalog file could not be opened because of insufficient virtual memory To overcome this problem increase the per process data limit by using the limit C shell or ulimit Bourne and Korn and bash shells commands before running the program again For more information see error 41 This error has no condition symbol 1 severe 1 Not a Fortran specific error FOR IOS_NOTFORSPE An error in the user program or in the RTL was not a Intel Fortran specific error and was not reportable through any other Intel Fortran run time messages If you call ERRSNS an error of this kind returns a value of 1 for more information on the ERRSNS subroutine see the Intel Fortran Language Reference Manual severe 8 Internal consistency check failure FOR IOS_BUG_CHECK Internal error Please check that the program is correct Recompile if an error existed in the program If this error persists submit a problem report severe 9 Permission to access file denied FOR
221. iNng esse esse see 207 Using Common External Data in Mixed Language Programming 209 Handling Data Types in Mixed Language ProgrammiNng iis sesse esse ese ee 213 Handling Data Types in Mixed Language Programming Overview 214 Handling Numeric Complex and Logical Data Types rrrrnnnnnnnnnnnnnnnn 215 Handling Fortran Array Pointers and Allocatable ArrayS ccseeeeee 217 Handling Integer Pointers iese ss ee de dee ee se ee ee ee ee ee ee ee ee ee ed ee ee 218 Handling Arrays and Fortran Array Descriptors ies ss sesse see ees se ee ee ee ee 219 Handling Character SIINGS i e ESE ED SEE eco se Ge eb N EE ERGE 223 Handling User Defined Types issie sees se ed ee ee Re Ee ee AA ee ee ed ee ee 226 Intel Fortran C Mixed Language Programs iis ee ses ee ee ee ee RE ee ee eke ge ee 227 Intel Fortran C Mixed Language Programs OvervieW esse ee ese ee ee 227 Compiling and Linking Intel Fortran C Program sesse ss ss seed ee ee 227 Table Of Contents Using Modules in Fortran C Mixed Language Programming 228 Calling C Procedures from an Intel Fortran Program iese ss ss sede ee ese 230 ETHAN EE EER EE DE GE DE WED EE GE N EG ee eats 231 Error Handling Overview iese ek eee Ee ie ee ee 231 Run Time Library Default Error Processing iese ss see ede ee ee ee ee ee ee ee ee ee 231 Run Time Message Format iese ed ee ee EE ee ee ee RE ee
222. iable FORT CONVERTn Method Setting an environment variable for a specific file name extension before the file is opened The environment variable is named FORT CONVERT ext or FORT CONVERT ext where ext is the file name extension suffix See Environment Variable FORT CONVERT ext or FORT CONVERT ext Method Setting an environment variable for a set of units before any files are opened The environment variable is named F UFMTENDIAN See Environment Variable F UFMTENDIAN Method Specifying the CONVERT keyword in the OPEN statement for a specific unit number See OPEN Statement CONVERT Method Compiling the program with an OPTIONS statement that specifies the CONVERT keyword qualifier This method affects all unit numbers using unformatted data specified by the program See OPTIONS Statement Method Compiling the program with the command line convert keyword option which affects all unit numbers that use unformatted data specified by the program See Compiler Option convert Method If none of these methods are specified the native LITTLE ENDIAN format is assumed no conversion occurs between disk and memory Any keyword listed in Supported Native and Nonnative Numeric Formats can be used with any of these methods except for the Environment Variable F_UFMTENDIAN Method which supports only LITTLE_ENDIAN and BIG_ENDIAN If you specify more than one method the order of precedence when you open a file with unformatted data is to 1
223. ictable In such programs the results will depend on the exact optimizations that are performed In some cases normal results will occur but in other cases results will differ because the values used in computations involving the offending aliases will differ For more information see the information about the dummy aliasing assumption in the User s Guide Volume II Optimizing Applications assume no protect_constants Default assume protect_constants 64 Compiler Options Specifies that constants are read only The assume noprotect constants option tells the compiler to pass a copy of aconstant actual argument As a result the called routine can modify this copy even though the Fortran standard prohibits such modification The calling routine does not modify the constant The default assume protect_constants results in passing of a constant actual argument Any attempt to modify it may result in an error auto_scalar auto and save Default auto scalar unless recursive Of openmp is specified in which case the default is auto Alternate syntax for auto automatic and nosave Alternate syntax for save noauto and noautomatic Specifies where local variables are stored if default local storage is not desired auto scalar causes allocation of scalar variables of intrinsic types INTEGER REAL COMPLEX and LOGICAL to the stack auto scalar does not affect variables that appear in EQUIVALENCE or SAVE
224. ifier handles all error conditions If you use the END EOR or ERR branch specifiers no error message is displayed and execution continues at the designated statement usually an error handling routine You might encounter an unexpected error that the error handling routine cannot handle In this case do one of the following e Modify the error handling routine to display the error message number e Remove the END EOR or ERR branch specifiers from the I O statement that causes the error 235 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I After you modify the source code compile link and run the program to display the error message For example READ 8 50 ERR 400 If any severe error occurs during execution of this statement the Intel Fortran RTL transfers control to the statement at label 400 Similarly you can use the END specifier to handle an end of file condition that might otherwise be treated as an error For example READ 12 70 END 550 When using nonadvancing VO use the EOR specifier to handle the end of record condition For example 150 FORMAT F10 2 F10 2 I6 READ UNIT 20 FMT 150 SIZE X ADVANCE NO EOR 700 A F You can also use ERR as a Specifier in an OPEN CLOSE or INQUIRE statement For example OPEN UNIT 10 FILE FILNAM STATUS OLD ERR 999 If an error is detected during execution of this OPEN statement
225. ile contains 4 a 3 4 Handling Arrays and Fortran Array Descriptors Fortran 95 90 allows arrays to be passed as array elements as array subsections or as whole arrays referenced by array name Within Fortran array elements are ordered in column major order meaning the subscripts of the lowest dimensions vary first When using arrays between Fortran and another language differences in element indexing and ordering must be taken into account You must reference the array elements individually and keep track of them Fortran and C vary in the way that array elements are indexed Array indexing is a source level consideration and involves no difference in the underlying data Fortran and C arrays differ in two ways 219 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e The value of the lower array bound is different By default Fortran indexes the first element of an array as 1 C and C index it as 0 Fortran subscripts should therefore be one higher Fortran also provides the option of specifying another integer lower bound e In arrays of more than one dimension Fortran varies the left most index the fastest while C varies the right most index the fastest These are sometimes called column major order and row major order respectively In C the first four elements of an array declared as X 3 3 are In Fortran the first four elements are X 1 1 X 2 1 X 3 1 X 1 2 The order of indexing ex
226. iles with a o suffix substituted for the source file suffix F Note You cannot use c and o together with multiple source files The default optimization level is o2 unless you specify 9 Temporary Files Created by the Compiler or Linker Temporary files created by the compiler or linker reside in the directory used by the operating system to store temporary files To store temporary files the driver first checks for the TMP environment variable If defined the directory that TMP points to is used to store temporary files If the TMP environment variable is not defined the driver then checks for the TMPDIR environment variable If defined the directory that TMPDIR points to is used to store temporary files If the TMPDIR environment variable is not defined the driver then checks for the TEMP environment variable If defined the directory that TEMP points to is used to store temporary files If the TEMP environment variable is not defined the tmp directory is used to store temporary files 26 Building Applications Building Applications Overview See these topics about Intel Fortran Controlling the Compilation Process Setting and Viewing Environment Variables Running the Shell Script to Set Up the Environment Variables Invoking the Intel Fortran Compiler Examples of the ifort Command Using Module mod Files Searching for Include and mod Files Configuration Files and Response Files
227. ime for ACCEPT PRINT and TYPE statements and for READ and WRITE statements that do not specify a unit number such as READ 1000 Treatment of blanks in input The vms option causes the defaults for the keyword BLANK in OPEN statements to become NULL for an explicit OPEN and ZERO for an implicit OPEN of an external or internal file For more information see the description of the OPEN statement OPEN statement effects Carriage control defaults to FORTRAN if the file is formatted and the unit is connected to a terminal checked by means of isatty 3 Otherwise carriage control defaults to LIST The vms option affects the record length for direct access and relative organization files The buffer size is increased by 1 to accommodate the deleted record character Reading deleted records and ENDFILE records The run time direct access READ routine checks the first byte of the retrieved record If this byte is or NULL VO then an ATTACCNON error is returned The run time sequential access READ routine checks to see if the record it just read is one byte long and contains a Ctrl Z If this is true it returns EOF Compilation Diagnostics Options The compilation diagnostics options let you specify the kinds of diagnostic messages warnings and errors you want to receive Descriptions of Compilation Diagnostics Options e90 or e95 Default Off Alternate syntax w90 or w95 57 Intel amp Fortran Com
228. implemented in the 8 0 release How to Use This Document This is Volume I in the two volume Intel Fortran Compiler for Linux Systems User s Guide It explains how you can use the Intel Fortran Compiler to build applications Volume II explains how to optimize applications This User s Guide provides information on how to get started with Intel Fortran how the compiler operates and how to develop applications This documentation assumes that you are familiar with the Fortran Standard programming language and with the Intel processor architecture You should also be familiar with the host computer s operating system E Note This document explains how information and instructions apply differently to each targeted architecture If there is no specific indication as to the architecture the description is applicable for all architectures Additional Documentation Besides the two volumes of the User s Guide you should also have access to these manuals e Intel Fortran Compiler Options Quick Reference Guide for Linux Systems e Intel Fortran Language Reference e Intel Fortran Libraries Reference e Intel Fortran Release Notes For additional technical product information including white papers about Intel compilers open the page associated with your product at http developer intel com software products Notation Conventions This manual uses the following conventions Intel Fortran The name of the com
229. imum Handling Run Time Errors Whenever possible the Intel Fortran RTL does certain error handling such as generating appropriate messages and taking necessary action to recover from errors You can explicitly supplement or override default actions by using the following methods e To transfer control to error handling code within the program use the ERR EOR and END branch specifiers in VO statements e To identify Fortran specific VO errors based on the value of Intel Fortran RTL error codes use the I O status specifier IOSTAT in VO statements or call the ERRSNS subroutine e Obtain system level error codes by using the appropriate library routines e For certain error conditions use the signal handling facility to change the default action to be taken These error processing methods are complementary you can use any or all of them within the same program to obtain Intel Fortran run time and Linux system error codes Using the END EOR and ERR Branch Specifiers When a severe error occurs during Intel Fortran program execution the default action is to display an error message and terminate the program To override this default action there are three branch specifiers you can use in VO statements to transfer control to a specified point in the program e The END branch specifier handles an end of file condition e The EOR branch specifier handles an end of record condition for nonadvancing reads e The ERR branch spec
230. in combination with the environment variable methods or the OPEN statement CONVERT keyword method to specify a different format for a particular unit number Porting Nonnative Data Keep this information in mind when porting nonnative data When porting source code along with the unformatted data vendors might use different units for specifying the record length RECL specifier of unformatted files While formatted files are specified in units of characters bytes unformatted files are specified in longword units for Intel Fortran default and some other vendors To allow you to specify the RECL units bytes or longwords for unformatted files without source file modification use the assume byterecl compiler option The Fortran 95 standard American National Standard Fortran 95 ANSI X3J3 96 007 and International Standards Organization standard ISO IEC 1539 1 1997 states If the file is being connected for unformatted input output the length is measured in processor dependent units Certain vendors apply different OPEN statement defaults to determine the record type The default record type RECORDTYPE with Intel Fortran depends on the values for the ACCESS and FORM specifiers for the OPEN statement Certain vendors use a different identifier for the logical data types such as hex FF instead of 01 to denote true Source code being ported may be coded specifically for big endian use Fortran I O Fortran I O Overview
231. int idata 20 declared as global outside of any function Fortran can declare the variable global COMMON and other languages can reference it as external Fortran declaring PI global REAL PI COMMON PI PI Common Block and variable have the same nam In C the variable is referenced as an external with the statement C code with external reference to PIO extern float PI 210 Programming with Mixed Languages Note that the global name C references is the name of the Fortran common block not the name of a variable within a common block Thus you cannot use blank common to make data accessible between C and Fortran In the preceding example the common block and the variable have the same name which helps keep track of the variable between the two languages Obviously if a common block contains more than one variable they cannot all have the common block name See Using Fortran Common Blocks and C Structures Using Fortran Common Blocks and C Structures To reference C structures from Fortran common blocks and vice versa you must take into account the way the common blocks and structures differ in their methods of storing member variables in memory Fortran places common block variables into memory in order as close together as possible with the following rules e Asingle BYTE INTEGER 1 LOGICAL 1 or CHARACTER variable in common block list begins immediately following the previous variable or array in memo
232. ion done idb list 1 9 3 1 PROGRAM SQUARES 2 NTEGER INARR 20 OUTARR 20 3 C Read the input array from the data file gt 4 OPEN UNIT 8 FILE datafile dat STATUS OLD 5 READ 8 END 5 N INARR I I 1 N 6 5 CLOSE UNIT 8 7 C Square all nonzero elements and store in OUTARR 8 K 0 9 DO 10 T 1 N idb stop at 8 4 1 stop at squares f90 8 idb run 5 1 stopped at squares f90 4 0x120001a88 gt 8 K 0 idb step 6 stopped at squares 9 0x120001a90 9 DO TO he N idb print n k 7 4 0 idb step 8 stopped at squares 10 0x120001ab0 en F INARR I NE 0 THEN idb stopped at squares 11 0x1200011acc 11 OUTARR K INARR I 2 idb print i k 9 io idb assign k 1 10 idb watch variable k 11 2 watch variable write k 0x1400002c0 to 0x1400002c3 idb cont 12 Number of nonzero elements is 1 Element 1 has value 4 Process has exited with status 0 idb quit 13 vi squares f90 14 VOE F INARR I NE 0 THEN 11 K K 1 123 OUTARR K INARR I 2 135 ENDIF 115 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I ifort g o squares squares f90 15 idb squares Welcome to the idb Debugger Version x x xx Reading symbolic information done idb when at 12 print k 16 1 when at squares f90 12 print K idb run 17 1 when squares 12 O0x120001ae
233. ion controls the following run time behavior e When the unit is not connected to a file some INQUIRE specifiers will return different values NUMBER returns 0 ACCESS BLANK and FORM return UNKNOWN e List directed input for character strings must be delimited by apostrophes or quotation marks or an error will result e When processing NAMELIST input Column 1 of each record is skipped Additionally the or amp that appears prior to the group name must appear in column 2 of the input record fpscomp all and fpscomp none Default fpscomp libs Specifies that all the fpscomp options for compatibility with Microsoft Fortran PowerStation should be used The default value specifies that the PowerStation portability library should be passed to the linker fpscomp none specifies that no options for Fortran PowerStation compatibility should be used fpscomp no filesfromcmd Default fpscomp nofilesfromcmd Specifies Microsoft Fortran PowerStation behavior when the OPEN statement file specifier is blank This option looks in the command line arguments for unspecified filenames on an OPEN FILE and prompts for filenames at the terminal console fpscomp no general Default fpscomp nogeneral Specifies that Microsoft Fortran PowerStation semantics should be used where differences exist between Intel Fortran and PowerStation fpscomp no ioformat 54 Compiler Options Default fpscomp noioformat
234. ion does not need file fordef for real 4 a 100 open an unformatted file as unit 1 read 1 a do i 1 100 if isnan a i then print Element i contains a NaN end if end do close 1 end 139 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I You can compile this program with any value of fpen Character Representation A character string is a contiguous sequence of bytes in memory as shown below GHAR 1 GHAR L Ade ZK 0808 3E A character string is specified by two attributes the address A of the first byte of the string and the length L of the string in bytes The length L of a string is in the range 1 through 2 147 483 647 2 31 1 Hollerith Representation Hollerith constants are stored internally one character per byte as shown below 140 Data and VO AKSIE Converting Unformatted Data Converting Unformatted Data Overview This section describes how you can use Intel Fortran to read and write nonnative unformatted numeric data See these topics Supported Native and Nonnative Numeric Formats Limitations of Numeric Conversion Methods of Specifying the Data Format Overview Porting Nonnative Data Supported Native and Nonnative Numeric Formats Intel Fortran supports the following little endian floating point formats in memory 141 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Floating point size Format in memory
235. ions Some compiler directives and compiler options have the same effect as shown in the table below However compiler directives can be turned on and off throughout a program while compiler options remain in effect for the whole compilation unless overridden by a compiler directive Compiler directives and equivalent command line compiler options are Compiler Directive Equivalent Command Line Compiler Option DECLARE warn declarations NODECLARE warn nodeclarations DEFINE symbol Dname FIXEDFORMLINESIZE option extend source option FREEFORM free or nofixed NOFREEFORM nofree or fixed INTEGER opt ion integer size option PACK option align option REAL option real size option STRICT warn stderrors with stand NOSTRICT warn nostderrors Note that the compiler directive names above are specified using the prefix DECS followed by a space For example DEC NOSTRICT Note The prefix DECS is normally used DECS works for both fixed form and free form source You can also use these alternative prefixes for fixed form source only CDECS CDECS DECS cDIR CDIRS DIRS and MSS Code Generation Options The code generation options let you specify how code should be generated Descriptions of Code Generation Options no recursive Default norecursive 51 Intel amp F
236. isted in the following table Nonnative Numeric Format Keywords and Supported Data Types Keyword Description BIG ENDIAN Big endian integer data of the appropriate INTEGER size one two four or eight bytes and big endian IEEE floating point formats for REAL and COMPLEX single and double and extended precision numbers INTEGER KIND 1 or INTEGER 1 data is the same for little endian and big endian CRAY Big endian integer data of the appropriate INTEGER size one two four or eight bytes and big endian CRAY proprietary 143 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I floating point format for REAL and COMPLEX single and double precision numbers FDX Native little endian integers of the appropriate INTEGER size one two four or eight bytes and the following little endian proprietary floating point formats e VAX F_float for REAL KIND 4 and COMPLEX KIND 4 e VAXD float for REAL KIND 8 and COMPLEX KIND 8 e IEEE style X_float for REAL KIND 16 and COMPLEX KIND 16 FGX Native little endian integers of the appropriate INTEGER size one two four or eight bytes and the following little endian proprietary floating point formats e VAX F_float for REAL KIND 4 and COMPLEX KIND 4 e VAX G_float for REAL KIND 8 and COMPLEX KIND 8 e IEEE style X_float for REAL KIND 16 and COMPLEX KIND 16 IBM Big endian integer data of the appropriate INTEG
237. ite more records than existed severe 28 CLOSE error FOR IOS_CLOERR An error condition was detected by the Intel Fortran RTL I O system during execution of a CLOSE statement severe 29 File not found FORS IOS FILNOTFOU A file with the specified name could not be found during an open operation 30lsevere 30 Open failure FORS IOS OPEFAI An error was detected by the Intel Fortran RTL VO system while attempting to open a file in an OPEN INQUIRE or other I O statement This message is issued when the error condition is not one of the more common conditions for which specific error messages are provided It can occur when an OPEN operation was attempted for one of the following e Segmented file that was not on a disk or a raw magnetic tape e Standard VO file that had been closed severe 31 Mixed file access modes FOR IOS_MIXFILACC An attempt was made to use any of the following combinations Formatted and unformatted operations on the same unit An invalid combination of access modes on a unit such as direct and sequential A Intel Fortran RTL VO statement on a logical unit that was opened by a program coded in another language severe 32 Invalid logical unit number FOR IOS_INVLOGUNI A logical unit number greater than 2 147 483 647 or less than zero was used in an I O statement severe 33 ENDFILE error FOR IOS_ENDFILERR One of the following conditions occurred 261 Intel amp
238. iting new code use Fortran 95 90 intrinsic procedures whenever possible for portability and performance reasons Portability Routines This section describes some of the portability routines and how to use them For a complete list of the routines see the table of Portability Routines in the Overview chapter of the nte Fortran Libraries Reference Information Retrieval Routines Information retrieval routines return information about system commands command line arguments environment variables and process or user information Group user and process ID are INTEGER 4 variables Login name and host name are character variables The functions GETGID and GETUID are provided for portability but always return 1 Process Control Routines Process control routines control the operation of a process or subprocess You can wait for a subprocess to complete with either SLEEP or ALARM monitor its progress and send signals via KILL and stop its execution with ABORT 244 Creating and Using Libraries In spite of its name KILL does not necessarily stop execution of a program Rather the routine signaled could include a handler routine that examines the signal and takes appropriate action depending on the code passed Note that when you use SYSTEM commands are run in a separate shell Defaults set with the SYSTEM function such as current working directory or environment variables do not affect the environment the calling program ru
239. itten in C is used to open the socket e Pipes opened for read and write access block wait until data is available if you issue a READ to an empty pipe e Pipes opened for read only access return EOF if you issue a READ to an empty pipe You can access the terminal screen or keyboard by using preconnected files Assigning Files to Logical Units You can choose to assign files to logical units by using one of the following methods e Using default values such as a preconnected unit e Supplying a file name and possibly a directory in an OPEN statement e Using environment variables Using Default Values In the following example the PRINT statement is associated with a preconnected unit stdout by default PRINT 100 The READ statement associates the logical unit 7 with the file fort 7 because the FILE specifier was omitted by default OPEN UNIT 7 STATUS NEW READ 7 100 Supplying a File Name in an OPEN Statement For example OPEN UNIT 7 FILE FILNAM DAT STATUS OLD The FILE specifier in an OPEN statement typically specifies only a file name Such as testdata or contains both a directory and file name such as usr proj testdata The DEFAULTFILE specifier in an OPEN statement typically specifies a pathname that contains only a directory such as usr proj or both a directory and file name such as usr proj testdata 165 Intel amp Fortran Compiler for Linux S
240. ive numbers PROGRAM MAIN USE ARRAY CALCULATOR REAL DIMENSION 5 A 0 REAL AVERAGE PRINT Type five numbers READ F10 3 A AVERAGE CALC AVERAGE A PRINT Average of the five numbers is AVERAGE END PROGRAM MAIN The example below shows the module referenced by the main program This example program shows more Fortran 95 90 features including an interface block and an assumed shape array 41 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I File array calc f90 Module containing various calculations on arrays MODULE ARRAY CALCULATOR INTERFACE FUNCTION CALC_AVERAGE D REAL CALC AVERAGE REAL INTENT IN D END FUNCTION CALC_AVERAGE END INTERFACE Other subprogram interfaces END MODULE ARRAY_CALCULATOR The example below shows the function declaration CALC_AVERAGE referenced by the main program File calc_aver f90 External function returning average of array FUNCTION CALC_AVERAGE D REAL CALC AVERAGE REAL NTENT IN D CALC_AVERAGE SUM D UBOUND D DIM 1 END FUNCTION CALC_AVERAGE Commands to Create a Sample Program During the early stages of program development the sample program files shown above might be compiled separately and then linked together using the following commands ifort c array calc f9
241. ixed length Relative None if the vms option was omitted the default One byte if the vms option was specified Variable Sequential Eight bytes per record length Segmented Sequential Four bytes per record One additional padding byte space is added if the specified record size is an odd number Stream Sequential None required Stream CR Sequential One byte per record Stream LF Sequential One byte per record Record Length Use the RECL specifier to specify the record length The units used for specifying record length depend on the form of the data e Formatted files FORM FORMATTED Specify the record length in bytes e Unformatted files FORM UNFORMATTED Specify the record length in 4 byte units unless you specify the assume byterec1 option to request 1 byte units For all but variable length sequential records on 64 bit addressable systems the maximum record length is 2 147 billion bytes 2 147 483 647 minus the bytes for record overhead For variable length sequential records on 64 bit addressable systems the theoretical maximum record length is about 17 000 gigabytes When considering very large record sizes also consider limiting factors such as system virtual memory Accessing and Assigning Files 164 Data and VO Most I O operations involve a disk file keyboard or screen display Other devices can also be used e Sockets can be read from or written to if a USEROPEN routine usually wr
242. l storage unlike external files such as between character variables and a character array An internal file consists of any of the following e Character variable e Character array element e Character array e Character substring e Character array section without a vector subscript Instead of specifying a unit number for the READ or WRITE statement use an internal file specifier in the form of a character scalar memory reference or a character array name reference An internal file is a designated internal storage space variable buffer of characters that is treated as a sequential file of fixed length records To perform internal VO use formatted and list directed sequential READ and WRITE statements You cannot use file related statements such as OPEN and INQUIRE on an internal file no unit number is used If an internal file is made up of a single character variable array element or substring that file comprises a single record whose length is the same as the length of the character variable array element or substring it contains If an internal file is made up of a character array that file comprises a sequence of records with each record consisting of a single array element The sequence of records in an internal file is determined by the order of subscript progression A record in an internal file can be read only if the character variable array element or substring comprising the record has been defined a value ha
243. language becomes C The debugger uses the current language to determine the valid expression syntax and the semantics used to evaluate an expression The debugger sets the Slang environment variable to the language of the current subprogram or code segment By manually setting the lang environment variable you can force the debugger to interpret expressions used in commands by the rules and semantics of a particular language For example you can check the current setting of slang and change it as follows idb print lang C idb set lang Fortran When the lang environment variable is set to Fortran names are case insensitive To make names case sensitive when the program was compiled with the names as is option specify another language for the lang environment variable such as C view the variable then set the lang environment variable to Fortran Debugging a Program that Generates a Signal If your program encounters a signal exception at run time to make it easier to debug the program you should recompile and relink with the following command line options before debugging the cause of the signal e Use the fpen option to control the handling of signals 125 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e As with other debugging tasks use the g option to generate sufficient symbol table information and debug unoptimized code If requested idb will catch and handle signals before
244. le below shows a program called SQUARES that requires debugging The program was compiled and linked without diagnostic messages from either the compiler or the linker However this program contains a logic error in an arithmetic expression Compiler assigned line numbers have been added in the example so that you can identify the source lines to which the explanatory text refers PROGRAM SQUARES NTEGER NARR 10 OUTARR 10 I K Read the input array from the data file OPEN UNIT 8 FILE datafile dat READ 8 END 5 N INARR I UNIT 8 5 CLOSE STATUS OLD 1 N Square all nonzero elements and store in OUTARR 113 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I K 0 DO T sd N F INARR I NE 0 THEN K K 1 add this line OUTARR K INARR I 2 ENDIF END DO Print the squared output values Then stop PRINT 20 N 20 FORMAT Total number of elements read is 14 PRINT 30 K 0 FORMAT Number of nonzero elements is I4 DO I 1 K PRINT 40 I OUTARR K 40 FORMAT Element I4 Has value I6 END DO END PROGRAM SQUARES The program SQUARES performs the following functions 1 Reads a sequence of integer numbers from a data file and saves these numbers in the array INARR The file datafile dat contains one record with the integer
245. le below shows these relationships Intel Fortran Environment Environment Standard VO file statement variable when variable when name vms specified vms omitted READ f iolist FOR_READ FORT5 stdin READ f iolist FOR_READ FORT5 stdin ACCEPT f iolist FOR_ACCEPT FORTS stdin WRITE f iolist FOR PRINT FORT6 stdout PRINT f iolist FOR_PRINT FORT6 stdout TYPE f iolist FOR_TYPE FORT6 stdout You can change the file associated with these Intel Fortran environment variables as you would any other environment variable by means of the environment variable assignment command For example setenv FOR_READ usr users smith test dat 166 Data and VO After executing the preceding command the environment variable for the READ statement using an asterisk refers to file test dat in directory usr users smith Default Pathnames and File Names Intel Fortran provides the following possible ways of specifying all or part of a file specification directory and file name such as usr proj testdata The FILE specifier in an OPEN statement typically specifies only a file name such as testdata or contains both a directory and file name such as usr proj testdata e The DEFAULTFILE specifier in an OPEN statement typically specifies a pathname that contains only a directory such as usr proj or both a directory and file name Such as usr proj testdata e If you used an i
246. lent to check all check noJarg_temp_created Default Custom options are specified individually 103 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Default check noarg temp created Requests a run time informational message if actual arguments are copied into temporary storage before routine calls check no bounds Default check nobounds Alternate syntax CB Generates code to perform run time checks on array subscript and character substring expressions The default check nobounds suppresses range checking For array bounds each individual dimension is checked Array bounds checking is not performed for arrays that are dummy arguments in which the last dimension bound is specified as or when both upper and lower dimensions are 1 Once the program is debugged omit this option to reduce executable program size and slightly improve run time performance check no format Default check noformat unless vms is specified in which case check format is the default Requests a run time error message when the data type for an item being formatted for output does not match the FORMAT descriptor check noJoutput_conversion Default check nooutput conversion unless vms is specified in which case check output conversionis the default Requests a run time error message when format truncation occurs that is when a number is too large to fit in the specified format field length witho
247. lications warn all or warn none or nowarn Default Custom individually specified Specifies the compiler diagnostics level Choices are e warn all Show all diagnostics e warn none Show no diagnostics 59 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Specifying warn all requests all possible warning messages but does not set warn errors or warn stderrors To enable all the additional checking to be performed and force the severity of the diagnostics to be severe enough to not generate an object file specify warn all warn errors or warn all warn stderrors Specifying warn is the same as specifying warn all Specifying nowarn is the same as specifying warn none warn no alignments Default warn alignments Issues warning messages for data that is not naturally aligned warn no declarations Default warn nodeclarations Issues an error message for any undeclared symbols This option makes the default type of a variable undefined IMPLICIT NONE rather than using the implicit Fortran rules See also u warn no errors Default warn noerrors Treats all warnings as errors by changing the severity of all warning diagnostics into error diagnostics including standards warnings warn no general Default warn general Alternate syntax w1 to display all warnings or w0 or w to suppress all warnings Displays all informational level and warning level diagnostic messa
248. list of libraries that the ifort command would have otherwise passed to 1a When you create a shared library all symbols must be resolved It is probably a good idea to look at the output of the aryrun command to find the names of all the libraries used so you can specify them correctly You can use the Qoption command to pass options to 1d For more information on shared libraries see Creating Libraries See also the 1a 1 reference page Shared Library Restrictions When creating a shared library with 1a be aware of the following restrictions Shared libraries must not be linked with archive libraries When creating a shared library you can only depend on other shared libraries for resolving external references If you need to reference a routine that currently resides in an archive library either put that routine in a separate shared library or include it in the shared library being created You can specify multiple object 0 files when creating a shared library To put a routine in a separate shared library obtain the source or object file for that routine recompile if necessary and create a separate shared library You can specify an object file when recompiling with the ifort command or when creating the shared library with the 14 command To include a routine in the shared library being created put the routine source or object file with other source files that make up the shared library and recompile if necessary
249. lization support crtxn o for main o main routine for Fortran programs icrt internal map C link support icrt link ifcore msg cat Error message catalog for Fortran run time library Not used after Version 8 0 libcprts a C standard language library libcprts so libcprts so 5 libcxa a C language library indicating VO libcxa so data location libcxa so 5 libcxaguard a Used for interoperability with the libcxaguard so cxxlib gcec option libcxaguard so 5 242 Creating and Using Libraries libguide a OpenMP static library for the libguide so parallelizer tool libguide stats a Support for parallelizer tool with libguide stats so performance and profile information libifcore a Intel specific Fortran run time library libifcore so libifcore so 5 libifcoremt a Multithreaded Intel specific Fortran libifcoremt so run time library libifcoremt so 5 libifport a Portability and POSIX support libifport so libifport so 5 libimf a Math library libimf so libirc a Intel specific library optimizations libirc s a libompstub a Library that resolves references to OMP subroutines when OMP is not in use libsvml a Short vector math library libunwind a Unwind support libunwind so libunwind so 5 Portability Library Portability Library Overview Intel Fortran includes functions and subroutines that ease porting of code to or from a PC or allow y
250. llelized 3 Same as 2plus dependency information See also these topics in Volume II Auto Parallelization Overview Auto Parallelization Enabling Options Directives and Environment Variables 58 Compiler Options std std90 std95 Default Off no messages are issued Alternate syntax no st and or w90 or stand90 for Fortran 90 or w95 or stand95 for Fortran 95 std and stand and std95 and stand95 which are equivalent warn for nonstandard Fortran 95 std90 and stand90 which are equivalent warn for nonstandard Fortran 90 This option issues compile time messages for language elements that are not standard in the Fortran language that can be identified at compile time w90 and w95 turn off warnings for nonstardard Fortran for Fortran 90 and Fortran 95 respectively stand is set if you specify warn stderrors vec_report 0 1 2 3 4 5 IA 32 and Intel EM64T systems only Default Of vec report1 is the default if vec report is specified without an argument Specifies the vectorizer s diagnostic level where n is 0 No information 1 Indicate vectorizer loops 2 Indicate vectorizer and nonvectorizer loops 3 Indicate vectorizer loops plus dependence information 4 5 Indicate nonvectorized loops Indicate nonvectorized loops plus the reason why they were not vectorized For more information see Vectorization Overview and related sections in the User s Guide Volume II Optimizing App
251. matted Sequential Files A formatted sequential file is a series of formatted records written sequentially and read in the order in which they appear in the file Records can vary in length and can be empty They are separated by carriage return OD and line feed 0A characters as shown in the following figure Formatted Records in a Formatted Sequential File Record N C Record N 1 An example of a program writing three records to a formatted sequential file is given below The resulting file is shown in the following figure OPEN 3 FILE FSEQ FSEQ is a formatted sequential file by default WRITE 3 A I3 RECORD 1 WRITE 3 WRITE 3 A11 The 3rd One CLOSE 3 END 190 Data and VO Formatted Sequential File ytes data in Record 1 9b 2 bytes CR LF separator 0 bytes data in Record 2 2 bytes CR LF separator 11 EE data in Record 3 fr bytes CR LF separator 910111213 14 24 25 26 ee Hex koeel d mensranone sal RECO koeel d mensranone sal QD BAD GA Fer QD GA Formatted Direct Files In a formatted direct file all of the records are the same length and can be written or read in any order The record size is specified with the RECL option in an OPEN statement and should be equal to or greater than the number of bytes in the longest record The carriage return CR and line feed LF characters are record separators and are not included in the RECL value
252. mber of the namelist group An attempt was made to subscript a scalar variable A subscript of the array variable was out of bounds An array variable was specified with too many or too few subscripts for the variable An attempt was made to specify a substring of a noncharacter variable or array name A substring specifier of the character variable was out of bounds A subscript or substring specifier of the variable was not an integer constant An attempt was made to specify a substring by using an unsubscripted array variable 20lsevere 20 REWIND error FOR IOS REWERR One of the following conditions occurred e The file was not a sequential file e The file was not opened for sequential or append access e The Intel Fortran RTL VO system detected an error condition 259 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I in during execution of a REWIND statement 21lsevere 21 Duplicate file specifications FORS IOS DUPFILSPE Multiple attempts were made to specify file attributes without an intervening close operation A DEFINE FILE statement was followed by another DEFINE FILE statement or an OPEN statement adisevere 22 Input record too long FOR IOS_INPRECTOO A record was read that exceeded the explicit or default record length specified when the file was opened To read the 2 file use an OPEN statement with a RECL value record length of the appropriate size severe 23 BACKSPACE erro
253. ment variable to assign the directory and file name for the other configuration file Example Configuration File An example configuration file is shown below The pound character indicates that the rest of the line is a comment Example ifort cfg file Define preprocessor macro MY_PROJECT DMY PROJECT Set extended length source lines extend source Set maximum floating point significand precision pc80 Response Files You can use response files also known as indirect command files to e Specify options used during particular compilations for particular projects e Save this information in individual files Response files are invoked as an option on the command line Options specified in a response file are inserted in the command line at the point where the response file is invoked Like configuration files response files are used to e Decrease the time you spend entering command line options e Ensure consistency of often used commands 36 Building Applications However options in a configuration file are executed every time you run the compiler In contrast you use response files to maintain options for individual projects You can place any number of options or file names on a line in the indirect command file or response file Several files can be referenced in the same command line The syntax for using response files is ifort responsefile respons
254. mmon External Data in Mixed Language Programming Common external data structures include Fortran common blocks and C structures and variables that have been declared global or external All of these 209 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I data specifications create external variables which are variables available to routines outside the routine that defines them External variables are case sensitive so the cases must be matched between different languages as discussed in the section on naming conventions Common external data exchange is described in the following sections e Using Global Variables e Using Fortran Common Blocks and C Structures Using Global Variables in Mixed Language Programming A variable can be shared between Fortran and C by declaring it as global or COMMON in one language and accessing it as an external variable in the other language In Fortran programs variables must be passed as arguments In Fortran a variable can access a global parameter by using the EXTERN option for ATTRIBUTES For example IDECS ATTRIBUTES C EXTERN idata INTEGER idata 20 EXTERN tells the compiler that the variable is actually defined and declared global in another source file If Fortran declares a variable external with EXTERN the language it shares the variable with must declare the variable global In C a variable is declared global with the statement
255. mon compiler language supported by the Intel Visual Fortran Compiler for Windows and Intel Fortran Compiler for Linux products Intel EM64T The label used to indicate IA 32 systems with Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Intel Extended Memory 64 Technology Intel EM64T This type style Elements of syntax reserved words option keywords variables file names and code examples are shown in a monospaced font The text appears in lowercase unless uppercase is required THIS TYPE STYLE Statements keywords and directives are shown in all uppercase in a normal font For example add the USE statement This type style Bold normal text shows menu names menu items button names dialog window names and other user interface items File gt Open Menu names and menu items joined by a greater than gt sign indicate a sequence of actions For example Click File gt Open indicates that in the File menu click Open to perform this action This type style Bold monospaced text indicates user input Shows what you type as command or input This type style Italic monospaced text indicates placeholders for information that you must supply Italics are also used to introduce new terms options Items inside single square brackets are optional In some examples square brackets are used to show arrays value value Br
256. mp_flag environment variable set or examine the core dump file to determine the source code in error 139 severe 139 Array index out of bounds for index nn SIGILL FOR IOS_BRK_RANGE2 Break exception generated a SIGTRAP signal described in signal 3 Core dump file created The cause is an array subscript that is outside the dimensioned boundaries of the array index n Either recompile with the check bounds option perhaps with the decfort_dump_flag environment variable set or examine the core 268 dump file to determine the source code in error severe 140 Floating inexact FOR IOS_FLTINE A floating point arithmetic or conversion operation gave a result that differs from the mathematically exact result This trap is reported if the rounded result of an IEEE operation is not exact Reference Information severe 144 reserved operand FORS IOS ROPRAND The Intel Fortran RTL encountered a reserved operand Please report the problem to Intel severe 145 Assertion error FOR IOS_ASSERTERR The Intel Fortran RTL encountered an assertion error Please report the problem to Intel severe 146 Null pointer error FOR IOS NULPTRERR Attempted to use a pointer that does not contain an address Modify the source program recompile and relink severe 147 stack overflow FOR IOS_STKOVF The Intel Fortran RTL encountered a stack overflow while executing your program severe 148 String length error FOR IO
257. mplied OPEN or if the FILE specifier in an OPEN statement did not specify a file name you can use an environment variable to specify a file name or a pathname that contains both a directory and file name Examples of Applying Default Pathnames and File Names For example for an implied OPEN of unit number 3 Intel Fortran would check the environment variable FORTS If the environment variable FORT3 was set its value is used If it is not set the system supplies the file name fort 3 In the following table assume the current directory is usr smith and the VO uses unit 1 as in the statement READ 1 100 OPEN FILE OPEN FORT1 Resulting pathname value DEFAULTFILE environment value variable value not specified not specified not specified usr smith fort 1 not specified not specified test dat usr smith test dat not specified not checked usr tmp t dat usr tmp t dat not specified tmp not specified tmp fort 1 not specified tmp testdata tmp testdata not specified usr lib testdata usr lib testdata file dat usr group not checked usr group file dat tmp file dat not checked not checked tmp file dat file dat not specified not checked usr smith file dat When the resulting file pathname begins with a tilde character C shell style pathname substitution is used regardless of what shell is being used such as a top level directory below the root For additional
258. ms written in Intel C if the appropriate calling conventions are used see Calling C Procedures from a Fortran program Intel Fortran subprograms can be called by Intel C main programs Calls to the Subprogram You can use subprograms in static libraries if the main program is written in Intel Fortran or Intel C You can use subprograms in shared libraries in mixed language applications if the main program is written in Intel Fortran or Intel C Summary of Mixed Language Issues Mixed language programming involves a call from a routine written in one language to a function procedure or subroutine written in another language For example a Fortran main program may need to execute a specific task that you want to program separately in an assembly language procedure or you may need to call an existing shared library or system procedure Mixed language programming is possible with Intel Fortran and Intel C because each language implements functions subroutines and procedures in approximately the same way The following table shows how different kinds of routines from each language correspond to each other For example a C main program could call an external void function which is actually implemented as a Fortran subroutine Language Equivalents for Calls to Routines Language Call with Return Call with No Return Value Value Fortran FUNCTION SUBROUTINE 196 Programming with Mixed Languages
259. n such as REAL KIND 4 for single precision floating point data Intrinsic COMPLEX kinds are also 4 single precision 8 double precision and 16 extended precision To obtain the kind of a variable use the KIND intrinsic function You can also use a size specifier such as REAL 4 but be aware this is an extension to the Fortran 95 standard If you omit certain compiler options the default sizes for REAL and COMPLEX data declarations are as follows e For REAL data declarations without a kind parameter or size specifier the default size is REAL KIND 4 same as REAL 4 e For COMPLEX data declarations without a kind parameter or size specifier the default data size is COMPLEX KIND 4 same as COMPLE X 8 To control the size of all REAL or COMPLEX declarations without a kind parameter use the real size 64 Of real size 128 options the default is real size 32 You can explicitly declare the length of a REAL or a COMPLEX declaration using a kind parameter or specify DOUBLE PRECISION or DOUBLE COMPLEX To control the size of all DOUBLE PRECISION and DOUBLE COMPLEX declarations use the double size 128 option the default is double size 64 The following sections discuss floating point data 134 Data and VO REAL KIND 4 Single Precision Representation REAL KIND 8 Double Precision Representation REAL KIND 16 Extended Precision Representation COMPLE X KIND 4 Single Precision Representation CO
260. n external file and allows you to explicitly specify file attributes and run time options using OPEN statement specifiers Once you open a file you should close it before opening it again unless it is a preconnected file If you open a unit number that was opened previously without being closed one of the following occurs e f you specify a file specification that does not match the one specified for the original open the Intel Fortran run time system closes the original file and then opens the second file This resets the current record position for the second file e lf you specify a file specification that matches the one specified for the original open the file is reconnected without the internal equivalent of the CLOSE and OPEN This lets you change one or more OPEN statement run time specifiers while maintaining the record position context You can use the INQUIRE statement to obtain information about whether or not a file is opened by your program Especially when creating a new file using the OPEN statement examine the defaults see the description of the OPEN statement in the Intel Fortran Language Reference Manual or explicitly specify file attributes with the appropriate OPEN statement specifiers Specifiers for File and Unit Information These specifiers identify file and unit information e UNIT specifies the logical unit number e FILE or NAME and DEFAULTFILE specify the directory and or file name of an external file
261. n used with direct files after an FSEEK GETG or PUTC operation the record number is the number of the next whole record Any subsequent normal Fortran I O to that unit occurs at the next whole record For example if you seek to absolute location 1 of a file wnose record length is 10 the NEXTREC returned by an INQUIRE would be 2 If you seek to absolute location 10 NEXTREC would still return 2 e On units with CARRIAGECONTROL FORTRAN the default PUTC and FPUTC characters are treated as carriage control characters if they appear in column 1 245 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e On sequentially formatted units the C string n c which represents the carriage return line feed escape sequence is written as CHAR 13 carriage return and CHAR 10 line feed instead of just line feed or CHAR 10 On input the sequence 13 followed by 10 is returned as just 10 The length of character string n c is 1 character whose ASCII value indicated by ICHAR n c is 10 e Reading and writing is in a raw form for direct files Separators between records can be read and overwritten Therefore be careful if you continue using the file as a direct file VO errors arising from the use of these routines result in an Intel Fortran run time error Some portability file VO routines have equivalents in standard Fortran 95 90 For example you could use the ACCESS function to check a file specified by name
262. nes containing the letters FUNCTION allowing use of the function name SUBSORT in the stop in command idb sh grep FUNCTION data for INTEGER 4 FUNCTION SUBSORT A B 110 idb idb Debugging Using stop in subsort See also Summary of Debugger Commands Summary of Debugger Commands The table below lists some of the more frequently used debugging commands available in idb Many of these commands can be abbreviated for example you can enter c instead of cont and s instead of step You can use the alias command to get a complete list of these abbreviations and even create your own aliases The table below shows examples of the most commonly used debugger commands For more information see the online Intel amp Debugger IDB Manual idb Command Description example catch Displays all signals that the debugger is currently set to catch See also ignore catch fpe Tells the debugger to catch the fpe signal or the signal specified This prevents the specified signal from reaching the Intel Fortran run time library RTL catch Tells the debugger to catch the unaligned signal unaligned cont Resumes continues execution of the program that is being debugged Note that there is no ido command named continue delete 2 Removes the breakpoint or tracepoint identified by event number 2 See also status delete all Removes all breakpoints and tracepoints help Displays debugger
263. nium based and Intel EM64T systems only 87 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Default Off Allows the compiler to use 32 bit pointers whenever possible as long as the application does not exceed a 32 bit address space Because this optimization requires interprocedural analysis over the whole program you must use this option with the ipo option Using this option on programs that exceed 32 bit address space may cause unpredictable results during program execution On Intel EM64T systems auto ilp32 has no effect unless xP or axP is also specified ax K W N B P IA 32 and Intel EM64T systems only Default None Directs the compiler to find opportunities to generate separate versions of functions that take advantage of features that are specific to the specified Intel processor If the compiler finds such an opportunity it first checks whether generating a processor specific version of a function is likely to result in a performance gain If this is the case the compiler generates both a processor specific version of a function and a generic version of the function The generic version will run on any IA 32 processor At run time one of the versions is chosen to execute depending on the Intel processor in use In this way the program can benefit from performance gains on more advanced Intel processors while still working properly on older IA 32 processors Possible values an
264. nly Default On if prof use is specified Off otherwise Enables function splitting if 0rof use is also enabled This option has no effect if prof use is not enabled This option is automatically enabled if you use prof use To turn off function splitting use fnsplit However function grouping will continue to be enabled See also these topics in Volume ll Basic PGO Options Example of Profile Guided Optimization fp IA 32 and Intel EM64T systems only Default On Disables the use of ebp as a general purpose register Most debuggers expect ebp to be used as a stack frame pointer and cannot produce a stack backtrace unless this is so This option allows frame pointers and disables the use of the ebp register in optimizations and lets the debugger produce a stack backtrace 90 Compiler Options gp Default Off Alternate syntax p Compile and link for function profiling with the gprof tool ip Default Off Enables single file interprocedural optimizations Enhances inline function expansion See also this topic in Volume Il Using ip with Qoption Specifiers ip_no_inlining Default Off Disables interprocedural inlining that results from the ip or ipo interprocedural optimizations but has no effect on other interprocedural optimizations Requires ip or ipo ip_no_pinlining Default Off Disables partial inlining Requires ip or ipo n ipo n Default Off Enables multifil
265. nnnrnnnnrr 77 libsvml a Me ss RE 242 libunwind a file eee 242 libunwind so file esse ee 242 294 libunwind so 5 file esse 242 limitations numeric conversion 0 145 limits EOMPleEk see 253 Ta EEE EEE 22 linker library speel Vind DA 30 linking C Fortran mixed language eltelel TER tees 227 preventiNg iss esse see ee 30 linux preprocessor symbol 38 list directed VO statement 157 little endian storage 2 141 LITTLE ENDIAN keyword 141 logical data representation 133 logical data types handling uer 215 logical VO uns 155 logo compiler option 55 79 M macro See preprocessor symbol 38 make command USING aasan N 29 makefile ae EO DE 29 31 manuals additional EE E 17 map lle ER Des 103 math libraries iss ees ee ee 247 methods of specifying the data format VENER 145 Microsoft compatibility 190 Microsoft Fortran PowerStation compatibility ssornnnnnnnnnn 190 miscellaneous options 79 mixed language programming return values rrrrrvrurrn 215 223 mixed_str_len_arg compiler option EE 68 199 223 mixed language programming accessing data rrrrnnnrrr 207 adjusting calling conventions NEMNE N ua 198 adjusting naming conventions OVEFV EW Aasta kossen 202 ATTRIBUTES properties 199 C C naming co
266. not guaranteed to remain the same between versions Use of extern C has some restrictions e You cannot declare a member function with extern C e You can specify extern C for only one instance of an overloaded function all other instances of an overloaded function have C linkage 203 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Procedure Names in Fortran C and C The following table summarizes how Fortran C and C handle procedure names Language Attributes Name Translated As Case of Name in 0 File Fortran cDEC name All lowercase ATTRIBUTES C Fortran default name All lowercase C cdec1 default name Mixed case preserved C __stdcall _name n Mixed case preserved C Default _name decoration Mixed case preserved Reconciling the Case of Names The following summarizes how to reconcile names between languages 204 All lowercase names If the name of the routine appears as all lowercase in C then naming conventions are automatically correct Any case can be used in the Fortran source code including mixed case since the name is changed to all lowercase Mixed case names If the name of a routine appears as mixed case in C and you cannot change the name then you can resolve this naming conflict by using the Fortran ATTRIBUTES ALIAS option ALIAS is required in this situation because otherwise Fortran will not preserve the mixed case name
267. ns adjusting naming conventions and writing interface procedures are discussed in the next sections e Adjusting Calling Conventions in Mixed Language Programming e Adjusting Naming Conventions in Mixed Language Programming e Prototyping a Procedure in Fortran After establishing a consistent interface between mixed language procedures you then need to reconcile any differences in the treatment of individual data types strings arrays and so on This is discussed in Exchanging and Accessing Data in Mixed Language Programming Note This section uses the term routine in a generic way to refer to functions subroutines and procedures from different languages 197 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Adjusting Calling Conventions in Mixed Language Programming Adjusting Calling Conventions in Mixed Language Programming Overview The calling convention determines how a program makes a call to a routine how the arguments are passed and how the routines are named See Adjusting Naming Conventions in Mixed Language Programming In a single language program calling conventions are nearly always correct because there is one default for all routines and because header files or Fortran module files with interface blocks enforce consistency between the caller and the called routine In a mixed language program different languages cannot share the same header files If as a result you link Fortran and
268. ns in The portability library does not include the FORK routine On Linux systems FORK creates a duplicate image of the parent process Child and parent processes each have their own copies of resources and become independent from one another Numeric Values and Conversion Routines Numeric values and conversion routines are available for calculating Bessel functions data type conversion and generating random numbers Some of these functions have equivalents in standard Fortran 95 90 Data object conversion can be accomplished by using the INT intrinsic function instead of LONG or SHORT The intrinsic subroutines RANDOM NUMBER and RANDOM SEED perform the same functions as the random number functions listed in the table showing numeric values and conversion routines Other bit manipulation functions such as AND XOR OR LSHIFT and RSHIFT are intrinsic functions You do not need the IFPORT module to access them Standard Fortran 95 90 includes many bit operation routines These routines are listed in Chapter 9 of the Language Reference in table 9 2 under Category Bit Input and Output Routines The portability library contains routines that change file properties read and write characters and buffers and change the offset position in a file These input and output routines can be used with standard Fortran input or output statements such as READ or WRITE on the same files provided that you take into account the following e Whe
269. nsic function 138 fp_port compiler option 69 FPATH environment variable 34 249 fpconstant compiler option 69 fpe compiler option 0 69 fpic compiler option 43 79 IDEE samen eves SN see 20 21 252 fpp compiler option 101 fpscomp compiler option 52 fpstkchk compiler option 69 fr32 compiler option 0 69 free compiler option 00 74 free format compiler option for 0 74 FREEFORM compiler directive 51 free form files ees ee ee sae 23 fsource asm compiler option 99 ftz compiler option xoxeees 69 fverbose asm compiler option 99 fvisibility compiler option 79 fvisibility keyword compiler option 79 G g compiler option 79 107 getting help on compiler options 49 getting started debugging EE EE ES 107 OVErMIE Wa ee ie ee Di EG 19 global variables using in mixed language programming 209 gp compiler option 000 86 guide HOW tO USG 17 H help compiler option 2 79 help on compiler options 49 hexadecimal conversions 254 Hollerith data representation 140 compiler option eerrnnnnnnnr 101 VO logical unit sr Rd es 155 preconnected files 168 record I O statement specifiers 174 i dynamic compiler option
270. nt The type COMPLEX is equivalent to the type COMPLEX 4 The types COMPLEX 8 and COMPLE X 16 are similar except that each field contains an 8 byte or 16 byte floating point number respectively S Note On IA 32 systems Fortran functions of type COMPLEX place a hidden COMPLEX argument at the beginning of the argument list C functions that implement such a call from Fortran must declare this hidden argument explicitly and use it to return a value The C return type should be void Following are the C C structure definitions for the Fortran COMPLEX types struct complex4 float real imag struct complex8 double real imag A Fortran LOGICAL 2 is stored as a 2 byte indicator value 0 false and the fpscomp no logicals compiler option determines how true values are 215 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I handled A Fortran LOGICAL 4 is stored as a 4 byte indicator value and LOGICAL 1 is stored as a single byte The type LOGICAL is the same as LOGICAL 4 which is equivalent to type int in C You can use a variable of type LOGICAL in an argument list module common block or global variable in Fortran and type int in C for the same argument Type LOGICAL 4 is recommended instead of the shorter variants for use in common blocks The Intel C class type has the same layout as the corresponding C struct type unless the class defines virtual functions or has base classes Cla
271. nt of zero initialized variables in the BSS section By default variables explicitly initialized with zeros are placed in the BSS section By using this option you can place any variables that are explicitly initialized with zeros in the DATA section if required There is no bss init option ccdefault keyword Default ccdefault default Specifies the type of carriage control used for units 6 and The choices for keyword are e default Specifies that the compiler is to use the default carriage control setting This choice can be affected by the vms option If vms ccdefault default is specified carriage control defaults to fortran if the file is formatted and the unit is connected to a terminal If novms ccdefault default is specified carriage control defaults to list e fortran Specifies normal Fortran interpretation of the first character e list Specifies one line feed between records e none Specifies no carriage control processing debug keyword Default Off Specifies settings that enhance debugging To use this option you must also specify the g option The variable_locations keyword produces enhanced debug information useful in finding scalar local variables It uses a feature of the Dwarf object module known as location lists This feature allows the run time locations of local scalar variables to be specified more accurately that is whether at a given position in the code a variable value is found in
272. ntially starting with the first record in the file Sequential files with a fixed length record type that are stored on disk can also be accessed by relative record number direct access Relative Organization Within a relative file are numbered positions called cells These cells are of fixed equal length and are consecutively numbered from 1 to n where 1 is the first cell and nis the last available cell in the file Each cell either contains a single record or is empty Records in a relative file are accessed according to cel number A cell number is a record s relative record number its location relative to the beginning of the file By specifying relative record numbers you can directly retrieve add or delete records regardless of their locations direct access Detecting deleted records is only available if you specified the vms option when the program was compiled When creating a relative file use the RECL value to determine the size of the fixed length cells Within the cells you can store records of varying length as long as their size does not exceed the cell size Internal Files and Scratch Files Intel Fortran also supports two other types of files that are not file organizations e Internal files e Scratch files 160 Data and VO Internal Files When you use sequential access you can use an internal file to reference character data in a buffer The transfer occurs between internal storage and interna
273. nux Systems User s Guide Vol I Your application can contain both C and Fortran source files If your main program is a Fortran source file myprog for that calls a routine written in C cfunc c you can use the following sequence of commands to build your application ice c cfunc c ifort o myprog myprog for cfunc o The icc for Intel C command compiles cfunc c The c option specifies that the linker is not called This command creates cfunc o The ifort command compiles myprog for and links cfunc o with the object file created from myprog for to create myprog If your C C program calls an Intel Fortran subprogram specify the option nofor main on the ifort command line icc c cmain c ifort nofor main cmain o fsub f90 Using Modules in Fortran C Mixed Language Programming Modules are the simplest way to exchange large groups of variables with C because Intel Fortran modules are directly accessible from C C The following example declares a module in Fortran then accesses its data from C Fortran code F90 Module definition MODULE EXAMP REAL A 3 INTEGER I1 I2 CHARACTER 80 LINE TYPE MYDATA SEQUENCE INTEGER N CHARACTER 30 INFO END TYPE MYDATA END MODULE EXAMP 1 JG C code C code accessing module data extern float examp_mp_a 3 extern int examp_mp_il examp_mp_i2 extern char examp_mp_line 80 extern struct
274. nventions 203 calling conventions 2 199 calling subprograms from the main rogram AE 196 complex data types 215 exchanging data 0608 207 handling data types in 214 logical data typeS 06 215 numeric data types 215 OVESEN Lassa aent 195 passing arguments in 207 procedure names ees see 204 reconciling case of names 204 summary Of iSSUES 555 196 using common external data 209 using modules iN sesse 228 mixed language programs debEAAING EE SEE EER GE 125 module compiling programs with 31 using in mixed language programming 228 module mod files multi directory rrnnnennnnnnnnr 31 searching for annnnnnnnnnnnnnnn 34 295 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Mee EO ei 31 module compiler option 99 module variable ee ese se ee 117 mp1 compiler OPHON ee 69 multi byte characters sesse 23 multiple files compiling and linking 30 N name case POCOMGINIG aar 204 namelist VO statement 157 names compiler option 68 naming convention adjusting in mixed language programming s s s 202 naming conventions GE EE EI 203 C Fortran mixed language programs seeen 230 NATIVE keyword ceeeeeeee 141 nbs compiler option
275. oduces Itanium based applications Itanium based compilations can only operate on Itanium based systems The command to invoke either of these compilers is ifort F Note Intel amp Fortran Compiler for Linux Systems User s Guide Vol I For information on IA 32 systems with Intel Extended Memory Technology Intel EM64T see the Intel Fortran Compiler 8 1 Extended Memory 64 Technology Edition for Linux Release Notes The Intel Fortran Compiler has a variety of options that enable you to use the compiler features for higher performance of your application The Intel Fortran Compiler enables your software to perform the best on Intel architecture based computers The compiler has several high performance optimizations Some of its features and benefits are What feature might you want to How will this help you use Support for Streaming SIMD Intel microarchitecture benefit Extensions SSE Streaming SIMD Extensions 2 SSE2 and Streaming SIMD Extensions 3 SSE3 Automatic vectorizer Parallelism in your code achieved automatically Parallelization Automatic generation of multithreaded code for loops Shared memory parallel programming with OpenMP Floating point optimizations Improved floating point performance Data prefetching Improved performance due to the accelerated data delivery Interprocedural optimizations Better performance for larger applications Whole pro
276. of whether they are used as arguments When calling between Intel Fortran and a non Fortran language such as C using an implicit interface allows the array argument to be passed without an Intel Fortran descriptor However for cases where the called routine needs the information in the Intel Fortran descriptor declare the routine with an explicit interface and specify the dummy array as either an assumed shape array or with the pointer attribute You can associate a Fortran 95 90 pointer with any piece of memory organized in any way desired so long as it is rectangular in terms of array bounds You can also pass Fortran 95 90 pointers to other languages such as C and have the other language correctly interpret the descriptor to obtain the information it needs However using array descriptors can increase the opportunity for errors and the corresponding code is not portable In particular be aware of the following e If the descriptor is not defined correctly the program may access the wrong memory address possibly causing a General Protection Fault e Array descriptor formats are specific to each Fortran compiler Code that uses array descriptors is not portable to other compilers or platforms For example the current Intel Fortran array descriptor format differs from the array descriptor format for Intel Fortran 7 0 e The array descriptor format may change in the future The components of the current Intel Fortran array des
277. ommon block which must be set by the routine to point to the block of memory allocated e size is the integer number of bytes of memory that the compiler has determined are necessary to allocate for the common block as it was declared in the program You can ignore this value and use whatever value is necessary for your purpose E Note You must return the size in bytes of the space you allocate The library routine that calls _FTN_ALLOC ensures that all other occurrences of this common block fit in the space you allocated Return the size in bytes of the space you allocate by modifying size e name is the name of the common block being dynamically allocated Allocating Memory to Dynamic Common Blocks The run time library routine f90 dyncom performs memory allocation The compiler calls this routine at the beginning of each routine in a program that contains a dynamic common block In turn this library routine calls _FTN_ALLOC to allocate memory By default the compiler passes the size in bytes of the common block as declared in each routine to f90 dyncom and then onto FTN ALLOG If you use the nonstandard extension having the common block of the same name declared with different sizes in different routines you might get a run time error depending on the order in which the routines containing the common block declarations are invoked The Fortran run time library contains a default version of FTN ALLOC which simply allocates t
278. ompatible Intel processors Programs compiled with this option will detect non compatible processors and generate an error message during execution This option also enables new optimizations in addition to Intel processor specific optimizations e xB Intel Pentium M and compatible Intel processors Programs compiled with this option will detect non compatible processors and generate an error message during execution This option also enables new optimizations in addition to Intel processor specific optimizations e xP Intel Pentium 4 processors with Streaming SIMD Extensions 3 SSE3 instruction support Programs compiled with this option will detect non compatible processors and generate an error message during execution This option also enables new optimizations in addition to Intel processor specific optimizations On Intel EM64T systems xw and xP are the only valid options To execute the program on x86 processors not provided by Intel Corporation do not specify this option A caution 98 Compiler Options If a program compiled with this option is executed on a processor that lacks the specified set of instructions it can fail with an illegal instruction exception or display other unexpected behavior In particular programs compiled with xN xB or xP will emit run time errors if they are executed on unsupported processors Output Files Options The output options let you specify names and directory locations for fil
279. on in WBAT Handling Fortran Array Pointers and Allocatable Arrays How Fortran 95 90 array pointers and arrays are passed is affected by the ATTRIBUTES properties in effect and by the INTERFACE if any of the procedure they are passed to If the INTERFACE declares the array pointer or array with deferred shape for example ARRAY its descriptor is passed This is true for array pointers and all arrays not just allocatable arrays If the INTERFACE declares the array pointer or array with fixed shape or if there is no interface the array pointer or array is passed by base address as a contiguous array which is like passing the first element of an array for contiguous array slices When a Fortran 95 90 array pointer or array is passed to another language either its descriptor or its base address can be passed The following shows how allocatable arrays and Fortran 95 90 array pointers are passed with different attributes in effect e f the property of the array pointer or array is not included or is REFERENCE it is passed by descriptor regardless of the property of the passing procedure None C or C REFERENCE e If the property of the array pointer or array is VALUE an error is returned regardless of the property of the passing procedure Note that the VALUE option cannot be used with descriptor based arrays When you pass a Fortran array pointer or an array by descriptor to a non Fortran routine that routine needs
280. on results in an error but two subsequent calls to PUTC succeed a call to IERRNO returns the error for the GETC call Examine IERRNO immediately after returning from one of the portability library routines Other standard Fortran 90 routines might also change the value to an undefined value If your application uses multithreading remember that IERRNO is set on a per thread basis System Drive or Directory Control and Inquiry Routines You can retrieve information about devices directories and files with these routines Standard Fortran 90 provides the INQUIRE statement which returns detailed file information either by file name or unit number Use INQUIRE as an equivalent to FSTAT LSTAT or STAT LSTAT and STAT return the same information STAT is the preferred function Additional Routines You can also use portability routines for program call and control keyboards and speakers file management arrays floating point inquiry and control IEEE functionality and other miscellaneous uses See the table of Portability Routines in the Overview chapter of the Intel Fortran Libraries Reference Math Libraries libimf a is the math library provided by Intel and 1ipm a is the math library provided with gcc Both of these libraries are linked in by default on IA 32 and ltanium based compilers Both libraries are linked in because there are math functions supported by the GNU math library that are not in the Intel math library
281. only specify one numeric file format for all unformatted file unit numbers using this method unless you also use one of the environment variable methods or OPEN statement CONVERT keyword method You specify the numeric format at compile time and must compile all routines under the same OPTIONS statement CONVERT keyword qualifier 152 Data and VO The environment variable methods and the OPEN statement CONVERT method take precedence over this method For instance you might use the environment variable FORT CONVERTn method or OPEN statement CONVERT method to specify each unit number that will use a format other than that specified using the ifort option method This method takes precedence over the convert keyword compiler option method You can use OPTIONS statements to specify the appropriate floating point formats in memory and in unformatted files instead of using the corresponding ifort command qualifiers For example to use VAX F_floating and G_floating as the unformatted file format specify the following OPTIONS statement OPTIONS CONVERT VAXG Because this method affects all unit numbers you cannot read data in one format and write it in another format unless you use it in combination with one of the environment variable methods or the OPEN statement CONVERT keyword method to specify a different format for a particular unit number Compiler Option convert Method You can only specify one numeric format for all unforma
282. or processing X Default Off Alternate syntax nostdinc Removes standard directories from the include file search This option prevents the compiler from searching the default path specified by the FPATH environment variable Xlinker value Default Off Passes value directly to the linker for processing Optimization Options The optimization options let you specify how to optimize your applications for speed particular processors code size and so forth For more information about optimization see Compiler Optimizations Overview and related sections in the Intel amp Fortran User s Guide for Linux Volume Il Optimizing Applications See also Floating Point Options Descriptions of Optimization Options arch keyword I A 32 systems only Default arch pn4 Determines the version of the architecture for which the compiler generates instructions The following are arch options 86 Compiler Options e arch pnl Optimizes for the Intel Pentium processor e arch pn2 Optimizes for the Intel Pentium Pro Intel Pentium Il and Intel Pentium Ill processors e arch pn3 Optimizes for the Intel Pentium Pro Intel Pentium Il and Intel Pentium Ill processors This is the same as specifying the arch pn2 option e arch pn4 Optimizes for the Intel Pentium 4 processor e arch SSE Optimizes for Intel Pentium 4 processors with Streaming SIMD Extensions SSE e arch SSE2 O
283. or symbol This option suppresses any symbol definition currently in effect for the specified name The U option performs the same function as an undef preprocessor directive Redirecting Command Line Output to Files For programs that display a lot of text consider redirecting text that is usually displayed on stdout to a file Displaying a lot of text will slow down execution 40 Building Applications scrolling text in a terminal window on a workstation can cause an VO bottleneck increased elapsed time and use more CPU time The following commands show how to run the program more efficiently by redirecting output to a file and then displaying the program output myprog gt results lis more results lis Redirecting output from the program will change the times reported because of reduced screen VO Creating Running and Debugging an Executable Program The example below shows a sample Fortran main program using free source form that uses a module and an external subprogram The function CALC AVERAGE is contained in a separate file and depends on the module ARRAY_CALCULATOR for its interface block The USE statement accesses the module ARRAY_CALCULATOR This module contains the function declaration for CALC_AVERAGE The 5 element array is passed to the function CALC_AVERAGE which returns the value to the variable AVERAGE for printing The example is File main 90 This program calculates the average of f
284. or Microsoft Fortran PowerStation logical values where 0 zero is false and non zero values are true LOGICAL 1 LOGICAL 2 LOGICAL 4 and LOGICAL 8 data representation when fpscomp nological option was set appears below TRUE UNDEFINED BITS R T FALSE UNDEFINED BITS I ad 2 jo Key n 15 31 or 63 depending on LOGICAL declaration sia ZK Sa E 133 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Native IEEE Floating Point Representations Native IEEE Floating Point Representations Overview The REAL 4 IEEE S floating REAL 8 IEEE T floating and REAL 16 IEEE style X floating formats are stored in standard little endian IEEE binary floating point notation See IEEE Standard 754 for additional information about IEEE binary floating point notation COMPLEX formats use a pair of REAL values to denote the real and imaginary parts of the data All floating point formats represent fractions in sign magnitude notation with the binary radix point to the right of the most significant bit Fractions are assumed to be normalized and therefore the most significant bit is not stored this is called hidden bit normalization This bit is assumed to be 1 unless the exponent is 0 If the exponent equals 0 then the value represented is denormalized subnormal or plus or minus zero Intrinsic REAL kinds are 4 single precision 8 double precision and 16 extended precisio
285. or not the default action of an associated signal was changed 231 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e For certain errors related to arithmetic operations including floating point exceptions compilation options can determine whether the error is reported and the severity of the reported error How arithmetic exception conditions are reported and handled depends on the cause of the exception and how the program was compiled Unless the program was compiled to handle exceptions the exception might not be reported until after the instruction that caused the exception condition The following compiler options are related to handling errors and exceptions e The check bounds option generates extra code to catch certain conditions e The check noformat and check nooutput_conversion options reduce the severity level of the associated run time error to allow program continuation e The fpen options control the handling and reporting of floating point arithmetic exceptions at run time e The warn xxxx u nowarn w and w1 options control compile time warning messages which in some circumstances can help determine the cause of a run time error Run Time Message Format When errors occur during execution run time of a program the Fortran RTL issues diagnostic messages These run time messages have the following format forrtl severity nnn message text where e forrtl identifies the sourc
286. ords The default value nopad source causes a warning message to be displayed if a character or Hollerith literal that ends before the statement field ends is continued onto the next source record To suppress this warning message specify the warn nousage option 76 Compiler Options Specifying pad source can prevent warning messages associated with warn usage Libraries Options The libraries options let you specify libraries for your application Descriptions of Libraries Options no cpprt Default cxxlib icc use Intel C libraries Specifies that C run time libraries should not be linked This option exists for GNU compatibility reasons to disable the use of the cpp run time libraries during link There is no cpprt or yes cpprt option nodefaultlibs Default Off include default libraries Specifies that standard libraries should be used when linking This option exists for GNU compatibility reasons There is no defaultlibs option See also nostdlib i dynamic Default Off Instructs the linker to link Intel provided libraries dynamically Ldir Default Off Instructs the linker to search dir for libraries no threads Default nothreads Specifies whether or not multithreaded libraries should be linked against 77 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I If you specify threads this sets the reentrancy threaded option nostdlib Default Off Specifies
287. ormatted direct file Intel Visual Fortran pads these records to the fixed record length with ASCII NULL characters Unwritten records in the file contain undefined data The following program creates the sample unformatted direct file shown in the following figure 193 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I OPEN 3 FILE UFDIR RECL 10 amp amp FORM UNFORMATTED ACCESS DIRECT WRITE 3 REC 3 TRUE abcdef WRITE 3 REC 1 2049 CLOSE 3 END Unformatted Direct File 4 bytes for integer value 2049 6 undefined bytes zeros in Microsoft Fortran 10 bytes undefined data 4 bytes for logical value TRUE 6 bytes for character vate abcdef 10 11 2021 EES i Hex menu EE EG a8 00 T 01 80 aa m re aea Sear abedef L Record 1 L Record 2 L Record 3 194 Programming with Mixed Languages Programming with Mixed Languages Overview Mixed language programming is the process of building programs in which the source code is written in two or more languages It allows you to e Call existing code that is written in another language e Use procedures that may be difficult to implement in a particular language e Gain advantages in processing speeds Mixed language programming is possible between Intel Fortran and Intel C To properly create mixed language programs rules must be established for naming variables and procedures for sta
288. ortran Compiler for Linux Systems User s Guide Vol I Compiles all procedures functions and subroutines for possible recursive execution When recursive is specified the auto option is also set no reentrancy keyword Default noreentrancy Generates reentrant code that supports a multithreaded application The keyword can be e none Sameas noreentrancy Tells the Intel Fortran run time library RTL that the program will not be relying on threaded or asynchronous reentrancy Therefore the RTL will not guard against such interrupts inside its own critical regions e async Tells the RTL that the program may contain asynchronous handlers that could call the RTL This causes the RTL to guard against asynchronous interrupts inside its own critical regions e threaded Tells the RTL that the program is multithreaded This causes the RTL to use thread locking to guard its own critical regions Specifying threads sets reentrancy threaded since multithreaded code must be reentrant Specifying reentrancy is equivalent to specifying reentrancy threaded sox IA 32 and Intel Extended Memory 64 Technology Intel EM64T systems only Default sox Enables saving of the compiler options and version in the executable This option has no effect in Itanium based systems Compatibility Options The compatibility options let you specify how to make your source files and data files compatible with older Fortran versions or
289. ortran Compiler for Linux Systems User s Guide Vol I Questionable programming practices although allowed often are the result of programming errors For example the default value warn usage detects a continued character or Hollerith literal whose first part ends before the statement field ends and appears to end with trailing spaces Data Options The data options let you specify rules for how your Fortran data is treated during compilation optimization and code generation See Also Compatibility Options Language Options Descriptions of Data Options align none Default Add padding to structures only No padding is added to common blocks Alternate Syntax noalign Tells the compiler not to add padding bytes anywhere in common blocks or structures This is the same as noalign align No commons or align no dcommons Default align nocommons or align nodcommons Aligns the data items of all common blocks on natural boundaries up to 4 bytes align commons or 8 bytes align dcommons instead of the default byte boundary by adding padding bytes If your command line includes the stand option then the compiler ignores align dcommons align recnbyte Default align recl byte which is the same as Zzp16 or align records Alternate syntax zp 11214 8 16 Specifies alignment constraint for structures on 1 2 4 8 or 16 byte boundaries 62 Compiler Options Aligns fields of recor
290. ortran program expects a function to return data of type CHARACTER the Fortran compiler adds two additional arguments to the beginning of the called procedure s argument list 225 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e The first argument is a pointer to the location where the called procedure should store the result e The second is the maximum number of characters that must be returned padded with white spaces if necessary The called routine must copy its result through the address specified in the first argument Example that follows shows the Fortran code for a return character function called MAKECHARS and corresponding C routine Example of Returning Character Types from C to Fortran Fortran code CHARACTER 10 CHARS MAKECHARS DOUBLE PRECISION X Y CHARS MAKECHARS X Y Corresponding C Routine void makechars result length x y char result int length double x y program text producing returnvalue for i 0 i lt length i result i returnvalue i In the above example the following restrictions and behaviors apply e The function s length and result do not appear in the call statement they are added by the compiler e The called routine must copy the result string into the location specified by result it must not copy more than length characters e If fewer than length characters are returned the retu
291. ou have the flexibility of identifying exceptional numbers so that for example you can replace positive and negative denormalized numbers with true zero The following is a simple example of identifying floating point bit representations include fordef for real 4 a integer 4 class_of_bits a 57 0 Bit pattern is a finite number class of bits fp_class a if class of bits eg for k fp pos norm or amp class of bits eq for k fp neg norm then print a is a non zero and non exceptional value else print a is zero or an exceptional value end if end In this example the symbol for k fp pos norm in the file opt intel fo 80 include fordef for plus the REAL 4 value 57 0 to the FP CLASS intrinsic function results in the execution of the first print statement The table below explains the symbols in the file opt intel fo 80 include fordef for and their corresponding floating point representations Symbols in File fordef for Symbol Name Class of Floating Point Bit Representation FOR_K_FP_SNAN Signaling NaN FOR_K_FP_QNAN Quiet NaN FOR_K_FP_POS_INF Positive infinity FOR_K_FP_NEG_INF Negative infinity FOR K FP POS NORM Positive normalized finite number FOR K FP NEG NORM Negative normalized finite number FOR K FP POS DENORM Positive denormalized number FOR K FP NEG DENORM Negative denormalized number FOR K FP POS ZERO Positive zero
292. ou to write code on a PC that is compatible with other platforms The portability library is called 1ibifport a Frequently used functions are included in a portability module called IFPORT See these topics Using the Portability Library libifport a Portability Routines Using the Portability Library libifport a You can use the portability library 1ibifport ain one of two ways 243 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e Add the statement USE IFPORT to your program This statement includes the portability library 1ibifport a e Call portability routines using the correct parameters and return value libifport a is passed to the linker by default during linking To prevent libifport a from being passed to the linker specify the fpscomp nolibs option Using the 1ibifport a portability library provides interface blocks and parameter definitions for the routines as well as compiler verification of calls Some routines in this library can be called with different sets of arguments and sometimes even as a function instead of a subroutine In these cases the arguments and calling mechanism determine the meaning of the routine The libifport a portability library contains generic interface blocks that give procedure definitions for these routines Fortran 95 90 contains intrinsic procedures for many of the portability functions The portability routines are extensions to the Fortran 95 standard When wr
293. ous OPTIONS gasser karene Ger Grenen 79 Optimization OPNONS aa Gael denne Gere 86 Descriptions of Optimization Options eernnnnnornnnnnnrnrnnnnrnnnnnnnrnnnnnanenenen 86 Output Files Options es Es aars gadgeten GR Ge ee GE Ge be 99 Table Of Contents Descriptions of Output Files Options rrrrrnnrrrrrnrnrrrrrrnnnrrrrrnnrrrnnnnnerernnnn 99 Presto essor OBOS e i EE Eee gass er rales feet es eed 101 Descriptions of Preprocessor Options ie ee ER Ee ee ee de RE ee ee ee 101 Run Time OP ONS sd ek WEE ED ines SE RD De ee ee ae ie DE 103 Descriptions of Run Time OPDONS iese ee ee Re EA AA ee AR AA ee ee 103 Bebuadind Lsltid idD RR N utes hoe titel SEE ER DER ef Ee DER EE 107 Debugging Using idb Overview ee ee ee ee Re AA ee ee Re ee Ge ee 107 Getting Started with Debugging iese ee EE ee ee ee RE ee ee ee RR ee ee ee ee 107 Debugging 0 6 0 EE RA GO ED DO Ee es 108 Preparing Your Program for Debugging iese sesse ee de ee ee ee de ee ee ee 108 Using Debugger Commands and Setting Breakpoint iss ee ese ee ee 109 Other Debugger CommandsS sees ed ee ee Re ee ee Ak Ge ee 110 Summary of Debugger Commands iese ee ee Re AA ee ee dk ee ee 111 Debugging the SQUARES Example Program ees esse sesse ee ee ee ee ee ee ee ee ee 113 Displaying Variables in the Debugger sees ees se ee ee ee RR Ee ee ee ee ee ee 117 Module VatiaDleS is EO EE ER DES GE Ee ER GE Pe RO tas ES EE DEE R
294. ows that the program executed to completion 13 The quit command returns control to the shell so that you can correct the source file and recompile and relink the program 14 The shell command vi runs a text editor and the source file is edited to add K K 1 after line 10 as shown Compiler assigned line numbers have been added to clarify the example 15 The revised program is compiled and linked The shell command i db squares starts the debugger using the revised program so that its correct execution can be verified 16 The when at 12 print k command reports the value of K at each iteration through the loop 17 The run command starts execution 18 The displayed values of K confirm that the program is running correctly 19 The quit command ends the debugging session returning control to the shell Displaying Variables in the Debugger To refer to a variable use either the uppercase or lowercase letters For example idb print J idb print j You can enter command names in uppercase idb print J 117 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I If you compile the program with the command line option names as is and you need to examine case sensitive names you can control whether idb is case sensitive by setting the 1ang environment variable to the name of a case sensitive language Module Variables To refer to a variable defined in a module insert an opening quote t
295. p by the Intel Fortran RTL The only way to restore the default action is to save the returned value from the first call to signal When using a debugger it may be necessary to enter a command to allow the Intel Fortran RTL to receive and handle the appropriate signals 238 Error Handling Overriding the Default Run Time Library Exception Handler To override the default run time library exception handler your application must call signal to change the action for the signal of interest For example assume that you want to change the signal action to cause your application to call abort and generate a core file The following example adds a function named clear signal to call signal and change the action for the SIGABRT signal include lt signal h gt void clear signal signal SIGABRT SIG DFL int myabort abort return 0 A call to the clear signal local routine must be added to main Make sure that the call appears before any call to the local myabort routine program aborts integer i call clear_signal i 3 if i lt 5 then call myabort end if end Obtaining Traceback Information with TRACEBACKQQ You can obtain traceback information in your application by calling the TRACEBACKQQ routine TRACEBACKOO allows an application to initiate a stack trace You can use this routine to report application detected errors use it for debugging and so on It
296. piler for Linux Systems User s Guide Vol I Issues errors for nonstandard Fortran 90 e90 or nonstandard Fortran 95 e95 This option issues compile time errors for language elements that are not standard in the Fortran language that can be identified at compile time See also no stand no error limit n Default error limit 30 Specifies the maximum number of error level or fatal level compiler errors allowed for a given file before compilation aborts If you specify noerror_limit on the command line there is no limit on the number of errors that are allowed If the maximum number of errors is reached a warning message is issued and the next file if any on the command line is compiled openmp_report 0 1 2 Default Off openmp_report1 is the default if openmp report is specified without an argument Specifies the OpenMP parallelizer s diagnostic level where n is e 0 No information e 1 Loops regions and sections parallelized e 2 Same as 1 plus master construct single construct and so forth For more information see Parallelization with OpenMP Overview and related sections in the User s Guide Volume II Optimizing Applications par_report 0 1 2 3 Default Off par_report1 is the default if par report is specified without an argument Specifies the autoparallelizer s diagnostic level where n is 0 No information 1 Loops successfully parallelized 2 Loops successfully and unsuccessfully para
297. processor symbol can be used in both fpp and the Fortran compiler conditional compilation It is available only openmp IS specified PRO INSTRUMENT Off Both Defined when prof gen is 39 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I specified Defining Preprocessor Symbols You can use the D option to define the symbol names to be used during preprocessing This option performs the same function as the define preprocessor directive The format of this option is Dname value where e name is the name of the symbol to define e value specifies an optional value to substitute for name If you do not enter a value name is set to 1 The value should be enclosed in quotation marks if it contains spaces or special characters Preprocessing replaces every occurrence of name with the specified value For example to define a symbol called SIZE with the value 100 use the following command ifort fpp DSIZE 100 progl f Preprocessing replaces all occurrences of SIZE with the specified value 100 before passing the preprocessed source code to the compiler Assume that the program contains this declaration REAL VECTOR SIZE In the code sent to the compiler the value 100 replaces SIZE in this declaration and in all other occurrences of the name SIZE Suppressing Preprocessor Symbols You can use the U option to suppress an automatic definition of a preprocess
298. ptimizes for Intel Pentium 4 processors with Streaming SIMD Extensions 2 SSE2 assume no buffered_io Default assume nobuffered_io buffer is flushed as each record is written Specifies whether records are written flushed to disk as each is written or are accumulated in the buffer If you specify assume buffered_io records accumulate in the buffer For disk devices assume buffered_io or the equivalent OPEN statement BUFFERED YES specifier or the FORT_BUFFERED run time environment variable requests that the internal buffer will be filled possibly by many record output statements WRITE before it is written to disk by the Fortran run time system If a file is opened for direct access I O buffering will be ignored Using buffered writes usually makes disk VO more efficient by writing larger blocks of data to the disk less often However if you request buffered writes records not yet written to disk may be lost in the event of a system failure Unless you set the FORT_BUFFERED environment variable to true the default is BUFFERED NO and assume nobuffered io for all I O in which case the Fortran run time system empties its internal buffer for each WRITE or similar record output statements The OPEN statement BUFFERED specifier applies to a specific logical unit In contrast the assume no buffered io option and the FORT BUFFERED environment variable apply to all Fortran units auto_ilp32 Ita
299. ption 74 par report compiler option 57 par_threshold compiler option 86 parallel compiler option 86 parallelizer ssnrrnnnnnnnnnnnnnnr 19 passing arguments between Fortran and C 230 in mixed language programming Sabie EE E E beate HE 207 PATH environment variable 249 pathname absolute RR ee etl 24 default rules for applying 167 ENG 24 pc compiler option 00 69 pg compiler option 62 phases compilation ceeeeeeee cette 20 DIEDIOCESS ir er EERS mig 21 oe re 164 Index pointer passing in mixed language piO9rammINd EE ss EE Se 218 receiving in mixed language programming EE E EES 218 pointer variable iese sesse dee 117 portability library OVEIVIGW uns ei ed Ee ee 243 USING ote RR i hata ctr 243 portability library ernnnnnnnnnr 244 portability routines 0606 244 porting nonnative data 154 POSITION specifier in OPEN statement 177 PowerStation compatibility 190 prec_div compiler option 79 preconnected file preconnected files 164 168 predefined preprocessor symbol 38 prefetch compiler option 86 preprocess phase ese 21 preprocess only compiler option 101 preprocessor OptiONS ee 101 299 Intel amp Fortran Compiler for Linux Systems User s G
300. r FOR IOS_BACERR The Intel Fortran RTL VO system detected an error condition during execution of a BACKSPACE statement 2 severe 24 End of file during read FOR IOS ENDDURREA One of the following conditions occurred e A Intel Fortran RTL VO system end of file condition was encountered during execution of a READ statement that did not contain an END ERR or IOSTAT specification An end of file record written by the ENDFILE statement was encountered during execution of a READ statement that did not contain an END ERR or IOSTAT specification An attempt was made to read past the end of an internal file character string or array during execution of a READ statement that did not contain an END ERR or IOSTAT specification This error is returned by END and ERRSNS 2Eisevere 25 Record number outside range FOR IOS RECNUMOUT A direct access READ WRITE or FIND statement specified a record number outside the range specified when the file was opened 26lsevere 26 OPEN or DEFINE FILE required FORS IOS OPEDEFREQ A direct access READ WRITE or FIND statement was attempted for a file when no prior DEFINE FILE or OPEN statement with ACCESS DIRECT was performed for that file La 27 Too many records in I O statement 260 Reference Information FOR IOS TOOMANREC An attempt was made to do one of the following e Read or write more than one record with an ENCODE or DECODE statement e Wr
301. r is a slash For example the following directory and file name refer to the file named testdata in the usr users gdata directory usr users gdata testdata e Arelative pathname where the specified directory is relative to the current directory Relative pathnames do not begin with a slash The following example uses a relative pathname from the current directory usr users to refer to the same file testdata in the gdata subdirectory gdata testdata Directory names and file names should not contain any operating system wildcard characters such as and the construct You can use the tilde 24 Getting Started character as the first character in a pathname to refer to a top level directory as in the C shell When specifying files keep in mind that trailing and leading blanks are removed from character expression names but not from Hollerith numeric array names File names are case sensitive and can consist of uppercase and lowercase letters For example the following file names represent three different files myfile for MYfile for MYFILE for Output Files The output produced by the ifort command includes e An object file such as test o if you specify the c option on the command line An object file is created for each source file e An executable file such as a out if you omit the c option e One or more module files such as dat adef moa if the source file contains one or
302. ran Compiler for Linux Systems User s Guide Vol I OPEN statement specifiers for 169 error handling routines 244 error messages NING Jure 257 error processing iese sesse dee 231 error limit compiler option 57 ERRSNS subroutine 0 235 example program SOUAMRES eee 113 exception handler for Run Time Library RTL overriding 2 ceceeeeeeeeeeees 239 EXCEPTION CONTINUE SEARCH EE IE RS EE 249 exceptional numbers identifying ua 138 exchanging data in mixed language programming EE SN ETER 207 executable program creating running and cebugging EO EO EE EE 41 export command ee ee 28 expressions in debugger commands 124 284 extend source compiler option 74 EXTENDED PRECISION data representation 136 extensions ee RE 23 external procedures options 68 F F compiler option xonnonn 101 F UFMTENDIAN environment variable 2 ind EE 149 249 F_UFMTENDIAN method 149 f66 compiler option ee 74 f77rtl compiler option 0 52 f90_dyncom run time library routine EE EE talons 46 falias compiler option 86 fast compiler option 06 86 fcode asm comipiler option 99 FDX keyword rrrnnnnnnnnnnnnnnnnnn 141 TOATUNES rare ie ee 15 ffnalias compiler option 86 FGX keyword rnrronnnnnnnnnnnnnnnnn 141 file WMOCKING E
303. rds are the same size If the size of an I O record being written is less than the record length RECL extra bytes are added padding Typically the data transferred by an VO statement is read from or written to a single record It is possible however for a single I O statement to transfer data from or to more than one record depending on the form of I O used Input Record Transfer When using advancing I O if an input statement specifies fewer data fields less data than the record contains the remaining fields are ignored If an input statement specifies more data fields than the record contains one of the following occurs e For formatted input using advancing I O if the file was opened with PAD YES additional fields are read as spaces If the file is opened with PAD NO an error occurs the input statement should not specify more data fields than the record contains e For formatted input using nonadvancing VO ADVANCE NO an end of record EOR condition is returned If the file was opened with PAD YES additional fields are read as spaces e For list directed input another record is read e For NAMELIST input another record is read e For unformatted input an error occurs 179 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Output Record Transfer If an output statement specifies fewer data fields than the record contains less data than required to fill a record the following
304. rds using sequential access just before you close the file Unless you use nonadvancing VO reading and writing records usually advances the current record position by one record More than one record might be transferred using a single record VO statement Advancing and Nonadvancing Record I O After you open a file if you omit the ADVANCE specifier or specify ADVANCE YES in READ and WRITE statements advancing I O normal Fortran VO will be used for record access When using advancing VO e Record VO statements transfer one entire record or multiple records e Record VO statements advance the current record position to a position before the next record You can request nonadvancing VO for the file by specifying the ADVANCE NO specifier in a READ and WRITE statement You can use nonadvancing VO only for sequential access to external files using formatted VO not list directed or namelist When you use nonadvancing VO the current record position does not change and part of the record might be transferred unlike advancing VO where one entire record or records are always transferred You can alternate between advancing and nonadvancing VO by specifying different values for the ADVANCE specifier YES and NO in the READ and WRITE record VO statements When reading records with either advancing or nonadvancing VO you can use the END specifier to branch to a specified label when the end of the file is read Becaus
305. real and COMPLEX imaginary parts each range from 2 2250738585072013D 308 to 1 7976931348623158D308 Values between 2 2250738585072008D 308 and 4 94065645841246544D 324 are denormalized subnormal COMPLEX 16 32 bytes Extended precision complex floating point values in a pair of EXTENDED 256 bits IEEE style X floating format parts real and imaginary The PRECISION real and imaginary parts each range from 6 4751751194380251109244389582276465524996Q 4966 to 1 189731495357231765085759326628007016196477Q4932 LOGIGAL See Logical value either LOGICAL 2 LOGICAL 4 or LOGICAL 2 LOGICAL 8 The size is controlled by the integer size nn LOGICAL AN compiler option The default is integer size 32 LOGICAL 4 130 Data and VO and LOGICAL 8 LOGICAL 1 1 byte Logical values TRUE or FALSE 8 bits LOGICAL 2 2 bytes Logical values TRUE or FALSE 16 bits LOGICAL 4 4 bytes Logical values TRUE or FALSE 32 bits LOGICAL 8 8 bytes Logical values TRUE or FALSE 64 bits CHARACTER 1 byte 8 Character data represented by character code convention bits per Character declarations can be in the form character CHARACTER LEN n or CHARACTER n where n is the number of bytes or n is to indicate passed length format HOLLERITH 1 byte 8 Hollerith constants bits per Hollerith character In addition you can define binary bit constants as explained in the Language
306. ress of the beginning of the string e For string arguments passed by reference with default ATTRIBUTES o When nomixed str len argis set the length of the string is not available to the called procedure This is the default o When mixed str len argis set the length of the string is pushed by value on the stack immediately after the address of the beginning of the string Since all strings in C are pointers C expects strings to be passed by reference without a string length In addition C strings are null terminated while Fortran strings are not There are two basic ways to pass strings between Fortran and C convert Fortran strings to C strings or write C routines to accept Fortran strings To convert a Fortran string to C choose a combination of attributes that passes the string by reference without length and null terminate your strings For example INTERFACE SUBROUTINE Pass_Str string IDECS ATTRIBUTES C DECORATE ALIAS Pass_Str Pass Str CHARACTER string IDECS ATTRIBUTES REFERENCE string END SUBROUTINE END INTERFACE CHARACTER 40 forstring DATA forstring This is a null terminated string C 224 Programming with Mixed Languages The following example shows the extension of using the null terminator for the string in the Fortran DATA statement see C Strings in the Intel Fortran Language Reference DATA forstring This is a null
307. rn location should be padded on the right with blanks Fortran does not use zeros to terminate strings e The called procedure is type void e You must use lowercase names for C routines and INTERFACE blocks to make the calls using lower case Handling User Defined Types Fortran 95 90 supports user defined types data structures similar to C structures User defined types can be passed in modules and common blocks just as other data types but the other language must know the type s structure For example 226 Programming with Mixed Languages Fortran Code TYPE LOTTA DATA SEQUENCE REAL A INTEGER B CHARACTER 30 INFO COMPLEX CX CHARACTER 80 MOREINFO END TYPE LOTTA DATA TYPE LOTTA DATA D1 D2 COMMON T_BLOCK D1 D2 In the Fortran code above the SEQUENCE statement preserves the storage order of the derived type definition C Code C code accessing D1 and D2 extern struct struct float a int b char info 30 struct float real imag CX char moreinfo 80 dl d2 t block Intel Fortran C Mixed Language Programs Intel Fortran C Mixed Language Programs Overview See these topics Compiling and Linking Mixed Language Programs Using Modules in Fortran C Mixed Language Programming Calling C Procedures from an Intel Fortran Program Compiling and Linking Intel Fortran C Programs 227 Intel amp Fortran Compiler for Li
308. rnate syntax r16 See Also REAL KIND 16 Representation COMPLEX KIND 16 Representation safe cray ptr Default Off assume that Cray pointers do alias other variables 67 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Requires that the compiler assume that Cray pointers do not alias that is do not specify sharing memory between other variables Consider the following example pointer pb b pb getstorage do i 1 n b i a i 1 enddo By default the compiler assumes that b and a are aliased To prevent such an assumption specify the safe_cray_ptr option and the compiler will treat b i and a i as independent of each other However if the variables are intended to be aliased with Cray pointers using the safe cray ptr option produces incorrect results For the code example below safe cray ptr Should not be used pointer pb b pb loc a 2 do i 1 n b i a i 1 enddo zero Default Off zero Initializes to zero all local scalar variables of intrinsic type INTEGER REAL COMPLEX or LOGICAL that are saved and not already initialized Use save on the command line to make all local variables specifically marked as SAVE External Procedures Options The external procedures options let you specify how external procedures are called Descriptions of External Procedures Options assume no underscore Default assume nounderscore Alternate syntax nus
309. rogram may execute For disk files the segmented record is a single logical record that consists of one or more segments Each segment is a physical record A segmented logical record can exceed the absolute maximum record length 2 14 billion bytes but each segment physical record individually cannot exceed the maximum record length To access an unformatted sequential file that contains segmented records specify FORM UNFORMATTED and RECORDTYPE SEGMENTED when you open the file As shown in the figure below the layout of segmented records consists of 4 bytes of control information followed by the user data 188 Data and VO 2 2 H Record length RECL valye Record size count integer ZK 9821 GE The control information consists of a 2 byte integer record size count includes the two bytes used by the segment identifier followed by a 2 byte integer segment identifier that identifies this segment as one of the following Identifier Value Segment Identified 0 One of the segments between the first and last segments 1 First segment 2 Last segment 3 Only segment If the specified record length is an odd number the user data will be padded with a single blank one byte but this extra byte is not added to the 2 byte integer record size count Stream File A Stream file is not grouped into records and contains no control information Stream files are used with CARRIAGECONTROL
310. ry e All other types of single variables begin at the next even address immediately following the previous variable or array in memory e Al arrays of variables begin on the next even address immediately following the previous variable or array in memory except for CHARACTER arrays which always follow immediately after the previous variable or array e All common blocks begin on a four byte aligned address Because of these padding rules you must consider the alignment of C structure elements with Fortran common block elements and assure matching either by making all variables the same types and kinds in both languages using only 4 byte and 8 byte data types in both languages simplifies this or by using the C pack pragmas in the C code around the C structure to make C data packing like Fortran s For example pragma pack 2 struct int N char INFO 30 examp pragma pack To restore the original packing you must add pragma pack atthe end of the structure Remember Fortran module data can be shared directly with C structures with appropriate naming 211 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Once you have dealt with alignment and padding you can give C access to an entire common block or set of common blocks Alternatively you can pass individual members of a Fortran common block in an argument list just as you can any other data item Use of common blocks for mixed language data
311. s been assigned to the record Prior to each READ and WRITE statement an internal file is always positioned at the beginning of the first record Scratch Files Scratch files are created by specifying STATUS SCRATCH in an OPEN statement By default these temporary files are created in and later deleted from the directory specified in the OPEN statement DEFAULTFILE if specified Record Types 161 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Record type refers to whether records stored in a file are all the same length are of varying length or use other conventions to define where one record ends and another begins You can use any of the record types with sequential files Relative files require the fixed length record type When creating a new file or opening an existing file specify one of the record types described below See also Format of Record Types Fixed Length Record Type Records in a file must be the same length You must specify the record length RECL when the file is opened See also Fixed Length Records Variable Length Record Type Records in a file can vary in length Record length information is stored as control bytes at the beginning and end of each record See also Variable Length Records Segmented Record Type This pertains to a single logical record containing one or more unformatted records of varying length which can only be used for unformatted sequential a
312. s ee es ee ee ee ee ER ee ee de ge ee 29 Using the ifort Command EE EE EER EE DEE RD ee OR cous De Ee 29 Using the make Command iese ses ee ee EE AA ee Ge EE AA ee ee Re AA ede ee 30 Examples of the ifort Command iese ses se ee ee ee EE AA ee ee Re ee ee Ge ee 30 Compiling and Linking Multiple Files iis ee ese ee ee ke ee EA ee Ge ee 30 Pieventindd KING se EG OE SE DR Ee Si 30 Renaming the Output File iese ss ed ee ee ee AA ee ee Ad ee ee ee Ak ede ee 31 Specifying an Additional Linker LiDrarY ii ees se ek ee ee Re AA ee ee ee ee 31 Using Module mod Files ss EE SE EN SE N EE EEA ER 31 Compiling Programs with ModuleS ies see ede ee ee Ee ee ee ee RR ER Ee ee ee ee ge ee 32 Parallel Invocation with a makefile ees ss ee ee ee ee Re Ad ee ee ee Ak ee ee 33 Searching for Include and mod Files iese esse de ee ee Re AA ee ee Be Ak ee ee 34 Specifying and Removing an Include File Path iese see ee ee ee 35 Configuration Files and Response Files esse ee ee se AA ee ee Ak ee ee 35 Contig ratiom EISE it EES EE EG RA REA 35 Response Files RE N EE ee EE ER ek eee 36 Specifying Alternative Tool Locations and ODtiONS ees ees ee RR Ee AE 37 Using Qlocation to Specify an Alternative Location for a Tool 5 37 Table Of Contents Using Qoption to Pass Options to ToolS ee see RR ee ee RR Ee ee ee 38 Predefined Preprocessor Symbols iss ee ee ee ee EE e
313. s how the following exceptions are handled e When floating point calculations result in a divide by zero overflow or invalid operation e When floating point calculations result in an underflow e When denormalized number or other exceptional number positive infinity negative infinity or a NaN is present in an arithmetic expression You can choose the following e fpe0 specifies underflow gives 0 0 abort on other IEEE exceptions e fpe3 specifies produce NaN signed infinities and denormal results On IA 32 systems using fpe0 will slow run time performance Many programs do not need to handle denormalized numbers or other exceptional values On Itanium based systems using fpe3 will slow run time performance fpstkchk IA 32 systems only Default Off Generates extra code after every function call to ensure that the floating point FP stack is in the expected state By default there is no checking So when the FP stack overflows a NaN value is put into FP calculations and the program s results differ Unfortunately the overflow point can be far away from the point of the actual bug The fpstkchk option places code that would fail immediately after an incorrect call occurred thus making it easier to locate these issues fr32 Itanium based systems only Default Off Specifies that the use of high floating point registers should be disabled ftz Default Off ftz 72 Compiler Options Enabl
314. s or library routines to open the file and establish special context that changes the effect of subsequent Intel Fortran VO statements The Intel Fortran RTL VO support routines call the USEROPEN function in place of the system calls usually used when the file is first opened for VO The USEROPEN specifier in an OPEN statement specifies the name of a function to receive control The called function must open the file or pipe and return the file descriptor of the file when it returns control to the RTL When opening the file the called function usually specifies options different from those provided by anormal OPEN statement You can obtain the file descriptor from the Intel Fortran RTL for a specific unit number with the get fd routine 180 Data and VO Although the called function can be written in other languages such as Fortran C is usually the best choice for making system calls such as open or create Syntax and Behavior of the USEROPEN Specifier The USEROPEN specifier for the OPEN statement has the form USEROPEN function name function name represents the name of an external function In the calling program the function must be declared in an EXTERNAL statement For example the following Intel Fortran code might be used to call the USEROPEN procedure UOPEN known to the linker as uopen_ EXTERNAL UOPEN INTEGER UOPEN OPEN UNIT 10 FILE usr test data STATUS NEW USEROP EN UOPEN During the O
315. sable memory severe 256 Unformatted I O to unit open for formatted transfers FORS IOS UNFIO FMT Attempted unformatted VO to a unit where the OPEN statement FORM specifier indicated the file was formatted Check that the correct unit file was specified If the FORM specifier was not present in the OPEN statement and the file contains unformatted data specify FORM UNFORMATTED in the OPEN statement Otherwise if appropriate use formatted I O such as list directed or namelist I O 2E7lsevere 257 Formatted I O to unit open for unformatted transfers FOR IOS_FMTIO_UNF Attempted formatted VO such as list directed or namelist VO to a unit where the OPEN statement indicated the file was unformatted FORM specifier Check that the correct unit file was specified If the FORM specifier was not present in the OPEN statement and the file contains formatted data specify FORM FORMATTED in the OPEN statement Otherwise if appropriate use unformatted VO 271 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I 26dlsevere 264 operation requires file to be on disk or tape FOR IOS OPERREODIS Attempted to use a BACKSPACE statement on such devices as a terminal or pipe severe 265 operation requires sequential file organization and access FOR IOS OPEREQSEQ Attempted to use a BACKSPACE statement on a file whose organization was not sequential or whose access was not sequential A BAC
316. sses that lack those features can be passed in the same way as C structures Returning Complex Type Data If a Fortran program expects a procedure to return a COMPLEX DOUBLE COMPLEX value the Fortran compiler adds an additional argument to the beginning of the called procedure argument list This additional argument is a pointer to the location where the called procedure must store its result Example below shows the Fortran code for returning a complex data type procedure called WBAT and the corresponding C routine Example of Returning Complex Data Types from C to Fortran Fortran code COMPLEX BAT WBAT REAL X Y BAT WBAT X Y Corresponding C routine struct _mycomplex float real imag typedef struct _mycomplex _single_complex void WBAT _single_complex location float x float y float realpart float imaginarypart program text producing realpart and imaginarypart location real realpart location imag imaginarypart In the above example the following restrictions and behaviors apply 216 Programming with Mixed Languages e The argument location does not appear in the Fortran call it is added by the compiler e The C subroutine must copy the result s real and imaginary parts correctly into location e The called procedure is type void If the function returned a DOUBLE COMPLEX value the type float would be replaced by the type double in the definition of locati
317. statements or those that are in common blocks auto scalar may provide a performance gain for your program but if your program depends on variables having the same value as the last time the routine was invoked your program may not function properly Variables that need to retain their values across subroutine calls should appear in a SAVE statement auto makes all local variables AUTOMATIC causing all variables to be allocated on the stack rather than in local static storage It does not affect variables that have the SAVE attribute or appear in an EQUIVALENCE statement or in acommon block save Saves all variables in static allocation except local variables within a recursive routine auto might provide a performance gain for your program but if your program depends on variables having the same value as the last time the routine was invoked your program might not function properly double size 64 128 Default double size 64 65 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Defines DOUBLE PRECISION and DOUBLE COMPLEX declarations constants functions and intrinsics double size 64 defines DOUBLE PRECISION declarations constants functions and intrinsics as REAL 8 and defines DOUBLE COMPLEX declarations functions and intrinsics as COMPLEX 16 double size 128 defines DOUBLE PRECISION declarations constants functions and intrinsics as REAL 16 and for Fortran 90 and 95 defines DOUBLE COM
318. sting of DO IF or CASE constructs Limited only by memory constraints Nesting of parenthesized formats Limited only by memory constraints Number of digits in a numeric constant Parentheses nesting in expressions Limited only by memory constraints Limited only by memory constraints Structure nesting 30 Symbolic name length 63 characters See the product Release Notes for more information on memory limits for large data objects Hexadecimal Binary Octal Decimal Conversions The following table lists hexadecimal binary octal and decimal conversion Hex Number Binary Number Octal Number Decimal Number 0 ooo EE EE 254 Reference Information Compatibility with Previous Versions of Intel Fortran This topic is written for developers who are familiar with Intel Fortran Version 7 1 or earlier versions are now using Intel Fortran Version 8 x Intel Fortran supports extensions to the ISO and ANSI standards including a number of extensions defined by e Intel Fortran for various platforms e Microsoft Fortran PowerStation 4 0 Many language extensions associated with Microsoft Fortran PowerStation Version 4 have been added to Intel Fortran Differences Between Intel Fortran Version 7 1 and Intel Fortran Version 8 x 255 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Some differences are e The command name for command line use is now ifort E
319. t least once e FORTRAN 66 EXTERNAL statement syntax and semantics are allowed e Ifthe OPEN statement STATUS specifier is omitted the default changes to STATUS NEW instead of STATUS UNKNOWN e lf the OPEN statement BLANK specifier is omitted the default changes to BLANK ZERO instead of BLANK NULL no free or no fixed Default File extension is used to determine format Alternate syntax FR is equivalent to free F I is equivalent to fixed Specifies the format of the Fortran source code If this option is not specifed the file extension determines the format e Files with an extension of 90 F90 or i90 are free format source files e Files with an extension of f for FOR ftn or i are fixed format files openmp or openmp_ stubs Default Off disabled Specifies that OpenMP directives should be processed Options are e openmp Generate parallel code If you use this option multithreaded libraries are used but fpp is not automatically invoked When openmp is specified the auto option is also set e openmp stubs Generate sequential code The OpenMP directives are ignored and a stub OpenMP library is linked no pad_source Default nopad source Specifies that fixed form source lines shorter than the statement field width are to be padded with spaces to the end of the statement field This affects the interpretation of character and Hollerith literals that are continued across source rec
320. t thread context watch location Displays a message when the debuggee or user program accesses the specified memory location For example 1 12 Debugging Using idb watch 0x140000170 watch variable m Displays a message when the debuggee or user program accesses the variable specified by m ESS Displays the data type of the specified symbol symbo when at 9 Executes a command or commands command When a specified line such as 9 is reached the command or commands are executed For example when at 9 print k prints the value of variable K when the program executes source code line 9 when in name command When a procedure specified by name is reached the command or commands are executed For example when in calc_ave print k prints the value of variable K when the program begins executing the procedure named calc_ave where Executes a command or commands Displays the call stack where thread all Displays the stack traces of all threads The debugger supports other special purpose commands For example e You might use the attach and detach commands for programs with very long execution times e The listobj command might be helpful when debugging programs that depend on shared libraries The 1istobj command displays the names of executables and shared libraries currently known to the debugger Debugging the SQUARES Example Program The examp
321. tants functions and intrinsics where n is 32 64 or 128 nis 32 Defines REAL declarations constants functions and intrinsics as REAL KIND 4 SINGLE PRECISION and defines COMPLEX declarations constants functions and intrinsics as COMPLEX KIND 4 COMPLEX Alternate syntax None See Also REAL KIND 4 REAL Representation COMPLE X KIND 4 COMPLEX Representation nis 64 Defines REAL declarations constants functions and intrinsics as REAL KIND 8 DOUBLE PRECISION and defines COMPLEX declarations constants functions and intrinsics as COMPLEX KIND 8 DOUBLE COMPLEX Specifying real size 64 causes intrinsic functions to produce a REAL KIND 8 or COMPLEX KIND 8 result instead of a REAL KIND 4 or COMPLEX KIND 4 result unless the argument is explicitly typed as REAL KIND 4 or COMPLEX KIND 4 including CMPLX FLOAT REAL SNGL and AIMAG For instance references to the CMPLX intrinsic produce DCMPLX results COMPLE X KIND 8 unless the argument to CMPLX is explicitly typed as REAL KIND 4 REAL 4 COMPLE X KIND 4 or COMPLEX 8 In this case the resulting data type is COMPLEX KIND 4 Alternate syntax r8 or autodouble See Also REAL KIND 8 DOUBLE PRECISION Representation COMPLEX KIND 8 DOUBLE COMPLEX Representation n is 128 Defines REAL declarations constants functions and intrinsics as REAL KIND 16 and defines COMPLEX declarations constants functions and intrinsics as COMPLEX KIND 16 Alte
322. tends to any number of dimensions you declare For example the C declaration int arrl 2 10 15 20 is equivalent to the Fortran declaration INTEGER arrl 20 15 10 2 The constants used in a C array declaration represent extents not upper bounds as they do in other languages Therefore the last element in the C array declared as int arr 5 5 is arr 4 4 not arr 5 5 The following table shows equivalencies for array declarations Equivalent Array Declarations for Different Languages Language Array Declaration Array Reference from Fortran Fortran DIMENSION x i k x i k Or type x i k C C type xk i DT k 1 220 Programming with Mixed Languages Intel Fortran Array Descriptor Format For cases where Fortran 95 90 needs to keep track of more than a pointer memory address the Intel Fortran Compiler uses an array descriptor which stores the details of how an array is organized When using an explicit interface by association or procedure interface block Intel Fortran generates a descriptor for the following types of array arguments e Pointers to arrays array pointers e Assumed shape arrays Certain data structure arguments do not use a descriptor even when an appropriate explicit interface is provided For example explicit shape and assumed size arrays do not use a descriptor In contrast array pointers and allocatable arrays use descriptors regardless
323. terminated string C The C interface is void Pass_Str char string To get your C routines to accept Fortran strings C must account for the length argument passed along with the string address For example Fortran code INTERFACE SUBROUTINE Pass_Str string CHARACTER string END INTERFACE The C routine must expect two arguments void pass_str char string unsigned int length_arg This interface handles the hidden length argument but you must still reconcile C strings that are null terminated and Fortran strings that are not In addition if the data assigned to the Fortran string is less than the declared length the Fortran string will be blank padded Rather than trying to handle these string differences in your C routines the best approach in Fortran C mixed programming is to adopt C string behavior whenever possible Fortran functions that return a character string using the syntax CHARACTER place a hidden string argument and the length of the string at the beginning of the argument list C functions that implement such a Fortran function call must declare this hidden string argument explicitly and use it to return a value The C return type should be void However you are more likely to avoid errors by not using character string return functions Use subroutines or place the strings into modules or global variables whenever possible Returning Character Data Types If a F
324. ti Directory Module Files For an example of managing modules when the mod files could be produced in different directories assume that the program mod_def 90 resides in directory usr yourdir test t and this program contains a module defined as follows file mod_def f90 module definedmod end module The compiler command ifort c mod_def f90 produces two files mod def o and definedmod mod in directory usr yourdir test t If you need to use the above mod file in another directory for example in directory usr yourdir test t2 where the program usemod uses the definedmod mod file do the following file use mod def f90 program usemod use definedmod end program To compile the above program use this command ifort c use mod def f90 I usr yourdir test t where the Idir option provides the compiler with the path to search and locate the definedmod mod file Parallel Invocation with a makefile 33 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I The programs containing module definitions support parallel invocation using a makefile The makefile supports interprocedural optimizations of multiple files and of the whole program Consider the following code testl f90 module ml end module test2 90 subroutine s2 use ml end subroutine test3 90 subroutine s3 use ml end subroutine The makefile to compile the above code looks like this ml mod testl o testl o testl f9
325. tial access READ or WRITE statement will read or write the first record in the file e A point beyond the last record in the file POSITION APPEND just before the end of file record if one exists For a new file this is the initial position before the first record same as REWIND You might specify APPEND before you write records to an existing sequential file using sequential access e The current position POSITION ASIS This is usually used only to maintain the current record position when reconnecting a file The second OPEN specifies the same unit number and specifies the same file name or omits it which leaves the file open retaining the current record position However if the second OPEN specifies a different file name for the same unit number the current file will be closed and the different file will be opened The following VO statements allow you to change the current record position 177 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e REWIND sets the record position to the initial position before the first record A sequential access READ or WRITE statement would read or write the first record in the file e BACKSPACE sets the record position to the previous record in a file Using sequential access if you wrote record 5 issued a BACKSPACE to that unit and then read from that unit you would read record 5 e ENDFILE writes an end of file marker This is typically done after writing reco
326. to big endian conversion is accomplished by the following operations e The WRITE operation converts little endian format to big endian format e The READ operation converts big endian format to little endian format Little to Big Endian Conversion Environment Variable In order to use the little endian to big endian conversion feature specify the numbers of the units to be used for conversion purposes by setting the F_UFMTENDIAN environment variable Then the READ WRITE statements that use these unit numbers will perform relevant conversions Other READ WRITE statements will work in the usual way In the general case the variable consists of two parts divided by a semicolon No spaces are allowed inside the F_UFMTENDIAN value The variable has the following syntax F_UFMTENDIAN MODE MODE EXCEPTION where MODE big little EXCEPTION big ULIST little ULIST ULIST ULIST U ULIST U U decimal decimal decimal e MODE defines current format of data represented in the files it can be omitted The keyword little means that the data has little endian format and will not be converted This is the default The keyword big means that the data has big endian format and will be converted 149 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e EXCEPTION is intended to define the list of exclusions for MODE EXCEPTION keyword little or big
327. to know how to interpret the descriptor Part of the descriptor is a pointer to address space as a C pointer and part of it is a description of the pointer or array properties such as its rank stride and bounds For information about the Intel Fortran array descriptor format see Handling Arrays and Fortran Array Descriptors Fortran 95 90 pointers that point to scalar data contain the address of the data and are not passed by descriptor 217 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Handling Integer Pointers Integer pointers also known as Cray style pointers are not the same as Fortran 90 pointers but are instead like C pointers Integer pointers are 4 byte INTEGER quantities on IA 32 systems and 8 byte INTEGER quantities on ltanium based systems Passing Integer Pointers When passing an integer pointer to a routine written in another language e The argument should be declared in the non Fortran routine as a pointer of the appropriate data type e The argument passed from the Fortran routine should be the integer pointer name not the pointee name For example Fortran main program INTERFACE SUBROUTINE Ptr_Sub p IDECS ATTRIBUTES C ALIAS Ptr Sub Ptr Sub INTEGER p END SUBROUTINE Ptr_Sub END INTERFACE REAL A 10 VAR 10 POINTER p VAR VAR is the pointee p is the integer pointer p LOC A CALL Ptr_Sub p WRITE
328. to open logical unit 5 6 or 0 and do not set the appropriate environment variable FORT n Intel Fortran at run time implicitly opens preconnected units 5 6 and 0 and associates them with the following operating system standard VO files Unit Environment Variable Equivalent Linux Standard VO File 5 FORT5 Standard input stdin 6 FORT6 Standard output stdout 0 FORTO Standard error stderr You can change these preconnected files by doing one of the following e Using an OPEN statement to open unit 5 6 or 0 When you explicitly OPEN a file for unit 5 6 or 0 the OPEN statement keywords specify the file related information to be used instead of the preconnected standard VO file e Setting the appropriate environment variable FORTn to redirect VO to an external file 168 Data and VO To redirect input or output from the standard preconnected files at run time you can set the appropriate environment variable or use the appropriate shell redirection character in a pipe such as gt or lt Opening Files OPEN Statement To open a file you should use a preconnected file such as for terminal output or explicitly open files with an OPEN statement Although you can also implicitly open a file this prevents you from using the OPEN statement to specify the file connection characteristics and other information OPEN Statement Specifiers The OPEN statement connects a unit number with a
329. to strict IEEE precision this option 73 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I slightly reduces the accuracy of floating point calculations performed by these functions usually limited to the least significant digit IPF fp speculationmode ltanium based systems only Default IPF fp speculationfast Enables floating point operations in one of the following modes fast Speculate on floating point operations safe Speculate on floating point operations only when it is safe strict Disables speculation on floating point operations off Same as strict See also Floating Point Arithmetic Options for Itanium Based Systems in Volume II Optimizing Applications mp1 Default Off Restricts floating point precision to be closer to declared precision This option has some impact on speed but less than the impact of mp pc 32 64 80 IA 32 and Intel EM64T systems only Default pc64 Enables floating point significand precision control Possible values are e pc32 Sets internal FPU precision to 24 bit significand e pc64 Sets internal FPU precision to 53 bit significand e pc80 Sets internal FPU precision to 64 bit significand Language Options The language options let you specify semantics syntax and source file format See Also Compatibility Options Data Options Descriptions of Language Options 74 Compiler Options noJaltparam Default altparam alternate syntax is
330. tput file oo AE Ee ke ei ve ek EE 25 output files Options iese 99 output item list inquiry Bye SE AR oh EE 171 output record transfer 179 overriding default run time library exception handler iese eke eke ee ee 239 overriding ODIONS ees ees ee 49 overview building applications 27 compiler options rrrrennnnnn 49 converting unformatted data 141 298 data representation 129 dEDIGANG rene 107 error handling sonnnnnnnnnnnr 231 files and file characteristics 159 Fortran VO ee ee ee 154 getting started ees ee 19 handling data types in mixed language programming 214 integer data representations 131 methods of specifying the data omahuasseafrifesdendse 145 mixed language programming adjusting calling conventions 198 adjusting naming conventions EE EE ER evi 202 mixed language programming 195 native IEEE floating point representation see 134 of Fortran C mixed language 101909 gt 114 gt eit stadia Ee teed cs 227 portability library onnnn 243 record operations 0 006 174 using libraries rnnnnnnnnnnnr 241 P P compiler option 008 101 p optimization compiler option 86 p32 assembler option 22 PACK compiler directive 51 pad compiler option 0 79 pad source compiler o
331. tran Compiler for Linux Systems User s Guide Vol I data types ogie ds vesen ieee debugger equivalents Fortran and CO sesse handling in mixed language programming OVEIVICW ee ees eek eke INSIG SEER ER data DES EE sauen date and time routines DD compiler OPDHON ee debug compiler option debugger See debugging esse debugging commands summary OF ER comnandsa aaret displaying variables OXPICSSIONS aa getting started with x locating unaligned data mixed language programs ODUORS vers tins Cote a ER GE GE Ge Ge 282 OVErVI W Lee ee ee ee ee ee 107 preparing program for 108 program that generates a signal EE RE 125 SQUARES example program 113 decfort dump flag environment VAIAD Ge avansere amet 249 decimal conversions 0 254 DECLARE compiler directive 51 DECORATE property 199 default file names neee 167 pathnames sesse ees sesse 167 default behavior of compiler 23 DEFAULTFILE specifier in OPEN statement 164 167 DEFINE compiler directive 51 DEFINE FILE statement 156 DELETE statement 156 174 denormalized numbers 138 derived type variable 117 differences between versions 255 direct access for records ee 175 directives 1
332. tted file unit numbers using the compiler option convert method unless you also use one or more of the previous methods You specify the numeric format at compile time and must compile all routines under the same convert keyword compiler option You could use the same source program and compile it using different ifort commands to create multiple executable programs that each read a certain format If you specify other methods they take precedence over this method For instance you might use the environment variable or OPEN statement CONVERT keyword method to specify each unit number that will use a format different than that specified using the convert keyword compiler option method for all other unit numbers For example the following command compiles program file for to use VAX D_floating and F_floating floating point data for all unit numbers unless superseded by one of the other methods Data is converted between the file format and the little endian memory format little endian integers S_float and T float little endian IEEE floating point format The created file vconvert exe can then be run 153 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I ifort file for o vconvert exe convert vaxd Because this method affects all unformatted file unit numbers you cannot read data in one format and write it in another file format using the convert keyword compiler option method alone You can if you use it
333. ue requests that specified value be returned to the operating system The default value is 0 which causes the application to abort execution 240 Creating and Using Libraries Creating and Using Libraries Overview See these topics Creating Libraries Libraries Provided by Intel Fortran Portability Library Overview Math Libraries Overview Creating Libraries Libraries are simply an indexed collection of object files that are included as needed in a linked program Combining object files into a library makes it easy to distribute your code without disclosing the source It also reduces the number of command line entries needed to compile your project Static Libraries Executables generated using static libraries are no different than executables generated from individual source or object files Static libraries are not required at runtime so you do not need to include them when you distribute your executable At compile time linking to a static library is generally faster than linking to individual source files To build a static library 1 Use the c option to generate object files from the source files ifort c my sourcel f90 my source2 f90 my source3 f90 2 Use the GNU ar tool to create the library file from the object files ar rc my lib a my sourcel o my source2 0 my source3 o 3 Compile and link your project with your new library ifort main f90 my lib a If your library file and source files are in different directori
334. uide Vol I preprocessor symbol 38 preventing linking onrnnnnnnnnnnr 30 PRINT statement 156 157 164 174 procedure prototyping esse ee 206 procedure names in mixed language programming BO EE TE 204 procedures user supplied OPEN 180 process control routines 244 processor dispatch 008 19 prof_dir compiler option 86 prof file compiler option 86 prof format 32 compiler option 52 prof gen compiler option 86 prof use compiler option 86 profdcg file EE nenene 252 profile guided optimization 19 profmerge file sesse see 252 proforder file ee ee ee 252 program creating running and debugging ERE SED 41 300 prototyping a procedure 206 Q Qinstall compiler option 99 Qlocation compiler option 37 99 Qoption compiler option 37 99 R r compiler option xnnnnnnnnnn 62 RANDOM_NUMBER intrinsic Subroutine rrrrrrrnvnrnrvnnnnnnnn 244 RANDOM SEED intrinsic subroutine ERE 244 rcd compiler option oxernrrnnn 79 READ statement ADVANCE specifier 178 READ statement 156 157 164 174 READONLY specifier in OPEN statement 177 REAL compiler directive 51 REAL data representation 135 REAL KIND 16 data representation EE N 136 REAL KIND 4
335. ut includes up to twenty stack frames reported one line per stack frame For each frame the image name followed by the PC routine name line number and source file are given The verbose output if selected will provide in addition to the information in brief output the exception context record if the error was a machine exception machine register dump and for each frame the return address frame pointer and stack pointer and possible parameters to the routine This output can be quite long but limited to 16K bytes and use of the environment variable FOR DIAGNOSTIC LOG FILE is recommended if you want to capture the output accurately Most situations should not require the use of verbose output The variable FOR ENABLE VERBOSE STACK TRACE is also recognized for compatibility with Compaq Fortran TBK FULL SRC FILE SPEC This variable displays complete file name information for traceback output including the path By default the traceback output displays only the file name and extension in the source file field You must set this variable to display more The variable FOR FULL SRC FILE SPEC Is also recognized for compatibility with Compaq Fortran 251 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I e TMP TMPDIR and TEMP Specifies an alternate working directory where temporary files are created See Temporary Files Created by the Compiler or Linker Key
336. ut loss of significant digits no traceback Default notraceback 104 Compiler Options Requests that the compiler generate extra information in the object file that allows the display of source file traceback information at run time when a severe error occurs Specifying traceback provides source file routine name and line number correlation information in the displayed call stack hexadecimal addresses program counter trace that is displayed when a severe error occurs If traceback is not specified this information is not displayed However advanced users can locate the cause of the error using a map file and the hexadecimal addresses of the stack displayed when a severe error occurs Specifying traceback will increase the size of the executable program but has no impact on run time execution speeds The traceback option functions independently of the debug option 105 Debugging Using idb Debugging Using idb Overview See these topics Getting Started with Debugging Preparing Your Program for Debugging Using Debugger Commands and Setting Breakpoints Summary of Debugger Commands Debugging the SQUARES Example Program Displaying Variables in the Debugger Expressions in Debugger Commands Debugging Mixed Language Programs Debugging a Program that Generates a Signal Locating Unaligned Data Getting Started with Debugging The Intel Debugger idb is a source level symbolic debugger that lets you e
337. wing ifort command compiles multiple source files ifort o circle out circle calc f90 sub f90 Because the c option was omitted an executable program named circle out is created Specifying an Additional Linker Library The following ifort command compiles a free format source file myprog 90 using default optimization and passes an additional library for the linker to search ifort myprog f90 typedefs 1 0 lmylib The file is processed at optimization level 02 and then linked with the object file typedefs 1 0 The 1mylib option instructs the linker to search in the libmylib library for unresolved references in addition to the standard list of libraries the ifort command passes to the linker Using Module mod Files A module mod file is a type of program unit that contains specifications of such entities as data objects parameters structures procedures and operators These precompiled specifications and definitions can be used by one or more program units Partial or complete access to the module entities is provided by the USE statement Typical applications of modules are the specification of global data or the specification of a derived type and its associated operations Some programs require modules located in multiple directories You can use the Idir option when you compile the program to locate the mod files that should be included in the program 31 Intel amp Fortran Compiler for Linux Systems User
338. xample the ifort command e Compiles and links the program squares 90 e Requests symbol table information needed for symbolic debugging and no optimization g e Names the executable file squares instead of a out o squares The idb shell command runs the debugger specifying the executable program squares At the debugger prompt idb you can enter a debugger command See also the online Intel amp Debugger IDB Manual See the debug keyword option to learn more about settings that enhance debugging Using Debugger Commands and Setting Breakpoints To find out what happens at critical points in your program you need to stop execution at these points and look at the contents of program variables to see if they contain the correct values Points at which the debugger stops program execution are called breakpoints To set a breakpoint use one of the forms of the stop or stopi commands Using a sample program the following debugger commands set a breakpoint at line 4 run the program continue the program delete the breakpoint rerun the program and return to the shell 109 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I idb stop at 4 1 stop at squares f90 4 idb run 1 stopped at squares 4 0x120001880 gt 4 OPEN UNIT 8 FILE datafile dat STATUS 0LD idb cont Process has exited with status 0 idb delete 1 idb rerun Process has exit
339. y and syntax Requests that only the syntax of the source file be checked Code generation is suppressed T file Default Off Instructs the linker to read link commands from file 84 Compiler Options Tf file Default Off Specifies that Filename should be compiled as a Fortran source file This option is used when you have a Fortran file with a nonstandard file extension that is not one of F FOR or F90 tcheck Default Off Enables analysis of threaded applications To use this option you must have previously installed Intel Thread Checker one of the Intel Threading Tools If this threading tool is not installed this option has no effect For more information about Intel Thread Checker including how to obtain an evaluation copy open the page associated with threading tools at www intel com software products u Default Off Alternate syntax implicitnone Specifies that the IMPLICIT NONE should be set by default See also warn no declarations V Default Off Specifies that driver tool commands should be shown and executed See also dryrun V Default None Displays the compiler version information what Default Off Prints the version strings of the Fortran command and the compiler 85 Intel amp Fortran Compiler for Linux Systems User s Guide Vol I Wl option1 option2 Default Off Passes options specified by option1 opt ion2 and so forth to the linker f
340. ype e When a C program calls a Fortran subprogram each actual argument must be specified explicitly as a pointer 230 Error Handling Error Handling Overview See these topics Run Time Library Default Error Processing Handling Run Time Errors Signal Handling Overriding the Default Run Time Library Exception Handler Obtaining Traceback Information with TRACEBACKQQ Run Time Library Default Error Processing During execution your program may encounter errors or exception conditions These conditions can result from any of the following Errors that occur during VO operations Invalid input data Argument errors in calls to the mathematical library Arithmetic errors Other system detected errors The Intel Fortran Run Time Library RTL generates appropriate messages and takes action to recover from errors whenever possible A default action is defined for each error recognized by the Fortran RTL The default actions described throughout this chapter occur unless overridden by explicit error processing methods The way in which the Fortran RTL actually processes errors depends upon the following factors e The severity of the error For instance the program usually continues executing when an error message with a severity level of warning or info informational is detected e For certain errors associated with VO statements whether or not an VO error handling specifier was specified e For certain errors whether
341. ystems User s Guide Vol I Implied OPEN Performing an implied OPEN means that the FILE and DEFAULTFILE specifier values are not specified and an environment variable is used if present Thus if you used an implied OPEN or if the FILE specifier in an OPEN statement did not specify a file name you can use an environment variable to specify a file name or a pathname that contains both a directory and file name Using Environment Variables You can use shell commands to set the appropriate environment variable to a value that indicates a directory if needed and a file name to associate a unit with an external file Intel Fortran recognizes environment variables for each logical VO unit number in the form of FORTn where n is the logical I O unit number If a file name is not specified in the OPEN statement and the corresponding FORTn environment variable is not set for that unit number Intel Fortran generates a file name in the form fort n where n is the logical unit number Implied Intel Fortran Logical Unit Numbers The ACCEPT PRINT and TYPE statements and the use of an asterisk in place of a unit number in READ and WRITE statements do not include an explicit logical unit number Each of these Fortran statements uses an implicit internal logical unit number and environment variable Each environment variable is in turn associated by default with one of the Fortran file names that are associated with standard VO files The tab

Download Pdf Manuals

image

Related Search

Related Contents

Whirlpool MW8570XR User's Manual  Télécharger (306 Ko)  V1.02 - Milesight  アップデータ 取扱説明書 - KAWAI コンピュータミュージック  Pioneer HTZ-BD30 User's Manual  平成23年事業年度に係る業務実績報告書  

Copyright © All rights reserved.
Failed to retrieve file