Ticket #179 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

need logic for explicit initialization of derivative components

Reported by: utke Owned by: hlcm
Priority: major Milestone: AD for SAS
Component: xaifBooster Keywords:
Cc:

Description

this is needed when the code uses constructs preventing the default initialization in the active module.

Change History

follow-up: ↓ 6   Changed 4 years ago by utke

  • owner changed from utke to hlcm
  • status changed from new to assigned

The current active type has a default initialization to 0 that is needed for correctness of the adjoint computation but is not permitted in Fortran if the active type occurs e.g. in an Equivalence.
The analog in C/C++ is the use of the active type in a "union".
For this scenario we need an option for explicit initialization or the active type of
A: all locally declared variables (that are not "static") in a given procedure
B: all globally declared variables at some predefined point.

For A: a change in the xaif may be needed to distinguish scopes for static from non-static variables.
For B: the postprocessor should generate an initialization procedure to be called
by having the user inject the call into his driver code.

  Changed 4 years ago by utke

  • milestone set to MATWS adjoint

  Changed 4 years ago by utke

There is also already a need in forward mode to initialize the derivative component of the the temporary propagation variables or alternatively we change the accumulation logic

  Changed 4 years ago by utke

in Init branch so far...

============================ xaifBooster
hg out:------------------
1140:00f35b21663c
1141:b722fac3b935
1142:79d51b7be4da
1143:8c0838c0a01c
1144:b66e179fa167
1148:00a34e845bcb

  Changed 4 years ago by utke

more changesets:

1149:8cd158fde9b3
1150:6f09a7237ff6
1151:f7d1ff5cd420
1152:c9f0d81e51a3
1161:679ce59503f7

in reply to: ↑ 1   Changed 4 years ago by utke

Replying to utke:

The current active type has a default initialization to 0 that is needed for correctness of the adjoint computation but is not permitted in Fortran if the active type occurs e.g. in an Equivalence.
The analog in C/C++ is the use of the active type in a "union".
For this scenario we need an option for explicit initialization or the active type of
A: all locally declared variables (that are not "static") in a given procedure
B: all globally declared variables at some predefined point.

For A: a change in the xaif may be needed to distinguish scopes for static from non-static variables.
For B: the postprocessor should generate an initialization procedure to be called
by having the user inject the call into his driver code.

Addendum to B:
to avoid nameclashes between modules and common blocks we step through the global symbol table
and for each module and each common block generate a separate init procedure
all of which are kept in a list and then called in a cover-all init. Example:

common /CA/ a,b,c,
double precision a,b,c

turns into:

subroutine CA_init

common /CA/ a,b,c,
double precision a,b,c
a%d=0 etc

end subroutine

and then
subroutine OAD_globalVar_init()
call CA_init()
call ..._init
end subroutine

  Changed 4 years ago by utke

notes for fixing:
- doxygen class level comments for new classes in BBpreaccumulation
- remove algAction1 and the vertex label writer class from ControlFlowReversal? that was used as a template for the new CallGraphAlg? in BBP
- revisit changes in ControlFlowReversal?/driver/Makefile and TraceDiff?/driver/Makefile
- have a -D flag now in ControlFlowReversal/CallGraphAlg? and the BBP/CallGraphAlg which doesn't work. need to have only one and the question is if one should inherit from the other. TBD.
- revisit changes in ControlFlowReversal?/src/ReversibleControlFlowGraph.cpp lines 229/238 etc.

  Changed 4 years ago by utke

  • milestone changed from MATWS adjoint to AD for SAS

  Changed 4 years ago by hlcm

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.