From 8849901a37caa5a6afc0c26bdf1942184cb838ad Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Wed, 22 Mar 2017 18:49:17 -0500
Subject: [PATCH] Make philox compilable with Oclgrind

---
 pyopencl/__init__.py                            | 4 +++-
 pyopencl/cl/pyopencl-random123/openclfeatures.h | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index afb48d61..a8a694cd 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -218,7 +218,9 @@ _DEFAULT_BUILD_OPTIONS = []
 _DEFAULT_INCLUDE_OPTIONS = ["-I", _find_pyopencl_include_path()]
 
 # map of platform.name to build options list
-_PLAT_BUILD_OPTIONS = {}
+_PLAT_BUILD_OPTIONS = {
+        "Oclgrind": ["-D", "PYOPENCL_USING_OCLGRIND"],
+        }
 
 
 def enable_debugging(platform_or_context):
diff --git a/pyopencl/cl/pyopencl-random123/openclfeatures.h b/pyopencl/cl/pyopencl-random123/openclfeatures.h
index af03d309..8403706f 100644
--- a/pyopencl/cl/pyopencl-random123/openclfeatures.h
+++ b/pyopencl/cl/pyopencl-random123/openclfeatures.h
@@ -69,8 +69,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 #ifndef R123_USE_MULHILO64_OPENCL_INTRIN
+#ifdef PYOPENCL_USING_OCLGRIND
+#define R123_USE_MULHILO64_OPENCL_INTRIN 0
+#else
 #define R123_USE_MULHILO64_OPENCL_INTRIN 1
 #endif
+#endif
 
 #ifndef R123_USE_AES_NI
 #define R123_USE_AES_NI 0
-- 
GitLab