• No results found

Check whether the compiler option convert keyword (Linux OS and Mac OS X) or /con vert:keyword (Windows OS) was present when the program was compiled.

In document Intel Fortran Compiler User Guide (Page 189-193)

Using Traceback Information

6. Check whether the compiler option convert keyword (Linux OS and Mac OS X) or /con vert:keyword (Windows OS) was present when the program was compiled.

Environment Variable FORT_CONVERT.ext or FORT_CONVERT_ext Method

You can use this 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 explicitOPENto 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 I/O statements. You want the program to read nonnative big endian (IEEE floating-point) format from a file with a .dat file 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 a program, the following command sets the appropriate environment variables before running the program:

Linux:

setenv FORT_CONVERT.DAT BIG_ENDIAN

Windows:

set FORT_CONVERT.DAT=BIG_ENDIAN

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_CONVERTn 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. If you also use Intel Fortran on Linux* systems, 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 FORT_CONVERT.ext and

FORT_CONVERT_ext for the same extension (ext), the file defined by FORT_CONVERT.ext is used.

On Windows systems, the file name extension (suffix) is not case-sensitive. The extension must be part of the file name (not the directory path).

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 explicitOPENto 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 28 and writes it to unit 29 using unformatted I/O 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 a program. Linux:

setenv FORT_CONVERT28 BIG_ENDIAN setenv FORT_CONVERT29 NATIVE

Windows:

set FORT_CONVERT28=BIG_ENDIAN set FORT_CONVERT29=NATIVE

The following figure shows the data formats used on disk and in memory when the program is run after the environment variables are set.

Figure 11: Sample Unformatted File Conversion

Environment Variable F_UFMTENDIAN Method

This little-endian-big-endian conversion feature is intended for Fortran unformatted input/output operations. It enables the development and processing of files with little-endian and big-endian data organization.

The F_UFMTENDIAN environment variable is processed once at the beginning of program execution. Whatever it specifies for specific units or for all units continues for the rest of the execution.

Specify the numbers of the units to be used for conversion purposes by settingF_UFMTENDIAN. Then, theREAD/WRITEstatements that use these unit numbers will perform relevant conversions. OtherREAD/WRITEstatements will work in the usual way.

General Syntax for F_UFMTENDIAN

In the general case, the variable consists of two parts divided by a semicolon. No spaces are allowed inside theF_UFMTENDIANvalue:

F_UFMTENDIAN=MODE | [MODE;] EXCEPTION

where:

MODE = big | little

EXCEPTION = big:ULIST | little:ULIST | ULIST ULIST = U | ULIST,U

U = decimal | decimal -decimal

• MODEdefines current format of data, represented in the files; it can be omitted. The keywordlittlemeans that the data has little endian format and will not be converted.This is the default.

The keywordbigmeans that the data has big endian format and will be converted.

• EXCEPTIONis intended to define the list of exclusions forMODE.EXCEPTIONkeyword (little

orbig) defines data format in the files that are connected to the units from theEXCEPTION

list. This value overridesMODEvalue for the units listed.

TheEXCEPTIONkeyword and the colon can be omitted. The default when the keyword is omitted isbig.

• Each list memberUis a simple unit number or a number of units. The number of list members is limited to 64.

• decimalis a non-negative decimal number less than 232.

Converted data should have basic data types, or arrays of basic data types. Derived data types are disabled.

Error messages may be issued during the little-endian-to-big-endian conversion. They are all fatal.

On Linux* systems, the command line for the variable setting in the shell is:

Sh: export F_UFMTENDIAN=MODE;EXCEPTION

NOTE. The environment variable value should be enclosed in quotes if the semicolon is

present.

The environment variable can also have the following syntax:

F_UFMTENDIAN=u[,u] . . .

Examples

In document Intel Fortran Compiler User Guide (Page 189-193)