Skip to content

Commit

Permalink
Compute CaKernel stencil size from calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Jan 27, 2012
1 parent 760ab23 commit 47bcbd1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Tools/CodeGen/CaKernel.m
Expand Up @@ -55,7 +55,8 @@
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]]];
Expand Down
14 changes: 13 additions & 1 deletion Tools/CodeGen/Calculation.m
Expand Up @@ -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`"];

Expand Down Expand Up @@ -65,6 +67,16 @@
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[];
12 changes: 6 additions & 6 deletions Tools/CodeGen/KrancThorn.m
Expand Up @@ -197,6 +197,12 @@ Thorn generation (main entry point for non-tensorial thorns)
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];
Expand Down Expand Up @@ -275,12 +281,6 @@ Thorn generation (main entry point for non-tensorial thorns)

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],
Expand Down

0 comments on commit 47bcbd1

Please sign in to comment.