Prev Next whats_new_11

Changes and Additions to CppAD During 2011

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

  1. There was a bug when using abs with an AD< AD<double> > argument, whereby the corresponding AD<double> operation sequence depended on the value of the argument to the abs function.
  2. Change the specifications for the derivative of the abs function to be the sign function; see to old derivative specifications.
  3. Add the sign function to the AD<Base> list of available functions. In addition, add the sign function to the list of base type requirements .

The file time_test.hpp was not being included by cppad/cppad.hpp. This has been fixed.

The types SizeVector, NumberVector, ADNumber, and ADVector, were in the global namespace and this was causing warnings about the shadowing of these declarations. The cppad_ipopt namespace was created to avoid these problems. The simplest way to make old cppad_ipopt_nlp code work with this change is to use the command
	using namespace cppad_ipopt;

  1. Change team_start to team_create and team_stop to team_destroy .
  2. Change NDEBUG mentions to include link to NDEBUG .
  3. Improve memory_leak documentation.

THe time_test routine was still executing the test at least twice, even if that was not necessary for the specified minimum time. This has been fixed.

Move multi_thread.cpp to thread_test.cpp and fix its running instructions.

Create preprocessor section with pointers to all the preprocessor symbols that are in the CppAD API.

Separate --with-boostvector for boost_dir . This enables one to specify boost_dir for team_bthread.cpp with out using boost vectors.

  1. Move sum_i_inv.cpp to harmonic.cpp .
  2. Include the date, time, CppAD version, and team_name in the thread_test.cpp output.

  1. The thread_test.cpp program was truncating test_time to the nearest integer. This has been fixed.
  2. The time_test routine has been made more efficient and now check for the case where only one execution of the test is necessary to achieve the desired test_time (it used to always run at least two).
  3. The sum_i_inv_time.cpp and multi_newton.cpp routines were calling the test an extra time at the end to check for correctness. The results of the last test are now cached and used for the correctness test so that an extra call is not necessary (to make the tests run faster when only a few repetitions are necessary).

  1. Create another speed testing routine time_test which is like speed_test but it returns the time instead of rate and as a double instead of a size_t. The use it for the timing tests in sum_i_inv_time.cpp and multi_newton_time.cpp .
  2. Add test_time as a command line argument to the multi-threading sum_i_inv and multi_newton timing tests.

Change thread_team.hpp to team_thread.hpp and do the same for all other names that ended in _team; e.g., team_openmp.cpp .

The users choice for test_vector was not actually changing the tests that the user ran. This have been fixed.

Make all the output generated by multi_newton.cpp valid matlab and octave input so it is easy to plot the results.

Use thread specific data to simplify team_openmp.cpp .

Make team_bthread.cpp more similar to team_pthread.cpp .

  1. Reorganize and improve the multi_thread section and its subsections.
  2. There was a bug in multi_newton_work.cpp that only showed up when the number of threads was greater than or equal 4. This has been fixed. In addition, CPPAD_MAX_NUM_THREADS was increased from 2 to 4 (to enable testing for this bug).
  3. The accuracy expected in the sum_i_inv.cpp results were failing when mega_sum was large. This check has been modified to include a correction for mega_sum .

The following changes were merged in from branches/thread:
  1. Move openmp to multi_thread/openmp. and create multi_thread/bthread, multi_thread/pthread with similar tests.
  2. Put multi-threading common code in multi_thread directory and threading system specific code in multi_thread/threading for threading equal to openmp, bthread, and pthread.
  3. Update the README file.
  4. Remove the bug/ file (no longer a bug).
  5. Make arc_tan.cpp utility that can be used by multiple multi-threading tests.
  6. Create team_thread.hpp specifications, move OpenMP management to team_openmp.cpp , Boost thread management to team_bthread.cpp , and pthread management to team_pthread.cpp .
  7. All of the make files were modified so that the command
    	make test
    would run the tests for the current directory.
  8. Extend the multi-threading speed tests sum_i_inv.cpp and multi_newton.cpp so they run using Boost threads and pthreads (as well as OpenMP threads).

