diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index afb48d619460943bb2a5245a27298f13da091cf2..a8a694cd3156c931cdfbc094e070914ac0ade510 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 af03d3092318c6c27f1a65ce8104c1609b1e66e1..8403706f9d5b16c3ac2a44a7c122c531e20bc9ec 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