get_started

View page source

Get Started Using cmpad

The instructions below are for execution a bash shell.

  • Items in italic font get replaced by the value you choose; e.g., program .

  • Items in code font get entered as is; e.g., --time_setup .

System Requirements

The following packages should be installed using your system package manager: autoconf , automake , bash , c++ , cmake , fortran . git , libtool , python3 , swig , wget ,

sed and grep

You will need a gnu version of sed and grep. These are named sed and grep on most unix systems, but on Darwin (MacOS) they may be named gsed and ggrep .

Clone Repository

Clone the cmpad git repository and change into its top source directory with the commands:

git clone https://github.com/bradbell/cmpad.git cmpad.git
cd cmpad.git

Pick An AD Package

Pick one AD package that has been implemented from the AD Package List ; e.g. adolc . We use package to denote this AD package below. If package is none, you will be timing the algorithm instead of its derivative.

Install Package

Create a local install of package in the build/release subdirectory with the following commands:

      bin/get_package.sh release package

Build C++ Executable

This step is only necessary if package is a C++ package:

cpp/bin/run_cmake.sh

You should see the following in the cmake output:

      cmpad_has_package = 1

The value will be zero for the other C++ packages, unless you installed some of them. Now execute the following commands:

cd cpp/build
make
cd ../..

Setup Python Environment

This step is only necessary if package is a Python package ( see environment ):

bash
build_type=release
source bin/environment.sh

This sets up a Python virtual environment that can be deactivated using the exit command (which exits the shell started with the bash command above).

Choose Test Parameters

Each of the parameters below, except for program, has a default value that is used when the parameter is not specified. Note that --time_setup is just a flag and has no corresponding value. See run_cmpad for more discussion of these parameters and flags.

program

If this is a C++ package, program is cpp/build/src/run_cmpad . If it is a Python package, program is python/bin/run_cmpad.py . There is no default value for this parameter.

file_name

Choose a file_name where the output of the speed tests will be written (default is cmpad.csv ).

algorithm

Choose and algorithm (default is det_by_minor ).

min_time

Choose a minimum time, in seconds, over which to average the computation rate (default is 0.5 ).

n_arg

Size of the domain space for this use of the algorithm. Note that for det_by_minor n_arg must be a square and is the number of elements in the matrix (default is 9 ).

n_other

This argument is algorithm specific; see the heading n_other for det_by_minor , an_ode , llsq_obj (default is 0 ).

–time_setup

If this flag is present on the command line, the setup time is included. This is used to test what the speed comparisons would be for algorithms where it is not possible to tape the floating point operations and use that tape for different argument values. For example, one can tape the det_by_minor operations for one size of matrix and use that for different values of the matrix elements.

Run Seed Test

Execute the following command.

      program \
            -p package \
            -f file_name \
            -a algorithm \
            -m min_time \
            -n n_arg \
            -o n_other \
            --time_setup

All of the lines above, except for program , are optional. If a line is not present, the corresponding default value is used. Running this program will add one line to file_name with the test parameters and results.