Fix some compiler warnings about shadowed variables that were detected by g++ version 4.6.1 20110908.

  1. The MAC version of the pthread library does not include the pthread_barrier_wait function; i.e., is not compliant with the IEEE Std 1003.1, 2004 Edition for pthread. This caused the pthread_simple_ad.cpp to fail to compile on the MAC. This has been fixed by not compiling the pthread examples unless pthread_barrier_wait is present.
  2. The cppad_ipopt_nlp routine has been changed to optimize the functions  r_k (u) such that retape(k) is false.

  1. Add the boost multi-threading examples a11c_bthread.cpp and bthread_simple_ad.cpp.
  2. Improve documentation for thread_num argument to parallel_setup.
  3. More simplification of bthread_simple_ad.cpp example.

Simply and fix some problems with pthread_simple_ad.cpp, including avoiding a Bug in Cygwin .

  1. The OpenMP speed test program openmp/run.cpp was not setting the number of threads for the one thread case (so dynamic thread adjustment was used). This has been fixed.
  2. The thread_alloc.cpp example was missing from the Microsoft example/example.vcproj file and a attempt was made to link to missing OpenMP routines (this has been fixed). In addition, some Microsoft compiler warning have been fixed; see the examples and tests in the Windows install instructions.
  3. There was an oversight, and CPPAD_MAX_NUM_THREAD was being set to 2 when _OPENMP was not defined. This has been fixed and CPPAD_MAX_NUM_THREADS has been documented and is now part of the CppAD API.
  4. The pthread_simple_ad.cpp test failed under cygwin. This was because the previous test openmp_ad.cpp was set up calls to OpenMP routines that were still in effect when pthread/simple_ad ran. This has been fixed by making num_threads == 1 a special case in parallel_setup .

  1. Modify the CppAD trunk using the changes from svn revision 2060 to revision 2081 in the branch
    These changes are described below under the headings 08-21 through 08-31 .
  2. There was a bug in the old_atomic functions in the case where none of the elements of the argument to the function was a variable . This has been fixed. In addition, old_tan.cpp generated an assert for this case and this has also been fixed (in addition to including an example for this case).

  1. Move the sum_i_inv_time.cpp test from openmp/ to openmp/run.cpp.
  2. Change --with-openmp to OPENMP_FLAGS=openmp_flags configure command line argument.

  1. Create the openmp/run.cpp program and move the openmp_multi_newton.cpp test from openmp/ to openmp/run.cpp. This uses configure information for building the tests.
  2. Document the --with-openmp configure command line argument.
  3. Move openmp/multi_newton.hpp to openmp/newton_method.hpp and openmp/multi_newton.cpp to openmp/newton_example.cpp.

  1. Replace omp_alloc by thread_alloc in multi_thread , the section on how to use CppAD in parallel.
  2. Implement omp_alloc as links to corresponding thread_alloc sections.
  3. Create the pthread_simple_ad.cpp example that does AD using the pthread library. In addition, fix some problems in openmp_simple_ad.cpp
  4. Move openmp/example_a11c.cpp to example/a11c_openmp.cpp .
  5. Move openmp/parallel_ad.cpp to openmp_simple_ad.cpp.

Beginning steps in replacing omp_alloc by thread_alloc :
  1. Replace omp_alloc by thread_alloc in the library .
  2. move omp_alloc to the deprecated section of the documentation.
  3. Change all omp_alloc section names to begin with omp_, and change all thread_alloc section names to begin with new_.
  4. Convert CppAD_vector from using omp_alloc to using thread_alloc for memory allocation.
  5. Extend the memory_leak routine to also check the thread_alloc allocator.

