Skip to content

Commit

Permalink
Set requirements correctly for OpenCL
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett authored and ianhinder committed Jan 31, 2012
1 parent ecbe96d commit 60fad9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Tools/CodeGen/KrancThorn.m
Expand Up @@ -135,7 +135,7 @@ Thorn generation (main entry point for non-tensorial thorns)

CheckGroups[groupsOrig];

groups = Join[groupsOrig, {coordGroup}];
groups = Union[Join[groupsOrig, {coordGroup}]];
includeFiles = Join[includeFiles, {"GenericFD.h", "Symmetry.h", "sbp_calc_coeffs.h"}];

inheritedImplementations = Join[inheritedImplementations, {"Grid",
Expand Down
19 changes: 11 additions & 8 deletions Tools/CodeGen/Schedule.m
Expand Up @@ -55,11 +55,20 @@
eqs = lookup[calc, Equations];
lhss = Map[First, eqs];
gfsInLHS = Union[Cases[lhss, _ ? (MemberQ[gfs,#] &), Infinity]];

lhsGroupNames = containingGroups[gfsInLHS, groups];
Return[lhsGroupNames]
];

groupsReadInCalc[calc_, groups_] :=
Module[{gfs, eqs, lhss, gfsInLHS, lhsGroupNames},
gfs = allGroupVariables[groups];
eqs = lookup[calc, Equations];
rhss = Map[Last, eqs];
gfsInRHS = Union[Cases[rhss, _ ? (MemberQ[gfs,#] &), Infinity]];
rhsGroupNames = containingGroups[gfsInRHS, groups];
Return[rhsGroupNames]
];

(* Each calculation can be scheduled at multiple points, so this
function returns a LIST of schedule structures for each calculation
*)
Expand Down Expand Up @@ -100,19 +109,13 @@

(* TODO: Pass this as {keyword,value} pair instead of a string,
once Thorn.m understands this format *)
(* TODO: This doesn't work -- I don't know how to access
OptionValue[] in this file.
tags = If[OptionValue[UseOpenCL], "OpenCL=1", ""];
*)
tags = "OpenCL=1";

prefixWithScope[group_] :=
If[StringMatchQ[ToString[group], __~~"::"~~__],
ToString[group],
thornName <> "::" <> ToString[group]];
(* TODO: Don't blindly require/provide all groups, check the
equations instead *)
groupsToRequire = prefixWithScope /@ Map[First, groups];
groupsToRequire = prefixWithScope /@ groupsReadInCalc[calc, groups];
groupsToProvide = prefixWithScope /@ groupsSetInCalc[calc, groups];

before = lookupDefault[calc, Before, None];
Expand Down

0 comments on commit 60fad9c

Please sign in to comment.