.. java:import:: fr.inria.tapenade.analysis ActivityPattern .. java:import:: fr.inria.tapenade.representation Block .. java:import:: fr.inria.tapenade.representation BlockStorage .. java:import:: fr.inria.tapenade.representation CallGraph .. java:import:: fr.inria.tapenade.representation ILUtils .. java:import:: fr.inria.tapenade.representation Instruction .. java:import:: fr.inria.tapenade.representation MemoryMaps .. java:import:: fr.inria.tapenade.representation MemMap .. java:import:: fr.inria.tapenade.representation NewSymbolHolder .. java:import:: fr.inria.tapenade.representation SymbolTable .. java:import:: fr.inria.tapenade.representation SymbolTableConstants .. java:import:: fr.inria.tapenade.representation TapEnv .. java:import:: fr.inria.tapenade.representation TapList .. java:import:: fr.inria.tapenade.representation Unit .. java:import:: fr.inria.tapenade.representation UnitStorage .. java:import:: fr.inria.tapenade.representation WrapperTypeSpec .. java:import:: fr.inria.tapenade.representation ModifiedTypeSpec .. java:import:: fr.inria.tapenade.representation ZoneInfo .. java:import:: fr.inria.tapenade.utils BoolVector .. java:import:: fr.inria.tapenade.utils TapIntList .. java:import:: fr.inria.tapenade.utils TapPair .. java:import:: fr.inria.tapenade.utils ILLang .. java:import:: java.io File DifferentiationEnv ================== .. java:package:: fr.inria.tapenade.differentiation :noindex: .. java:type:: public final class DifferentiationEnv Differentiation environment. .. parsed-literal:: Constant objects kept by the DifferentiationEnv: callGraphDifferentiator, FlowGraphDifferentiator, BlockDifferentiator, procedureCallDifferentiator, dynMemoryDifferentiator, expressionDifferentiator (soon), VarRefDifferentiator, multiDirMode, suffixes srcCallGraph, diffCallGraph Modifiable "current" objects during navigation inside IR and construction of IR: curUnit curActivity curDiffUnit curFwdDiffUnit curDiffUnitSort curDiffVarSort curBlock curVectorMap, curDiffVectorMap, curPtrVectorMap, curSymbolTable curInstruction curFwdSymbolTable, curBwdSymbolTable Fields ------ activeRootCalledFromContext ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected boolean activeRootCalledFromContext :outertype: DifferentiationEnv True when the curInstruction being differentiated is in context code and is a call to an active. adDiffMode ^^^^^^^^^^ .. java:field:: protected int adDiffMode :outertype: DifferentiationEnv The current differentiation mode for the current Unit. blockDifferentiator ^^^^^^^^^^^^^^^^^^^ .. java:field:: protected BlockDifferentiator blockDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate Basic Blocks. callGraphDifferentiator ^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected CallGraphDifferentiator callGraphDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate a callGraph. callersOfRootUnits ^^^^^^^^^^^^^^^^^^ .. java:field:: protected TapList callersOfRootUnits :outertype: DifferentiationEnv commonActivityMemoryMap ^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected MemoryMaps commonActivityMemoryMap :outertype: DifferentiationEnv copiedIncludes ^^^^^^^^^^^^^^ .. java:field:: protected TapList> copiedIncludes :outertype: DifferentiationEnv Association original include instruction to include instruction in diff. copiedUnits ^^^^^^^^^^^ .. java:field:: protected UnitStorage copiedUnits :outertype: DifferentiationEnv Association original Unit to copied original Unit in diff. copiedUnitsBack ^^^^^^^^^^^^^^^ .. java:field:: protected UnitStorage copiedUnitsBack :outertype: DifferentiationEnv Association copied original Unit in diff to original Unit. curBlock ^^^^^^^^ .. java:field:: protected Block curBlock :outertype: DifferentiationEnv The current source Block. curBwdSymbolTable ^^^^^^^^^^^^^^^^^ .. java:field:: protected SymbolTable curBwdSymbolTable :outertype: DifferentiationEnv The current bwd differentiated SymbolTable (i.e. of the current bwd diff Block). curDiffUnit ^^^^^^^^^^^ .. java:field:: protected Unit curDiffUnit :outertype: DifferentiationEnv The current "standard" differentiated Unit of the current Unit. Contains: -- in TANGENT_MODE: the tangent diff Unit. -- in ADJOINT_MODE: the joint diff Unit (fwd and bwd sweeps together) -- in ADJOINT_SPLIT_MODE: the bwd sweep alone. curDiffUnitPushesPointers ^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected boolean curDiffUnitPushesPointers :outertype: DifferentiationEnv True when differentiation notices that there must be a F90 INTERFACE declaration for PUSH/LOOK/POP POINTER(). curDiffUnitSort ^^^^^^^^^^^^^^^ .. java:field:: protected int curDiffUnitSort :outertype: DifferentiationEnv The current sort of derivatives for procedures. curDiffVarSort ^^^^^^^^^^^^^^ .. java:field:: protected int curDiffVarSort :outertype: DifferentiationEnv The current sort of derivatives for variables. curDiffVectorMap ^^^^^^^^^^^^^^^^ .. java:field:: protected int[] curDiffVectorMap :outertype: DifferentiationEnv The current diffVectorMap (i.e. of the current Unit+SymbolTable). curFwdDiffUnit ^^^^^^^^^^^^^^ .. java:field:: protected Unit curFwdDiffUnit :outertype: DifferentiationEnv The current "standard" differentiated Unit of the current Unit. Contains: -- in TANGENT_MODE: the tangent diff Unit. -- in ADJOINT_MODE: the joint diff Unit (fwd and bwd sweeps together) -- in ADJOINT_SPLIT_MODE: the bwd sweep alone. curFwdSymbolTable ^^^^^^^^^^^^^^^^^ .. java:field:: protected SymbolTable curFwdSymbolTable :outertype: DifferentiationEnv The current fwd differentiated SymbolTable (i.e. of the current fwd diff Block). curPtrVectorMap ^^^^^^^^^^^^^^^ .. java:field:: protected int[] curPtrVectorMap :outertype: DifferentiationEnv The current ptrVectorMap (i.e. of the current Unit+SymbolTable). curUnitIsActiveUnit ^^^^^^^^^^^^^^^^^^^ .. java:field:: protected boolean curUnitIsActiveUnit :outertype: DifferentiationEnv Global boolean true when "curUnit" is an active subroutine. curUnitIsContext ^^^^^^^^^^^^^^^^ .. java:field:: protected boolean curUnitIsContext :outertype: DifferentiationEnv Global boolean true when "curUnit" is currently differentiated as context. curVectorMap ^^^^^^^^^^^^ .. java:field:: protected int[] curVectorMap :outertype: DifferentiationEnv The current vectorMap (i.e. of the current Unit+SymbolTable). debugADHereUnit ^^^^^^^^^^^^^^^ .. java:field:: protected Unit debugADHereUnit :outertype: DifferentiationEnv The Unit of the external boolean function "DEBUG_***_HERE()". diffKind ^^^^^^^^ .. java:field:: protected int diffKind :outertype: DifferentiationEnv The kind of zones that are currently differentiated. Usually, it is SymbolTableConstants.REALKIND, but in a special mode, it can be ALLKIND!... dynMemoryDifferentiator ^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected DynMemoryDifferentiator dynMemoryDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate Dynamic Memory manipulations. emptyCopiedUnitSuffix ^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected boolean emptyCopiedUnitSuffix :outertype: DifferentiationEnv True when copied Units keep their original name. expressionDifferentiator ^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected ExpressionDifferentiator expressionDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate expressions. flowGraphDifferentiator ^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected FlowGraphDifferentiator flowGraphDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate FlowGraphs. hiddenDiffInitVariables ^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected TapList>> hiddenDiffInitVariables :outertype: DifferentiationEnv List of hidden variables to be diff-initialized for the current unit. hiddenInstrumentedVariables ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected TapList>> hiddenInstrumentedVariables :outertype: DifferentiationEnv List of hidden variables to be instrumented (for debug) for the current unit. hiddenPushPopVariables ^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected TapList>> hiddenPushPopVariables :outertype: DifferentiationEnv List of hidden variables to be PUSH/POP'ed for the current unit. iReplic ^^^^^^^ .. java:field:: protected int iReplic :outertype: DifferentiationEnv The current replica number for diff variables. integer4TypeSpec ^^^^^^^^^^^^^^^^ .. java:field:: protected WrapperTypeSpec integer4TypeSpec :outertype: DifferentiationEnv INTEGER*4 type integerTypeSpec ^^^^^^^^^^^^^^^ .. java:field:: protected WrapperTypeSpec integerTypeSpec :outertype: DifferentiationEnv The "INTEGER" WrapperTypeSpec, necessary to create new INTEGER variables. multiDirMode ^^^^^^^^^^^^ .. java:field:: protected boolean multiDirMode :outertype: DifferentiationEnv True to get vector loops around derivative instructions. procedureCallDifferentiator ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected ProcedureCallDifferentiator procedureCallDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate procedure calls. realTypeSpec ^^^^^^^^^^^^ .. java:field:: protected WrapperTypeSpec realTypeSpec :outertype: DifferentiationEnv The "REAL" WrapperTypeSpec, necessary to create new REAL variables. rootUnits ^^^^^^^^^ .. java:field:: protected TapList rootUnits :outertype: DifferentiationEnv suffixes ^^^^^^^^ .. java:field:: protected String[][] suffixes :outertype: DifferentiationEnv The array of all suffixes used during differentiation. toActiveTmpZones ^^^^^^^^^^^^^^^^ .. java:field:: protected TapIntList toActiveTmpZones :outertype: DifferentiationEnv toIndexSymbolHolders ^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected TapList toIndexSymbolHolders :outertype: DifferentiationEnv List of already created newSymbolHolders for variables named "indexN", used in sub-expressions in actual arguments of calls. This list is ordered with increasing N's. toTotalZones ^^^^^^^^^^^^ .. java:field:: protected TapIntList toTotalZones :outertype: DifferentiationEnv traceCurBlock ^^^^^^^^^^^^^ .. java:field:: protected int traceCurBlock :outertype: DifferentiationEnv 1 means trace on current Block. 2 means trace in even more detail (when traceCurDifferentiation is true). traceCurDifferentiation ^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected boolean traceCurDifferentiation :outertype: DifferentiationEnv Detailled trace of differentiation on the standard output: True when we want to trace differentiation on-the-fly on the current Unit (curUnit). traceDifferentiationUnits ^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected TapList traceDifferentiationUnits :outertype: DifferentiationEnv Units for which we want to trace differentiation on-the-fly. unitActivities ^^^^^^^^^^^^^^ .. java:field:: protected BlockStorage> unitActivities :outertype: DifferentiationEnv Activity info for the current Unit (curUnit). unitAvlXs ^^^^^^^^^ .. java:field:: protected BlockStorage> unitAvlXs :outertype: DifferentiationEnv AvlX info for the current Unit (curUnit). unitRecomputations ^^^^^^^^^^^^^^^^^^ .. java:field:: protected BlockStorage, TapList>>> unitRecomputations :outertype: DifferentiationEnv Recomputation (see TBR) info for the current Unit (curUnit). unitReqXs ^^^^^^^^^ .. java:field:: protected BlockStorage> unitReqXs :outertype: DifferentiationEnv ReqX info for the current Unit (curUnit). unitTBRs ^^^^^^^^ .. java:field:: protected BlockStorage>> unitTBRs :outertype: DifferentiationEnv TBR info for the current Unit (curUnit). unitUsefulnesses ^^^^^^^^^^^^^^^^ .. java:field:: protected BlockStorage> unitUsefulnesses :outertype: DifferentiationEnv Usefulness info for the current Unit (curUnit). usesADMM ^^^^^^^^ .. java:field:: protected boolean usesADMM :outertype: DifferentiationEnv True when differentiation notices that ADMM is used. varRefDifferentiator ^^^^^^^^^^^^^^^^^^^^ .. java:field:: protected VarRefDifferentiator varRefDifferentiator :outertype: DifferentiationEnv The object that knows how to differentiate memory references. Constructors ------------ DifferentiationEnv ^^^^^^^^^^^^^^^^^^ .. java:constructor:: protected DifferentiationEnv(CallGraph srcCallGraph, String[][] suffixes) :outertype: DifferentiationEnv Methods ------- addInHiddenDiffInitVariables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void addInHiddenDiffInitVariables(ZoneInfo zoneInfo) :outertype: DifferentiationEnv addInHiddenInstrumentedVariables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void addInHiddenInstrumentedVariables(ZoneInfo zoneInfo) :outertype: DifferentiationEnv addInHiddenPushPopVariables ^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void addInHiddenPushPopVariables(ZoneInfo zoneInfo) :outertype: DifferentiationEnv allocateTmpZone ^^^^^^^^^^^^^^^ .. java:method:: protected int allocateTmpZone() :outertype: DifferentiationEnv Allocate a new zone number for a new temporary variable. increments the head of "toTotalZones", that contains the last zone used. curActivity ^^^^^^^^^^^ .. java:method:: protected ActivityPattern curActivity() :outertype: DifferentiationEnv :return: The activity pattern for which we are differentiating the current Unit. curInstruction ^^^^^^^^^^^^^^ .. java:method:: protected Instruction curInstruction() :outertype: DifferentiationEnv :return: The current (source) Instruction. curSymbolTable ^^^^^^^^^^^^^^ .. java:method:: protected SymbolTable curSymbolTable() :outertype: DifferentiationEnv :return: The current source SymbolTable (i.e. of the current source Block). curUnit ^^^^^^^ .. java:method:: protected Unit curUnit() :outertype: DifferentiationEnv :return: The current source Unit being analyzed or differentiated. diffCallGraph ^^^^^^^^^^^^^ .. java:method:: protected CallGraph diffCallGraph() :outertype: DifferentiationEnv The differentiated CallGraph. getCurrentFilename ^^^^^^^^^^^^^^^^^^ .. java:method:: public String getCurrentFilename(boolean fullPath) :outertype: DifferentiationEnv Get the filename in which we are differentiating at a given time :param fullPath:: true if the path to file is kept or simply the filename :return: either the filename where the current unit is located (fullPath = False) or path + filename getDiffOfModule ^^^^^^^^^^^^^^^ .. java:method:: protected Unit getDiffOfModule(Unit unit) :outertype: DifferentiationEnv getDiffOfUnit ^^^^^^^^^^^^^ .. java:method:: protected Unit getDiffOfUnit(Unit unit, ActivityPattern pattern, int diffMode) :outertype: DifferentiationEnv getOrigUnitOfPrimalCopy ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected Unit getOrigUnitOfPrimalCopy(Unit unit) :outertype: DifferentiationEnv getPatternsForCallingUnitPattern ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected TapList getPatternsForCallingUnitPattern(ActivityPattern callerPattern, Unit calledUnit) :outertype: DifferentiationEnv :param callerPattern: The activity pattern of this particular call site. :param calledUnit: The called unit :return: the ActivityPatterns for a "calledUnit" that are used at a particular call site, i.e. only the patterns of "calledUnit" that may be called here in the caller's pattern. When the call site is a module, the callerPattern is null and all called patterns are returned. getPrimalCopyOfOrigUnit ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected Unit getPrimalCopyOfOrigUnit(Unit unit) :outertype: DifferentiationEnv hideActiveTmpZones ^^^^^^^^^^^^^^^^^^ .. java:method:: protected void hideActiveTmpZones() :outertype: DifferentiationEnv popCurDiffSorts ^^^^^^^^^^^^^^^ .. java:method:: protected void popCurDiffSorts() :outertype: DifferentiationEnv popCurDiffUnit ^^^^^^^^^^^^^^ .. java:method:: protected void popCurDiffUnit() :outertype: DifferentiationEnv popCurDiffVectorMap ^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void popCurDiffVectorMap() :outertype: DifferentiationEnv popCurSymbolTable ^^^^^^^^^^^^^^^^^ .. java:method:: protected void popCurSymbolTable() :outertype: DifferentiationEnv popCurUnitEtc ^^^^^^^^^^^^^ .. java:method:: protected void popCurUnitEtc() :outertype: DifferentiationEnv popCurVectorMap ^^^^^^^^^^^^^^^ .. java:method:: protected void popCurVectorMap() :outertype: DifferentiationEnv pushCurDiffSorts ^^^^^^^^^^^^^^^^ .. java:method:: protected void pushCurDiffSorts(int diffUnitSort, int diffVarSort) :outertype: DifferentiationEnv pushCurDiffUnit ^^^^^^^^^^^^^^^ .. java:method:: protected void pushCurDiffUnit(Unit diffUnit) :outertype: DifferentiationEnv pushCurDiffVectorMap ^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void pushCurDiffVectorMap(int[] diffVectorMap) :outertype: DifferentiationEnv Current pointer Type vectorMap :param diffVectorMap: current diff vectorMap pushCurSymbolTable ^^^^^^^^^^^^^^^^^^ .. java:method:: protected void pushCurSymbolTable(SymbolTable symbolTable) :outertype: DifferentiationEnv pushCurUnitEtc ^^^^^^^^^^^^^^ .. java:method:: protected void pushCurUnitEtc(Unit unit) :outertype: DifferentiationEnv pushCurVectorMap ^^^^^^^^^^^^^^^^ .. java:method:: protected void pushCurVectorMap(int[] vectorMap) :outertype: DifferentiationEnv resetActiveTmpZones ^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void resetActiveTmpZones() :outertype: DifferentiationEnv setCurActivity ^^^^^^^^^^^^^^ .. java:method:: protected void setCurActivity(ActivityPattern activity) :outertype: DifferentiationEnv Sets and redistributes the global current activity pattern for the current Unit. setCurBlock ^^^^^^^^^^^ .. java:method:: protected void setCurBlock(Block block) :outertype: DifferentiationEnv setCurBwdSymbolTable ^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurBwdSymbolTable(SymbolTable symbolTable) :outertype: DifferentiationEnv setCurDiffSorts ^^^^^^^^^^^^^^^ .. java:method:: protected void setCurDiffSorts(int diffUnitSort, int diffVarSort) :outertype: DifferentiationEnv setCurDiffUnit ^^^^^^^^^^^^^^ .. java:method:: protected void setCurDiffUnit(Unit diffUnit) :outertype: DifferentiationEnv setCurDiffVectorMap ^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurDiffVectorMap(int[] diffVectorMap) :outertype: DifferentiationEnv setCurFwdDiffUnit ^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurFwdDiffUnit(Unit fwdDiffUnit) :outertype: DifferentiationEnv setCurFwdSymbolTable ^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurFwdSymbolTable(SymbolTable symbolTable) :outertype: DifferentiationEnv setCurInstruction ^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurInstruction(Instruction instr) :outertype: DifferentiationEnv setCurPtrVectorMap ^^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurPtrVectorMap(int[] ptrVectorMap) :outertype: DifferentiationEnv setCurSymbolTable ^^^^^^^^^^^^^^^^^ .. java:method:: protected void setCurSymbolTable(SymbolTable symbolTable) :outertype: DifferentiationEnv setCurUnitEtc ^^^^^^^^^^^^^ .. java:method:: protected void setCurUnitEtc(Unit unit) :outertype: DifferentiationEnv Sets and redistributes the global current source Unit ("curUnit"), and sets traceCurDifferentiation boolean accordingly, and resets global curInstruction to null. setCurVectorMap ^^^^^^^^^^^^^^^ .. java:method:: protected void setCurVectorMap(int[] vectorMap) :outertype: DifferentiationEnv setDiffCallGraph ^^^^^^^^^^^^^^^^ .. java:method:: protected void setDiffCallGraph(CallGraph diffCallGraph) :outertype: DifferentiationEnv setDiffCallGraphAndRootUnits ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: protected void setDiffCallGraphAndRootUnits(CallGraph diffCG, TapList rootUnits) :outertype: DifferentiationEnv someUnitsAreTraced ^^^^^^^^^^^^^^^^^^ .. java:method:: public boolean someUnitsAreTraced() :outertype: DifferentiationEnv srcCallGraph ^^^^^^^^^^^^ .. java:method:: protected CallGraph srcCallGraph() :outertype: DifferentiationEnv The source/original non-differentiated CallGraph.