Skip to content

Commit

Permalink
KrancThorn.m: Accumulate calculation sources in sources variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Sep 12, 2013
1 parent 665ca92 commit 3567168
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Tools/CodeGen/KrancThorn.m
Expand Up @@ -362,13 +362,16 @@ Thorn generation (main entry point for non-tensorial thorns)
InfoMessage[Terse, "Creating calculation source files"];

hostCalcs = Select[calcs, !CalculationOnDevice[#] &];
deviceCalcs = Select[calcs, CalculationOnDevice];

calcSources = Join[Map[CreateSetterSource[{#}, False, {}, opts] &, hostCalcs],
Map[CaKernelCode[#,opts] &, deviceCalcs]];
hostSources = Map[{Filename -> lookup[#, Name] <> ext,
Contents -> CreateSetterSource[{#}, False, {}, opts]} &,
hostCalcs];
sources = Join[sources, hostSources];

calcFilenames = Join[Map[lookup[#, Name] <> ext &, hostCalcs],
Map["CaKernel__"<>lookup[#, Name] <> ".code" &, deviceCalcs]];
deviceCalcs = Select[calcs, CalculationOnDevice];
deviceSources = Map[{Filename -> "CaKernel__"<>lookup[#, Name] <> ".code",
Contents -> CaKernelCode[#,opts]} &,
deviceCalcs];
sources = Join[sources, deviceSources];

incFilenames = Map[lookup[#, Name] <> ext &, hostCalcs];

Expand Down Expand Up @@ -396,8 +399,6 @@ Thorn generation (main entry point for non-tensorial thorns)
CaKernel -> cakernel,
Makefile -> make,
Sources -> Join[sources,
MapThread[{Filename -> #1, Contents -> #2} &,
{calcFilenames, calcSources}],
If[Length[OptionValue[ParameterConditions]] > 0,
{{Filename -> "ParamCheck.cc",
Contents -> ParameterCheckSource[thornName, OptionValue[ParameterConditions]]}},
Expand Down

0 comments on commit 3567168

Please sign in to comment.