From 5fcdf618c416037fb1b2454490e1cf03c12e0d86 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Thu, 12 Sep 2013 15:46:24 +0200 Subject: KrancThorn.m: Move CaKernel-related code into CaKernel section --- Tools/CodeGen/KrancThorn.m | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Tools/CodeGen/KrancThorn.m b/Tools/CodeGen/KrancThorn.m index cd80d30..6d116ba 100644 --- a/Tools/CodeGen/KrancThorn.m +++ b/Tools/CodeGen/KrancThorn.m @@ -109,7 +109,7 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ reflectionSymmetries = OptionValue[ReflectionSymmetries]; (* ------------------------------------------------------------------------ - Process calculations for CaKernel + CaKernel ------------------------------------------------------------------------ *) (* Make the CaKernel option calculation-specific *) @@ -122,6 +122,15 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ calcs = Map[Append[#, PartialDerivatives -> partialDerivs] &, calcs]; + If[OptionValue[UseCaKernel], + includeFiles = Append[includeFiles, "CaCUDALib_driver_support.h"]]; + + If[OptionValue[UseCaKernel], + inheritedImplementations = Append[inheritedImplementations, "Accelerator"]]; + + (* Add ExecuteOn -> Device to any CaKernel calculation that has no ExecuteOn option *) + calcs = Map[If[!lookup[#,UseCaKernel,False], #, If[mapContains[#,ExecuteOn], #, Append[#,ExecuteOn->Device]]] &, calcs]; + (* ------------------------------------------------------------------------ Add coordinates group ------------------------------------------------------------------------ *) @@ -150,9 +159,6 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ includeFiles = Join[includeFiles, {"GenericFD.h", "Symmetry.h", "sbp_calc_coeffs.h"}]; - If[OptionValue[UseCaKernel], - includeFiles = Append[includeFiles, "CaCUDALib_driver_support.h"]]; - (* ------------------------------------------------------------------------ Inherited implementations ------------------------------------------------------------------------ *) @@ -160,9 +166,6 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ inheritedImplementations = Join[inheritedImplementations, {"Grid", "GenericFD"}, CactusBoundary`GetInheritedImplementations[]]; - If[OptionValue[UseCaKernel], - inheritedImplementations = Append[inheritedImplementations, "Accelerator"]]; - (* ------------------------------------------------------------------------ Check input parameters ------------------------------------------------------------------------ *) @@ -261,8 +264,6 @@ CreateKrancThorn[groupsOrig_, parentDirectory_, thornName_, opts:OptionsPattern[ calcs = Map[Append[#, Parameters -> AllNumericParameters[parameters]] &, calcs]; - calcs = Map[If[!lookup[#,UseCaKernel,False], #, If[mapContains[#,ExecuteOn], #, Append[#,ExecuteOn->Device]]] &, calcs]; - (* ------------------------------------------------------------------------ Split calculations according to SplitVars option ------------------------------------------------------------------------ *) -- cgit v1.2.3