Prev Next

Compile and Run the OpenMP Test

Syntax
openmp/run.sh


Purpose
This script file, openmp/run.sh, compiles and runs the speed and correctness tests for using OpenMP. The following are a list of parameters in this file that can be changed by directly editing the file (there are no command line parameters to the script):

Compiler Command
The following sets the name of the C++ compiler command:
compiler="g++"

Version Flag
The following compiler flag requests its version information:
version_flag="--version"

OpenMP Flag
The following compiler flag requests openmp support You can run these tests with a compiler that does not support OpenMP by setting this flag to "".
openmp_flag=""
For g++ version 4.1 and higher, you can use "-fopenmp" for this flag.

Other Flag
The following other flags will be used during compilation:
other_flags="-DNDEBUG -O2 -Wall"

Boost Directory
If the BoostDir is specified on the configure command line, you must add the corresponding include directory; e.g.,
if [ -d /usr/include/boost-1_33_1 ]
then
     other_flags="-DNDEBUG -O2 -Wall -I/usr/include/boost-1_33_1"
fi

Number of Repeats
The following specifies the number of times to repeat the calculation corresponding to one timing test. If this is equal to "automatic", the number of repeats is determined automatically. If it is not equal to "automatic", it must be a positive integer.
n_repeat="automatic"

Number of Threads
The following determines a set of number of threads to test. Each value in the set must be a positive integer or zero (the value zero is used for dynamic thread adjustment). If the openmp_flag is equal to "", this setting is not used.
n_thread_set="0 1 2 3 4"

example_a11c
The following setting determine the corresponding command line arguments for the example_a11c.cpp program:
example_a11c_size="10000"

multi_newton
The following settings determine the corresponding command line arguments for the multi_newton program:
multi_newton_n_zero="10"
multi_newton_n_grid="40"
multi_newton_n_sum="10"

sum_i_inv
The following setting determine the corresponding command line arguments for the sum_i_inv.cpp program:
sum_i_inv_mega_sum="1"

Restrictions
Current this script only runs under the bash shell; e.g., it will not run in an MSDOS box.

Contents
example_a11c.cppA Simple Parallel Loop
multi_newton.cppMulti-Threaded Newton's Method Main Program
sum_i_inv.cppSum of 1/i Main Program

Input File: openmp/run.sh