Purpose
Runs the CppAD multi-threading examples and timing tests:
build
We use
build
for the directory where you run the cmake
command.
threading
If the cmake
command output indicates that
bthread, pthread, or openmp is available,
you can run the program below with
threading
equal to
bthread, pthread, or openmp respectively.
program
We use the notation
program
for
example_multi_thread_threading
Running Tests
You can build this program and run the default version of its test
parameters by executing the following commands:
cd build
make check_program
After this operation, in the directory
build/example/multi_thread/threading
you can execute the following commands:
.
./program a11c
./program simple_ad
./program team_example
./program harmonic test_timemax_threadsmega_sum
./program multi_atomic test_timemax_threadsnum_solve
./program multi_newton test_timemax_threads \ num_zeronum_subnum_sumuse_ad
harmonic
The harmonic_time
routine
preforms a timing test for a multi-threading
example without algorithmic differentiation using a team of threads.
test_time
Is the minimum amount of wall clock time that the test should take.
The number of repeats for the test will be increased until this time
is reached.
The reported time is the total wall clock time divided by the
number of repeats.
max_threads
If the argument
max_threads
is a non-negative integer specifying
the maximum number of threads to use for the test.
The specified test is run with the following number of threads:
num_threads = 0 , ... , max_threads
The value of zero corresponds to not using the multi-threading system.
mega_sum
The command line argument
mega_sum
is an integer greater than or equal one and has the same meaning as in
harmonic_time
.
multi_atomic
The multi_atomic_time
routine
preforms a timing test for a multi-threading
example without algorithmic differentiation using a team of threads.
test_time
Is the minimum amount of wall clock time that the test should take.
The number of repeats for the test will be increased until this time
is reached.
The reported time is the total wall clock time divided by the
number of repeats.
max_threads
If the argument
max_threads
is a non-negative integer specifying
the maximum number of threads to use for the test.
The specified test is run with the following number of threads:
num_threads = 0 , ... , max_threads
The value of zero corresponds to not using the multi-threading system.
num_solve
The command line argument
num_solve
is an integer specifying the number of solves; see
num_solve
in multi_atomic_time.
multi_newton
The multi_newton_time
routine
preforms a timing test for a multi-threading
example with algorithmic differentiation using a team of threads.
test_time
Is the minimum amount of wall clock time that the test should take.
The number of repeats for the test will be increased until this time
is reached.
The reported time is the total wall clock time divided by the
number of repeats.
max_threads
If the argument
max_threads
is a non-negative integer specifying
the maximum number of threads to use for the test.
The specified test is run with the following number of threads:
num_threads = 0 , ... , max_threads
The value of zero corresponds to not using the multi-threading system.
num_zero
The command line argument
num_zero
is an integer greater than or equal two and has the same meaning as in
multi_newton_time
.
num_sub
The command line argument
num_sub
is an integer greater than or equal one and has the same meaning as in
multi_newton_time
.
num_sum
The command line argument
num_sum
is an integer greater than or equal one and has the same meaning as in
multi_newton_time
.
use_ad
The command line argument
use_ad
is either
true or false and has the same meaning as in
multi_newton_time
.
Team Implementations
The following routines are used to implement the specific threading
systems through the common interface team_thread.hpp
: