Prev Next

@(@\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 One Speed Test and Return Results

Syntax
# include <cppad/utility/speed_test.hpp>
rate_vec = speed_test(testsize_vectime_min)

See Also
time_test

Purpose
The speed_test function executes a speed test for various sized problems and reports the rate of execution.

Motivation
It is important to separate small calculation units and test them individually. This way individual changes can be tested in the context of the routine that they are in. On many machines, accurate timing of a very short execution sequences is not possible. In addition, there may be set up and tear down time for a test that we do not really want included in the timing. For this reason speed_test automatically determines how many times to repeat the section of the test that we wish to time.

Include
The file cppad/utility/speed_test.hpp defines the speed_test function. This file is included by cppad/cppad.hpp and it can also be included separately with out the rest of the CppAD routines.

Vector
We use Vector to denote a simple vector class with elements of type size_t.

test
The speed_test argument test is a function with the syntax
    
test(sizerepeat)
and its return value is void.

size
The test argument size has prototype
    size_t 
size
It specifies the size for this test.

repeat
The test argument repeat has prototype
    size_t 
repeat
It specifies the number of times to repeat the test.

size_vec
The speed_test argument size_vec has prototype
    const 
Vectorsize_vec
This vector determines the size for each of the tests problems.

time_min
The argument time_min has prototype
    double 
time_min
It specifies the minimum amount of time in seconds that the test routine should take. The repeat argument to test is increased until this amount of execution time is reached.

rate_vec
The return value rate_vec has prototype
    
Vectorrate_vec
We use @(@ n @)@ to denote its size which is the same as the vector size_vec . For @(@ i = 0 , \ldots , n-1 @)@,
    
rate_vec[i]
is the ratio of repeat divided by time in seconds for the problem with size size_vec[i] .

Timing
If your system supports the unix gettimeofday function, it will be used to measure time. Otherwise, time is measured by the difference in
 
    (double) clock() / (double) CLOCKS_PER_SEC
in the context of the standard <ctime> definitions.

Example
The routine speed_test.cpp is an example and test of speed_test.
Input File: include/cppad/utility/speed_test.hpp