aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-07-28 09:28:18 -0700
committerErik Schnetter <schnetter@gmail.com>2013-07-28 09:28:18 -0700
commit5944de36a22858eff9ea2e9bb7100f762ce7aeec (patch)
treebd73f047af4b7c6b94bee592a5783a4c8e85b0ca
parent9d951bebe486c0695f22915553feb39a4b229b78 (diff)
Introduce Cactus parameters to disable using stress-energy tensor and MP jacobian
These Cactus parameters switch off the stress-energy tensor and the jacobian, improving performance if the code is compiled dynamically (e.g. OpenCL).
-rw-r--r--Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl12
-rw-r--r--Tools/CodeGen/CalculationFunction.m2
-rw-r--r--Tools/CodeGen/Jacobian.m10
-rw-r--r--Tools/CodeGen/Param.m3
4 files changed, 21 insertions, 6 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl
index 0348872..6ac9fe8 100644
--- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl
+++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/param.ccl
@@ -32,6 +32,18 @@ CCTK_INT boundary_width "width of boundary (fix later to use Cactus boundary ca
} 1
restricted:
+CCTK_INT assume_stress_energy_state "Assume stress_energy_state has a particular value" STEERABLE=RECOVER
+{
+ -1 :: "do not assume anything"
+ 0:1 :: "assume off or on"
+} -1
+
+CCTK_INT assume_use_jacobian "Assume use_jacobian has a particular value" STEERABLE=RECOVER
+{
+ -1 :: "do not assume anything"
+ 0:1 :: "assume off or on"
+} -1
+
CCTK_STRING jacobian_group "Name of group containing Jacobian" STEERABLE=RECOVER
{
"" :: "String of the form <implementation>::<groupname>"
diff --git a/Tools/CodeGen/CalculationFunction.m b/Tools/CodeGen/CalculationFunction.m
index 8fff03c..d97d83a 100644
--- a/Tools/CodeGen/CalculationFunction.m
+++ b/Tools/CodeGen/CalculationFunction.m
@@ -937,7 +937,7 @@ DefFn[
assignLocalFunctions[gs_, useVectors_, useJacobian_, NameFunc_] :=
Module[{conds, varPatterns, varsInConds, simpleVars, code},
conds =
- {{"eT" ~~ _ ~~ _, "*stress_energy_state", "ToReal(0.0)"}}; (* This should be passed as an option *)
+ {{"eT" ~~ _ ~~ _, "assume_stress_energy_state>=0 ? assume_stress_energy_state : *stress_energy_state", "ToReal(0.0)"}}; (* This should be passed as an option *)
If[useJacobian,
conds = Append[conds, JacobianConditionalGridFunctions[]]];
diff --git a/Tools/CodeGen/Jacobian.m b/Tools/CodeGen/Jacobian.m
index c65ff61..40a93d8 100644
--- a/Tools/CodeGen/Jacobian.m
+++ b/Tools/CodeGen/Jacobian.m
@@ -117,9 +117,10 @@ InsertJacobian[calc_List, opts:OptionsPattern[]] :=
derivatives groups *)
CreateJacobianVariables[] :=
CommentedBlock["Jacobian variable pointers",
- {"bool const use_jacobian = (!CCTK_IsFunctionAliased(\"MultiPatch_GetMap\") || MultiPatch_GetMap(cctkGH) != jacobian_identity_map)\n",
- " && strlen(jacobian_group) > 0;\n",
- "bool const usejacobian CCTK_ATTRIBUTE_UNUSED = use_jacobian;\n",
+ {"const bool use_jacobian1 = (!CCTK_IsFunctionAliased(\"MultiPatch_GetMap\") || MultiPatch_GetMap(cctkGH) != jacobian_identity_map)\n",
+ " && strlen(jacobian_group) > 0;\n",
+ "const bool use_jacobian = assume_use_jacobian>=0 ? assume_use_jacobian : use_jacobian1;\n",
+ "const bool usejacobian CCTK_ATTRIBUTE_UNUSED = use_jacobian;\n",
"if (use_jacobian && (strlen(jacobian_determinant_group) == 0 || strlen(jacobian_inverse_group) == 0 || strlen(jacobian_derivative_group) == 0))\n",
"{\n",
" CCTK_WARN (1, \"GenericFD::jacobian_group, GenericFD::jacobian_determinant_group, GenericFD::jacobian_inverse_group, and GenericFD::jacobian_derivative_group must all be set to valid group names\");\n",
@@ -159,7 +160,8 @@ JacobianSymbols[] :=
(* Parameters to inherit from GenericFD *)
JacobianGenericFDParameters[] :=
- {{Name -> "jacobian_group", Type -> "CCTK_STRING"},
+ {{Name -> "assume_use_jacobian", Type -> "CCTK_INT"},
+ {Name -> "jacobian_group", Type -> "CCTK_STRING"},
{Name -> "jacobian_determinant_group", Type -> "CCTK_STRING"},
{Name -> "jacobian_inverse_group", Type -> "CCTK_STRING"},
{Name -> "jacobian_derivative_group", Type -> "CCTK_STRING"},
diff --git a/Tools/CodeGen/Param.m b/Tools/CodeGen/Param.m
index 023674e..6ccd594 100644
--- a/Tools/CodeGen/Param.m
+++ b/Tools/CodeGen/Param.m
@@ -224,7 +224,8 @@ CreateKrancParam[evolvedGroups_, nonevolvedGroups_,
{
Name -> "GenericFD",
UsedParameters ->
- If[OptionValue[UseJacobian], JacobianGenericFDParameters[], {}]
+ Join[{{Name -> "assume_stress_energy_state", Type -> "CCTK_INT"}},
+ If[OptionValue[UseJacobian], JacobianGenericFDParameters[], {}]]
};
realStructs = Map[krancParamStruct[#, "CCTK_REAL", False] &, reals];