diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-01-09 16:32:26 -0600 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-01-09 16:32:26 -0600 |
commit | 05cec5065435e769c0591bca2285a70da3dbc45f (patch) | |
tree | 1aefc41d92a3393fb6861b3f4481ace18c2735a9 /Tools | |
parent | d2340a01767241ec17cf8eb1e1d8e6312779a359 (diff) | |
parent | 28e774d72de23cb7be50194073a3627922cf9a55 (diff) |
Merge /Users/eschnett/Calpha/kranc
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/CodeGen/CalculationFunction.m | 9 | ||||
-rw-r--r-- | Tools/CodeGen/CodeGen.m | 7 | ||||
-rw-r--r-- | Tools/CodeGen/KrancThorn.m | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m index d24431d..ecf2150 100644 --- a/Tools/CodeGen/CalculationFunction.m +++ b/Tools/CodeGen/CalculationFunction.m @@ -24,7 +24,7 @@ BeginPackage["sym`"]; {GridFunctions, Shorthands, Equations, t, DeclarationIncludes, LoopPreIncludes, GroupImplementations, PartialDerivatives, Dplus1, NoSimplify, -Dplus2, Dplus3, Boundary, Interior, Where, AddToStencilWidth, Everywhere, normal1, normal2, normal3} +Dplus2, Dplus3, Boundary, Interior, InteriorNoSync, Where, AddToStencilWidth, Everywhere, normal1, normal2, normal3} {INV, SQR, CUB, QAD, dot, pow, exp,dx,dy,dz, idx, idy, idz} @@ -556,6 +556,7 @@ CreateCalculationFunction[calc_, debug_, useLoopControl_, useCSE_] := Switch[where, Everywhere, DefineCCTKSubroutine[functionName, "GenericFD_LoopOverEverything(cctkGH, &" <> bodyFunctionName <> ");\n"], Interior, DefineCCTKSubroutine[functionName, "GenericFD_LoopOverInterior(cctkGH, &" <> bodyFunctionName <> ");\n"], + InteriorNoSync, DefineCCTKSubroutine[functionName, "GenericFD_LoopOverInterior(cctkGH, &" <> bodyFunctionName <> ");\n"], Boundary, DefineCCTKSubroutine[functionName, "GenericFD_LoopOverBoundary(cctkGH, &" <> bodyFunctionName <> ");\n"], BoundaryWithGhosts, DefineCCTKSubroutine[functionName, "GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &" <> bodyFunctionName <> ");\n"], PenaltyPrim2Char, DefineFunction[functionName, "CCTK_INT", @@ -713,9 +714,15 @@ equationLoop[eqs_, (* DeclareDerivatives[pddefs, eqs], *) DeclareDerivatives[defsWithoutShorts, eqsOrdered], +(* CommentedBlock["Assign local copies of grid functions", Map[AssignVariableInLoop[localName[#], GridName[#]] &, gfsInRHS]], +*) + CommentedBlock["Assign local copies of grid functions", + Map[MaybeAssignVariableInLoop[localName[#], GridName[#], + StringMatchQ[ToString[localName[#]], "eT*L"]] &, + gfsInRHS]], (* CommentedBlock["Check for nans", diff --git a/Tools/CodeGen/CodeGen.m b/Tools/CodeGen/CodeGen.m index c51eaf0..d3d0dfc 100644 --- a/Tools/CodeGen/CodeGen.m +++ b/Tools/CodeGen/CodeGen.m @@ -62,6 +62,8 @@ AssignVariable::usage = "AssignVariable[dest_, src_] returns a block of code " < "that assigns 'src' to 'dest'."; AssignVariableInLoop::usage = "AssignVariable[dest_, src_] returns a block of code " <> "that assigns 'src' to 'dest'."; +MaybeAssignVariableInLoop::usage = "MaybeAssignVariable[dest_, src_, cond_] returns a block of code " <> + "that assigns 'src' to 'dest'."; DeclareVariablesInLoopVectorised::usage = ""; AssignVariablesInLoopVectorised::usage = ""; TestForNaN::usage = "TestForNaN[expr_] returns a block of code " <> @@ -273,6 +275,11 @@ AssignVariableInLoop[dest_, src_] := TestForNaN[dest]}; *) +MaybeAssignVariableInLoop[dest_, src_, cond_] := + If [cond, + {dest, " = useMatter ? ", src, " : 0.0", EOL[]}, + {dest, " = ", src, EOL[]}]; + (* TODO: move these into OpenMP loop *) DeclareVariablesInLoopVectorised[dests_, temps_, srcs_] := { diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index bce9a0f..9ca57ec 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -34,7 +34,7 @@ BeginPackage["sym`"]; EvolutionTimelevels, UseCSE, -PartialDerivatives, InheritedImplementations, ConditionalOnKeyword, ConditionalOnKeywords, ReflectionSymmetries, ZeroDimensions, CollectList, Interior, Boundary, BoundaryWithGhosts, Where, PreDefinitions, AllowedSymbols, UseLoopControl}; +PartialDerivatives, InheritedImplementations, ConditionalOnKeyword, ConditionalOnKeywords, ReflectionSymmetries, ZeroDimensions, CollectList, Interior, InteriorNoSync, Boundary, BoundaryWithGhosts, Where, PreDefinitions, AllowedSymbols, UseLoopControl}; EndPackage[]; |