@(@\newcommand{\W}[1]{ \; #1 \; }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }
\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }
\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }
\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
This is cppad-20221105 documentation. Here is a link to its
current documentation
.
Run Multi-Threading Examples and Speed Tests
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 atomic_two test_timemax_threadsnum_solve
./program atomic_three test_timemax_threadsnum_solve
./program chkpoint_one test_timemax_threadsnum_solve
./program chkpoint_two test_timemax_threadsnum_solve
./program multi_newton test_timemax_threads \ num_zeronum_subnum_sumuse_ad
We refer to the values a11c, ... , multi_newton
as the
test_case
below.
a11c
The
test_casea11c runs the examples
a11c_openmp.cpp
,
a11c_bthread.cpp
, and
a11c_pthread.cpp
.
These cases demonstrate simple multi-threading,
without algorithmic differentiation, using
OpenMP, boost threads and pthreads respectively.
team_example
The
test_caseteam_example runs the
team_example.cpp
example.
This case demonstrates simple multi-threading with algorithmic differentiation
and using a team of threads
.
test_time
All of the other cases include the
test_time
argument.
This 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
All of the other cases include the
max_threads
argument.
This 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.
harmonic
The
test_caseharmonic runs the
harmonic_time
example.
This is a timing test for a multi-threading
example without algorithmic differentiation using a team of threads.
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
.
Atomic and Checkpoint
The
test_case
values
atomic_two,
atomic_three,
chkpoint_one,
chkpoint_two,
all run the same problem.
These cases preforms a timing test for a multi-threading
example without algorithmic differentiation using a team of threads.
num_solve
The command line argument
num_solve
is an integer specifying the number of solves; see
num_solve
in multi_atomic_two_time.
multi_newton
The
test_casemulti_newton runs the
multi_newton.cpp
example.
This preforms a timing test for a multi-threading
example with algorithmic differentiation using a team of threads.
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
: