diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-11-14 22:52:46 +0100 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-11-14 22:52:46 +0100 |
commit | beb854b56cd60ec97072d709a064eeafe1633ed1 (patch) | |
tree | 4f0ade0e7f57c39210605e81d9263e0a89a041b0 /Tools/CodeGen | |
parent | 4d508ec50139c8ff7424c6655314fd2d1c8d878b (diff) |
Add some debugging code (disabled by default)
Diffstat (limited to 'Tools/CodeGen')
-rw-r--r-- | Tools/CodeGen/CalculationFunction.m | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m index d373ed3..f64693e 100644 --- a/Tools/CodeGen/CalculationFunction.m +++ b/Tools/CodeGen/CalculationFunction.m @@ -151,6 +151,7 @@ removeUnusedShorthands[calc_] := rhsShorthands = calculationRHSUsedShorthands[calc]; lhsShorthands = calculationLHSUsedShorthands[calc]; unusedButAssignedShorthands = Complement[lhsShorthands, rhsShorthands]; + InfoMessage[InfoFull, "Removing definitions for shorthands: "<>ToString[unusedButAssignedShorthands,InputForm]]; eqs = lookup[calc, Equations]; neweqs = removeShorts[eqs]; newCalc = mapReplace[calc, Equations, neweqs]; @@ -381,6 +382,13 @@ DefFn[ addToStencilWidth, pDefs, haveCondTextuals, condTextuals, calc, kernelCall}, + functionName = ToString@lookup[calcp, Name]; + bodyFunctionName = functionName <> "_Body"; + + InfoMessage[Terse, "Creating calculation function: " <> functionName]; + + InfoMessage[InfoFull, "Calculation sets "<>ToString[Map[First,lookup[calcp, Equations]]]]; + calc = If[OptionValue[UseJacobian], InsertJacobian[calcp, opts], calcp]; cleancalc = removeUnusedShorthands[calc]; @@ -405,10 +413,6 @@ DefFn[ VerifyCalculation[cleancalc]; gfs = allGroupVariables[groups]; - functionName = ToString@lookup[cleancalc, Name]; - bodyFunctionName = functionName <> "_Body"; - - InfoMessage[Terse, "Creating calculation function: " <> functionName]; InfoMessage[InfoFull, " ", Length@shorts, " shorthands"]; InfoMessage[InfoFull, " ", Length@gfs, " grid functions"]; @@ -425,7 +429,7 @@ DefFn[ eqs], If[!lookupDefault[cleancalc, NoSimplify, False], - InfoMessage[InfoFull, "Simplifying equations", eqs]; + InfoMessage[InfoFull, "Simplifying equations", eqs//InputForm]; eqs = Simplify[eqs, {r>=0}]]]; InfoMessage[InfoFull, "Equations:"]; @@ -434,7 +438,9 @@ DefFn[ parameterRules = Map[(#->ToReal[#])&, parameters]; eqs = eqs /. Prepend[parameterRules, IfThen[cond_, x_, y_] :> IfThen[cond, x/.parameterRules, y/.parameterRules]]; - Map[printEq, eqs]; + (* Map[printEq, eqs]; *) + + Scan[InfoMessage[InfoFull, " " <> ToString@First[#]<>" = ..."] &, eqs]; (* Check all the function names *) functionsPresent = functionsInCalculation[cleancalc]; (* Not currently used *) @@ -479,6 +485,7 @@ DefFn[ ThrowError["Unknown 'Where' entry in calculation " <> functionName <> ": " <> ToString[where]]]; + InfoMessage[InfoFull,"Generating function"]; { DefineFunction[bodyFunctionName, "static void", "cGH const * restrict const cctkGH, int const dir, int const face, CCTK_REAL const normal[3], CCTK_REAL const tangentA[3], CCTK_REAL const tangentB[3], int const imin[3], int const imax[3], int const n_subblock_gfs, CCTK_REAL * restrict const subblock_gfs[]", { @@ -585,6 +592,7 @@ DefFn[ arraysInRHS, arraysInLHS, arraysOnlyInRHS, odeVars, generateEquationCode, groupedIfs, IfThenGroup, noSimplify}, + InfoMessage[InfoFull, "Equation loop"]; rhss = Map[#[[2]] &, eqs]; lhss = Map[#[[1]] &, eqs]; @@ -666,6 +674,7 @@ DefFn[ generateEquationCode[{declare2_, eq2_}] := Module[{ret, vars, preDeclare, cond, vectorize}, vectorize = OptionValue[UseVectors]; + InfoMessage[InfoFull, "Generating code for " <> ToString[eq2[[1]], InputForm]]; Which[ SameQ[Head[eq2[[2]]], IfThen], ret = assignVariableFromExpression[eq2[[1]], @@ -689,6 +698,7 @@ DefFn[ calcCode = Riffle[generateEquationCode /@ groupedIfs, "\n"]; calcCodeArrays = Riffle[generateEquationCode /@ groupedIfsArrays, "\n"]; + InfoMessage[InfoFull, "Finished generating equation code"]; assignLocalFunctions[gs_, useVectors_, useJacobian_, NameFunc_] := Module[{conds, varPatterns, varsInConds, simpleVars, code}, |