aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
Diffstat (limited to 'Tools')
-rw-r--r--Tools/CodeGen/Calculation.m24
-rw-r--r--Tools/CodeGen/CalculationFunction.m2
-rw-r--r--Tools/CodeGen/Kranc.m2
-rw-r--r--Tools/CodeGen/Schedule.m8
-rw-r--r--Tools/CodeGen/ScriptOutput.m4
5 files changed, 25 insertions, 15 deletions
diff --git a/Tools/CodeGen/Calculation.m b/Tools/CodeGen/Calculation.m
index 55644ed..36c8059 100644
--- a/Tools/CodeGen/Calculation.m
+++ b/Tools/CodeGen/Calculation.m
@@ -37,6 +37,7 @@ AddCondition;
AddConditionSuffix;
InNewScheduleGroup;
BoundaryCalculationQ;
+GetSchedule;
Begin["`Private`"];
@@ -161,7 +162,7 @@ DefFn[
Module[
{splitBy = lookup[calc,SplitBy, {}],
oldName = lookup[calc,Name],
- oldSchedule = lookup[calc, Schedule, Automatic],
+ oldSchedule = GetSchedule[calc],
newGroup},
(* If there is nothing to split, return the calculation without any changes *)
@@ -213,7 +214,7 @@ separateDerivativesInCalculation[calc_] :=
{sepPat = lookup[calc, SeparatedDerivatives , None],
sepPat2 = lookup[calc, SeparatedDerivatives2, None]},
If[sepPat === None, {calc},
- If[lookupDefault[calc, Schedule, Automatic] === Automatic,
+ If[GetSchedule[calc] === Automatic,
ThrowError["Separating derivatives in an automatically scheduled function is not supported"]];
Module[
@@ -289,7 +290,7 @@ separateDerivativesInCalculation[calc_] :=
(* TODO: "after" modifiers currently don't work with
CaKernel *)
afterNames = StringJoin[Map[" after " <> # &, otherNames]];
- thisSchedule = lookup[theCalc, Schedule];
+ thisSchedule = GetSchedule[theCalc];
newSchedule = Map[# <> afterNames &, thisSchedule];
mapReplace[theCalc, Schedule, newSchedule]];
(* TODO: could instead enforce order only between those
@@ -301,8 +302,8 @@ separateDerivativesInCalculation[calc_] :=
(GetEquations[calc]/.replaceSymmetric/.replaceMixed) /.
Map[# -> derivGFName[#] &, Flatten[Join[sepDerivs,sepDerivs2],1]]];
- derivCalcs = Map[mapReplace[#, Schedule, Map[#<>" before "<>GetCalculationName[calc2] &, lookup[#,Schedule]]] &, derivCalcs ];
- derivCalcs2 = Map[mapReplace[#, Schedule, Map[#<>" before "<>GetCalculationName[calc2] &, lookup[#,Schedule]]] &, derivCalcs2];
+ derivCalcs = Map[mapReplace[#, Schedule, Map[#<>" before "<>GetCalculationName[calc2] &, GetSchedule[#]]] &, derivCalcs ];
+ derivCalcs2 = Map[mapReplace[#, Schedule, Map[#<>" before "<>GetCalculationName[calc2] &, GetSchedule[#]]] &, derivCalcs2];
calc2 = InNewScheduleGroup[lookup[calc,Name], calc2];
@@ -314,14 +315,14 @@ DefFn[
DefFn[
AddConditionSuffix[calc_List, condition_] :=
- mapReplaceAdd[calc, Schedule, Map[#<>" IF "<>condition &, lookup[calc,Schedule]]]];
+ mapReplaceAdd[calc, Schedule, Map[#<>" IF "<>condition &, GetSchedule[calc]]]];
InNewScheduleGroup[groupName_String, calc_List] :=
Module[
{newGroup},
newGroup = {Name -> groupName,
Language -> "None", (* groups do not have a language *)
- SchedulePoint -> lookup[calc,Schedule,Automatic],
+ SchedulePoint -> GetSchedule[calc],
Comment -> ""};
mapReplaceAdd[
mapReplaceAdd[
@@ -329,6 +330,15 @@ InNewScheduleGroup[groupName_String, calc_List] :=
Schedule, {"in "<>groupName}],
ScheduleGroups, Append[lookup[calc, ScheduleGroups, {}],newGroup]]];
+DefFn[
+ GetSchedule[calc_List] :=
+ Module[
+ {s = lookup[calc,Schedule,Automatic]},
+ If[s =!= Automatic && !ListQ[s],
+ ThrowError["Calculation "<>lookup[calc,Name]<>" has an invalid Schedule entry: ",
+ s]];
+ s]];
+
End[];
EndPackage[];
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m
index 6a19ab4..3612e58 100644
--- a/Tools/CodeGen/CalculationFunction.m
+++ b/Tools/CodeGen/CalculationFunction.m
@@ -501,7 +501,7 @@ DefFn[
"GenericFD_LoopOverInterior(cctkGH, " <> bodyFunctionName <> ");\n",
InteriorNoSync,
"GenericFD_LoopOverInterior(cctkGH, " <> bodyFunctionName <> ");\n",
- Boundary,
+ Boundary | BoundaryNoSync,
"GenericFD_LoopOverBoundary(cctkGH, " <> bodyFunctionName <> ");\n",
BoundaryWithGhosts,
"GenericFD_LoopOverBoundaryWithGhosts(cctkGH, " <> bodyFunctionName <> ");\n",
diff --git a/Tools/CodeGen/Kranc.m b/Tools/CodeGen/Kranc.m
index a94306f..e7bd118 100644
--- a/Tools/CodeGen/Kranc.m
+++ b/Tools/CodeGen/Kranc.m
@@ -47,7 +47,7 @@ MacroPointer, CachedVariables, SplitBy, SeparatedDerivatives,
SeparatedDerivatives2}
{ConditionalOnKeyword, ConditionalOnKeywords, CollectList, Interior,
-InteriorNoSync, Boundary, BoundaryWithGhosts, Where, PreDefinitions,
+InteriorNoSync, Boundary, BoundaryNoSync, BoundaryWithGhosts, Where, PreDefinitions,
AllowedSymbols, Parameters, ConditionalOnTextuals, ApplyBCs,
SimpleCode};
diff --git a/Tools/CodeGen/Schedule.m b/Tools/CodeGen/Schedule.m
index c8fac55..24b1802 100644
--- a/Tools/CodeGen/Schedule.m
+++ b/Tools/CodeGen/Schedule.m
@@ -153,7 +153,7 @@ scheduleCalc[calc_, groups_, thornName_, OptionsPattern[]] :=
<> If[after =!= None, " after " <> after, ""];
applyBCs = lookupDefault[calc, ApplyBCs, False];
- userSchedule = lookupDefault[calc, Schedule, Automatic];
+ userSchedule = GetSchedule[calc];
If[userSchedule =!= Automatic && !applyBCs,
@@ -179,7 +179,7 @@ scheduleCalc[calc_, groups_, thornName_, OptionsPattern[]] :=
{}],
If[mapContains[calc, Conditional], {NewConditional -> lookup[calc,Conditional]}, {}]
] &,
- lookup[calc, Schedule]]],
+ GetSchedule[calc]]],
(* Scheduling is automatic. For the moment, all automatically
scheduled functions are going to be performed in
@@ -213,8 +213,8 @@ scheduleCalc[calc_, groups_, thornName_, OptionsPattern[]] :=
SchedulePoint -> "in " <> groupName,
Language -> CodeGenC`SOURCELANGUAGE,
Tags -> tags,
- RequiredGroups -> groupsToRequire,
- ProvidedGroups -> groupsToProvide,
+ RequiredGroups -> variablesToRead,
+ ProvidedGroups -> variablesToWrite,
Comment -> lookup[calc, Name]
};
diff --git a/Tools/CodeGen/ScriptOutput.m b/Tools/CodeGen/ScriptOutput.m
index 9900647..64bc7ec 100644
--- a/Tools/CodeGen/ScriptOutput.m
+++ b/Tools/CodeGen/ScriptOutput.m
@@ -18,7 +18,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
-BeginPackage["ScriptOutput`", {"Errors`", "Helpers`", "Kranc`", "CodeGen`", "MapLookup`", "TensorTools`", "KrancGroups`"}];
+BeginPackage["ScriptOutput`", {"Errors`", "Helpers`", "Kranc`", "CodeGen`", "MapLookup`", "TensorTools`", "KrancGroups`", "Calculation`"}];
WriteScript;
@@ -120,7 +120,7 @@ DefFn[
Indent -> True]]];
writeSchedule[calc_] :=
- If[lookup[calc,Schedule,Automatic] =!= Automatic, FlattenBlock@Riffle[{"scheduled \"", #, "\""}&/@ lookup[calc,Schedule,Automatic]," "],""];
+ If[GetSchedule[calc] =!= Automatic, FlattenBlock@Riffle[{"scheduled \"", #, "\""}&/@ GetSchedule[calc]," "],""];
DefFn[
writeDerivatives[pdefs_] :=