aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2014-02-20 20:04:20 +0000
committereschnett <eschnett@578cdeb0-5ea1-4b81-8215-5a3b8777ee0b>2014-02-20 20:04:20 +0000
commitc1043e58f9011028e43fe86ef73dee44b05f746e (patch)
tree688a29a0cca2aa7650f2086bc4915de9e3d8f242
parentd5bc7cf9626df7800644836c81712ace1e92ed0f (diff)
Do not call LinearCombination unless the evolved variable lives on the device
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@211 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b
-rw-r--r--interface.ccl4
-rw-r--r--src/Operators.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/interface.ccl b/interface.ccl
index f12606b..ccafdbb 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -215,6 +215,10 @@ CCTK_INT FUNCTION GetRefinementLevel \
(CCTK_POINTER_TO_CONST IN cctkGH)
USES FUNCTION GetRefinementLevel
+CCTK_INT FUNCTION Device_GetDevice \
+ (CCTK_POINTER_TO_CONST IN cctkGH)
+USES FUNCTION Device_GetDevice
+
# Computes:
# var = scale * var + \sum_i^nsrcs facts[i] * scrcs[i][tls[i]]
CCTK_INT FUNCTION LinearCombination \
diff --git a/src/Operators.c b/src/Operators.c
index 2cbde16..01947b4 100644
--- a/src/Operators.c
+++ b/src/Operators.c
@@ -226,10 +226,18 @@ MoL_LinearCombination(cGH const *const cctkGH,
{
DECLARE_CCTK_PARAMETERS;
- // Forward call to aliased function, if it is defined
+ // Forward call to aliased function, if it is defined and if we are
+ // using the device (accelerator)
static int is_aliased = -1;
if (is_aliased < 0) {
- is_aliased = CCTK_IsFunctionAliased("LinearCombination");
+ int is_device = 0;
+ if (CCTK_IsFunctionAliased("Device_GetDevice")) {
+ is_device = Device_GetDevice(cctkGH) >= 0;
+ }
+ is_aliased = 0;
+ if (is_device) {
+ is_aliased = CCTK_IsFunctionAliased("LinearCombination");
+ }
}
if (is_aliased) {
return