File: get_started.xrst

package info (click to toggle)
cppad 2026.00.00.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,584 kB
  • sloc: cpp: 112,960; sh: 6,146; ansic: 179; python: 71; sed: 12; makefile: 10
file content (56 lines) | stat: -rw-r--r-- 1,836 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{xrst_comment
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2024 Bradley M. Bell

This file is intended to help document the multi threading get_started examples

It has the following xrst template comments:
   title: Getting Started Using @Name@ Threads With CppAD
   start source code after: // <space> BEGIN_C++
   end source code before:  // <space> END_C++

It has the following xrst template replacements
   @Name@    : is the name of this threading system
   @####@    : is the underlining for the name of the threading system
   @DEFAULT@ : is macro a macro name. If it is 1 (0),
               the ADFun default ctor is used (is not used)
}

Getting Started Using @Name@ Threads With CppAD
######################@####@###################

in_parallel
***********
see :ref:`ta_parallel_setup@in_parallel` .

thread_number
*************
see :ref:`ta_parallel_setup@thread_num` .

ADFun Constructor
*****************
If you use the :ref:`fun_construct@Sequence Constructor` for the original
function, you will need to clear the Taylor coefficient memory associated
with the function using :ref:`capacity_order-name` ; e.g. ::

   {xrst_spell_off}
   CppAD::ADFun fun(ax, ay);
   fun.capacity_order(0);
   {xrst_spell_on}

If you do not free the Taylor coefficient memory in ``fun`` ,
the function assignments will allocate zero order Taylor coefficients for each
function in ``fun_thread`` using thread zero. Depending on what you do in
parallel mode, you may attempt to free that memory using another thread.
For example, if you change @DEFAULT@ from 1 to 0, you will
get the message::

   Attempt to return memory for a different thread while in parallel mode

Source Code
***********
{xrst_literal
   // BEGIN_C++
   // END_C++
}