------------------------------------------------------ lines 8-91 of file: include/cppad/core/parallel_ad.hpp ------------------------------------------------------ {xrst_begin parallel_ad} {xrst_spell rosen runge teardown } Enable AD Calculations During Parallel Mode ########################################### Syntax ****** | ``parallel_ad`` < *Base* >() Purpose ******* The function ``parallel_ad`` < *Base* >() must be called before any ``AD`` < *Base>* objects are used in :ref:`parallel` mode. In addition, if this routine is called after one is done using parallel mode, it will free extra memory used to keep track of the multiple ``AD`` < *Base* > tapes required for parallel execution. Discussion ********** By default, for each ``AD`` < *Base* > class there is only one tape that records :ref:`glossary@AD of Base` operations. This tape is a global variable and hence it cannot be used by multiple threads at the same time. The :ref:`parallel_setup` function informs CppAD of the maximum number of threads that can be active in parallel mode. This routine does extra setup (and teardown) for the particular *Base* type. CheckSimpleVector ***************** This routine has the side effect of calling ``CheckSimpleVector`` for some of the possible :ref:`CheckSimpleVector@Scalar` and :ref:`CheckSimpleVector@Vector` cases. The set of these cases may increase in the future and currently includes the following: .. csv-table:: :header: Scalar, Vector ``bool`` , ``CppAD::vectorBool`` ``size_t`` , ``CppAD::vector`` *Base* , *vector* < *Base* > ``AD`` < *Base* > , *vector* ``AD`` < *Base* > Where *vector* above is ``CppAD::vector`` , ``std::vector`` , and the :ref:`cppad_testvector-name` . Example ******* The files :ref:`openmp_get_started.cpp-name` , :ref:`bthread_get_started.cpp-name` , and :ref:`pthread_get_started.cpp-name` , contain examples and tests that implement this function. Restriction *********** This routine cannot be called in parallel mode or while there is a tape recording ``AD`` < *Base* > operations. Other Initialization ******************** If the following routines have static memory and must be called once before being used in parallel mode: #. :ref:`CheckSimpleVector ` #. :ref:`thread_alloc, memory_leak ` #. :ref:`Rosen34 ` #. :ref:`Runge45 ` #. :ref:`discrete ` #. :ref:`atomic_one ` {xrst_end parallel_ad}