diff options
-rw-r--r-- | interface.ccl | 4 | ||||
-rw-r--r-- | src/Operators.c | 12 |
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 |