From 6d3b10bad6c289f52dac7e92baa51748596b0494 Mon Sep 17 00:00:00 2001
From: fwaters <fwaters@anaconda.com>
Date: Mon, 23 Sep 2019 18:33:43 +0000
Subject: [PATCH 07/22] intel_mkl_random

---
 numpy/random_intel/__init__.py |  7 +++++++
 numpy/random_intel/setup.py    | 10 ++++++++++
 numpy/setup.py                 |  1 +
 numpy/tests/test_warnings.py   |  2 ++
 4 files changed, 20 insertions(+)
 create mode 100644 numpy/random_intel/__init__.py
 create mode 100644 numpy/random_intel/setup.py

diff --git a/numpy/random_intel/__init__.py b/numpy/random_intel/__init__.py
new file mode 100644
index 000000000..9c105de54
--- /dev/null
+++ b/numpy/random_intel/__init__.py
@@ -0,0 +1,7 @@
+import warnings
+try:
+    with warnings.catch_warnings():
+        warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
+        from mkl_random import *
+except ImportError as e:
+    warnings.warn("mkl_random not found. Install it with 'conda instal -c intel mkl_random', or get it from 'http://github.com/IntelPython/mkl_random'", stacklevel=2)
diff --git a/numpy/random_intel/setup.py b/numpy/random_intel/setup.py
new file mode 100644
index 000000000..6d4fecf29
--- /dev/null
+++ b/numpy/random_intel/setup.py
@@ -0,0 +1,10 @@
+from __future__ import division, print_function
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('random_intel', parent_package, top_path)
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)
diff --git a/numpy/setup.py b/numpy/setup.py
index 4ccdaeea5..d794e92d0 100644
--- a/numpy/setup.py
+++ b/numpy/setup.py
@@ -18,6 +18,7 @@ def configuration(parent_package='',top_path=None):
     config.add_subpackage('matrixlib')
     config.add_subpackage('polynomial')
     config.add_subpackage('random')
+    config.add_subpackage('random_intel')
     config.add_subpackage('testing')
     config.add_data_dir('doc')
     config.add_data_dir('tests')
diff --git a/numpy/tests/test_warnings.py b/numpy/tests/test_warnings.py
index f5560a099..aff8f3e93 100644
--- a/numpy/tests/test_warnings.py
+++ b/numpy/tests/test_warnings.py
@@ -71,6 +71,8 @@ if sys.version_info >= (3, 4):
                 continue
             if path == base / "random" / "__init__.py":
                 continue
+            if path == base / "random_intel" / "__init__.py":
+                continue
             # use tokenize to auto-detect encoding on systems where no
             # default encoding is defined (e.g. LANG='C')
             with tokenize.open(str(path)) as file:
-- 
2.20.1

