Skip to content

Commit e590884

Browse files
1e-toetotmeni
andauthored
Change default current device to None (#39)
Co-authored-by: etotmeni <[email protected]>
1 parent 219115d commit e590884

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dppl/ocldrv.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def __new__(cls):
532532
else:
533533
_logger.warning("No GPU device")
534534

535-
cls._curr_device = DeviceEnv(cls._runtime[0][0].curr_env)
535+
cls._curr_device = None
536536

537537
return obj
538538

@@ -555,6 +555,10 @@ def has_gpu_device(self):
555555

556556
return Runtime._gpu_device is not None
557557

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
558562

559563
def get_cpu_device(self):
560564
''' Returns a cdata wrapper for the first available OpenCL
@@ -607,6 +611,7 @@ def dump(self):
607611
runtime = Runtime()
608612
has_cpu_device = runtime.has_cpu_device()
609613
has_gpu_device = runtime.has_gpu_device()
614+
has_current_device = runtime.has_current_device()
610615

611616
#------- Global Functions
612617

0 commit comments

Comments
 (0)