diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2012-01-27 15:25:31 -0600 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2012-01-27 15:25:31 -0600 |
commit | 47bcbd10d0e7a1ec30cd1c7900289bf2ae757e26 (patch) | |
tree | a454460866893c6f4c6f30d7ee543188610842f1 /Tools/CodeGen | |
parent | 760ab235e1de8d4d1eb33fc89a2a897d2af28c9e (diff) |
Compute CaKernel stencil size from calculation
Diffstat (limited to 'Tools/CodeGen')
-rw-r--r-- | Tools/CodeGen/CaKernel.m | 3 | ||||
-rw-r--r-- | Tools/CodeGen/Calculation.m | 14 | ||||
-rw-r--r-- | Tools/CodeGen/KrancThorn.m | 12 |
3 files changed, 21 insertions, 8 deletions
diff --git a/Tools/CodeGen/CaKernel.m b/Tools/CodeGen/CaKernel.m index ec48ef1..9444864 100644 --- a/Tools/CodeGen/CaKernel.m +++ b/Tools/CodeGen/CaKernel.m @@ -55,7 +55,8 @@ DefFn[ kernelCCLBlock[calc_] := CCLBlock["CCTK_CUDA_KERNEL", lookup[calc, Name], {"TYPE" -> "gpu_cuda/3dblock", - "STENCIL" -> Quote["0,0,0,0,0,0"], + "STENCIL" -> Quote@FlattenBlock@Riffle[ + Flatten[Map[{#,#} &, CalculationStencilSize[calc]],1],","], "TILE" -> Quote["8,8,8"], "SHARECODE" -> "yes"}, variableBlocks[calc]]]; diff --git a/Tools/CodeGen/Calculation.m b/Tools/CodeGen/Calculation.m index 45c3938..eb471fe 100644 --- a/Tools/CodeGen/Calculation.m +++ b/Tools/CodeGen/Calculation.m @@ -18,13 +18,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) -BeginPackage["Calculation`", {"Errors`", "Helpers`", "Kranc`", "KrancGroups`", "MapLookup`"}]; +BeginPackage["Calculation`", {"Errors`", "Helpers`", "Kranc`", "KrancGroups`", + "MapLookup`","Differencing`"}]; InputGridFunctions; OutputGridFunctions; AllGridFunctions; GetCalculationName; GetEquations; +CalculationStencilSize; Begin["`Private`"]; @@ -65,6 +67,16 @@ DefFn[ GetCalculationName[calc_List] := lookup[calc,Name]]; +DefFn[ + CalculationStencilSize[calc_List] := + Module[ + {pddefs,eqs}, + + pddefs = lookup[calc, PartialDerivatives, {}]; + eqs = lookup[calc, Equations]; + + StencilSize[pddefs, eqs, "not needed", {} (*ZeroDimensions*)]]]; + End[]; EndPackage[]; diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index f930d1f..679cd26 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -197,6 +197,12 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ rhsGroups = Map[groupName, rhsGroupDefinitions]; rhsODEGroups = Map[groupName, rhsODEGroupDefinitions]; + calcs = Map[Join[#, + {ODEGroups -> Join[odeGroups, rhsODEGroups], + Parameters -> allParams, + PartialDerivatives -> partialDerivs, + Implementation -> implementation}] &, calcs]; + (* Construct the configuration file *) InfoMessage[Terse, "Creating configuration file"]; configuration = CreateConfiguration[opts]; @@ -275,12 +281,6 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ InfoMessage[Terse, "Creating calculation source files"]; - calcs = Map[Join[#, - {ODEGroups -> Join[odeGroups, rhsODEGroups], - Parameters -> allParams, - PartialDerivatives -> partialDerivs, - Implementation -> implementation}] &, calcs]; - If[!OptionValue[UseCaKernel], calcSources = Map[CreateSetterSource[{#}, False, {}, opts] &, calcs]; calcFilenames = Map[lookup[#, Name] <> ext &, calcs], |