Ignore:
Timestamp:
Jul 12, 2016 4:18:44 AM (3 years ago)
Author:
kulshres
Message:

Merge branch 'master' of 'gitclone' into 'svn'

The following changes have been merged:

commit e2291bde44a282a133894b0db350aeb0b92a87db
Author: Mladen Banovic <mladenbanovic2705@…>
Date: Fri Jul 8 10:15:51 2016 +0200

Add methods getNumLiveVar and getNumDir in adtl.h, change counter type in FOR_I_EQ_0_LT_NUMDIR macro to size_t (instead of int). Update chunk size of BOOST pool in adouble_tl.cpp according to adouble::numDir.

commit 2ffb294465b973bfd4bf1f73d84478f8233c0d2f
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Jun 23 12:32:14 2016 +0200

implement missing ref_eq_mult_p und ref_eq_min_p in ho_rev.c

somehow these were left out when parameters were being implemented.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 8cf0e5c1bd36f1dcf3be72cd67de631b2e1d0ee6
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Jun 23 12:31:04 2016 +0200

make sure the result is the last locint written in trace for each operation

since we're trying to generate ascii traces in the future, we'll need this
convention that the last location is the result, and previous locations
are arguments. This has been the case for almost all operations anyway
except for a few new one's that I wrote without keeping this in mind.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 9ae0ff220f37463f2ed85cafc8a626c24e472f2f
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Jun 21 14:16:27 2016 +0200

on some compilers newer boost interferes with AC_FUNC_MALLOC test

so do AC_FUNC_MALLOC and AC_FUNC_REALLOC as usual and check for boost
library later.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit b746f620772cc8cce53e8f350adc6281279caf72
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Jun 20 15:32:22 2016 +0200

make Klaus Röbenack's name UTF-8 instead of ISO-8859-1

These are the only places where we're not simple ASCII or UTF-8 already

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 1171aa3961b5eb46a5d2ee64751c02a393a8a6f5
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Jun 17 10:42:39 2016 +0200

correct short_ref document about include file

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 2c6b2aac2ef04431ece2c6ff80e574aa2e58814b
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Jun 17 10:40:34 2016 +0200

correct error message to new semantics

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 506cde73451740bf0a15eff7d4abb158ee719ab0
Author: mflehmig <martin.flehmig@…>
Date: Fri Jun 17 10:14:26 2016 +0200

Fixed include of ADOL-C header.

ADOL-C header was included in old fashion (without adolc directory) for this example.

commit 2a023d3281d3d6d9824bad724a5768e3ee2fff94
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Jun 16 13:50:39 2016 +0200

Try to use boost::pool for allocating advals in traceless vector mode

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 80f1e2019ac1faab96fe06f3e9da47efcc1bcd23
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon May 23 15:13:22 2016 +0200

correct a reference in doc and rebuild

commit d7ab5283afe58bacb2e8739d72ede4e17f4c8081
Author: Mladen Banovic <mladenbanovic2705@…>
Date: Fri May 20 16:42:13 2016 +0200

Update section 7 of adolc-manual related to the Traceless forward differentiation.

commit bedb8e36f959c5272e4610fe504acc83208e5e9d
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue May 17 16:09:36 2016 +0200

macro name correction

commit 92ff596a0331776901df7f172ca347572e3daafd
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue May 17 15:56:17 2016 +0200

Add a warning about using static build of ADOL-C

