Closed rhaas80 closed 4 years ago
Before applying the first couple of commits should be squashed so that in the end there are only 2 commits: 1 to introduce Kranc_SelectXForY
and one to add a READS for stress_energy_state
.
I verified that a ET_2019_10_v0 version of McLachlan's MMA files can be translated using this version of Kranc, compiled and linked against ET_2019_10_v0 everything and passes all tests.
I will merge the branch into master (after squashing as indicated above) tomorrow May 27th.
This pull requests adds support for Cactus' "PreSync" functionality to Kranc. Using PreSync the Driver, Boundary thorn and flesh collaborate to use the READS / WRITES statements in the schedule to keep track of which regions of the grid are valid and, if a READS requires data that is currently invalid but can be supplied by a SYNC and / or application of boundary and symmetry conditions, will execute those before a scheduled routine starts.
To this end a thorn has to inform the driver about the boundary condition to apply to each grid variable by calling a function of the
Driver_SelectVarForBCI
before the first SYNC. This patch introduces a convenience functionKranc_SelectVarForBCI
which combines calls toBoundary_SelectVarForBCI
andDriver_SelectVarForBCI
, calling the latter only if it is aliased. Depending on the value of the Cactus parameterpresync_mode
the Driver / Boundary will ignore one of the callsBoundary_SelectVarFoBCI
orDriver_SelectVarForBCI
without any need by the user thorn to be aware of this parameter.Coded the way it is in this pull request a Kranc generated thorn is usable for both a flesh / Driver that do support PreSync and ones that do not.
A second change involves Kranc's built in handling of access to the stress energy tensor. In CodeGenSchedule.m (diff without whitespace: https://github.com/ianhinder/Kranc/pull/148/files?diff=split&w=1) it generates READS clauses for the grid scalar indicating storage for Tmunu which is used in Kranc's auto-generated code to skip access to Tmunu when it has no storage (see https://github.com/ianhinder/Kranc/blob/8b36a2a7243dccb9f6867d34990dd07691a0d2d0/Tools/CodeGen/CodeGenCalculation.m#L573).
These two changes make up a minimal set of modifications to fully make use of the PreSync code in the flesh.