From 82b4f08b508d773cc1f095f40cefe13b7f00e4e6 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Fri, 18 Sep 2020 03:48:03 -0500 Subject: [PATCH] Change default current device to None --- dppl/ocldrv.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dppl/ocldrv.py b/dppl/ocldrv.py index 7b8395b1ee..2d762b9acf 100644 --- a/dppl/ocldrv.py +++ b/dppl/ocldrv.py @@ -532,7 +532,7 @@ def __new__(cls): else: _logger.warning("No GPU device") - cls._curr_device = DeviceEnv(cls._runtime[0][0].curr_env) + cls._curr_device = None return obj @@ -555,6 +555,10 @@ def has_gpu_device(self): return Runtime._gpu_device is not None + def has_current_device(self): + ''' Returns True if GPU or CPU context manager is being used.''' + + return Runtime._curr_device is not None def get_cpu_device(self): ''' Returns a cdata wrapper for the first available OpenCL @@ -607,6 +611,7 @@ def dump(self): runtime = Runtime() has_cpu_device = runtime.has_cpu_device() has_gpu_device = runtime.has_gpu_device() +has_current_device = runtime.has_current_device() #------- Global Functions