aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 15:46:24 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2013-09-12 15:46:24 +0200
commit5fcdf618c416037fb1b2454490e1cf03c12e0d86 (patch)
treeae213463d220f4a814743b33eacf120fc21aa429
parent4ee05bf4578c570efc208ffe1f12b939528a54ce (diff)
KrancThorn.m: Move CaKernel-related code into CaKernel section
-rw-r--r--Tools/CodeGen/KrancThorn.m19
1 files 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
------------------------------------------------------------------------ *)