diff --git a/httomo/base_block.py b/httomo/base_block.py index 9334f6991..e1bb0c61a 100644 --- a/httomo/base_block.py +++ b/httomo/base_block.py @@ -111,7 +111,7 @@ def to_gpu(self): self._data = xp.asarray(self.data, order="C") def to_cpu(self): - if not gpu_enabled: + if not gpu_enabled or xp.get_array_module(self.data).__name__ == "numpy": return self._data = xp.asnumpy(self.data, order="C") diff --git a/httomo/method_wrappers/generic.py b/httomo/method_wrappers/generic.py index a41180ff4..92ede0250 100644 --- a/httomo/method_wrappers/generic.py +++ b/httomo/method_wrappers/generic.py @@ -319,7 +319,10 @@ def execute(self, block: T) -> T: block = self._run_method(block, args) block = self._postprocess_data(block) - self._gpu_time_info.kernel = t.elapsed + if xp.get_array_module(block.data).__name__ == "cupy": + self._gpu_time_info.kernel = t.elapsed + else: + self._gpu_time_info.kernel = 0 return block