diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 601ec6f969c7fff0f6f5c2c68952f48c7563ed90..704dd7b499d4359170790898129b679d0ad8d0da 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -38,10 +38,7 @@ except ImportError: # _ccl = _cl # import cffi_cl # _cl = cffi_cl -try: - import numpypy as np -except: - import numpy as np +import np #from pyopencl._cl import * # noqa from pyopencl.cffi_cl import * import inspect as _inspect diff --git a/pyopencl/algorithm.py b/pyopencl/algorithm.py index 2ad82f7b3ca70bf85169474b5fef64d2cf36be65..e34bb018029e6f75b81e38af916a159ac1e553ea 100644 --- a/pyopencl/algorithm.py +++ b/pyopencl/algorithm.py @@ -27,7 +27,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -import numpy as np +import pyopencl.np as np import pyopencl as cl import pyopencl.array # noqa from pyopencl.scan import ScanTemplate diff --git a/pyopencl/array.py b/pyopencl/array.py index 2877ac56ea37bbb2a8fe583e46749bf58c34feef..2bc18d5459b6a0ed585af6ffc98729babda46ed2 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE. """ -import numpy as np +import pyopencl.np as np import pyopencl.elementwise as elementwise import pyopencl as cl from pytools import memoize_method diff --git a/pyopencl/capture_call.py b/pyopencl/capture_call.py index b45e310219068fc61cbc8fae33a5801db3533484..1d6b2e2f9d2462b5c342fa1bf2ae39ee2028e5d7 100644 --- a/pyopencl/capture_call.py +++ b/pyopencl/capture_call.py @@ -24,7 +24,7 @@ THE SOFTWARE. import pyopencl as cl -import numpy as np +import pyopencl.np as np from pytools.py_codegen import PythonCodeGenerator, Indentation @@ -41,7 +41,7 @@ def capture_kernel_call(kernel, filename, queue, g_size, l_size, *args, **kwargs cg("# generated by pyopencl.capture_call") cg("") - cg("import numpy as np") + cg("import pyopencl.np as np") cg("import pyopencl as cl") cg("from base64 import b64decode") cg("from zlib import decompress") diff --git a/pyopencl/characterize/performance.py b/pyopencl/characterize/performance.py index e498582e8dd26d2ddb496038780b144adf9482cd..2b843877492b06cf44042b1974b23b48c92a384d 100644 --- a/pyopencl/characterize/performance.py +++ b/pyopencl/characterize/performance.py @@ -23,7 +23,7 @@ THE SOFTWARE. """ import pyopencl as cl -import numpy as np +import pyopencl.np as np diff --git a/pyopencl/clrandom.py b/pyopencl/clrandom.py index 92a5c2de4862ce17e79c7ededb6e4a29b7f8460f..03d5494f3be4afd129fec775767fce50f926a0f5 100644 --- a/pyopencl/clrandom.py +++ b/pyopencl/clrandom.py @@ -57,7 +57,7 @@ import pyopencl.array as cl_array from pyopencl.tools import first_arg_dependent_memoize from pytools import memoize_method -import numpy as np +import pyopencl.np as np class RanluxGenerator(object): diff --git a/pyopencl/elementwise.py b/pyopencl/elementwise.py index 5878b89cf9b557c2c65bb2b9e061b5cd29813f74..36d127fdac65ff526608d973c8a686ab00ee3da3 100644 --- a/pyopencl/elementwise.py +++ b/pyopencl/elementwise.py @@ -29,7 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE. from pyopencl.tools import context_dependent_memoize -import numpy as np +import pyopencl.np as np import pyopencl as cl from pytools import memoize_method from pyopencl.tools import (dtype_to_ctype, VectorArg, ScalarArg, diff --git a/pyopencl/np.py b/pyopencl/np.py new file mode 100644 index 0000000000000000000000000000000000000000..1c35453e0a1707c893801aa85389f06491200150 --- /dev/null +++ b/pyopencl/np.py @@ -0,0 +1,4 @@ +try: + from numpypy import * +except ImportError: + from numpy import * diff --git a/pyopencl/reduction.py b/pyopencl/reduction.py index f342909fd7219ebeba83aa7b0b96e9e960c9ace3..60d8b17ff2164f17ae58a6d0162027011775d8aa 100644 --- a/pyopencl/reduction.py +++ b/pyopencl/reduction.py @@ -36,7 +36,7 @@ from pyopencl.tools import ( context_dependent_memoize, dtype_to_ctype, KernelTemplateBase, _process_code_for_macro) -import numpy as np +import pyopencl.np as np # {{{ kernel source diff --git a/pyopencl/scan.py b/pyopencl/scan.py index 2d7bc9ec8e0eac0eba5f1c59f93dae185f1da9a3..38233f96d85819a36f4b9a2b78f46786612bfdfa 100644 --- a/pyopencl/scan.py +++ b/pyopencl/scan.py @@ -28,7 +28,7 @@ within the Thrust project, https://code.google.com/p/thrust/ # Direct link to thrust source: # https://code.google.com/p/thrust/source/browse/thrust/detail/backend/cuda/detail/fast_scan.inl # noqa -import numpy as np +import pyopencl.np as np import pyopencl as cl import pyopencl.array # noqa diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 47c001401375797ff738f2b674329c40ca4849cd..553eb064551a50944c36136de02f119993a4adbb 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE. """ -import numpy as np +import pyopencl.np as np from decorator import decorator import pyopencl as cl from pytools import memoize, memoize_method @@ -524,7 +524,7 @@ def match_dtype_to_c_struct(device, name, dtype, context=None): This example explains the use of this function:: - >>> import numpy as np + >>> import pyopencl.np as np >>> import pyopencl as cl >>> import pyopencl.tools >>> ctx = cl.create_some_context()