Create the OpenMP and pthread examples a11c_openmp.cpp , a11c_pthread.cpp , and openmp_simple_ad.cpp. These OpenMP examples were originally in the openmp directory, and have been moved, and modified to conform, to the normal example directory.

Modify the CppAD trunk using the changes from svn revision 2044 to revision 2056 in the branch
These changes are described below under the headings 08-04 through 08-10 .

  1. Add the output stream optional argument s in
    f.Forward(0, xs)
    See zero order forward mode and PrintFor .
  2. Improve omp_alloc.cpp example.

  1. Warning: Add epsilon to the Base type requirements.
  2. Extend epsilon to AD types.

  1. Improve the base_require documentation for standard math functions .
  2. Warning: Add abs_geq to the requirements for a user defined Base type.
  3. Check that zero order forward mode results are approximately equal, instead of exactly equal, after an optimize operation. This fixes a bug in the optimize correctness check (The order of operations can be changed by optimize and hence the zero order forward mode results may not be exactly the same.)

Improve the base_require documentation for EqualOpSeq , Identical Integer , and Ordered operations.

Add the CondExpRel paragraph to the base requirements documentation. This was missing and are required for CondExp to work with AD<Base> arguments and a non-standard Base type.

  1. Warning: Change the include file name to base_require.hpp .
  2. Use base_float.hpp and base_double.hpp as additional examples for the CondExp Base requirements requirements.

Change PrintFor condition from less than or equal zero to not greater than zero;i.e., not positive. This makes nan print because it results in false for all comparisons.

  1. Change PrintFor so it no longer aborts execution when there is no operation sequence being recording; see start recording .
  2. Improve the print_for_cout.cpp example.

Add a conditional version of the PrintFor command
which only prints when z <= 0 . This is useful for error reporting during forward mode; i.e., reporting when the argument to the log function is not valid.

  1. The routines set_max_num_threads and get_max_num_threads were created. User's will need to replace calls to max_num_threads by calls to set_max_num_threads.
  2. The functions omp_efficient was deprecated because it has not been shown to be useful.

  1. Change omp_return_memory so that if omp_max_num_threads is one (the default), omp_alloc does not hold onto memory (keep it available for the corresponding thread).
  2. Add files that were missing from the Microsoft Visual Studio example and test_more subdirectory project files.
  3. Fix some warnings generated by Microsoft Visual Studio 2010 build.

Make tan and tanh atomic operations; see tan_forward and tan_reverse .

Finish the old_atomic example old_tan.cpp . This is also a design and implementation of the routines necessary to make tan and tanh CppAD atomic operations.

The reverse mode formulas for  Z(t) need to involve the lower order Taylor coefficients for  Y(t) . This has been fixed in tan_reverse .

  1. Fix bug in old_atomic functions. To be specific, the Taylor coefficients for  y , of order less than k , were not passed into the old_atomic forward callback function.
  2. Derive the theory for including the tangent and hyperbolic tangent as CppAD atomic operations tan_forward and tan_reverse ; see the wish list item Tan and Tanh.
  3. Implement and test forward mode calculation of derivative for the tangent and hyperbolic tangent functions; see the new old_atomic example old_tan.cpp .

  1. The InstallUnix instructions for running the individual correctness and speed tests were out of date. This has been fixed; see example and tests .
  2. Move parallel_ad.cpp from example directory to openmp directory (and convert it from a function to a program).
  3. Simplify example_a11c.cpp by making it just a correctness test.
  4. Change openmp/ so that it runs correctness tests with the compiler debugging flags.

  1. static hash code data that was begin used by multiple threads when recording AD<Base> operations omp_in_parallel execution mode. This has been fixed.
  2. Make the sparsity calculations safe for use during omp_in_parallel execution mode.
  3. Add the parallel_ad.cpp example.
  4. Change example_a11c.cpp example so that is just a correctness (not speed) test.

  1. Change the upper limit for omp_max_num_threads from 32 to 48.
  2. Add parallel documentation for, nan, Rosen34 , and Runge45 .
  3. Fix CheckNumericType and CheckSimpleVector so they work properly when used in parallel mode.

