Prev Next

Speed Testing Main Program

Syntax
speed/package/package test seed option_list

Purpose
A version of this program runs the correctness tests or the speed tests for one AD package identified by package .

package

AD Package
The command line argument package specifies one of the following AD packages: adolc , cppad , fadbad , sacado .

double
The value package can be double in which case the function values (instead of derivatives) are computed using double precision operations. This enables one to compare the speed of computing function values in double to the speed of the derivative computations. (It is often useful to divide the speed of the derivative computation by the speed of the function evaluation in double.)

profile
In the special case where package is profile, the CppAD package is compiled and run with profiling to aid in determining where it is spending most of its time.

test
It the argument test specifies which test to run and has the following possible values: correct , speed , det_minor , det_lu , mat_mul , ode , poly , sparse_hessian , sparse_jacobian .

correct
If test is equal to correct, all of the correctness tests are run.

speed
If test is equal to speed, all of the speed tests are run.

seed
The command line argument seed is a positive integer. The random number simulator uniform_01 is initialized with the call
     uniform_01(
seed)
before any of the testing routines (listed above) are called.

option_list
This is a list of options that follow seed value. The order of the options does not matter and the list can be empty. Each option in the list, must be separate command line argument to the main program.

retape
If the option retape is present, the symbol
 
	extern bool global_retape
is true and otherwise it is false. If this external symbol is true, every test must retape the operation sequence for each test repetition. If it is false, the AD package is allowed to use one taping of the operation sequence for all the repetitions of that speed test.

All of the tests, except det_lu , have a fixed operations sequence. The operation sequence for det_lu may be different for each repetition of the test because it depends on the matrix for which the determinant is being calculated. For this reason, cppad_det_lu.cpp returns false (for test not implemented) when global_retape is false.

optimize
If the option optimize is present, the symbol
 
	extern bool global_optimize
is true and otherwise it is false. If this external symbol is true, and the AD package has an optional way to spend time optimizing the operation sequence, this optimization should be done before doing computations. If it is false, this optimization should not be done.

atomic
If the option atomic is present, the symbol
 
	extern bool global_atomic
is true and otherwise it is false. If this external symbol is true, and the AD package has a way to speed up the processing by adding user_atomic operations, this should be included in computations. If it is false, user defined atomic operations should not be done.

memory
If the option memory is present, the symbol
 
	extern bool global_memory
is true and otherwise it is false. If it is true, the CppAD hold_memory routine will be called by the main program before any of the tests are executed. This should make the CppAD thread_alloc allocator faster. If it is false, standard memory allocation should be done by. Otherwise the test can use special memory allocation to try and improve speed.

Correctness Results
An output line of the following form:
     
package_test_optionlist_ok = flag
is generated for each correctness test where package and test are as above, optionlist are the options (in option_list ) separated by the underbar _ character (whereas they are separated by spaces in option_list ), and flag is true or false.

Speed Results
For each speed test, corresponds to three lines of the following form are generated:
     
package_test_optionlist_ok   = flag
     
package_test_optionlist_size = [ size_1...size_n ]
     
package_test_optionlist_rate = [ rate_1...rate_n ]
The values package , test , optionlist , and flag are as in the correctness results above. The values size_1 , ..., size_n are the size arguments used for the corresponding tests. The values rate_1 , ..., rate_n are the number of times per second that the corresponding size problem executed.

Link Functions
Each speed test defines it's own version of one of the following functions that link the speed test to the main program described above:
link_det_lu Speed Testing Gradient of Determinant Using Lu Factorization
link_det_minor Speed Testing Gradient of Determinant by Minor Expansion
link_mat_mul Speed Testing Derivative of Matrix Multiply
link_ode Speed Testing the Jacobian of Ode Solution
link_poly Speed Testing Second Derivative of a Polynomial
link_sparse_hessian Speed Testing Sparse Hessian
link_sparse_jacobian Speed Testing Sparse Jacobian

Input File: speed/main.cpp