x10ac_AD_f sets the computational mode in a configuration data structure for the NAG AD Library as created by a prior call to x10aa_AD_f. The full set of computational modes currently available are: nagad_algorithmic, nagad_symbolic, or nagad_symbolic_expert.
To be consistent with the naming scheme for other routines in the AD Library, five routines are available with names formed by replacing AD in the above by one of p0w, a1w, t1w, a1t1w or t2w.
This function is applicable whichever mode of AD is being used.
3Description
x10ac_AD_f sets the computational mode of differentiation in the configuration data object. This handle may then be passed to any computational routine in the NAG AD Library as listed in the Introduction to the NAG AD Library. The computational mode can be changed between calls to computational routines in the NAG AD Library. The computational modes currently available are nagad_algorithmic, nagad_symbolic, or nagad_symbolic_expert. See mode.
This routine must be called after a call to x10aa_AD_f (to create a handle to the configuration data object) and prior to the call of the computational NAG AD Library routines for which the mode is set.
3.1Life Cycle of the Handle
Each handle should pass four stages in its life: initialization; mode setting; problem solution using the NAG AD Library; and, destruction.
The initialization by x10aa_AD_f and destruction by x10ab_AD_f mark the beginning and the end of the life of the handle. During this time the handle must only be modified by NAG AD Library routines. Working with a handle which has not been properly initialized is potentially very dangerous as it may cause unpredictable behaviour.
After the handle has been initialized, two routines are provided to set or get the computational mode to be used in algorithmic differentiation. x10ac_AD_f sets the computational mode and x10ad_AD_f gets the computational mode.
The handle is then passed to the computational routines of the NAG AD Library. The computational mode can be changed, where appropriate, between calls to computational routines.
When all AD computation is completed, the handle must be destroyed by x10ab_AD_f.
4References
None.
5Arguments
1: – Pointer to AD DataInput/Output
On entry: a handle to the AD configuration data object, as created by x10aa_AD_f.
On exit: holds a handle to the internal data structure where the computational mode was changed according to mode. You must not change the handle other than via NAG AD Library calls until it is destroyed by x10ab_AD_f.
2: – IntegerInput
On entry: the computational mode to be used in subsequent calls to NAG AD Library computational routines.
The mode nagad_algorithmic is available to all computational routines; this means that differentiation of the primal algorithm (e.g., calculating adjoints) is performed by code, converted and instrumented from the primal code.
nagad_algorithmic is the default mode that is set if a computational routine is called without a previous call to x10ac_AD_f.
The modes nagad_symbolic and nagad_symbolic_expert are only available for the subset of computational routines listed in Section 3.2.2 in the X10 Chapter Introduction; these have been hand-coded using knowledge of the differentials of the primal algorithm.
Constraint:
, or .
3: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry: ad_handle is not a valid handle for the AD computational data object. Either ad_handle has not been initialized or it has become corrupted.
On entry, . Constraint: .
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
Not applicable.
8Parallelism and Performance
x10ac_AD_f is not threaded in any implementation.
9Further Comments
None.
10Example
See examples for computational routines in the NAG AD Library, for example, Section 10 in c05ay_a1w_f.