CppAD: A C++ Algorithmic Differentiation Package  20130918
omp_alloc.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 # ifndef CPPAD_OMP_ALLOC_INCLUDED
00003 # define CPPAD_OMP_ALLOC_INCLUDED
00004 
00005 /* --------------------------------------------------------------------------
00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
00007 
00008 CppAD is distributed under multiple licenses. This distribution is under
00009 the terms of the 
00010                     Eclipse Public License Version 1.0.
00011 
00012 A copy of this license is included in the COPYING file of this distribution.
00013 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
00014 -------------------------------------------------------------------------- */
00015 # include <cppad/thread_alloc.hpp>
00016 # ifdef _OPENMP
00017 # include <omp.h>
00018 # endif
00019 
00020 namespace CppAD { // BEGIN_CPPAD_NAMESPACE
00021 class omp_alloc{
00022 // ============================================================================
00023 public:
00024 /*
00025 $begin omp_max_num_threads$$
00026 $spell
00027      inv
00028      CppAD
00029      num
00030      omp_alloc
00031 $$
00032 $section Set and Get Maximum Number of Threads for omp_alloc Allocator$$
00033 
00034 $head Deprecated$$
00035 $index set_max_num_threads, omp_alloc$$
00036 $index get_max_num_threads, omp_alloc$$
00037 Use the functions $cref/thread_alloc::parallel_setup/ta_parallel_setup/$$
00038 and $cref/thread_alloc:num_threads/ta_num_threads/$$ instead.
00039 
00040 $head Syntax$$
00041 $codei%omp_alloc::set_max_num_threads(%number%)
00042 %$$
00043 $icode%number% = omp_alloc::get_max_num_threads()
00044 %$$
00045 
00046 $head Purpose$$
00047 By default there is only one thread and all execution is in sequential mode
00048 (not $cref/parallel/omp_in_parallel/$$).
00049 
00050 $head number$$
00051 The argument and return value $icode number$$ has prototype
00052 $codei%
00053      size_t %number%
00054 %$$ 
00055 and must be greater than zero.
00056 
00057 $head set_max_num_threads$$
00058 Informs $cref omp_alloc$$ of the maximum number of OpenMP threads. 
00059 
00060 $head get_max_num_threads$$
00061 Returns the valued used in the previous call to $code set_max_num_threads$$.
00062 If there was no such previous call, the value one is returned
00063 (and only thread number zero can use $cref omp_alloc$$).
00064 
00065 $head Restrictions$$
00066 The function $code set_max_num_threads$$ must be called before 
00067 the program enters $cref/parallel/omp_in_parallel/$$ execution mode.
00068 In addition, this function cannot be called while in parallel mode.
00069 
00070 $end
00071 */
00072      /*!
00073      Inform omp_alloc of the maximum number of OpenMP threads and enable 
00074      parallel execution mode by initializing all statics in this file.
00075 
00076      \param number [in]
00077      maximum number of OpenMP threads.
00078      */
00079      static void set_max_num_threads(size_t number)
00080      {    thread_alloc::parallel_setup(
00081                number, omp_alloc::in_parallel, omp_alloc::get_thread_num
00082           );
00083           thread_alloc::hold_memory(number > 1);
00084      }
00085      /*!
00086      Get the current maximum number of OpenMP threads that omp_alloc can use.
00087 
00088      \return 
00089      maximum number of OpenMP threads.
00090      */
00091      static size_t get_max_num_threads(void)
00092      {    return thread_alloc::num_threads(); }
00093 
00094 /* -----------------------------------------------------------------------
00095 $begin omp_in_parallel$$
00096 
00097 $section Is The Current Execution in OpenMP Parallel Mode$$
00098 $spell
00099      omp_alloc
00100      bool
00101 $$
00102 
00103 $head Deprecated$$
00104 $index in_parallel, omp_alloc$$
00105 $index omp_alloc, in_parallel$$
00106 Use the function $cref/thread_alloc::in_parallel/ta_in_parallel/$$ instead.
00107 
00108 $head Syntax$$
00109 $icode%flag% = omp_alloc::in_parallel()%$$
00110 
00111 $head Purpose$$
00112 Some of the $cref omp_alloc$$ allocation routines have different
00113 specifications for parallel (not sequential) execution mode.
00114 This routine enables you to determine if the current execution mode
00115 is sequential or parallel.
00116 
00117 $head flag$$
00118 The return value has prototype
00119 $codei%
00120      bool %flag%
00121 %$$
00122 It is true if the current execution is in parallel mode 
00123 (possibly multi-threaded) and false otherwise (sequential mode).
00124 
00125 $head Example$$
00126 $cref omp_alloc.cpp$$
00127 
00128 $end
00129 */
00130      /// Are we in a parallel execution state; i.e., is it possible that
00131      /// other threads are currently executing. 
00132      static bool in_parallel(void)
00133      {
00134 # ifdef _OPENMP
00135           return static_cast<bool>( omp_in_parallel() );
00136 # else
00137           return false;
00138 # endif
00139      }
00140 
00141 /* -----------------------------------------------------------------------
00142 $begin omp_get_thread_num$$
00143 $spell
00144      CppAD
00145      num
00146      omp_alloc
00147      cppad.hpp
00148 $$
00149 
00150 $section Get the Current OpenMP Thread Number$$
00151 
00152 $head Deprecated$$
00153 $index get_thread_num, omp_alloc$$
00154 $index omp_alloc, get_thread_num$$
00155 Use the function $cref/thread_alloc::thread_num/ta_thread_num/$$ instead.
00156 
00157 $head Syntax$$
00158 $icode%thread% = omp_alloc::get_thread_num()%$$
00159 
00160 $head Purpose$$
00161 Some of the $cref omp_alloc$$ allocation routines have a thread number.
00162 This routine enables you to determine the current thread.
00163 
00164 $head thread$$
00165 The return value $icode thread$$ has prototype
00166 $codei%
00167      size_t %thread%
00168 %$$
00169 and is the currently executing thread number.
00170 If $code _OPENMP$$ is not defined, $icode thread$$ is zero.
00171 
00172 $head Example$$
00173 $cref omp_alloc.cpp$$
00174 
00175 $end
00176 */
00177      /// Get current OpenMP thread number (zero if _OpenMP not defined).
00178      static size_t get_thread_num(void)
00179      {
00180 # ifdef _OPENMP
00181           size_t thread = static_cast<size_t>( omp_get_thread_num() );
00182           return thread;
00183 # else
00184           return 0;
00185 # endif
00186      }
00187 /* -----------------------------------------------------------------------
00188 $begin omp_get_memory$$
00189 $spell
00190      num
00191      ptr
00192      omp_alloc
00193 $$
00194 
00195 $section Get At Least A Specified Amount of Memory$$
00196 
00197 $head Deprecated$$
00198 $index get_thread_num, omp_alloc$$
00199 $index omp_alloc, get_thread_num$$
00200 Use the function $cref/thread_alloc::get_memory/ta_get_memory/$$ instead.
00201 
00202 $head Syntax$$
00203 $icode%v_ptr% = omp_alloc::get_memory(%min_bytes%, %cap_bytes%)%$$
00204 
00205 $head Purpose$$
00206 Use $cref omp_alloc$$ to obtain a minimum number of bytes of memory
00207 (for use by the $cref/current thread/omp_get_thread_num/$$).
00208 
00209 $head min_bytes$$
00210 This argument has prototype
00211 $codei%
00212      size_t %min_bytes%
00213 %$$
00214 It specifies the minimum number of bytes to allocate.
00215 
00216 $head cap_bytes$$
00217 This argument has prototype
00218 $codei%
00219      size_t& %cap_bytes%
00220 %$$
00221 It's input value does not matter.
00222 Upon return, it is the actual number of bytes (capacity) 
00223 that have been allocated for use,
00224 $codei%
00225      %min_bytes% <= %cap_bytes%
00226 %$$
00227 
00228 $head v_ptr$$
00229 The return value $icode v_ptr$$ has prototype
00230 $codei%
00231      void* %v_ptr%
00232 %$$
00233 It is the location where the $icode cap_bytes$$ of memory 
00234 that have been allocated for use begins.
00235 
00236 $head Allocation Speed$$
00237 This allocation should be faster if the following conditions hold:
00238 $list number$$
00239 The memory allocated by a previous call to $code get_memory$$ 
00240 is currently available for use.
00241 $lnext
00242 The current $icode min_bytes$$ is between 
00243 the previous $icode min_bytes$$ and previous $icode cap_bytes$$.
00244 $lend
00245 
00246 $head Example$$
00247 $cref omp_alloc.cpp$$
00248 
00249 $end
00250 */
00251      /*!
00252      Use omp_alloc to get a specified amount of memory.
00253 
00254      If the memory allocated by a previous call to \c get_memory is now 
00255      avaialable, and \c min_bytes is between its previous value
00256      and the previous \c cap_bytes, this memory allocation will have
00257      optimal speed. Otherwise, the memory allocation is more complicated and
00258      may have to wait for other threads to complete an allocation.
00259 
00260      \param min_bytes [in]
00261      The minimum number of bytes of memory to be obtained for use.
00262 
00263      \param cap_bytes [out]
00264      The actual number of bytes of memory obtained for use.
00265 
00266      \return
00267      pointer to the beginning of the memory allocted for use.
00268      */
00269      static void* get_memory(size_t min_bytes, size_t& cap_bytes)
00270      {    return thread_alloc::get_memory(min_bytes, cap_bytes); }
00271 
00272 /* -----------------------------------------------------------------------
00273 $begin omp_return_memory$$
00274 $spell
00275      ptr
00276      omp_alloc
00277 $$
00278 
00279 $section Return Memory to omp_alloc$$
00280 
00281 $head Deprecated$$
00282 $index return_memory, omp_alloc$$
00283 $index omp_alloc, return_memory$$
00284 Use the function $cref/thread_alloc::return_memory/ta_return_memory/$$ instead.
00285 
00286 $head Syntax$$
00287 $codei%omp_alloc::return_memory(%v_ptr%)%$$
00288 
00289 $head Purpose$$
00290 If $cref omp_max_num_threads$$ is one,
00291 the memory is returned to the system.
00292 Otherwise, the memory is retained by $cref omp_alloc$$ for quick future use
00293 by the thread that allocated to memory.
00294 
00295 $head v_ptr$$
00296 This argument has prototype
00297 $codei%
00298      void* %v_ptr%
00299 %$$.
00300 It must be a pointer to memory that is currently in use; i.e.
00301 obtained by a previous call to $cref omp_get_memory$$ and not yet returned.
00302 
00303 $head Thread$$
00304 Either the $cref/current thread/omp_get_thread_num/$$ must be the same as during
00305 the corresponding call to $cref omp_get_memory$$,
00306 or the current execution mode must be sequential 
00307 (not $cref/parallel/omp_in_parallel/$$).
00308 
00309 $head NDEBUG$$
00310 If $code NDEBUG$$ is defined, $icode v_ptr$$ is not checked (this is faster).
00311 Otherwise, a list of in use pointers is searched to make sure
00312 that $icode v_ptr$$ is in the list. 
00313 
00314 $head Example$$
00315 $cref omp_alloc.cpp$$
00316 
00317 $end
00318 */
00319      /*!
00320      Return memory that was obtained by \c get_memory.
00321      If  <code>max_num_threads(0) == 1</code>,
00322      the memory is returned to the system.
00323      Otherwise, it is retained by \c omp_alloc and available for use by 
00324      \c get_memory for this thread.
00325 
00326      \param v_ptr [in]
00327      Value of the pointer returned by \c get_memory and still in use.
00328      After this call, this pointer will available (and not in use).
00329 
00330      \par
00331      We must either be in sequential (not parallel) execution mode,
00332      or the current thread must be the same as for the corresponding call
00333      to \c get_memory.
00334      */
00335      static void return_memory(void* v_ptr)
00336      {    thread_alloc::return_memory(v_ptr); }
00337 /* -----------------------------------------------------------------------
00338 $begin omp_free_available$$
00339 $spell
00340      omp_alloc
00341 $$
00342 
00343 $section Free Memory Currently Available for Quick Use by a Thread$$
00344 
00345 $head Deprecated$$
00346 $index free_available, omp_alloc$$
00347 $index omp_alloc, free_available$$
00348 Use the function $cref/thread_alloc::free_available/ta_free_available/$$ 
00349 instead.
00350 
00351 $head Syntax$$
00352 $codei%omp_alloc::free_available(%thread%)%$$
00353 
00354 $head Purpose$$
00355 Free memory, currently available for quick use by a specific thread, 
00356 for general future use.
00357 
00358 $head thread$$
00359 This argument has prototype
00360 $codei%
00361      size_t %thread%
00362 %$$
00363 Either $cref omp_get_thread_num$$ must be the same as $icode thread$$,
00364 or the current execution mode must be sequential 
00365 (not $cref/parallel/omp_in_parallel/$$).
00366 
00367 $head Example$$
00368 $cref omp_alloc.cpp$$
00369 
00370 $end
00371 */
00372      /*!
00373      Return all the memory being held as available for a thread to the system.
00374 
00375      \param thread [in]
00376      this thread that will no longer have any available memory after this call.
00377      This must either be the thread currently executing, or we must be 
00378      in sequential (not parallel) execution mode.
00379      */
00380      static void free_available(size_t thread)
00381      {    thread_alloc::free_available(thread); }
00382 /* -----------------------------------------------------------------------
00383 $begin omp_inuse$$
00384 $spell
00385      num
00386      inuse
00387      omp_alloc
00388 $$
00389 
00390 $section Amount of Memory a Thread is Currently Using$$
00391 
00392 $head Deprecated$$
00393 $index inuse, omp_alloc$$
00394 $index omp_alloc, inuse$$
00395 
00396 $head Syntax$$
00397 $icode%num_bytes% = omp_alloc::inuse(%thread%)%$$
00398 Use the function $cref/thread_alloc::inuse/ta_inuse/$$ instead.
00399 
00400 $head Purpose$$
00401 Memory being managed by $cref omp_alloc$$ has two states,
00402 currently in use by the specified thread,
00403 and quickly available for future use by the specified thread.
00404 This function informs the program how much memory is in use.
00405 
00406 $head thread$$
00407 This argument has prototype
00408 $codei%
00409      size_t %thread%
00410 %$$
00411 Either $cref omp_get_thread_num$$ must be the same as $icode thread$$,
00412 or the current execution mode must be sequential 
00413 (not $cref/parallel/omp_in_parallel/$$).
00414 
00415 $head num_bytes$$
00416 The return value has prototype
00417 $codei%
00418      size_t %num_bytes%
00419 %$$
00420 It is the number of bytes currently in use by the specified thread.
00421 
00422 $head Example$$
00423 $cref omp_alloc.cpp$$
00424 
00425 $end
00426 */
00427      /*!
00428      Determine the amount of memory that is currently inuse.
00429 
00430      \param thread [in]
00431      Thread for which we are determining the amount of memory
00432      (must be < CPPAD_MAX_NUM_THREADS).
00433      Durring parallel execution, this must be the thread 
00434      that is currently executing.
00435 
00436      \return
00437      The amount of memory in bytes.
00438      */
00439      static size_t inuse(size_t thread)
00440      {    return thread_alloc::inuse(thread); } 
00441 /* -----------------------------------------------------------------------
00442 $begin omp_available$$
00443 $spell
00444      num
00445      omp_alloc
00446 $$
00447 
00448 $section Amount of Memory Available for Quick Use by a Thread$$
00449 
00450 $head Deprecated$$
00451 $index available, omp_alloc$$
00452 $index omp_alloc, available$$
00453 Use the function $cref/thread_alloc::available/ta_available/$$ instead.
00454 
00455 $head Syntax$$
00456 $icode%num_bytes% = omp_alloc::available(%thread%)%$$
00457 
00458 $head Purpose$$
00459 Memory being managed by $cref omp_alloc$$ has two states,
00460 currently in use by the specified thread,
00461 and quickly available for future use by the specified thread.
00462 This function informs the program how much memory is available.
00463 
00464 $head thread$$
00465 This argument has prototype
00466 $codei%
00467      size_t %thread%
00468 %$$
00469 Either $cref omp_get_thread_num$$ must be the same as $icode thread$$,
00470 or the current execution mode must be sequential 
00471 (not $cref/parallel/omp_in_parallel/$$).
00472 
00473 $head num_bytes$$
00474 The return value has prototype
00475 $codei%
00476      size_t %num_bytes%
00477 %$$
00478 It is the number of bytes currently available for use by the specified thread.
00479 
00480 $head Example$$
00481 $cref omp_alloc.cpp$$
00482 
00483 $end
00484 */
00485      /*!
00486      Determine the amount of memory that is currently available for use.
00487 
00488      \copydetails inuse
00489      */
00490      static size_t available(size_t thread)
00491      {    return thread_alloc::available(thread); } 
00492 /* -----------------------------------------------------------------------
00493 $begin omp_create_array$$
00494 $spell
00495      omp_alloc
00496      sizeof
00497 $$
00498 
00499 $section Allocate Memory and Create A Raw Array$$
00500 
00501 $head Deprecated$$
00502 $index create_array, omp_alloc$$
00503 $index omp_alloc, create_array$$
00504 Use the function $cref/thread_alloc::create_array/ta_create_array/$$ instead.
00505 
00506 $head Syntax$$
00507 $icode%array% = omp_alloc::create_array<%Type%>(%size_min%, %size_out%)%$$.
00508 
00509 $head Purpose$$
00510 Create a new raw array using $cref omp_alloc$$ a fast memory allocator 
00511 that works well in a multi-threading OpenMP environment.
00512 
00513 $head Type$$
00514 The type of the elements of the array.
00515 
00516 $head size_min$$
00517 This argument has prototype
00518 $codei%
00519      size_t %size_min%
00520 %$$
00521 This is the minimum number of elements that there can be
00522 in the resulting $icode array$$.
00523 
00524 $head size_out$$
00525 This argument has prototype
00526 $codei%
00527      size_t& %size_out%
00528 %$$
00529 The input value of this argument does not matter.
00530 Upon return, it is the actual number of elements 
00531 in $icode array$$ 
00532 ($icode% size_min %<=% size_out%$$).
00533 
00534 $head array$$
00535 The return value $icode array$$ has prototype
00536 $codei%
00537      %Type%* %array%
00538 %$$
00539 It is array with $icode size_out$$ elements.
00540 The default constructor for $icode Type$$ is used to initialize the 
00541 elements of $icode array$$.
00542 Note that $cref omp_delete_array$$
00543 should be used to destroy the array when it is no longer needed.
00544 
00545 $head Delta$$
00546 The amount of memory $cref omp_inuse$$ by the current thread, 
00547 will increase $icode delta$$ where
00548 $codei%
00549      sizeof(%Type%) * (%size_out% + 1) > %delta% >= sizeof(%Type%) * %size_out%
00550 %$$
00551 The $cref omp_available$$ memory will decrease by $icode delta$$,
00552 (and the allocation will be faster)
00553 if a previous allocation with $icode size_min$$ between its current value
00554 and $icode size_out$$ is available. 
00555 
00556 $head Example$$
00557 $cref omp_alloc.cpp$$
00558 
00559 $end 
00560 */
00561      /*!
00562      Use omp_alloc to Create a Raw Array.
00563 
00564      \tparam Type
00565      The type of the elements of the array.
00566 
00567      \param size_min [in]
00568      The minimum number of elements in the array.
00569 
00570      \param size_out [out]
00571      The actual number of elements in the array.
00572 
00573      \return
00574      pointer to the first element of the array.
00575      The default constructor is used to initialize 
00576      all the elements of the array.
00577 
00578      \par
00579      The \c extra_ field, in the \c omp_alloc node before the return value,
00580      is set to size_out.
00581      */
00582      template <class Type>
00583      static Type* create_array(size_t size_min, size_t& size_out)
00584      {    return thread_alloc::create_array<Type>(size_min, size_out); }
00585 /* -----------------------------------------------------------------------
00586 $begin omp_delete_array$$
00587 $spell
00588      omp_alloc
00589      sizeof
00590 $$
00591 
00592 $section Return A Raw Array to The Available Memory for a Thread$$
00593 
00594 $head Deprecated$$
00595 $index delete_array, omp_alloc$$
00596 $index omp_alloc, delete_array$$
00597 Use the function $cref/thread_alloc::delete_array/ta_delete_array/$$ instead.
00598 
00599 $head Syntax$$
00600 $codei%omp_alloc::delete_array(%array%)%$$.
00601 
00602 $head Purpose$$
00603 Returns memory corresponding to a raw array 
00604 (create by $cref omp_create_array$$) to the 
00605 $cref omp_available$$ memory pool for the current thread.
00606 
00607 $head Type$$
00608 The type of the elements of the array.
00609 
00610 $head array$$
00611 The argument $icode array$$ has prototype
00612 $codei%
00613      %Type%* %array%
00614 %$$
00615 It is a value returned by $cref omp_create_array$$ and not yet deleted.
00616 The $icode Type$$ destructor is called for each element in the array.
00617 
00618 $head Thread$$
00619 The $cref/current thread/omp_get_thread_num/$$ must be the
00620 same as when $cref omp_create_array$$ returned the value $icode array$$.
00621 There is an exception to this rule:
00622 when the current execution mode is sequential
00623 (not $cref/parallel/omp_in_parallel/$$) the current thread number does not matter.
00624 
00625 $head Delta$$
00626 The amount of memory $cref omp_inuse$$ will decrease by $icode delta$$,
00627 and the $cref omp_available$$ memory will increase by $icode delta$$,
00628 where $cref/delta/omp_create_array/Delta/$$ 
00629 is the same as for the corresponding call to $code create_array$$.
00630 
00631 $head Example$$
00632 $cref omp_alloc.cpp$$
00633 
00634 $end 
00635 */
00636      /*!
00637      Return Memory Used for a Raw Array to the Available Pool.
00638 
00639      \tparam Type
00640      The type of the elements of the array.
00641 
00642      \param array [in]
00643      A value returned by \c create_array that has not yet been deleted.
00644      The \c Type destructor is used to destroy each of the elements 
00645      of the array.
00646 
00647      \par
00648      Durring parallel execution, the current thread must be the same
00649      as during the corresponding call to \c create_array.
00650      */
00651      template <class Type>
00652      static void delete_array(Type* array)
00653      {    thread_alloc::delete_array(array); }
00654 };
00655 /* --------------------------------------------------------------------------
00656 $begin omp_efficient$$
00657 $spell
00658      omp_alloc
00659      ptr
00660      num
00661      bool
00662      const
00663 $$
00664 
00665 $section Check If A Memory Allocation is Efficient for Another Use$$
00666 
00667 $head Removed$$
00668 $index efficient, omp_alloc$$
00669 $index omp_alloc, efficient$$
00670 This function has been removed because speed tests seem to indicate
00671 it is just as fast, or faster, to free and then reallocate the memory.
00672 
00673 $head Syntax$$
00674 $icode%flag% = omp_alloc::efficient(%v_ptr%, %num_bytes%)%$$
00675 
00676 $head Purpose$$
00677 Check if memory that is currently in use is an efficient 
00678 allocation for a specified number of bytes.
00679 
00680 $head v_ptr$$
00681 This argument has prototype
00682 $codei%
00683      const void* %v_ptr%
00684 %$$.
00685 It must be a pointer to memory that is currently in use; i.e.
00686 obtained by a previous call to $cref omp_get_memory$$ and not yet returned.
00687 
00688 $head num_bytes$$
00689 This argument has prototype
00690 $codei%
00691      size_t %num_bytes%
00692 %$$
00693 It specifies the number of bytes of the memory allocated by $icode v_ptr$$ 
00694 that we want to use.
00695 
00696 $head flag$$
00697 The return value has prototype
00698 $codei%
00699      bool %flag%
00700 %$$
00701 It is true, 
00702 a call to $code get_memory$$ with 
00703 $cref/min_bytes/omp_get_memory/min_bytes/$$
00704 equal to $icode num_bytes$$ would result in a value for
00705 $cref/cap_bytes/omp_get_memory/cap_bytes/$$ that is the same as when $code v_ptr$$
00706 was returned by $code get_memory$$; i.e.,
00707 $icode v_ptr$$ is an efficient memory block for $icode num_bytes$$
00708 bytes of information.
00709 
00710 $head Thread$$
00711 Either the $cref/current thread/omp_get_thread_num/$$ must be the same as during
00712 the corresponding call to $cref omp_get_memory$$,
00713 or the current execution mode must be sequential 
00714 (not $cref/parallel/omp_in_parallel/$$).
00715 
00716 $head NDEBUG$$
00717 If $code NDEBUG$$ is defined, $icode v_ptr$$ is not checked (this is faster).
00718 Otherwise, a list of in use pointers is searched to make sure
00719 that $icode v_ptr$$ is in the list. 
00720 
00721 $end
00722 ---------------------------------------------------------------------------
00723 $begin old_max_num_threads$$
00724 $spell
00725      inv
00726      CppAD
00727      num
00728      omp_alloc
00729 $$
00730 $section Set Maximum Number of Threads for omp_alloc Allocator$$
00731 
00732 $head Removed$$
00733 $index max_num_threads, omp_alloc$$
00734 $index omp_alloc, max_num_threads$$
00735 This function has been removed from the CppAD API.
00736 Use the function $cref/thread_alloc::parallel_setup/ta_parallel_setup/$$
00737 in its place.
00738 
00739 $head Syntax$$
00740 $codei%omp_alloc::max_num_threads(%number%)%$$
00741 
00742 $head Purpose$$
00743 By default there is only one thread and all execution is in sequential mode
00744 (not $cref/parallel/omp_in_parallel/$$).
00745 
00746 $head number$$
00747 The argument $icode number$$ has prototype
00748 $codei%
00749      size_t %number%
00750 %$$ 
00751 It must be greater than zero and specifies the maximum number of 
00752 OpenMP threads that will be active at one time.
00753 
00754 $head Restrictions$$
00755 This function must be called before the program enters 
00756 $cref/parallel/omp_in_parallel/$$ execution mode.
00757 
00758 $end
00759 -------------------------------------------------------------------------------
00760 */
00761 } // END_CPPAD_NAMESPACE
00762 
00763 # endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines