Prev Next whats_new_12

@(@\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}} }@)@
CppAD Changes and Additions During 2012

This section contains a list of the changes to CppAD during 2012 (in reverse order by date). The purpose of this section is to assist you in learning about changes between various versions of CppAD.

  1. Merge changes in branches/ipopt_solve to trunk, delete that branch, and advance version number to cppad-20121230.
  2. Remove cppad/configure.hpp from repository because it is built by the configuration process (even for MS Visual Studio, now that we are using cmake ).
  3. Add the AD<Base> input stream operator >> .

In branches/ipopt_solve:
  1. Complete implementation of sparse Jacobian and Hessian calculations and add options that allow to user to choose between forward and reverse sparse Jacobians.
  2. The ipopt_solve routine seems to be faster and simpler than cppad_ipopt_nlp . More speed comparisons would be good to have.
  3. All of the ADFun Drivers have added specifications for the zero order Taylor coefficients after the routine is called. For example, see Hessian uses forward .

In branches/ipopt_solve:
  1. Add the ipopt_solve_retape.cpp and ipopt_solve_ode_inverse.cpp examples.
  2. Use ipopt::solve options argument (and not a file) for all the Ipopt options. As well as allowing for adding ipopt::solve special options; e.g., retape .

In branches/ipopt_solve: Change documentation section names that begin with cppad_ipopt to begin with ipopt_nlp to distinguish them from CppAD::ipopt::solve .

In branches/ipopt_solve:
  1. Convert documentation most all documentation references from the deprecated autotools instructions to the new cmake instructions.
  2. Include the Introduction programs in the cmake_check built using cmake .
  3. Deprecate cppad_ipopt_nlp and replace it by ipopt_solve which is easier to use. This is a first version of ipopt_solve and its speed and memory use needs to be improved.

Copy development trunk to branches/ipopt_solve.

Define a doxygen module (group) for each file that has doxygen documentation.

  1. The install instructions were installing cppad/CMakeLists.txt and cppad/ in the cppad include directory. This has been fixed so that only *.h and *.hpp files get installed in the cppad include directory.
  2. Advance the version number to cppad-20121220.

The files <stdbool.h> and <sys/time.h> do not exist for all C compilers, and this caused a problem when using the Windows compiler. This has been fixed by defining the type bool inside the compare_c/det_by_minor.c source code.

There was a mistake in a check for a valid op code in the file hash_code.hpp. This mistake could generate a C++ assertion with an unknown error source. It has been fixed.

  1. Advance version number from 20121120 to 20121215. Note that the CppAD version number no longer automatically advances with the date and is rather chosen to advance to the current date.
  2. The cmake installation was putting the cppad.pc pkgconfig file in
    This has been fixed and is now
  3. The pkgconfig documentation has been improved.
  4. The command for running the adolc examples and eigen examples was fixed (changed from make check to make check_example).

  1. Fix the old autotools so that it works with the new cppad.pc.
  2. Fix the old installation --with-Documentation option (it was attempting to copy from the wrong directory).

  1. Include documentation for ipopt_prefix
  2. Fix the cppad.pc pkgconfig file so that it includes the necessary libraries and include commands when ipopt_prefix is specified; see pkgconfig usage .

Update the wish_list :
  1. Remove Microsoft compiler warning item that has been fixed.
  2. Remove faster sparse set operations item that was completed using cppad_sparse_list (not part of user API).
  3. Remove cmake items that have been completed.
  4. Remove CondExp items related to using AD< std::complex<double> > types because it is better to use std::complex< AD<double> >.
  5. Remove thread_alloc memory chunk item that has been completed.
  6. Remove VecAD item about slicing from floating point type to int (not important).
  7. Change an Ipopt item to a cppad_ipopt_nlp (which was removed because cppad_ipopt_nlp is now deprecated). Add new cppad_ipopt_sum item to the wish list. (This has been removed because checkpointing can now be used for this purpose.)
  8. Add new old_atomic wish_list item (since removed).

  1. Fix the version number in link to the current download files.
  2. Change the subversion download instructions to use the export instead of checkout command. This avoids downloading the source code control files.

  1. The cmake variables cmake_install_includedir and cmake_install_libdir were changed to cmake_install_includedirs and cmake_install_libdirs to signify the fact that they can now be a list of directories.
  2. Advance version number to cppad-20121120.

  1. Finish documenting the new cmake configuration instructions and deprecate the old unix instructions.
  2. Change the specifications for CPPAD_MAX_NUM_THREADS to allow for a value of one. This enables one to have more tapes during a program execution.
  3. Include the C versus C++ speed comparison in the cmake build.

