File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ def __new__(cls):
532
532
else :
533
533
_logger .warning ("No GPU device" )
534
534
535
- cls ._curr_device = DeviceEnv ( cls . _runtime [ 0 ][ 0 ]. curr_env )
535
+ cls ._curr_device = None
536
536
537
537
return obj
538
538
@@ -555,6 +555,10 @@ def has_gpu_device(self):
555
555
556
556
return Runtime ._gpu_device is not None
557
557
558
+ def has_current_device (self ):
559
+ ''' Returns True if GPU or CPU context manager is being used.'''
560
+
561
+ return Runtime ._curr_device is not None
558
562
559
563
def get_cpu_device (self ):
560
564
''' Returns a cdata wrapper for the first available OpenCL
@@ -607,6 +611,7 @@ def dump(self):
607
611
runtime = Runtime ()
608
612
has_cpu_device = runtime .has_cpu_device ()
609
613
has_gpu_device = runtime .has_gpu_device ()
614
+ has_current_device = runtime .has_current_device ()
610
615
611
616
#------- Global Functions
612
617
You can’t perform that action at this time.
0 commit comments