Environment variables are variables that are defined in the
operating environment of the system and are available to various
system components. For example, when you run a program, the shell
looks at the PATH variable to determine
where the program is located. Table 2-14 “HP
Fortran 90 environment variables”
lists and briefly describes the environment variables that control
the way HP Fortran 90 programs are compiled, linked,
and run.
Table 2-14 HP
Fortran 90 environment variables
| Environment variable | Description |
|---|
| FTN_IO_BUFSIZ | Sets the default size in bytes of the
I/O library streams file buffer; equivalent to calling
setvbuf for each logical unit that
is opened; see the setbuf(3S) man page. |
| HP_F90OPTS | Specifies a list of compile-line options
that f90 inserts in the command
line that invokes the HP Fortran 90 compiler. |
| LPATH | Specifies a list of directories that
the linker is to search for libraries. |
| MP_NUMBER_OF_THREADS | Specifies the desired number of processors
to be used to run HP Fortran 90 programs that
have been compiled for parallel execution. |
| TMPDIR | Specifies a directory for temporary files;
used in place of the default directory /var/tmp. |
| TTYUNBUF | Controls tty buffering.
To enable tty buffering, set TTYUNBUF
to 0; to disable tty buffering, set it to a nonzero value. |
The following sections describe how to use the HP_F90_OPTS,
LPATH, and MP_NUMBER_OF_THREADS
environment variables. See the environ(5)
man page for information about system-level environment variables.
HP_F90OPTS environment variable |
 |
The HP_F90OPTS environment
variable is read by the f90 driver
for options to insert in the compile line. This variable is useful
when you want the same options and arguments each time you invoke
the f90 command. For example,
if HP_F90OPTS is set to the -v
option, the following command line:
is equivalent to:
The syntax of the HP_F90OPTS
variable allows the bar (|) character
to be used to specify that options appearing before |
are to be recognized before any options on the command line and
that options appearing after |
are to be recognized after any options on the command line. For
example, the commands:
$ export HP_F90OPTS="-O|-lmylib" $ f90
-v hello.f90 |
are equivalent to:
$ f90 -O -v hello.f90 -lmylib |
If you are programming in the csh,
the command line to define HP_F90OPTS
would be:
% setenv HP_F90OPTS "-O|-lmylib" |
LPATH environment variable |
 |
The LPATH environment variable
is read by the linker to determine where to look for libraries to
link with a program's object file. Depending on whether
LPATH is set or not, one of the
following actions occurs:
If LPATH
is already set, only the directories listed in LPATH
are searched. This happens, for example, when LPATH
is set in a user's .kshrc
or .cshrc file, or after LPATH
is defined from the command line.
If LPATH is not
set, the f90 command sets default
LPATH settings that are used when
linking the object files listed on the f90
command line.
Because the f90 command sets
LPATH before calling the linker,
it should not be necessary to set this variable for most compilations.
However, if you do need to set it (for example, you use the ld
command to link), the following directories should be the first
items in LPATH:
The following command lines set LPATH
to include these directories, using (respectively) the ksh
and csh syntax:
$ export LPATH:/opt/fortran90/lib:/usr/lib:/opt/langtools/lib |
% setenv LPATH "/opt/fortran90/lib:/usr/lib:/opt/langtools/lib" |
To see how f90 sets LPATH
before calling the linker, compile with the -v
option for verbose output. For an example, see “Linking with f90 vs. ld”.
MP_NUMBER_OF_THREADS
environment variable |
 |
The MP_NUMBER_OF_THREADS
environment variable sets the number of processors that are to execute
a program that has been compiled for parallel execution. If you
do not set this variable, it defaults to the number of processors
on the executing machine.
The following command lines set MP_NUMBER_OF_THREADS
to specify that programs compiled for parallel execution can execute
on two processors:
$ export
MP_NUMBER_OF_THREADS=2 # ksh syntax |
% setenv
MP_NUMBER_OF_THREADS 2 # csh syntax |
For information about parallel execution, see “Compiling for parallel execution”.