Compile and run your OpenMP program
The command to compile OpenMP C programs is omcc.
The command to compile OpenMP Fortran77 programs is
omf77 .
To run the OpenMP program, just execute the compiled executable on
your SMP platform. The number of processor (or operating system
threads) used is controlled as follows:
- The environment variable OMPC_NUM_PROCS specifies the number of
threads to execute the program. For example, you want to use 4
threads,
setenv OMPC_NUM_PROCS 4
- If the environment variable OMPC_NUM_PROCS is not set, check the
number of physical processors in your platform. The same number of
threads are created as the number of physical processors.
In Linux and Solaris platforms, the number of physical processors is
automatically obtained at run time using system calls.
Otherwise, the current version uses a compile-time constant
N_PROC_DEFALUT (currently 4) in "lib/libompc/ompclib.h"
as the number of threads.
- If the environment variable OMP_NUM_THREADS is set and its value
is greater than the number of threads described above, the value of
OMP_NUM_THREADS is used as the max number of threads.
- If the environment variable OMPC_BIND_PROCS and the max number of
threads is less than or equal to the max number of threads, the
threads are bind to the processor under solaris platforms.
Test programs
Several OpenMP test programs are included in "tests" directory.
You should make sure that the Omni Compiler is installed correctly
by compiling and running these test programs.
You can monitor the parallel execution the following command:
- mpstat in Solaris
(also jmpstat, Java version of "mpstat" in "tools" directory
for Solaris platforms)
- xcpustate command or xosview command in Linux