Parallel Programming in Fortran 95 using OpenMP - People
Parallel Programming in Fortran 95 using OpenMP - People
Parallel Programming in Fortran 95 using OpenMP - People
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 5<br />
The environment variables<br />
The parallel environment, under which an <strong>OpenMP</strong>-parallel application runs, is controlled<br />
by environment variables or equivalent platform-specific mechanisms. These variables<br />
can be set from the command-l<strong>in</strong>e of the operat<strong>in</strong>g system or by calls to specific subrout<strong>in</strong>es<br />
from the <strong>OpenMP</strong> <strong>Fortran</strong> API run-time library.<br />
The way <strong>in</strong> which these environment variables are set from with<strong>in</strong> the commandl<strong>in</strong>e<br />
of the operat<strong>in</strong>g system depends on the operat<strong>in</strong>g system itself. For example, on a<br />
L<strong>in</strong>ux/Unix mach<strong>in</strong>e us<strong>in</strong>g csh as shell, the setenv command does the job:<br />
> setenv OMP_NUM_THREADS 4<br />
If the sh, ksh or bash shells are used, then the previous example looks as follows:<br />
> OMP_NUM_THREADS=4<br />
> export OMP_NUM_THREADS<br />
In both cases it is possible to see the value of a given environment variable with the<br />
command echo:<br />
> echo $OMP_NUM_THREADS<br />
4<br />
><br />
From with<strong>in</strong> Microsoft W<strong>in</strong>dows NT/2000/XP, the environment variables can be specified<br />
through the Control Panel (User Environment Variables) or by add<strong>in</strong>g the correspond<strong>in</strong>g<br />
l<strong>in</strong>es <strong>in</strong> the AUTOEXEC.BAT file (AUTOEXEC.BAT Environment variables). In<br />
both cases the syntax is very simple:<br />
OMP_NUM_THREADS = 4<br />
The names of the environment variables must always be written <strong>in</strong> uppercase, while<br />
the characters assigned to them are case <strong>in</strong>sensitive and may have lead<strong>in</strong>g or trail<strong>in</strong>g white<br />
spaces.<br />
In the rest of the present chapter the different environment variables are described,<br />
giv<strong>in</strong>g their possible values and effects on the behavior of an <strong>OpenMP</strong>-parallel program:<br />
69