configure

View page source

Configure Test and Installation Script

Deprecated 2012-12-26

This install procedure is deprecated. You should use the cmake instructions to configure and install CppAD.

Distribution Directory

You must first obtain a copy of the CppAD distribution directory using the download instructions. We refer to the corresponding Distribution Directory as dist_dir .

Build Directory

Create the directory dist_dir / build , which will be referred to as the build directory below. (The build directory can be in any location so long as it is not the dist_dir .)

Configure

Execute the following command in the build directory:

../ configure \
      --help \
      --prefix = prefix_dir \
      --with- test vector \
      --enable-msvc \
      --with-clang \
      MAX_NUM_THREADS = max_num_threads \
      CXX_FLAGS = cxx_flags \
      POSTFIX_DIR = postfix_dir \
      ADOLC_DIR = adolc_dir \
      BOOST_DIR = boost_dir \
      EIGEN_DIR = eigen_dir \
      FADBAD_DIR = fadbad_dir \
      SADADO_DIR = sacado_dir \
      IPOPT_DIR = ipopt_dir \
      TAPE_ADDR_TYPE = tape_addr_type \
      TAPE_ID_TYPE = tape_id_type

where only the configure line need appear; i.e., the entries in all of the other lines are optional. The text in italic above is replaced values that you choose (see discussion below).

make

The following command, in the build directory, creates the file include/cppad/configure.hpp in the source directory and then builds some object libraries that are used by the tests

make

Examples and Tests

The following command will build and run all the correctness and speed tests.

make test

prefix_dir

The default value for prefix directory is $HOME i.e., by default the CppAD include files will install below $HOME . If you want to install elsewhere, you will have to use this option. As an example of using the --prefix = prefix_dir option, if you specify

./configure --prefix=/usr/local

the CppAD include files will be installed in the directory

/ usr/local/include/cppad

–with-testvector

The CPPAD_TESTVECTOR template class is used for many of the CppAD examples and tests. The default for this template class is CppAD::vector< Scalar > . If one, and only one, of the following command line arguments is specified:

--with-stdvector
--with-boostvector
--with-eigenvector

the corresponding of the following template classes is used

      std::vector< Scalar >
      boost::numeric::ublas::vector< Scalar >
      Eigen::matrix< Scalar , Eigen::Dynamic , 1>

See also, boost_dir and eigen_dir .

–enable-msvc

If this flag is present, the Microsoft cl compiler will be placed at the front of a list of compilers to search for. In addition, nmake make files will be generated; i.e., you will use nmake instead of make to build, test, and install. The resulting C++, C, and Fortran compiler orders work Coin-OR specific; see Building with Visual Studio in MSys2 .

–with-clang

If this flag is present, clang++ ( clang ) will be used for the C++ (C) compiler. This option cannot appear when the –enable-msvc option appears.

max_num_threads

this specifies the value for the preprocessor symbol CPPAD_MAX_NUM_THREADS . It must be greater than or equal to four; i.e., max_num_threads >= 4 . The default value for this option is 64.

cxx_flags

If the command line argument cxx_flags is present, it specifies compiler flags. For example,

CXX_FLAGS = "-Wall -ansi"

would specify that warning flags -Wall and -ansi should be included in all the C++ compile commands. The error and warning flags chosen must be valid options for the C++ compiler. The default value for cxx_flags is the empty string.

postfix_dir

The default value for this directory is empty; i.e., there is no postfix directory. As an example of using the POSTFIX_DIR = postfix_dir option, if you specify

./configure --prefix=/usr/local POSTFIX_DIR=coin

the CppAD include files will be installed in the directory

/ usr/local/include/coin-or/cppad

adolc_dir

The default value for this directory is empty; i.e., there is no adolc directory. If you have ADOL-C installed on your system, you can specify a value for adolc_dir in the Configure command line. The value of adolc_dir must be such that

adolc_dir / include/adolc/adouble.h

is a valid way to reference adouble.h . In this case, you can run the Adolc speed correctness tests by executing the following commands starting in the build directory

make check_speed_adolc

