Skip to content

Commit

Permalink
Attempting to fix issue with Ubuntu, ray, and opencl.
Browse files Browse the repository at this point in the history
Signed-off by: David Rowenhorst <[email protected]>
  • Loading branch information
drowenhorst-nrl committed Jul 26, 2024
1 parent 675dff5 commit 4ec8e33
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions pyebsdindex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,24 @@


# Try to import only once - also will perform check that at least one GPU is found.
_pyopencl_installed = False
try:
_pyopencl_installed = False
import pyopencl
from pyebsdindex.opencl import openclparam
testcl = openclparam.OpenClParam()
try:
gpu = testcl.get_gpu()
if len(gpu) > 0:
_pyopencl_installed = True
except:
raise ImportError('pyopencl could not find GPU')
import pyopencl as cl
plt = cl.get_platforms()
if len(plt) > 0:
for p in plt:
g = p.get_devices(device_type=cl.device_type.GPU)
if len(g) > 0:
_pyopencl_installed = True
break
#from pyebsdindex.opencl import openclparam
#testcl = openclparam.OpenClParam()
#try:
# gpu = testcl.get_gpu()
# if len(gpu) > 0:
# _pyopencl_installed = True
#except:
# raise ImportError('pyopencl could not find GPU')
except ImportError:
_pyopencl_installed = False

Expand Down

0 comments on commit 4ec8e33

Please sign in to comment.