summaryrefslogtreecommitdiff
path: root/debian/patches/0006-Tests-if-openCL-can-be-used.patch
blob: 69ba42f4812f98f731ef917d377da9d7b173d578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Alexandre Marie <alexandre.marie@synchrotron-soleil.fr>
Date: Fri, 5 Jul 2019 16:52:20 +0200
Subject: Tests if openCL can be used

---
 silx/opencl/common.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/silx/opencl/common.py b/silx/opencl/common.py
index 17c67d1..421a35a 100644
--- a/silx/opencl/common.py
+++ b/silx/opencl/common.py
@@ -60,7 +60,14 @@ else:
         logger.warning("Unable to import pyOpenCl. Please install it from: http://pypi.python.org/pypi/pyopencl")
         pyopencl = None
     else:
-        import pyopencl.array as array
+        try:
+            pyopencl.get_platforms()
+        except pyopencl.LogicError:
+            logger.warning("The module pyOpenCL has been imported but can't be used here")
+            pyopencl = None
+        else:
+            import pyopencl.array as array
+            mf = pyopencl.mem_flags
 
 if pyopencl is None:
     class mf(object):