From 1df66adf01531d7881d9f7c4bfc9c2181a19e725 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 24 Jul 2015 15:21:15 -0500
Subject: [PATCH] Deal with has_struct_arg_count_bug not being available

---
 loopy/compiled.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/loopy/compiled.py b/loopy/compiled.py
index da659eaba..d8d127c0b 100644
--- a/loopy/compiled.py
+++ b/loopy/compiled.py
@@ -310,13 +310,18 @@ def generate_value_arg_setup(gen, kernel, cl_kernel, impl_arg_info, options):
     work_around_arg_count_bug = False
     warn_about_arg_count_bug = False
 
-    from pyopencl.characterize import has_struct_arg_count_bug
-
     devices = cl_kernel.context.devices
 
-    count_bug_per_dev = [
-            has_struct_arg_count_bug(dev)
-            for dev in devices]
+    try:
+        from pyopencl.characterize import has_struct_arg_count_bug
+
+    except ImportError:
+        count_bug_per_dev = [False]*len(devices)
+
+    else:
+        count_bug_per_dev = [
+                has_struct_arg_count_bug(dev)
+                for dev in devices]
 
     if any(count_bug_per_dev):
         if all(count_bug_per_dev):
-- 
GitLab