The following changes were made to openmp/
  1. Change to openmp/ maximum number of threads instead of specifying the entire set of values to be tested.
  2. Change settings for newton_example so that n_gird is a multiple of the maximum number of threads.
  3. Report dynamic number of thread results as a separate result in the summary output line.
  4. Fix automatic removal of executables from openmp directory (was commented out).
  5. The documentation for openmp/ was moved to the multi_thread section.

  1. Add link to Discrete AD Functions in multi_thread .
  2. Make use of the TrackNewDel routines omp_in_parallel execution mode an error (it never worked properly); see TrackNewDel multi-threading .
  3. Change memory_leak so that it checks for a leak in all threads. This is what openmp_newton_example.cpp and sum_i_inv_time.cpp assumed was being done.

All the OpenMP parallel execution requirements have been grouped in the section multi_thread .

Add the routine parallel_ad to fix bug when using AD<Base> in parallel execution mode.

  1. Fix a bug whereby the assert
         Error detected by false result for
              ! omp_in_parallel()
         at line 
    n in the file
    sometimes occurred.
  2. The routine omp_max_thread was deprecated, use the routine omp_max_num_threads instead.
  3. The deprecated routines have been grouped together in the deprecated section of the CppAD manual.

  1. The openmp/ routine was changed to use zero, instead of automatic, for automatic choice of openmp/ number of repeats and maximum number of threads.
  2. The output of each of the OpenMP examples / speed tests (run by openmp/ was changed to be valid matlab / octave assignment statements.
  3. In the case where OpenMP is enabled during compilation, a summary for the different number of threads as added at the end of the openmp/ output.

  1. The tape_addr_type option was added to the configure command line.
  2. The function size_op_seq results uses sizeof(CppAD_TAPE_ADDR_TYPE) where it used to use sizeof(size_t).
  3. Remove cppad/config.h from CppAD distribution, (put the information in cppad/configure.hpp.) This removes the need to undefine symbols that were defined by cppad/config.h and that did not begin with CPPAD_.
  4. Change adolc library linkage so it works with version ADOL-C-2.2.0.

Fix bug (introduced on 05-22 ) whereby constructor might not be called (but required) when the base type is not plain old data.

  1. Add the omp_efficient routine to the omp_alloc system.
  2. Improve the omp_alloc tracing so it prints the same pointer as returned to the user (not an offset version of that pointer).

Fix Visual Studio project files that were broken during the change on 05-22. In addition, in the file cppad/omp_alloc.hpp, suppress the following Microsoft Visual Studio warning
	warning C4345: behavior change: an object of POD type constructed with 
	an initializer of the form () will be default-initialized

  1. The old memory tracking routines TrackNewDel have been deprecated. Their use should be replaced using the omp_alloc a memory allocator which is designed to work well in a multi-threading OpenMP environment; see purpose .
  2. The replacement of TrackNewDel by omp_alloc has been throughout the CppAD source code, including the examples that used TrackNewDel; namely, mul_level_adolc.cpp , mul_level_adolc_ode.cpp .
  3. The CppAD vector template class and the vectorBool class were modified to use the omp_alloc memory manager. This should improves its speed of memory allocation omp_in_parallel sections of a program.
  4. The speed_test argument size_vec call was by value, instead of by reference (as documented). This has been fixed and the call is now by reference.
  5. The capacity function has been added to the CppAD vector class.
  6. The simple vector element constructor and destructor description has been changed to explicitly specify that the default constructor is used to initialize elements of the array.
  7. The size_op_seq documentation has been improved to mention that the allocated memory may be larger.

  1. Avoid ambiguity in the definition of the complex isnan function.
  2. Errors during make test were not being detected. This has been fixed.

  1. If NDEBUG is not defined, the hasnan function is used to make sure that the results of any Forward operation does not contain a nan (not a number). If so, an error message is generated and the program terminates. This error message and termination can be caught; see ErrorHandler .
  2. In the event that the cppad_ipopt_nlp objective function, the constraints, or their derivatives are infinite, an error message is generated and the program terminates (proved that NDEBUG is not defined and the default error handler has not been replaced).

  1. The Microsoft Visual Studio 2003 project files for the Windows examples and tests no longer worked because the current version of CppAD uses local types in template instantiation; see Compiler Error C2918 . These project files were converted to Visual Studio 2008 where they do work (if you use a later version, Visual Studio should automatically convert them for you).
  2. The old speed test directory was moved to speed_cppad before the new speed test organization was created on 2006-12-11 (revision 715 of the repository). The old speed tests have not been used for years and so have been deleted.

The openmp/ script what changed to take an argument that specifies which tests is run (it no longer runs all the tests). Also improve the openmp test program output formatting.

The use_ad option was added to the openmp_newton_example.cpp test case.

The subversion write protected directory bin/.svn was mistakenly part of the compressed tar file . It has been removed.

The vector of sets argument r to the old_atomic function rev_hes_sparse must have size greater than or equal to n . There was a check that its size was greater than or equal q . This was incorrect and has been fixed.

Add the conjugate gradient example.

Add the atomic option to the speed test program and use old_mat_mul.hpp during the cppad_mat_mul.cpp speed test when the atomic option is specified.

There was a bug when omp_max_thread was set to one, and NDEBUG was not defined, the thread corresponding to parameters was one, but the only valid thread number was zero (only one thread) and an CPPAD stopped with an assertion error. This has been fixed.

There was a mistake in openmp/ where it attempted to remove a non-existent file in the case where openmp/ openmp_flag was not "". This has been fixed.

A matrix multiply speed test has been added. So far, this has only implemented for the cppad and double cases. (For the time being this test is not available for the other speed comparison cases.)

A variable in old_atomic.hpp was declare of type Base when it should have been declared of type size_t. It caused the old_atomic feature to fail with some base types. This has been fixed.

The old_mat_mul.hpp example has been improved by caching the  x variable information and using it during reverse Hessian sparsity calculations.

Some of the old_atomic documentation was extended to include more explanation.

The use can now define complex atomic operations and store them in a CppAD ADFun object. This item has been remove from the wish list .

The documentation for RevSparseHes had a dimension error. This has been fixed.

A faster set operations item was added to the wish list. This has since been satisfied by cppad_sparse_list choice during the install process.

The documentation for ForSparseJac had some formatting errors. The errors have been fix and the documentation has been improved.

The subversion install instructions were brought up to date. They have since been replaced by just separate subversion download instructions.

The directory where the pkgconfig file cppad.pc is stored has been moved from prefixdir/lib/pkgconfig/cppad.pc to prefixdir/share/pkgconfig/cppad.pc ; see .

The following have been fixed:
  1. The install of the documentation failed when it was done from a directory other than the top source directory.
  2. The GPL distribution had the output of the configure command in it.
  3. Since the change on 01-09, the file omh/whats_new_11.omh has been required to build the documentation (and it has been missing from the distribution).
  4. Fadbad was generating warnings due to the -Wshadow flag with the g++ compiler. The Fadbad speed tests have a special flag with this warning removed from the cxx_flags .

There were some problems running make test in the releases
where license is gpl or cpl.
  1. The version of automake used to build the corresponding files did not define abs_top_builddir.
  2. The include file cppad_ipopt_nlp.hpp was always installed, even if ipopt_dir was not defined on the configure command line.
  3. The speed test library libspeed.a was being installed (it is only intended for testing).
These problems are fixed in the trunk and these fixes will be copied to the corresponding stable and release versions; i.e.,
will not have this problem.
Input File: omh/whats_new/whats_new_11.omh