Fix a warning that occurred in Rosen34 when it was compiled with the preprocessor symbol NDEBUG defined.

Advanced the CppAD version to cppad-20121114.
  1. Started documenting the cmake configuration procedure during installation. This included factoring out the download procedure as a separate section so that the same download instruction also apply to the unix install procedure.
  2. Changed example/compare_change.cpp to just return true when NDEBUG is defined. This enabled all the tests in the example directory to be compiled with NDEBUG is defined and to pass.
  3. In the case where NDEBUG is defined, removed detection of nan during forward mode from test_more/forward.cpp%. This enables all the tests in the test_more directory to be compiled with NDEBUG is defined and to pass.
  4. Started a wish list for CppAD's use of cmake . The wish list items were completed and removed.

The team_pthread.cpp was failing to link on Ubuntu 12.04 because the libraries were not at the end of the link line. This has been fixed.

  1. Remove some remaining references to the old licenses CPL-1.0 and GPL-2.0; see 10-24 .
  2. Remove out of date Microsoft project files from the distribution. The build system is being converted to use cmake which builds these files automatically and thereby keeps them up to date. This feature is not yet documented, but one can inspect the file bin/ to see how to use cmake with CppAD.

Add missing return value to the example base_alloc CondExpOp function. This has been fixed and the comments for this example have been improved.