Note that these speed tests assume Adolc has been configure with its sparse matrix computations enabled using

--with-colpack = colpack_dir

where colpack_dir is the same as adolc_dir .

Linux

If you are using Linux, you may have to add adolc_dir / lib to LD_LIBRARY_PATH . For example, if you use the bash shell to run your programs, you could include

      LD_LIBRARY_PATH = adolc_dir / lib:$ { LD_LIBRARY_PATH }
      export LD_LIBRARY_PATH

in your $HOME/.bash_profile file.

Cygwin

If you are using Cygwin, you will have to add to following lines to the file .bash_profile in your home directory:

      PATH = adolc_dir / bin:$ { PATH }
      export PATH

in order for Adolc to run properly. If adolc_dir begins with a disk specification, you must use the Cygwin format for the disk specification. For example, if d:/adolc_base is the proper directory, /cygdrive/d/adolc_base should be used for adolc_dir .

boost_dir

The default value for this directory is empty; i.e., there is no boost directory. If the command line argument

BOOST_DIR = boost_dir

is present, it must be such that files

      boost_dir / include/boost/numeric/ublas/vector.hpp
      boost_dir / include/boost/thread.hpp

are present. In this case, these files will be used by CppAD. See also, –with-boostvector

eigen_dir

The default value for this directory is empty; i.e., there is no eigen directory. If you have Eigen installed on your system, you can specify a value for eigen_dir . It must be such that

eigen_dir / include/Eigen/Core

is a valid include file. In this case CppAD will compile and test the Eigen examples; e.g., eigen_array.cpp . See also, –with-eigenvector

fadbad_dir

The default value for this directory is empty; i.e., there is no fadbad directory. If you have Fadbad 2.1 installed on your system, you can specify a value for fadbad_dir . It must be such that

fadbad_dir / include/FADBAD ++/ badiff.h

is a valid reference to badiff.h . In this case, you can run the Fadbad speed correctness tests by executing the following commands starting in the build directory:

make check_speed_fadbad

ipopt_dir

The default value for this directory is empty; i.e., there is no ipopt directory. If you have Ipopt installed on your system, you can specify a value for ipopt_dir . It must be such that

ipopt_dir / include/coin-or/IpIpoptApplication.hpp

is a valid reference to IpIpoptApplication.hpp . In this case, the CppAD interface to Ipopt examples can be built and tested by executing the following commands starting in the build directory:

make check_cppad_ipopt

Once this has been done, you can execute the program cppad_ipopt_speed in the build/cppad_ipopt/speed directory; see ipopt_ode_speed.cpp .

sacado_dir

The default value for this directory is empty; i.e., there is no sacado directory. If you have Sacado installed on your system, you can specify a value for sacado_dir . It must be such that

sacado_dir / include/Sacado.hpp

is a valid reference to Sacado.hpp . In this case, you can run the Sacado speed correctness tests by executing the following commands starting in the build directory:

make check_speed_sacado

tape_addr_type

The default value for this type is size_t . If the command line argument tape_addr_type is present, it specifies the type used for address in the AD recordings (tapes). The valid values for this argument are unsigned short int , unsigned int , size_t . The smaller the value of sizeof ( tape_addr_type ) , the less memory is used. On the other hand, the value

std::numeric_limits< tape_addr_type >:: max ()

must be larger than any of the following: size_op , size_op_arg , size_par , size_par , size_par .

tape_id_type

The default value for this type is size_t . If the command line argument tape_id_type is present, it specifies the type used for identifying tapes. The valid values for this argument are unsigned short int , unsigned int , size_t . The smaller the value of sizeof ( tape_id_type ) , the less memory is used. On the other hand, the value

std::numeric_limits< tape_id_type >:: max ()

must be larger than the maximum number of tapes per thread times max_num_threads .

make install

Once you are satisfied that the tests are giving correct results, you can install CppAD into easy to use directories by executing the command

make install

This will install CppAD in the location specified by prefix_dir . You must have permission to write in the prefix_dir directory to execute this command. You may optionally specify a destination directory for the install; i.e.,

make install DESTDIR = DestinationDirectory