Directive

public class Directive

Tapenade directives, mostly about AD.

Fields

BINOMIALCKP

public static final int BINOMIALCKP

Time-stepping loops to be adjoined with binomial checkpointing.

CHECKPOINT

public static final int CHECKPOINT

Subroutine to be checkpointed.

CHECKPOINTEND

public static final int CHECKPOINTEND

End of a piece of code to be checkpointed.

CHECKPOINTSTART

public static final int CHECKPOINTSTART

Start of a piece of code to be checkpointed.

DEBUGCALL

public static final int DEBUGCALL

Trigger debug AD of the current call.

DEBUGHERE

public static final int DEBUGHERE

Trigger debug AD at the current point.

FIXEDPOINTLOOP

public static final int FIXEDPOINTLOOP

Piece of code containing a Fixed Point loop.

IILOOP

public static final int IILOOP

Independent-Iterations parallel loops.

LABEL_END

public static final int LABEL_END

End of a piece of code identified with a label

LABEL_START

public static final int LABEL_START

Start of a piece of code identified with a label

MULTITHREAD_ADJ

public static final int MULTITHREAD_ADJ

Directive that overrides multithread memory layout decision for adjoint differentiated variables

MULTITHREAD_TGT

public static final int MULTITHREAD_TGT

Directive that overrides multithread memory layout decision for tangent differentiated variables

NOCHECKPOINT

public static final int NOCHECKPOINT

Subroutine NOT to be checkpointed.

NODIFFEND

public static final int NODIFFEND

End of a piece of code NOT to be differentiated.

NODIFFSTART

public static final int NODIFFSTART

Start of a piece of code NOT to be differentiated.

SPECIALIZEACTIVITY

public static final int SPECIALIZEACTIVITY

Subroutine for which there may be specialized differentiations for each activity pattern.

adjReduction

public Float adjReduction

adjResidual

public Float adjResidual

For stopping criterion of adjoint fixed-point loops

arguments

public Tree[] arguments

Arguments linked to a directive.

label

public String label

name of a part, procedure.

type

public int type

Type of Directive.

Constructors

Directive

public Directive(int directiveType)

Constructor.

Parameters
  • directiveType – Directive Type.

Methods

analyzeInstructionDirectives

protected static void analyzeInstructionDirectives(Instruction instruction, Tree instructionComments)

Analyze the comments attached to the “instruction”, to find the AD directives.

analyzeMultithreadScopings

public static void analyzeMultithreadScopings(Tree scopingsStringTree, boolean caseSensitive, TapList<Tree> toClausesGivenScoping, TapList<String> toForcedAtomicScopingNames, TapList<String> toForcedOtherScopingNames)

Called by BlockDifferentiator to analyze the contents of an “$AD MULTITHREAD TGT_or_ADJ” directive. Current syntax is:

  • global(variables) : diff of variables must be OMP shared or Cuda globals

  • noconflict(variables) : same as global(variables)

  • shared(variables) : same as global(variables), but deprecated because “shared” meaning is different in Cuda

  • atomic(variables) : diff of variables must be OMP shared or Cuda globals with all usages atomic

  • private(variables) : diff of variables must be OMP private or Cuda registers (non-global)

  • firstprivate(variables) : diff of variables must be OMP firstprivate

  • lastprivate(variables) : diff of variables must be OMP lastprivate

  • reduction(op:variables) : diff of variables must be OMP reduction with given op

Parameters
  • scopingsStringTree – A tree of given scopings e.g. “atomic(X,Y) reduction(+:Z,R) global(V)”

  • caseSensitive – false for Fortran.

  • toClausesGivenScoping – will contain the corresponding future new scoping clauses.

  • toForcedAtomicScopingNames – will contain the names of variables that are forced to (global)ATOMIC.

  • toForcedOtherScopingNames – will contain the names of variables that are forced to another scoping.

analyzeUnitDirectives

protected static void analyzeUnitDirectives(Unit unit, Tree unitComments)

Analyze the comments attached to the header of “unit”, to find the AD directives.

containDirectives

protected static boolean containDirectives(TapList<Tree> commentsList)
Returns

true if some of the given comments trees are indeed directives.

containDirectives

protected static boolean containDirectives(Tree commentTree)
Returns

true if some contents of the given commentTree are indeed directives.

getDirectiveText

protected static String getDirectiveText(Tree comment)

When “comment” is an AD directive, returns the directive text after the “AD_DIRECTIVE_HEAD”. Otherwise returns null.

Parameters
  • comment – A comment.

Returns

The text of the directive

hasDirective

public static Directive hasDirective(TapList<Directive> directives, int kind)
Returns

a “kind” directive in a list of Directive’s.

hasDirective

public static Directive hasDirective(TapList<Directive> directives, int kind, String label)
Returns

a “kind” directive with the given “label” in a list of Directive’s.

isEndOfRegionDirective

protected static boolean isEndOfRegionDirective(Tree comment)

isIILoopDirective

protected static boolean isIILoopDirective(Tree comment)

rebuildFullDirective

public String rebuildFullDirective()

startKind

public static int startKind(int endKind)

toString

public String toString()