static build of ADOL-C does not call constructors
for internal global objects, thereby causing
segmentation faults.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/doc/adolc-manual.tex

    r689 r708  
    32853285%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    32863286%
    3287 \section{Tapeless forward differentiation in ADOL-C}
     3287\section{Traceless forward differentiation in ADOL-C}
    32883288\label{tapeless}
    32893289%
    32903290Up to version 1.9.0, the development of the ADOL-C software package
    32913291was based on the decision to store all data necessary for derivative
    3292 computation on tapes, where large applications require the tapes to be
     3292computation on traces (tapes), where large applications require the traces to be
    32933293written out to corresponding files. In almost all cases this means
    32943294a considerable drawback in terms of run time due to the excessive
    3295 memory accesses. Using these tapes enables ADOL-C to offer multiple
     3295memory accesses. Using these traces enables ADOL-C to offer multiple
    32963296functions. However, it is not necessary for all tasks of derivative
    32973297computation to do that.
    32983298
    3299 Starting with version 1.10.0, ADOL-C now features a tapeless forward
     3299Starting with version 1.10.0, ADOL-C now features a traceless forward
    33003300mode for computing first order derivatives in scalar mode, i.e.,
    33013301$\dot{y} = F'(x)\dot{x}$, and in vector mode, i.e., $\dot{Y} = F'(x)\dot{X}$.
    3302 This tapeless variant coexists with the more universal
    3303 tape based mode in the package. The following subsections describe
    3304 the source code modifications required to use the tapeless forward mode of
     3302This traceless variant coexists with the more universal
     3303trace based mode in the package. The following subsections describe
     3304the source code modifications required to use the traceless forward mode of
    33053305ADOL-C. 
    33063306%
     
    33153315y_3  =  \arctan(x_2/x_1),
    33163316\end{eqnarray*}
    3317 as an example. The corresponding source code is shown in \autoref{fig:tapeless}.
     3317as an example. The corresponding source code is shown in \autoref{fig:traceless}.
    33183318\begin{figure}[htb]
    33193319\framebox[\textwidth]{\parbox{\textwidth}{
     
    33433343%\end{center}
    33443344}}
    3345 \caption{Example for tapeless forward mode}
    3346 \label{fig:tapeless}
     3345\caption{Example for traceless forward mode}
     3346\label{fig:traceless}
    33473347\end{figure}
    33483348%
    33493349Changes to the source code that are necessary for applying the
    3350 tapeless forward ADOL-C are described in the following two
     3350traceless forward mode of ADOL-C are described in the following two
    33513351subsections, where the vector mode version is described
    33523352as extension of the scalar mode.
     
    33543354\subsubsection*{The scalar mode}
    33553355%
    3356 To use the tapeless forward mode, one has to include only
     3356To use the traceless forward mode, one has to include only
    33573357the header file \verb#adtl.h# since it does not include the
    3358 tape based functions defined in other header files.
    3359 
    3360 As in the tape based forward version of ADOL-C all derivative
     3358trace based functions defined in other header files.
     3359
     3360As in the trace based forward version of ADOL-C all derivative
    33613361calculations are introduced by calls to overloaded
    3362 operators. Therefore, similar to the tape-based version all
     3362operators. Therefore, similar to the trace-based version all
    33633363independent, intermediate and dependent variables must be declared
    3364 with type {\sf adouble}. The whole tapeless functionality provided by
     3364with type {\sf adouble}. The whole traceless functionality provided by
    33653365\verb#adtl.h# was written as complete inline intended code
    33663366due to run time aspects, where the real portion of inlined code can
    33673367be influenced by switches for many compilers. Likely, the whole
    33683368derivative code is inlined by default. Our experiments
    3369 with the tapeless mode have produced complete inlined code by using
     3369with the traceless mode have produced complete inlined code by using
    33703370standard switches (optimization) for GNU and Intel C++
    33713371compiler.
    33723372
    33733373To avoid name conflicts
    3374 resulting from the inlining the tapeless version has its own namespace
     3374resulting from the inlining the traceless version has its own namespace
    33753375\verb#adtl#. As a result four possibilities of using the {\sf adouble}
    3376 type are available for the tapeless version:
     3376type are available for the traceless version:
    33773377\begin{itemize}
    33783378\item Defining a new type
     
    34073407        \begin{center}
    34083408          \begin{tabular}{l}
    3409             {\sf \#using namespace adtl;}\\
     3409            {\sf using namespace adtl;}\\
    34103410            ...\\
    34113411            {\sf adouble tmp;}
     
    34183418function evaluation. This can be done by assigning the variables a {\sf
    34193419double} value. The {\sf ad}-value is set to zero in this case.
    3420 Additionally, the tapeless forward mode variant of ADOL-C
     3420Additionally, the traceless forward mode variant of ADOL-C
    34213421offers a function named {\sf setValue} for setting the value without
    34223422changing the {\sf ad}-value. To set the {\sf ad}-values of the independent
    3423 variables ADOL-C offers two possibilities: 
     3423variables ADOL-C offers two possibilities:
    34243424\begin{itemize}
    34253425  \item Using the constructor
    34263426        \begin{center}
    34273427          \begin{tabular}{l}
    3428             {\sf adouble x1(2,1), x2(4,0), y;}
     3428        {\sf double seedOne = 1., seedZero = 0.;}\\
     3429            {\sf adouble x1(2,\&seedOne), x2(4,\&seedZero), y;}
    34293430          \end{tabular}
    34303431        \end{center}
     
    34363437         \begin{center}
    34373438           \begin{tabular}{l}
     3439         {\sf double seedOne = 1., seedZero = 0.;}\\
    34383440             {\sf adouble x1=2, x2=4, y;}\\
    34393441             ...\\
    3440              {\sf x1.setADValue(1);}\\
    3441              {\sf x2.setADValue(0);}
     3442             {\sf x1.setADValue(\&seedOne);}\\
     3443             {\sf x2.setADValue(\&seedZero);}
    34423444           \end{tabular}
    34433445         \end{center}
    3444          The same example as above but now using {\sf setADValue}-method for initializing the derivative values.
     3446         The same example as above but now using {\sf setADValue}-method for initializing the derivative values. It is important to note that in both cases the derivative values have to be set by passing an address of a variable or a pointer of the {\sf double} type (instead of passing the value directly). The reason for doing this will become clear in the next subsection.
    34453447\end{itemize}
    34463448%
    34473449The derivatives can be obtained at any time during the evaluation
    3448 process by calling the {\sf getADValue}-method
     3450process by calling the {\sf getADValue}-method which returns a pointer (instead of a value), and therefore, it can be assigned to another pointer or it can be dereferenced immediately in order to read the value:
    34493451\begin{center}
    34503452  \begin{tabular}{l}
    34513453    {\sf adouble y;}\\
    34523454    ...\\
    3453     {\sf cout $<<$ y.getADValue();}
     3455    {\sf cout $<<$ *(y.getADValue());}
    34543456  \end{tabular}
    34553457\end{center}
     
    34753477\> {\sf \rule{1cm}{0pt}...}\\
    34763478\\
    3477 \> {\sf \rule{0.5cm}{0pt}x[0].setADValue(1);\hspace*{3cm}// derivative of f with respect to $x_1$}\\
     3479\> {\sf \rule{0.5cm}{0pt}double seed = 1.;}\\
     3480\> {\sf \rule{0.5cm}{0pt}x[0].setADValue(\&seed);\hspace*{3cm}// derivative of f with respect to $x_1$}\\
    34783481\> {\sf \rule{0.5cm}{0pt}y[0] = sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2]);}\\
    34793482\> {\sf \rule{0.5cm}{0pt}y[1] = atan(sqrt(x[0]*x[0]+x[1]*x[1])/x[2]);}\\
     
    34813484\\
    34823485\> {\sf \rule{0.5cm}{0pt}cout $<<$ "y1=" $<<$ y[0].getValue() $<<$ " , y2=" $<<$ y[1].getValue ... ;}\\
    3483 \> {\sf \rule{0.5cm}{0pt}cout $<<$ "dy2/dx1 = " $<<$ y[1].getADValue() $<<$ endl;}\\
     3486\> {\sf \rule{0.5cm}{0pt}cout $<<$ "dy2/dx1 = " $<<$ *(y[1].getADValue()) $<<$ endl;}\\
    34843487\> {\sf \rule{0.5cm}{0pt}return 0;}\\
    34853488\> {\sf \}}
     
    34873490%\end{center}
    34883491}}
    3489 \caption{Example for tapeless scalar forward mode}
     3492\caption{Example for traceless scalar forward mode}
    34903493\label{fig:modcode}
    34913494\end{figure}
     
    35063509error. \verb#adtl::setNumDir(N)# must therefore be called before
    35073510declaring any \verb#adtl::adouble# objects.
    3508  
    3509 Compared to the scalar case setting and getting the derivative
    3510 values, i.e. the directions, is more involved. Instead of
    3511 working with single {\sf double} values, pointer to fields of {\sf
    3512 double}s are used as illustrated by the following example:
     3511
     3512Setting and getting the derivative values is done in the same manner as in the scalar case, by passing and retrieving the pointers, as illustrated in the following example:
    35133513\begin{center}
    35143514  \begin{tabular}{l}
     
    35243524  \end{tabular}
    35253525\end{center}
    3526 Additionally, the tapeless vector forward mode of ADOL-C offers two
    3527 new methods for setting/getting the derivative values. Similar
    3528 to the scalar case, {\sf double} values are used but due to the vector
    3529 mode the position of the desired vector element must be supplied in
    3530 the argument list:
     3526Now using the pointers in the methods {\sf setADValue} and {\sf getADValue} makes more sense since the vector mode requires the field of $p$ elements per {\sf adouble} which holds the derivative values.
     3527Additionally, the traceless vector forward mode of ADOL-C offers two
     3528new methods for setting/getting the derivative values. Setting a derivative value of the desired vector element is possible by passing a {\sf double} value and its position in the vector ({\sf integer}). Getting a derivative value of the desired vector element requires as argument only its position in the vector. One can note that the pointers are not used in these cases, as illustrated in the following example:
    35313529\begin{center}
    35323530  \begin{tabular}{l}
     
    35783576\end{tabbing}
    35793577}}
    3580 \caption{Example for tapeless vector forward mode}
     3578\caption{Example for traceless vector forward mode}
    35813579\label{fig:modcode2}
    35823580\end{figure}
     
    35903588\begin{center}
    35913589  \begin{tabular}{l}
    3592     {\sf g++ -I/home/username/adolc\_base/include -c tapeless\_scalar.cpp}
     3590    {\sf g++ -I/home/username/adolc\_base/include -c traceless\_scalar.cpp}
    35933591  \end{tabular}
    35943592\end{center}
     
    36043602\begin{center}
    36053603  \begin{tabular}{l}
    3606     {\sf g++ -o tapeless\_scalar tapeless\_scalar.o -ladolc -L/home/username/adolc\_base/lib}
     3604    {\sf g++ -o traceless\_scalar traceless\_scalar.o}\\
     3605    {\sf -Wl,-{}-rpath -Wl,/home/username/adolc\_base/lib -L/home/username/adolc\_base/lib -ladolc}
    36073606  \end{tabular}
    36083607\end{center}
    3609 The mentioned source codes {\sf tapeless\_scalar.c} and {\sf tapeless\_vector.c}
    3610 illustrating the use of the for tapeless scalar and vector mode can be found in
     3608The mentioned source codes {\sf traceless\_scalar.c} and {\sf traceless\_vector.c}
     3609illustrating the use of the for traceless scalar and vector mode can be found in
    36113610the directory {\sf examples}.
    36123611%
    3613 \subsection{Concluding Remarks for the Tapeless Forward Mode Variant}
    3614 %
    3615 As many other AD methods the tapeless forward mode provided by the
     3612\subsection{Concluding Remarks for the Traceless Forward Mode Variant}
     3613%
     3614As many other AD methods the traceless forward mode provided by the
    36163615ADOL-C package has its own strengths and drawbacks. Please read the
    36173616following section carefully to become familiar with the things that
     
    36223621      \item Code speed\\
    36233622        Increasing computation speed was one of the main aspects in writing
    3624         the tapeless code. In many cases higher performance can be
     3623        the traceless code. In many cases higher performance can be
    36253624        expected this way. However this is not guarenteed for repeated
    36263625        evaluations.
    36273626      \item Smaller overall memory requirements\\
    3628         Tapeless ADOL-C does not write tapes anymore, as the name
     3627        Traceless ADOL-C does not write traces anymore, as the name
    36293628        implies. Loop ''unrolling'' can be avoided this
    36303629        way. Considered main memory plus disk space as overall memory
    3631         requirements the tapeless version can be
     3630        requirements the traceless version can be
    36323631        executed in a more efficient way.
    36333632    \end{itemize}
     
    36373636      The ability to compute derivatives to a given function is
    36383637      bounded by the main memory plus swap size  when using
    3639       tapeless ADOL-C. Computation from swap should be avoided anyway
     3638      traceless ADOL-C. Computation from swap should be avoided anyway
    36403639      as far as possible since it slows down the computing time
    36413640      drastically. Therefore, if the program execution is 
     
    36503649      where the storage size of all non {\sf adouble} based variables is described by $M_p$.
    36513650    \item Compile time\\
    3652       As discussed in the previous sections, the tapeless forward mode of
     3651      As discussed in the previous sections, the traceless forward mode of
    36533652      the ADOL-C package is implemented as inline intended version. Using
    36543653      this approach results in a higher source code size, since every
     
    36563655      operation itself as well as for the corresponding derivative
    36573656      code after the inlining process. Therefore, the compilation time
    3658       needed for the tapeless version may be higher than that of the tape based code.
     3657      needed for the traceless version may be higher than that of the trace based code.
    36593658    \item Code Size\\
    36603659      A second drawback and result of the code inlining is the
    36613660      increase of code sizes for the binaries. The increase
    3662       factor compared to the corresponding tape based program is
     3661      factor compared to the corresponding trace based program is
    36633662      difficult to quantify as it is task dependent. Practical results
    36643663      have shown that values between 1.0 and 2.0 can be
     
    37123711\end{eqnarray*}
    37133712as an example. We now calculate the Jacobian at $M=1024$ different points.
    3714 The source code for one point is shown in \autoref{fig:tapeless}. This example
     3713The source code for one point is shown in \autoref{fig:traceless}. This example
    37153714has no real application but can still be used to show the combination of the traceless version
    37163715of ADOL-C and Cuda.
Note: See TracChangeset for help on using the changeset viewer.