The CppAD profiling was not compiling the speed/src/*.cpp files with the profiling flag. This has been changes (only for the profiling speed test).

The fadbad_dir directory install instructions were changed. To be specific, FADBAD++ was changed to include/FADBAD++. This makes it more like the other optional packages.

The test runge45_1.cpp was failing when using gcc-4.5.2. This has been fixed by properly defining fabs(x) where x is a double (without the std in front).

Change the CppAD licenses from CPL-1.0 and GPL-2.0 to EPL-1.0 and GPL-3.0.

  1. Change all the multiple levels of AD examples to start with mul_level . To be specific, move ode_taylor.cpp to mul_level_ode.cpp and ode_taylor_adolc.cpp to mul_level_adolc_ode.cpp .
  2. Add ode_taylor.cpp as a example of Taylor's method for solving ODEs, (mul_level_ode.cpp is an application of this method to multi-level AD.)

  1. Change speed_main so that it outputs small rates (less than 1000) with two decimal points of precision (instead of as integers). In addition, flush result for each size when it finishes to give user more feedback about how things are progressing.
  2. Add the optional test_size argument to the time_test routine.

Change the hold_memory speed to option to just memory . In addition, in the speed test output, include all of the options that are present in the output variable name; see speed results .

Fix another problem with Debian's /bin/sh shell executing example/multi_thread/; see 03-17

Improve documentation for the old_atomic rev_hes_sparse argument v . In addition, add sparsity calculations to the old_reciprocal.cpp example.

Add user_simple.cpp, a simpler old_atomic example.

  1. A new type was added for the internal representation of vector of sets sparsity patterns; see the configure --with-sparse_option (since removed).
  2. A new speed test, compare_c , compares the speed of the same source code compiled with C and C++.

  1. The clear function was added to CppAD::vector.
  2. Warning !!: The CppAD::vector resize specifications were changed so that x.resize(0) no longer frees the corresponding memory (use x.clear() instead).
  3. Fix a bug in error checking during optimize procedure had the following valgrind symptom during the optimize.cpp example:
         ==6344== Conditional jump or move depends on uninitialised value(s)
  4. Fix mistake in old_tan.cpp where w[2] = 0 was missing before the call
              dw    = F.Reverse(1, w);

  1. Improve the documentation for pow and pow_int .
  2. Change all the example section names to be same as corresponding file names; e.g. change vectorBool.cpp to vector_bool.cpp for the example example/utility/vector_bool.cpp.

Add the CPPAD_TAPE_ID_TYPE argument to the configure command line.

Deprecate CPPAD_TEST_VECTOR and use CPPAD_TESTVECTOR in its place. This fixes a problem introduced by changes on 07-03 whereby code that used CPPAD_TEST_VECTOR would no longer work.

  1. Replace the requirement that the SimpleVector size function return a size_t value to the requirement that it can be converted to a size_t value.
  2. The --with-eigenvector option was added to the configure command line.

Fix bug in old_atomic functions identification of variables that caused old_tan.cpp to fail with error message
Error detected by false result for
    y_taddr > 0
at line 262 in the file cppad/local/dependent.hpp

Add eigen_plugin.hpp so that an Eigen vector can be used as a SimpleVector . This has since been removed; see 2017-05-11 .

  1. Change cppad_eigen.hpp to match new specifications and example in eigen help files on customizing and extending eigen.
  2. Fix bug whereby a newly constructed VecAD object was a variable (instead of a parameter) directly after construction (when no previous ADFun object had been created).
  3. Change a ok != a == 0. to ok &= a == 0. in the example ad_ctor.cpp .
  4. Add the eigen_array.cpp example.

  1. Move epsilon to numeric_limits and add the functions min and max in CppAD::numeric_limits<Type> .
  2. Convert use of the deprecated epsilon in examples to use of numeric_limits epsilon .
  3. Complete cppad_eigen.hpp interface to lowest and highest functions for all non-complex AD types.

Add the example eigen_det.cpp that uses the Eigen linear algebra package.

Include the base_adolc.hpp as <cppad/example/base_adolc.hpp> under the prefix_dir directory.

Increase the size and of the sparse Jacobian speed tests .

  1. Add the hold_memory option to the speed test main program. This was changed to just memory; see 10-03 .
  2. In cppad_sparse_jacobian.cpp , change USE_BOOL_SPARSITY from true to false. In addition, change the number of non-zeros per row from about approximately three to approximately ten.

Change adolc_sparse_jacobian.cpp to use the sparse adolc Jacobian (instead of the full Jacobian) driver. This was also done for adolc_sparse_hessian.cpp , but there is a problem with the test that is being investigated.

Implement the matrix multiply speed test link_mat_mul for all packages (there is a problem with the fadbad_mat_mul.cpp implementation and it is being looked into).

Make all the speed tests implementations (for the specific packages) uniform by having a Specification and Implementation heading and similar indexing. For example, see adolc_det_minor.cpp , cppad_det_minor.cpp , double_det_minor.cpp , fadbad_det_minor.cpp , and sacado_det_minor.cpp .

Add the sacado_ode.cpp speed test.

  1. The specifications for Runge45 where changes so that it uses the fabs function instead of the < operation. This enabled the a more precise statement about its operation sequence .
  2. The fabs function as added to the CppAD standard math library (see abs ) and the base type requirements . This enables one to write code that works with AD<double> as well as double without having to define abs for double arguments (and similarly for float).
  3. Add the adolc_ode.cpp and fadbad_ode.cpp speed tests (and edit the cppad_ode.cpp test).

  1. The CppAD::vector class was extended to allow assignment with the target of size zero and the source of non-zero size; see check size .
  2. A memory leak and a bug in cppad_mat_mul.cpp were fixed (the bug was related to the change to CppAD::vector above).

  1. Remove the deprecated symbol CppADvector from the det_by_lu speed test source code det_by_lu.hpp .
  2. Include memory_leak in the list of deprecated features.
  3. Change the ode_evaluate speed test utility so that its operation sequence does not depend on the repetition; see p == 0 in its documentation.
  4. Use same argument for taping and derivative evaluation when retape speed test option is true.
  5. Implement the retape == false option in cppad_ode.cpp .
  6. Have cppad_det_lu.cpp , cppad_det_minor.cpp , and cppad_poly.cpp , return false when one of the specified options is not supported. Do the same for package_test.cpp for package equal to adolc, fadbad, and sacado and for test equal to det_lu, det_minor, poly.

Change cppad_sparse_hessian.cpp and cppad_sparse_jacobian.cpp to use the row , col interface to sparse_hessian . In addition, implement the speed test retape speed test option for these tests.

Add the cppad_print_optimize routine to so that the corresponding code does not need to be reproduced for all the speed_cppad tests. In addition, during CppAD speed tests, print out the optimization results for each test size.

Change specifications for link_sparse_hessian so that the row and column indices are inputs (instead of being chosen randomly by the test for each repetition). This enables use of the retape speed test option during sparse Hessian speed tests.

Add index_sort to the general purpose template utilities so that it can be used by the implementations of link_sparse_jacobian and link_sparse_hessian .

Split the sparse Jacobian and Hessian test function the separate function sparse_jac_fun and sparse_hes_fun (do not use sparse Hessian for both). In addition, change row and column indices from i and j to row and col .

Merged in changes from branches/sparse:
  1. A new interface was added to sparse_jacobian and sparse_hessian . This interface returns a sparse representation of the corresponding matrices using row and column index vectors.
  2. The examples sparse_jacobian.cpp and sparse_hessian.cpp were improved and extended to include the new interface.
  3. The definition of an AD function was improved to include definition of the corresponding n and m .

The BOOST_DIR configure command line value has been changed to be the corresponding prefix during the installation of boost. To be specific, it used to be that boost_dir/boost was the boost include directory, now boost_dir/include is the boost include directory. This make it the same as the other directory arguments on the configure command line. In addition, it fixes some bugs in the detection of the boost multi-threading library.

Add documentation and testing for not using free_all and old_atomic clear while in parallel mode.

Fix bug when using old_atomic functions with multi_threading .

Add control of the max_num_threads argument to the unix configure command.

  1. A change was made to the way that the tapes were managed to reduce false sharing during multi-threading . Because of this change, it is now suggest that the user call parallel_ad after the multi-threading section of the program.
  2. The routine ta_free_all was created to make it easier to manage memory and the routine memory_leak was deprecated.
  3. Add the -lteuchos flag to the link line for the speed_sacado tests. (This was not necessary for trilinos-10.8.3 but is necessary for trilinos-10.10.1)

The restriction was added that parallel_ad cannot be called while a tape is being recorded. This was necessary inorder to initialize some new statics in the tape.

Fixed a race condition when using CppAD with multi-threading . This has been fixed and the error message below no longer occurs. Suppose that you ran the CppAD configure command in the work directory. If you then edited the file work/multi_thread/makefile and changed
     # AM_CXXFLAGS     = -g $(CXX_FLAGS)
     AM_CXXFLAGS     = -g $(CXX_FLAGS)
and then executed the commands
     make clean
     make pthread_test
     valgrind --tool=helgrind ./pthread_test simple_ad
The following error message would result:
     ... snip ...

==7041== Possible data race during write of size 4 at 0x8077460 by thread #1
==7041==    at 0x804FE23: CppAD::AD<double>::tape_new() (tape_link.hpp:221)
     ... snip ...

Reduce the amount of memory allocation and copying of information during a Dependent operation or an ADFun sequence constructor .

Calling taylor_capacity, with to with capacity equal to zero, was not freeing memory . This has been fixed.

  1. Improve, the multi-threading examples simple_ad_openmp.cpp , simple_ad_bthread.cpp , and simple_ad_pthread.cpp . This includes separating generic code that can be used for all applications from problem specific code.
  2. Add initialization of statics in CheckSimpleVector during parallel_ad call. These statics are required to use CppAD::vector .
  3. Add a debugging check to make sure CheckSimpleVector is initialized in sequential mode.

Fix an incorrect error check in thread_alloc that did not allow ta_return_memory to return memory in sequential execution mode that was allocated by a different thread during parallel execution.

Debian recently converted the default shell corresponding to /bin/sh to dash (which caused example/multi_thread/ to fail). This has been fixed. In general, Debian's policy is that bin/sh will be a Posix Shell .

There was a bug in thread_alloc where extra memory was held onto even if hold_memory was never called and only one thread was used by the program. This caused
valgrind --leak-check=full --show-reachable=yes
to generate an error message. If multiple threads are used, one should free this extra memory for threads other than thread zero. If hold_memory is used, one should call free_available for all threads.

  1. Add the examples simple_ad_openmp.cpp , simple_ad_bthread.cpp and simple_ad_pthread.cpp .
  2. Fix bug in finding boost multi-threading library (due to fact that boost_dir is not the prefix during the boost installation).

  1. Change the name simple_ad.cpp to team_example.cpp
  2. The multi-threading team_example.cpp example was changed to use @(@ f(x) = \sqrt{ x^2 } @)@ instead of the function @(@ {\rm atan2} [ \sin(x) , \cos (x) ] @)@ (both functions should behave like the identity function @(@ f(x) = x @)@). This enabled the removal of example/multi_thread/arc_tan.cpp.
  3. In team_example.cpp check that all of the threads pass their individual test; i.e. work_all_[thread_num].ok is true for all thread_num .

  1. The requirements in base_member were missing from the base_require documentation. In addition, the base_require.cpp example has been added.
The specifications for memory_leak where changes so that calling routine specifies the amount of static memory to add. In addition, it is now possible to call memory_leak when num_threads is greater than one (still can't be in parallel mode).

  1. Add the missing Base class requirements in the entire base_member section and under the Output Operator in the base_require section.
  2. Add the base_alloc.hpp example.

  1. Add the set_static to memory_leak . This is necessary for testing base types that allocate memory for each element.
  2. Fix memory allocation bug in cppad/local/pod_vector.hpp when each element of the Base type allocated memory.

Make another attempt to fix linking with boost threads where the wrong version of the library is in the system include directory; i.e., to have boost_dir override the default library.

There were some problems with configure's automatic detection of the boost multi-threading library. These have been fixed.

It used to be that thread_alloc did not hold onto memory when num_threads was one in the previous call to parallel_setup . Holding onto memory is now controlled by the separate routine hold_memory . This give the user more control over the memory allocator and the ability to obtain a speed up even when there is only one thread. To convert old code to the new interface, after each call to
put the following call
num_threads > 1);

Change variable notation and use optimize in mul_level.cpp .

  1. Add the example change_param.cpp which shows how to compute derivatives of functions that have parameters that change, but derivatives are not computed with respect to these parameters.
  2. The documentation for machine epsilon has been improved. (The fact that it can be used for Base types was missing.)

  1. In cases where is trivial, put its operations in corresponding makefile.
  2. Fix problem compiling cppad/speed/sparse_evaluate.hpp under gcc on Fedora 17.
  3. Run example/multi_thread/ from source directory (no need to copy to build directory).

The test program example/multi_thread/ failed if the openmp_flags not present in the configure command. This has been fixed. In addition, this has been made faster by cycling through the available threading systems instead of doing every system for every test.

Fix make test so it works when configure is run in the distribution directory cppad-yyyymmdd (not just when it is run in a different directory).

The -lpthread library was missing from the multi_thread test program linker command. This has been fixed.

  1. A duplicated code block beginning with
    if( fabs( fcur ) <= epsilon_ )
    was removed from the routine multi_newton_worker.
  2. The distance between solutions that are joined to one solution has been corrected from @(@ (b - a) / (2 n ) @)@ to @(@ (b - a) / n @)@; see xout . The correction was in the file multi_newton.cpp where sub_length_ / 2 was change to sub_length_.

  1. The thread_alloc memory allocator was changed to avoid certain false sharing situations (cases where two different thread were changing and using memory that is on the same page of cache). On one tests machine, the execution time for the 32 thread case for the test
    ./openmp_test multi_newton 1 32 1000 4800 10 true
    improved from 0.0302 seconds to 0.0135 seconds.
  2. There was a problem with the correctness test section of the multi_newton_time test. The convergence criteria, and correctness criteria, needed to be scaled by the largest argument values. This was a problem with over a hundred zeros were included in the test (and the largest argument value was @(@ 100 \pi @)@ or more).
  3. There was a problem with the way that multi_newton_takedown joined two solutions into one. It is possible that one of the solutions that needs to be joined is on the boundary and very close to a solution in the next (or previous interval) that is not on the boundary. In this case, the one with the smaller function value is chosen.
for the previous
Input File: omh/appendix/whats_new/whats_new_12.omh